machinereadable.dev

Trained on Meaning, Fed Boilerplate: Why Repetition Makes Agents Guess

tl;dr — for human consumption

An agent runs on a model that predicts the next token, and that model learned its statistics from real, meaningful human content. Context that resembles meaning gets confident prediction; context filled with meaningless repetition — boilerplate envelopes, fields the task doesn't need, raw data below the level where meaning lives — drifts away from anything the model was trained on, and its responses degrade toward guessing. Expose the meaningful level instead of the raw one (the language-server move), trim responses to what the task needs, and measure the difference in thinking tokens on the same task.

machine_summary:
  claim: "prediction quality tracks how much the context resembles the meaningful content the model was trained on; meaningless repetition — boilerplate, unneeded fields, raw sub-meaning data — pushes the context off-corpus and degrades responses into guessing"
  takeaway: "mediate raw data behind interfaces that expose the meaningful level (the language-server pattern), ship agents only task-relevant fields, and compare thinking tokens on the same task across optimized and unoptimized interfaces — less thinking means the answer was more obvious"
  evidence_type: mechanism
  cross_links: [computational-kindness, correct-apis-break-agents, deterministic-ax-metrics]

The model was trained on meaning; your context is a bet against that

Strip the harness away and an agent is a language model predicting the next token — and it learned those predictions from an enormous corpus of real, meaningful human content: prose that argues something, code that does something, documentation that describes something. That training is the entire trick, and it comes with a condition attached: the model predicts confidently when the context in front of it resembles the meaningful material it learned from. Fill the context with meaningless repetition and the response will be, with matching fidelity, meaningless — not because the model broke, but because you’ve walked it off the corpus, into territory where every next token is a guess. That’s the first-principles version of a claim the correct-APIs piece made in passing and owed a full piece; this is the piece. We argue it as mechanism plus field observation, not settled benchmark — and we’ll show you how to measure it on your own interface.

Machine code: more information, less meaning

The cleanest demonstration isn’t an API at all. Point an agent at high-level source code and it does decent work. Feed it the compiled output of the same program — machine code, straight into the context — and it loses the thread in short order. Nothing is missing; the machine code contains strictly more information than the source. What’s missing is meaning at the level the corpus taught: the model has read millions of TypeScript functions and approximately no honest hexdumps, so one context sits in the densest part of its training distribution and the other is noise wearing a file extension.

The working fix has the shape all the fixes in this piece will have: don’t hand the agent the raw level — put an interface in front of it that answers at the meaningful level. Agents that interact with language servers ask “definition of X, references to Y” and get back symbols and types, never bytes. In practice, context-mode-style tools push the same move further: the agent must describe what it needs and how it should be processed, and direct reads aren’t allowed — with visible gains on both context load and code quality. The interface’s job is to expose the level where meaning lives and keep everything below it out of the context.

Where repetitive boilerplate comes from — and what it does

APIs walk agents off the corpus the same way, just more politely. A response ships every field the webapp needs — for perfectly legitimate reasons — and the agent’s task needs three of them. Envelopes repeat because parsers like consistency; scaffolds get re-injected every turn because the framework template says so; few-shot examples get copied between tools because they worked last time. Each decision is locally fine. The sum is a context where the same unrelated, unneeded tokens recur dozens of times with tiny payloads of variation between them — and that’s where repetitive boilerplate becomes a pollutant with two distinct failure modes, the mechanisms linking repetition to hallucination.

The first is prompt priming: when the repetition forms a strong pattern, the model completes the pattern over the actual value. Thirty-nine records saying "status": "active" are thirty-nine demonstrations that record 27 says it too — and a model’s most reliable skill is continuing a demonstration, so it reads the expected value instead of the actual one. The second is quieter and closer to the root: drift. Real training text doesn’t repeat a wrapper forty times with noise between the copies; the more boilerplate accumulates, the further the whole context deviates from any known corpus, and next-token probabilities sag everywhere — not just inside the envelopes. Harnesses and SDKs carry guardrails for the critical floor, the moments when no good next token exists at all. But boilerplate-induced hallucination lives in the degraded middle — fluent, confident guessing that never trips a guardrail. Avoiding the pollution in the first place is what keeps the agent focused; the industry files the resulting failures under agent hallucinations, and confabulation fits better: the model isn’t perceiving something false, it’s filling a meaning-shaped hole with the most plausible material available.

Measure it in thinking tokens

Here’s the measurement, and it’s deterministic: run the same task against an optimized and an unoptimized version of your API — task-relevant fields versus the full dump — and compare thinking tokens. Less thinking means the answer was more obvious; the model found the meaning without excavating for it. It’s a paired, same-model comparison, so it needs no judge, no baseline, and no error bars, and the same harness telemetry gives you total token burn for free. For a correctness signal on top, plant a deviant value at a known position — a record 27 — and log whether each variant reads it right. The production version of the same idea: stamp transcripts with an interface version, then watch thinking-token and wrong-read deltas per version to detect boilerplate-induced hallucinations in production — regressions enter through changes that look cosmetic precisely because they only touch “the part that’s always the same.”

Mitigations: expose meaning, not data

The practical moves for designers and engineers, cheapest first. Trim to the task: the webapp can keep its forty fields; give agents a view that ships the three the task needs. State shared structure once: schema described a single time, records reduced to what varies — deduplication done where it’s cheapest, by the party that already knows what’s invariant. Mediate the raw level: generalize the language-server pattern — when the underlying data is below the level where meaning lives (bytes, dumps, bulk records), put a processing interface in front and let the agent describe what it needs rather than read directly. Verify the critical reads: where an action hangs on one field, have the agent quote the exact value first — the same move as writing errors as recovery instructions: put the load-bearing fact where it can be checked, not where it’s inferred.

When repetition pays rent

Not every repeated byte is pollution. Provenance headers, audit scaffolds, and compliance stamps repeat because a record may someday need to stand alone in front of a human; that’s auditability buying tokens, and it’s a legitimate trade. The test for any piece of boilerplate is three questions: Does it vary? If never, state it once. Can it be fetched? If the agent can pull it on demand, don’t pre-pay for it. Does it pay audit rent? If an incident review needs it attached to every record, keep it — and account for it as a governance cost of the interface, because removing boilerplate is never free either: trimming, mediating, and per-task views all cost engineering time and a little latency.

The takeaway: keep the agent on-corpus

A context window has no inert bytes — everything the agent reads is part of the prompt, and every meaningless repetition is a small bet against the training distribution the model’s competence comes from. Human-facing interfaces treat consistency and completeness as virtues; agent context design can’t afford to, because the reader’s entire skill is statistical familiarity with meaningful content. The sharpest version: an interface is good for agents in proportion to how obvious it makes the next token. Expose the level where meaning lives, ship what the task needs, and let the thinking-token meter tell you when you’ve drifted.

this page as your agent reads it → /posts/boilerplate-confabulation.md