---
compiled: 2025.12.13
depth: 6 min_read
---

the architecture of truth

Hallucination isn't a bug, it's lossy decompression. Why you can't prompt your way to reliability, and why you must architect for it instead.

The output of an LLM is not a fact. It is a lossy decompression of the internet.1

When you ask for a quote, a citation, or a function argument, the model is not retrieving it from a database. It is reconstructing a high-probability pattern from the compressed representation in its weights. Sometimes, the pattern is perfect. Sometimes, it is missing a few pixels.

We call these missing pixels “hallucinations.”2 Since the release of GPT-3 we’ve been trying to fix them by shouting at the compression algorithm, but it rarely works for long.

The Conservation of Complexity

Every engineering task has a fixed amount of inherent complexity.3 To build a reliable system, you must handle that complexity somewhere.

In traditional software, you handle it in the code. You write distinct logic for every edge case.

In AI engineering, we try to offload that complexity to the model. We write a prompt that says: “Be careful, check your work, and don’t make up citations.”

Then you change the prompt to fix a tone issue, and suddenly the citations break. You fix the citations, and the JSON output becomes malformed. It turns into a game of Prompt Whac-A-Mole.

Open-Loop vs. Closed-Loop

We often make the mistake of treating LLMs as open-loop systems.

In an open-loop system, you send an input, you get an output, and you show it to the user. You cross your fingers and hope the prompt was good enough.

Reliable engineering requires closed-loop systems (control theory5). You assume the output will be wrong (noisy), so you measure it against a reference and feed the error back into the system.

  • Open Loop: “Call the weather API.” -> Model returns tool call -> Execute it. (Risk: High)
  • Closed Loop: “Call the weather API.” -> Model returns tool call -> Verify (Schema Check) -> Invalid? -> Feed error back -> Model retries. (Risk: Managed)

The Three Layers of Grounding

To architect for truth, we must stop asking the model to “be true” and start constraining the search space so that truth is the only valid output.

1. Semantic Grounding (RAG)

Constraint: The Knowledge Base

Don’t ask the model to remember facts. Its memory is lossy. Inject the facts into the context window. This shifts the task from recall (hard, hallucinatory) to processing (easier, grounded).

2. Structural Grounding (Schemas)

Constraint: The Format

Don’t ask the model to “be consistent.” Force it. Use JSON modes, grammars, or tool definitions to constrain the output tokens to a valid syntax. If the model tries to output a token that violates the schema, the client (or the inference engine) should reject it immediately.

3. Execution Grounding (The Feedback Loop)

Constraint: Reality

This is the most important layer. The model’s output should never touch the user until it has passed a verifier.

In a robust architecture (like the Model Context Protocol), the tool execution happens on a server. This server acts as the verifier. It doesn’t just run the code; it validates the intent against the schema before execution.

If the validation fails, you don’t crash. You return the error to the model as a payload. This allows the model to “read” its own mistake and self-correct in the next turn.

Conclusion: The Pit of Success

We started this series by talking about tokens. We end it by talking about architectures.

In my experience, the journey usually looks like this: You start by being amazed that the rock can talk, spend a few months trying to “prompt” it into being a reliable employee, and eventually realize that reliability comes from the system you build around the rock.

The future of AI isn’t better prompting, it’s about deterministic skeletons with stochastic sprinkles.

It’s building architectures where the model can be wrong, and the system still works.


Footnotes

  1. Deletang, G., et al. (2023). “Language Modeling Is Compression”. Explores the mathematical equivalence between prediction accuracy and data compression efficiency.

  2. Karpathy, Andrej. (2023). Twitter/X Post. Karpathy’s foundational mental model of LLMs as “dream machines” that are constrained by prompts.

  3. Tesler, Larry. (1984). “The Law of Conservation of Complexity”. Often cited via Dan Saffer’s Designing for Interaction (2006). States that every application has a certain amount of complexity that cannot be removed, it can only be moved.

  4. Anthropic. (2024). “Effective Context Engineering for AI Agents”. Discusses the “attention budget” and how context degradation affects reasoning.

  5. “Control theory deals with the control of continuously operating dynamical systems in engineered processes and machines.” - Wikipedia. In AI, this maps to “loops” where the output is monitored and corrected.