Prompt Adherence: Making Models Do What You Actually Asked
Chapter from Applied Context Engineering
S1 Why This Chapter Matters
The entire premise of context engineering is that you can control a language model's behavior by controlling what goes into its context. Every technique in this book — retrieval, system prompts, tool integration, memory — exists to put the right information in front of the model at the right time.
🟡 Question / wants more detailWhat exactly is "context engineering"? Is it like prompt engineering but broader? I think the idea is that you're designing the entire input to the model, not just the user's question.
🟡 Question / wants more detailOK, I get the premise -- context engineering depends on the model using the context. But what's the first thing I should actually check in my system? I want a quick diagnostic before diving into the theory.
🟢 New learning / aha momentThis framing is useful for team alignment. When I explain to my PM why we need an eval pipeline, I can say: "All our context engineering is wasted if we can't verify the model uses it." That's a budget justification.
🟡 Question / wants more detailStrong opening but consider whether 'context engineering' needs a brief definition for readers who may have jumped to this chapter. Not everyone reads sequentially.
None of it matters if the model doesn't use what you gave it.
🟢 New learning / aha momentOh wow, so the model might just... ignore your documents? That's like giving a student a textbook for an open-book exam and they still make stuff up from memory. That's a wild failure mode.
🟢 New learning / aha momentThe rhetorical move here is strong -- 'None of it matters if the model doesn't use what you gave it' immediately establishes that prompt adherence is the foundation that all other context engineering rests on. This reframes the whole book.
🟢 New learning / aha moment'None of it matters if the model doesn't use what you gave it' -- this is exactly the problem I've been hitting. My RAG pipeline retrieves great documents but the model still makes stuff up. Now I have a name for it.
🟢 New learning / aha moment'None of it matters if the model doesn't use what you gave it.' -- Excellent one-line hook. This is the kind of sentence that sells a chapter. Keep it isolated as its own paragraph exactly like this.
A model that ignores your retrieval results and answers from its training data has made your RAG pipeline pointless. A model that follows nine of your twelve formatting rules has made your system prompt unreliable. A model that correctly uses every retrieved document but fabricates one additional detail has made your citations untrustworthy. These are not hypothetical failures. They are the daily reality of deployed LLM systems, and they are the reason this chapter exists.
🟢 New learning / aha momentThese three examples are really clear. So there are different WAYS the model can mess up: (1) ignoring your docs entirely, (2) partially following rules, (3) mostly right but adding fake details. Each one breaks the system differently.
🟡 Question / wants more detailThese failure modes have very different production impacts. The citation fabrication one is worst for us -- users trust the sources. How do I set up monitoring to catch each of these separately in my pipeline?
🔴 Concern / disagreementThe transition from the one-line hook into these three examples works well -- the punch of "none of it matters" followed by three concrete ways it fails. Good momentum. Don't add anything between them.
The degree to which a model's output actually serves everything in its context is what we call prompt adherence. It decomposes into two dimensions, and understanding why they are separate is the key insight of this chapter:
🟡 Question / wants more detailSo "prompt adherence" is an umbrella term for "did the model do what the entire input told it to do"? That's broader than I expected -- I thought prompts were just the user's question.
🟡 Question / wants more detailIs 'prompt adherence' an established term in the literature, or is this chapter coining it? I've seen 'instruction following' and 'faithfulness' separately but not this umbrella term. Worth checking if there's prior art.
🟢 New learning / aha momentSo there are two separate things to check: (1) did it follow my instructions, and (2) did it stick to the documents I gave it. I've been conflating these. That explains why my fixes keep creating new problems.
🔴 Concern / disagreementThe transition from the opening into the definition of prompt adherence feels slightly abrupt. Consider adding a bridging sentence before diving into definitions.
Instruction following asks: did the model follow all the instructions? Did it use the requested format? Stay within the specified scope? Obey every constraint? If your system prompt says "respond in three bullet points, cite sources inline, never recommend competitor products," instruction following is whether all three of those requirements were satisfied.
🟢 New learning / aha momentThis is like a checklist. Did it do bullet points? Check. Did it cite sources? Check. Did it avoid competitors? Check. If any of those fail, it's an instruction-following failure. Simple enough to understand.
🟡 Question / wants more detailIn production, we have system prompts with 20+ rules across multiple teams. Who owns which instruction? When a rule gets dropped, is it because of the model or because two teams' instructions conflict? I need a governance model, not just a taxonomy.
🟢 New learning / aha momentFraming instruction following as verifiable criteria is important -- it maps to testable assertions. Each instruction becomes a unit test. This has implications for formal verification approaches.
Groundedness (also called faithfulness) asks: are all the claims in the response supported by the context? This does not mean the response must parrot the context verbatim — the model can and should reason over what it was given, draw inferences, synthesize across documents. Groundedness means that every factual claim in the output should be traceable to the provided knowledge or to valid reasoning on top of that knowledge. A claim that comes from the model's training data rather than the context — however plausible — is a groundedness failure.
🟡 Question / wants more detailWait, the model has "training data" knowledge AND the documents you give it? And groundedness means it should ONLY use the documents? That's like telling a student "only use what's on this page" even if they know the answer from somewhere else.
🟢 New learning / aha momentThe "however plausible" part is key. My model sometimes adds true facts that aren't in my docs. I used to think that was OK. But if my system is supposed to be grounded, even true-but-unsourced claims are failures. That changes my eval criteria.
🔴 Concern / disagreementThis definition of groundedness is strict -- even true claims from training data count as failures. For our customer support system that's right. But for our internal tools team, they WANT the model to use general knowledge. We need different groundedness policies per use case.
🟡 Question / wants more detailThe "valid reasoning on top of that knowledge" caveat is doing a lot of work. What counts as valid inference vs. hallucination? If the context says "A implies B" and "B implies C," is concluding "A implies C" grounded? Where's the line?
These two dimensions are in tension with each other, and this tension is what makes prompt adherence hard. If you optimize only for groundedness — penalizing every claim that isn't directly supported — the model learns to deflect too aggressively. It refuses to answer questions it could have answered through straightforward reasoning over the context, because the safest way to avoid unsupported claims is to say nothing. If you optimize only for instruction following — rewarding the model for producing a complete, well-formatted, responsive answer — the model learns to hallucinate. It fills gaps with plausible-sounding information from its training data, because the surest way to satisfy every instruction is to always have an answer, even when the context doesn't support one.
🟢 New learning / aha momentThis is like the precision-recall tradeoff from my ML class! If you optimize for precision (groundedness), you lose recall (completeness). If you optimize for recall (instruction following), you lose precision. They're in tension. That analogy really helps.
🔴 Concern / disagreementThe theory about tension is fine, but what does 'holding both dimensions in balance' actually look like in code? I need a concrete example of a system that does this well, not just the principle.
🟢 New learning / aha momentThis tension explains why our QA team keeps filing contradictory bugs: "model refuses to answer" vs. "model makes stuff up." They're not bugs -- they're opposite ends of the same tradeoff. I can use this framework to set explicit thresholds.
🔴 Concern / disagreementThis paragraph on the tension is long and dense. Consider breaking it into two: one on the groundedness-only failure mode, one on the instruction-following-only failure mode. Each with a concrete one-sentence example.
Getting prompt adherence right means holding both dimensions in balance: follow the instructions and stay grounded, and when the context doesn't support a response, say so rather than fabricate one.
🟢 New learning / aha momentOK so the ideal system says "I don't know" when it doesn't have the info, rather than making something up to look helpful. That's actually the opposite of what I'd expect a chatbot to do.
🟡 Question / wants more detailHow do I operationalize "say so rather than fabricate"? Do I need a confidence threshold? A verification step? This is the design pattern I need for my team's SLA on accuracy.
🟢 New learning / aha momentThe principle is clear: calibrated abstention over confident confabulation. This connects to the selective prediction literature -- the model should have a "reject" option.
Both dimensions improve as language models get better — but neither is fully solved by better models alone. You can also improve prompt adherence through the system you build around the model: how you construct the context, how you orchestrate retrieval, how you validate outputs, and how you train the model for your specific requirements. This chapter covers all of these.
🟡 Question / wants more detailSo even GPT-5 or whatever comes next won't fully solve this? It's interesting that this is a system-level problem, not just a "make the model smarter" problem.
🟢 New learning / aha momentGood -- I was worried the answer would be "just use a better model." Instead, there are system-level fixes I can build today: better context construction, retrieval orchestration, output validation. Actionable.
🔴 Concern / disagreementThis is the right message for my team: don't wait for the next model release. Build the system infrastructure now. But I need to know the ROI of each approach to prioritize our engineering roadmap.
We start by looking at what's actually in the context you're assembling — because the structure of your context is what creates both problems.
🟢 New learning / aha momentGood transition. The causal framing -- "the structure of your context creates both problems" -- motivates the next subsection and gives the reader a reason to keep going.
What's In Your Context
🟡 Question / wants more detailThe 'What's In Your Context' subsection reads like a textbook definition of RAG. O'Reilly readers likely know this. Consider shortening or adding a 'if you're already familiar, skip to...' note.
🟢 New learning / aha momentOh this is going to explain what actually gets fed into the model! I knew about prompts but didn't realize there were so many layers to the input.
Every system that uses a language model assembles a context from multiple sources. Consider a retrieval-augmented generation (RAG) system — the architecture behind most enterprise LLM applications. When a user asks a question, the system does not simply pass the question to the model. It constructs a context:
🟡 Question / wants more detailWhat does RAG stand for? Retrieval-Augmented Generation. So the system retrieves documents first, then gives them to the model to generate an answer. That's like an open-book exam with an automated librarian.
🟢 New learning / aha momentGood framing. In our architecture, the context assembly is spread across 4 microservices. Each one can introduce adherence problems. Thinking of context as a structured assembly pipeline is useful for assigning ownership.
- The system prompt — written by the development team, often weeks before any user touches the system — establishes the rules of engagement: persona, tone, formatting requirements, scope ("only answer questions about our products"), and constraints ("never recommend competitor products," "always cite your sources inline").
- The user's input arrives — a question, a task, a request. This is what the system exists to serve. The user may also add their own instructions or constraints beyond what the system prompt specifies.
- The retrieval layer activates. It searches an index of documents — product specs, policy pages, internal knowledge bases — and surfaces the most relevant results. These retrieved documents are injected into the context as the knowledge the model should use to answer.
- Conversation history, tool outputs, or other state may also be folded in, depending on the system's design.
🟢 New learning / aha momentSo there are four layers: system prompt, user input, retrieved docs, and conversation history. They all get concatenated together and fed to the model. That's a lot of potential for things to conflict!
🟡 Question / wants more detailTool outputs are mentioned casually but in agentic systems they can be huge -- API responses, code execution results, database queries. How does adherence work when tool outputs dominate the context?
🟡 Question / wants more detailWho owns the system prompt in a large org? Product writes the persona, legal adds compliance rules, engineering adds formatting constraints. When the combined prompt hits 50 rules, who decides what to cut? This is an organizational problem, not just a technical one.
All of these layers are assembled into a single context window and handed to the language model. The instructions live in the system prompt and the user input. The knowledge lives in the retrieved documents, tool outputs, and conversation history. Instruction following checks adherence to the first. Groundedness checks adherence to the second.
🟢 New learning / aha momentSo the two dimensions map directly onto the two types of stuff in the context: instructions (rules) and knowledge (facts). Instruction following checks the rules, groundedness checks the facts. Clean split.
🟢 New learning / aha momentThe instructions/knowledge dichotomy maps to the prescriptive/descriptive distinction in formal pragmatics. Instructions are performative utterances; knowledge is constative. Different verification conditions for each.
🟢 New learning / aha momentThis clean separation means I can build separate monitoring for each. One dashboard for instruction violations (formatting, scope), another for groundedness failures (hallucinations, unsourced claims). Different teams, different alerts.
What counts as "good" prompt adherence depends on the system you've built. For a RAG system grounding a support chatbot, you want strict groundedness: the model should answer using only the retrieved documents, not its training knowledge. For a coding assistant, you might want the model to use both the code you provided and its general programming knowledge — but to strictly obey constraints like "use only the standard library." For a creative writing tool, you might actively want the model to draw on its training knowledge freely — but still follow structural instructions about length, tone, or format. The two dimensions are universal; the balance between them is system-specific.
🟢 New learning / aha momentThe three examples (chatbot = strict grounding, code assistant = mixed, creative writing = loose grounding) show it's a spectrum. There's no one "right answer" for how strict to be. It depends on the application.
🟡 Question / wants more detailMy system is a hybrid -- part knowledge base lookup, part reasoning. How do I define groundedness for the reasoning parts? When the model synthesizes across 5 documents, is the synthesis "grounded" even though no single doc says it?
🟢 New learning / aha momentThis is exactly why we need different adherence policies per product surface. Our support chatbot, developer docs, and internal assistant all need different groundedness thresholds. I should create an adherence spec per product.
🟡 Question / wants more detailThe system-specific balance raises a formal question: can we characterize the Pareto frontier of instruction-following vs. groundedness for a given task distribution? Is there theoretical work on this tradeoff surface?
S2 The Two Dimensions of Prompt Adherence
We've described two kinds of expectations your system places on the model: follow the instructions, and ground in the knowledge. These map onto two dimensions that the research community discovered and studied largely independently, and that fail for different reasons.
🟢 New learning / aha momentGood structural choice: presenting the two dimensions as parallel subsections with identical structure. This parallelism aids comprehension and makes the content scannable.
🟢 New learning / aha momentInteresting that these two problems were studied by different groups of researchers who didn't initially realize they were related. That's why there's no single solution.
🟡 Question / wants more detailIf these dimensions were studied independently, are the measurement tools also separate? That matters for which libraries and APIs I integrate into our eval pipeline.
Instruction Following: Did it do what you asked?
The first dimension is instruction following. This is about whether the model's output reflects everything the instructions asked for. Did it use the requested format? Did it stay within the specified scope? Did it follow every constraint? For example: your prompt says "respond in exactly three bullet points; do not add an introduction." A response that gives three correct bullets but starts with "Here are the key points:" has failed instruction following — the content may be fine, but the format rule was broken.
🟢 New learning / aha momentThe "Here are the key points:" example is so relatable! ChatGPT does this all the time. I never thought of it as a formal failure mode. It's correct content but wrong format. Those are different things.
🟡 Question / wants more detailThe trajectory from GPT-3 few-shot to RLHF to IFEval is well-chosen but moves fast. I'd want more on why RLHF specifically creates the tension -- is it the reward model collapsing dimensions, or the PPO optimization landscape?
🟢 New learning / aha momentThe "Here are the key points:" failure -- I see this constantly. The model adds preambles, conclusions, and disclaimers that my system prompt explicitly says to omit. Now I know it's a measurable instruction-following failure, not just an annoyance.
🟡 Question / wants more detailThe historical trajectory (GPT-3 -> FLAN -> RLHF -> IFEval) is well-organized but dense. Consider a timeline figure here instead of inline text.
Instruction following has been a central concern of the field for years. The trajectory is worth understanding briefly, because it explains both the capability and its limits:
🟡 Question / wants more detailWhat does RLHF stand for? I know it's Reinforcement Learning from Human Feedback. So humans rate model outputs and the model learns from those ratings? How does that create problems?
🟢 New learning / aha momentUnderstanding the historical arc helps me explain to my team why "the model should just follow instructions" isn't as simple as it sounds. There's a reason this is hard, and it's baked into how these models were trained.
- In 2020, GPT-3 showed that language models can follow instructions — but only if you provide examples (few-shot prompting). The capability existed but had to be elicited. [Brown et al., 2020]
- Instruction tuning (FLAN, T0) demonstrated that if you train on diverse instructions, models generalize to new instructions they haven't seen. Instruction following became a transferable skill. [Wei et al., 2022; Sanh et al., 2022]
- RLHF (InstructGPT) made models dramatically better at following instructions — but also optimized for general helpfulness, which sometimes conflicts with following your specific instructions. A model trained to always give a comprehensive answer will resist being told to say "I don't know." [Ouyang et al., 2022]
- Recent evaluation work (IFEval, ComplexBench, IFScale) has shown that simple instructions are largely solved, but as constraints multiply — ten rules, twenty rules, format and scope and tone and citations — even frontier models start dropping things. The problem didn't disappear; it moved to a harder regime. [Zhou et al., 2023; IFScale, 2025]
🟢 New learning / aha momentSo the history is: (1) models CAN follow instructions, (2) models learn to GENERALIZE instruction-following, (3) RLHF makes them helpful but also opinionated, (4) simple stuff is solved but complex multi-rule prompts still break. Got it.
🔴 Concern / disagreementThe claim that "simple instructions are largely solved" needs qualification. IFEval scores are high but the benchmark only tests syntactic constraints. Semantic instruction following -- "write in a professional tone" or "be concise" -- is much harder to evaluate and arguably unsolved.
🟡 Question / wants more detailThe "moved to a harder regime" point is crucial for planning. If simple rules are solved but 20+ rules break, I need to know the exact cliff for each model we use. Is there a benchmark I can run on our specific prompts?
If you think of the instructions in your context as a set of requirements, then instruction following is recall over those requirements: what fraction of them are reflected in the output? A failure is a dropped requirement — a formatting rule ignored, a constraint violated, a scope boundary crossed. In the language of classification, these are false negatives: things that should have been in the output (or should have shaped it) and weren't.
🟢 New learning / aha momentRecall = "of all the things that SHOULD be in the output, how many ARE?" So instruction following = "of all my rules, how many did it follow?" False negatives = dropped rules. This maps perfectly to my information retrieval class!
🟢 New learning / aha momentConnecting FActScore's claim decomposition to the measurement methodology is exactly right. This bridges the NLP evaluation literature with the engineering practice.
🟢 New learning / aha momentInstruction following = recall, groundedness = precision. Now I can use the same mental model I use for search metrics. False negatives = dropped instructions, false positives = hallucinated claims. This clicks.
🟢 New learning / aha momentThe precision/recall mapping is the chapter's intellectual core. This is what reviewers will cite. Make sure it's visually prominent -- consider a callout box or sidebar.
🟢 New learning / aha momentRecall over requirements -- this gives me a metric I can track. If we have 15 rules in our system prompt, I can score each response on how many rules it followed. That's a dashboard I can build this sprint.
Groundedness: Did it do it right?
The second dimension is groundedness — also called faithfulness. This is about whether the model's claims are supported by the knowledge in the context. Not verbatim repetition — the model can and should reason over what it was given, draw inferences, and synthesize across documents. Groundedness means every claim should be traceable to the provided knowledge or to valid reasoning on top of that knowledge. A claim that comes from the model's training data rather than the context — however plausible — is a groundedness failure.
🟡 Question / wants more detailSo "faithfulness" and "groundedness" are the same thing? Good to know the synonyms. And it's not about copying text word-for-word -- the model can reason about the documents, it just can't make stuff up from its training.
🟡 Question / wants more detailClaim-level evaluation sounds right but expensive. For every response, I need to decompose into claims and verify each one? What's the latency and cost impact in a production system serving 1000 QPS?
🔴 Concern / disagreementIn production, the "however plausible" standard is hard to enforce. My team's first reaction will be "but the answer was correct." I need to make the case that correct-but-ungrounded is still a failure for auditable systems.
🟢 New learning / aha momentThe distinction between "true in the world" and "supported by context" is philosophically interesting. It's the difference between truth-conditional and evidence-conditional semantics. Both matter but for different reasons.
This dimension was discovered somewhat separately from instruction following, and the history matters:
🟢 New learning / aha momentSo this problem was first noticed in summarization -- models would summarize a document but add things the document never said. If it happens in summarization, it definitely happens in more complex tasks.
- Work on faithfulness in summarization (Maynez et al., 2020) first showed that a model can perfectly follow the instruction "summarize this document" and still produce a summary containing claims the document never made. Instruction following and factual faithfulness turned out to be different things. [Maynez et al., 2020]
- Hallucination surveys (Ji et al., 2023) and benchmarks like TruthfulQA established that this isn't an edge case — it's systematic. Models confidently produce false information, and the problem doesn't simply improve with scale. [Ji et al., 2023; Lin et al., 2022]
- Fine-grained factuality work (FActScore, FACTS) showed that holistic "is this grounded?" judgments aren't precise enough. You need to decompose the response into individual claims and verify each one against the source. This claim-level evaluation is now the foundation for measuring groundedness. [Min et al., 2023; Jacovi et al., 2024]
🟡 Question / wants more detailWhat's FActScore? It seems like a way to measure how factual a model's output is by checking each individual claim. That sounds tedious but thorough. Is there a tool that automates this?
🟢 New learning / aha momentThe progression from Maynez et al. to FActScore is a clean intellectual arc: (1) notice the problem in summarization, (2) establish it's systematic, (3) develop fine-grained measurement. Each step enabled the next.
🔴 Concern / disagreement"Doesn't simply improve with scale" is a crucial finding for capacity planning. If scaling up the model doesn't fix hallucinations, I can't just upgrade to a bigger model. I need system-level solutions. This should be emphasized more.
🟡 Question / wants more detailThe FActScore approach is clear but I want implementation details. Can I run FActScore-style evaluation with an open-source model as the judge? Or do I need GPT-4 / Claude as the verifier?
🔴 Concern / disagreementThe parenthetical about sycophancy feels like it was added late. Either develop it into a proper subsection or cut it.
If you think of the knowledge in your context as the set of supported facts, then groundedness is precision over that context: what fraction of the output's claims are actually supported? A failure is an unsupported claim — a fabricated detail, a misattributed fact, a piece of training knowledge that leaked into a response that should have been grounded entirely in the provided documents. These are false positives: things in the output that shouldn't be there.
🟢 New learning / aha momentPrecision = "of all the claims in the output, how many are actually supported?" So groundedness = "of everything the model said, how much is backed by the documents?" False positives = made-up claims. Symmetry with recall/instruction following is elegant.
🟡 Question / wants more detailThe parenthetical about sycophancy is intriguing but underdeveloped. Sycophancy sits at the intersection of both dimensions -- this could be a whole subsection. Is there recent work on sycophancy as an adherence failure mode?
🟢 New learning / aha momentFalse positives in the output = claims that shouldn't be there. I can build a detection pipeline for this: decompose response into claims, check each against retrieved docs, flag unsupported ones. That's a concrete engineering task.
Why the Decomposition Matters
These two dimensions fail independently. A single response can ace one and fail the other — or fail both. If you don't distinguish between them, your debugging goes in circles: you tighten the grounding instructions and the formatting breaks; you lock down the formatting and the hallucinations creep back in.
🟢 New learning / aha momentThis is like whack-a-mole if you don't understand which dimension is failing. Fix one, break the other. But if you KNOW which one is broken, you can target the fix. Makes sense.
🟢 New learning / aha moment"Debugging goes in circles" -- I've lived this. I tighten the grounding prompt and the model starts refusing to format responses correctly. Now I know why: they're different dimensions requiring different fixes.
🟡 Question / wants more detailIndependent failure modes mean I need separate dashboards and separate on-call procedures. A groundedness alert should page the retrieval team; an instruction-following alert should page the prompt engineering team. Different runbooks.
The decomposition also structures everything that follows in this chapter. Measurement requires separate tools for each dimension: claim-level verification for groundedness, criteria-level testing for instruction following. Interventions target different layers of the system depending on which dimension is failing. Even training approaches use separate reward signals — one per dimension — because holistic "is this response good?" signals are too blurry to drive reliable improvement.
🟢 New learning / aha momentDecomposed reward signals in training is the key technical contribution here. Single-score RLHF rewards collapse the two dimensions, making optimization noisy. Separate rewards allow targeted gradient signal per dimension.
🟡 Question / wants more detailThis seems advanced but the key takeaway is: measure them separately, fix them separately, train on them separately. Everything in this chapter follows that structure.
🟢 New learning / aha momentThe chapter structure mirrors the engineering structure I need: separate measurement, separate intervention, separate training. I can assign these to different workstreams on my team.
A natural question is: are instruction following and groundedness the only dimensions of output quality? No. Reasoning correctness, safety, fluency, coherence, and creativity all matter too. But those dimensions are primarily about the model's internal capabilities — you don't fix reasoning by changing the context; you fix it by changing the model. Instruction following and groundedness are the dimensions most directly shaped by what you put in — by how you engineer the context. That's what makes them context engineering problems, and that's why they're the focus of this chapter.
🟡 Question / wants more detailSo reasoning and safety are "internal" model qualities but instruction following and groundedness are "external" -- they depend on what you feed the model. That's a useful distinction for knowing what you can actually control.
🔴 Concern / disagreementThe claim that reasoning is not shaped by context is problematic. Chain-of-thought prompting, few-shot examples, and retrieval all significantly affect reasoning quality. The boundary between "context-shaped" and "internal" is fuzzier than this suggests.
🟢 New learning / aha momentGood scoping decision. Acknowledging what's out of scope prevents reader frustration ("but what about safety?") while keeping the chapter focused.
(This scoping is imperfect. Reasoning is influenced by context — chain-of-thought prompting works, after all. And sycophancy, where a model overrides both its instructions and its context to agree with a user, sits at the intersection of both dimensions. We note these overlaps honestly rather than pretending the boundaries are clean.)
🟢 New learning / aha momentI appreciate the honesty here -- "the boundaries aren't clean." In my classes, concepts are usually presented as neat categories. Nice to see a textbook acknowledge the messiness.
🟢 New learning / aha momentGood epistemic hygiene. Acknowledging the imperfection of the scoping decision is more rigorous than pretending the decomposition is exhaustive. The sycophancy example is well-chosen as a boundary case.
🟡 Question / wants more detailSycophancy is a real problem for us -- users push back on model answers and the model caves. Is there a separate section on this? We've seen it cause both instruction violations AND groundedness failures.
S3 Why Both Problems Persist
A reasonable question at this point: if we know what instruction following and groundedness are, and we've been studying them for years, why do they still fail? The answer lies in what language models fundamentally are — and what the training process optimized them to do.
🟡 Question / wants more detailGood question! If we know the problem, why can't we just fix it? This section should explain why it's harder than it sounds.
🟢 New learning / aha momentOpening S3 with the reader's own question ("why do they still fail?") is a strong rhetorical move. It voices the skepticism and then addresses it head-on.
🟡 Question / wants more detailI need this section for executive communication. "Here's why the model isn't perfect and here's why just upgrading won't fix it" is a conversation I have monthly with leadership.
Language models are, at their core, next-token predictors trained on vast corpora of text. When you give a model a context and ask it to respond, it is not executing your instructions the way a program executes code. It is generating text that is statistically consistent with the patterns it learned during training — patterns about what plausible, helpful, knowledgeable responses look like. As Andrej Karpathy has put it, LLMs are "dream machines": their default mode is generation from learned priors, and your context is the opening scene that directs the dream. Adherence is whether the dream stays where you pointed it.
🟢 New learning / aha moment"Dream machines" -- that's a great metaphor. The model isn't following your instructions like a computer program. It's continuing a story that happens to involve following instructions. Sometimes the dream wanders off.
🟢 New learning / aha momentKarpathy's 'dream machines' framing is the best intuition pump I've seen for why adherence is fundamentally difficult. The model isn't executing; it's simulating. That's the key insight.
🟢 New learning / aha moment"Adherence is whether the dream stays where you pointed it" -- this is the best one-liner explanation of the entire chapter. I'll use this to explain the problem to my non-technical stakeholders.
🟢 New learning / aha momentThe Karpathy 'dream machines' quote is perfect for this audience. It's evocative, memorable, and from a credible source. Well-placed.
🟢 New learning / aha momentThe execute vs. simulate distinction has direct implications for SLAs. I can't guarantee instruction compliance the way I can with deterministic software. I need probabilistic SLAs and monitoring for drift.
This distinction — between executing instructions and simulating a scenario where instructions are being followed — is subtle but fundamental. The model does not want to follow your instructions. It does not want anything. It has learned to produce outputs that look like instruction-following, because its training data is full of examples where instructions were followed. But when your specific instructions conflict with the statistical patterns that dominated its training — when you ask it to say "I don't know" instead of giving a plausible-sounding answer, or to ignore information it "knows" is relevant — the training priors push back.
🟡 Question / wants more detail"The model does not want anything" -- this is a key CS concept. It's just pattern matching, not intentional behavior. But it LOOKS intentional, which is what makes it confusing when it disobeys.
🔴 Concern / disagreementThe "does not want anything" framing is philosophically loaded. There's active debate about whether sufficiently capable models have functional analogs to intentions. This strong eliminativist position may not age well.
🟢 New learning / aha moment"Training priors push back" -- so when I tell the model to say "I don't know" but it gives an answer anyway, it's because its training on millions of Q&A pairs taught it to always answer. My prompt is fighting the weights.
This is precisely what happened in the post-training process that made modern models feel so capable. RLHF and its successors optimized models to be generally helpful: fluent, comprehensive, knowledgeable, willing to engage. These are genuinely valuable properties. But they create a structural tension with prompt adherence. A model trained to be maximally helpful will use everything it knows to give you the best answer — including knowledge from its training data that contradicts or supplements the documents you retrieved. From the model's perspective, this is good behavior. From your system's perspective, it is a groundedness failure.
🟢 New learning / aha momentSo the model is being TOO helpful. It's trained to give the best possible answer, which means using ALL its knowledge. But my system only wants it to use the specific documents I gave it. Being helpful is the bug!
🟡 Question / wants more detailIs the tension between helpfulness and adherence a Pareto tradeoff, or can better training resolve it? If DPO/KTO can shape rewards more precisely than PPO, maybe the tension is an artifact of coarse reward modeling.
🔴 Concern / disagreementThe "from the model's perspective this is good behavior" framing is important for my team. Engineers get frustrated and say "the model is broken." It's not broken -- it's doing what it was trained to do. The system needs to constrain it.
The chip recommendation example makes this concrete. You are building a support chatbot for a company that sells Qualcomm chips. Via retrieval, you surface the relevant Qualcomm product listings. A customer asks a general question about processor options. The model, drawing on its training, recommends an ARM chip — a competitor's product that appears nowhere in your retrieved documents. The model is not malfunctioning. It is doing exactly what it was trained to do: give a comprehensive, knowledgeable answer. It is just not doing what your system required.
🟢 New learning / aha momentThis example is super clear. The chatbot recommends a competitor's product because it "knows" about it from training, even though the retrieved docs only mention Qualcomm products. Classic groundedness failure.
🟢 New learning / aha momentThe Qualcomm chip example is perfect. I've seen exactly this -- the model recommends a competitor product because it's 'better' even though my retrieved docs only contain our products. Now I know this is a groundedness failure, not a prompting failure.
🟢 New learning / aha momentThe Qualcomm chip example is the best concrete example in the chapter so far. Consider leading with it earlier -- perhaps even opening S3 with it, then explaining why it happens.
🟡 Question / wants more detailThis exact scenario happened to us. Our chatbot recommended a competitor's integration. The fix wasn't prompt engineering -- we added a verification step that checks all product mentions against an allowlist. Cost us 200ms latency but stopped the problem.
This is also where the tension between the two dimensions becomes concrete. If you try to fix the groundedness problem by aggressively penalizing unsupported claims, the model starts deflecting too often — refusing to answer questions it could have handled through reasonable inference from the context. If you try to fix the instruction following problem by rewarding completeness and responsiveness, the model fills gaps with training knowledge rather than admitting uncertainty. Optimizing for one dimension at the expense of the other makes the system worse overall.
🟢 New learning / aha momentThis is the practical version of the precision-recall tradeoff I mentioned earlier. Penalize hallucinations too much? Model refuses to answer. Reward helpfulness too much? Model makes stuff up. You literally can't win by optimizing one side.
🔴 Concern / disagreementI've been on both sides of this seesaw. My support chatbot deflects 40% of questions after I tightened the grounding prompt. Users are angry. But loosening it brings back hallucinations. I need a concrete recipe for the middle ground.
🟡 Question / wants more detailHow do I set the right deflection threshold? Is there a way to A/B test different thresholds and measure user satisfaction against groundedness? I need a product metrics framework, not just an ML framework.
Research has made the root cause even more precise. Kalai et al. (2025) showed formally that standard training and evaluation procedures structurally reward guessing over admitting uncertainty. Models receive no reward for saying "I don't know," so they learn never to say it. Xu et al. (2024) went further, proving using computability theory that any sufficiently capable language model will inevitably hallucinate when used as a general problem solver — not as an engineering limitation, but as a mathematical property.
🟢 New learning / aha momentThe Kalai et al. (2025) result is fascinating -- structurally rewarding guessing over uncertainty. Combined with Xu et al.'s computability theory result, this establishes hallucination as a mathematical inevitability, not an engineering bug. This changes how I think about the problem.
🟡 Question / wants more detailTwo heavy research citations back to back may lose practitioner readers. Consider a brief plain-English summary: 'In short, research has proved that hallucination isn't a bug -- it's a mathematical inevitability.'
🟡 Question / wants more detailThis seems advanced but the key takeaway is: the model is mathematically guaranteed to sometimes make stuff up. There's no training trick that completely eliminates hallucination. You have to build systems around it.
🔴 Concern / disagreementIf hallucination is mathematically inevitable, how do I write an SLA? "99.5% groundedness" requires a verification layer. This section convinces me that post-generation verification isn't optional -- it's load-bearing infrastructure.
This does not mean the problem is hopeless. It means the problem is structural, not incidental, and will not be solved by simply waiting for better models. Every generation of models gets better at both instruction following and groundedness, but the underlying tension between general helpfulness and specific adherence persists. As Karpathy has observed about building AI products: getting a demo to work just requires the system to succeed on some inputs; getting a product to work requires it to succeed on all of them — and "every single nine is a constant amount of work." Your demo works because both dimensions happened to hold on the examples you tested. Your product fails because the dimensions fail independently, on inputs you did not anticipate.
🟢 New learning / aha moment"Every single nine is a constant amount of work" -- going from 90% to 99% is as hard as going from 99% to 99.9%. That's a reliability engineering concept. Applied to AI, it means you can't just improve the model and call it done.
🟢 New learning / aha moment'Every single nine is a constant amount of work' -- this resonates. My demo worked great, production was a disaster. The failure modes are independent and show up on inputs I never tested.
🟢 New learning / aha momentThis is the SRE mindset applied to ML. Each "nine" of reliability requires a different investment: prompting gets you to 90%, orchestration to 99%, training to 99.9%. My team's roadmap should reflect this progression.
This is why prompt adherence is an engineering discipline, not a feature request. Both dimensions improve with better models — but they also improve with better systems: better context construction, better orchestration, better validation. The remainder of this chapter gives you the tools for both.
🟢 New learning / aha moment"Engineering discipline, not a feature request" -- you can't just ask the model to be better. You have to build systems. That reframes the whole problem from "AI capability" to "software engineering."
🟢 New learning / aha momentPerfect closing for S3. "Engineering discipline, not a feature request" is quotable and sets up the practical sections that follow.
🟡 Question / wants more detailThis framing is key for my team: prompt adherence is an engineering discipline. That means dedicated headcount, monitoring infrastructure, and continuous improvement processes. Not a one-time prompt-writing exercise.
S4 Recognizing Adherence Failures in Your System
Before you can measure or fix adherence, you need to recognize which dimension is failing. The taxonomy from the previous sections is not academic — it maps directly to patterns you will see in production. Each pattern below has a signature that tells you where to look.
🟢 New learning / aha momentS4 is perfectly scoped -- four concrete failure patterns, each with a clear diagnostic. This is the section practitioners will bookmark. Keep it concise.
🟢 New learning / aha momentThis section is like a diagnostic guide. "If you see this symptom, it's THIS type of failure." Very practical -- like a troubleshooting flowchart.
🟢 New learning / aha momentFour failure patterns that map to specific dimensions -- this is exactly what I need for incident classification. When the on-call engineer sees an issue, they can classify it immediately and route it to the right team.
Factual drift in RAG systems. The model supplements retrieved documents with knowledge from its training weights. This is a groundedness failure. It is particularly insidious because the response looks grounded — it has the right structure, it may even cite documents — but includes claims the documents never made. The tell: compare each factual claim in the response against the retrieved passages. If a claim has no source, the model is drifting.
🔴 Concern / disagreementFactual drift is described as 'particularly insidious' but the diagnostic -- 'compare each factual claim against retrieved passages' -- is essentially manual claim verification. At scale this is expensive. Should acknowledge the cost of detection here.
🟡 Question / wants more detailFor 'factual drift,' the diagnostic is to compare claims against retrieved passages. Is there a tool or library that does this automatically? Manual comparison doesn't scale.
🟡 Question / wants more detail"Drifting" -- so the model starts with the documents but gradually adds stuff from its training data? Like a student who starts answering from the textbook but then drifts into "I think I remember from somewhere..."
🟡 Question / wants more detailFactual drift is our #1 production issue. We catch about 30% of it through automated NLI checks. How do best-in-class teams detect the other 70%? Is there a sampling strategy that gives statistical confidence?
Instruction erosion at scale. Your system prompt has fifteen rules. The model follows most of them most of the time. But as the context grows — more retrieved documents, longer conversation history, more tool outputs — adherence to specific rules degrades. This is an instruction following failure, and it is not random: research on position effects (Liu et al., 2024) shows that models attend most reliably to the beginning and end of their context, and least to the middle. Rules buried in the middle of a long system prompt are the first to be dropped.
🟢 New learning / aha momentSo the model pays more attention to the beginning and end of the input, and less to the middle. That's like how I read long emails -- I remember the first paragraph and the last paragraph but zone out in the middle!
🟢 New learning / aha momentInstruction erosion at scale -- so the position of rules in my system prompt matters! I had 20 rules and the ones in the middle kept getting ignored. Now I know why. Moving critical rules to the top is an easy win.
🟢 New learning / aha momentPosition effects in attention -- this has immediate implications for our system prompt management. I should audit which rules are most critical and ensure they're in the first and last positions. A system prompt linter could enforce this automatically.
🟡 Question / wants more detailThe "lost in the middle" finding raises questions about the attention mechanism itself. Is this a fundamental limitation of scaled dot-product attention, or an artifact of training data distribution? Could architectural changes (e.g., ALiBi, RoPE modifications) mitigate it?
Out-of-scope responses. A model built to answer questions about one product domain draws on general knowledge to answer questions outside that domain. This is a groundedness failure — the model reached past the knowledge you provided rather than declining to answer. The fix is not more instructions telling the model to stay in scope (though that helps at the margin). The fix is training the model to treat deflection as default behavior when the context does not support a response.
🟢 New learning / aha momentThis is like a customer support agent who starts answering questions about topics they're not trained on, just to be helpful. The right behavior is "let me transfer you to someone who can help" -- not making stuff up.
🔴 Concern / disagreement"The fix is training" -- that's a heavy lift for most teams. What about a lighter approach? Can I detect out-of-scope queries at the retrieval layer (low similarity scores) and refuse before the model even sees them?
🟡 Question / wants more detailOut-of-scope detection needs to work at multiple layers: query classification before retrieval, retrieval confidence thresholds, and model-level deflection. How do I architect these as a defense-in-depth strategy?
Conflicting context resolution. Retrieved documents contradict each other — because your knowledge base contains outdated versions, or because different sources describe different policies. The model resolves the conflict using its training priors rather than following explicit instructions about precedence. This is a failure of both dimensions: the model is not following the instruction about how to resolve conflicts (instruction following), and it is grounding in the wrong source or in no source at all (groundedness).
🟡 Question / wants more detailWhat if the documents genuinely contradict each other? Like two different policy pages say different things? The model has to pick one -- but which one? This seems like a data quality problem as much as a model problem.
🟢 New learning / aha momentConflicting context is the most interesting failure mode because it involves both dimensions simultaneously. The model must follow meta-instructions about conflict resolution while staying grounded. This is where the two dimensions interact most directly.
🔴 Concern / disagreementConflicting context is often a data quality issue, not a model issue. Before blaming the model, we should audit our knowledge base for contradictions, stale documents, and version conflicts. The fix might be upstream in our content pipeline.
🔴 Concern / disagreementThe final paragraph of S4 reads like a transition rather than a conclusion. Consider adding a brief recap table: Pattern | Dimension | Diagnostic | Fix.
The pattern in all four cases: the model's behavior is governed by something other than what you put in the context. Your interventions should target the specific dimension that is failing. Tightening grounding instructions will not fix instruction erosion. Training for deflection will not fix formatting violations. The taxonomy tells you where to aim.
🟢 New learning / aha momentThe key pattern: the model is being influenced by something OUTSIDE your context (its training data). And different fixes work for different problems. You can't just "try harder" -- you need the right tool for the right failure.
🟢 New learning / aha moment"Tightening grounding instructions will not fix instruction erosion" -- this saved me weeks of work. I was trying to fix a formatting problem by adding more grounding prompts. Wrong dimension entirely.
🟢 New learning / aha momentThis taxonomy gives my team a common language for incident classification. Instead of "the model is wrong," we can say "this is a groundedness failure in the factual drift category." That routes to the right fix immediately.
S5 Measuring Each Dimension
You cannot improve what you cannot measure — and in prompt adherence, how you measure determines whether you can act on the result. The single most important principle: measure groundedness and instruction following separately, using decomposition.
🟢 New learning / aha momentThe decomposition principle -- measure separately -- is the most actionable advice in the chapter so far. It's surprising how many production systems still use holistic scores.
🟢 New learning / aha moment"You can't improve what you can't measure" -- classic engineering principle. And the twist is: HOW you measure matters. A single score hides what's actually broken.
🟡 Question / wants more detailS5 on measurement is critical but long. Consider splitting into two sections: one on measurement philosophy (why decompose) and one on specific techniques.
🟢 New learning / aha momentSeparate measurement is the foundation of everything else. I need to add groundedness and instruction-following as separate metrics in our eval dashboard, not just a single "response quality" score.
Why Holistic Scores Hide What's Failing
A common approach is to ask a judge model: "Is this response good?" and get a single score. This collapses both dimensions into one number. A response that scores 0.7 might be perfectly grounded but missing three formatting requirements, or it might follow every instruction but contain fabricated claims. The number tells you something is wrong. It does not tell you what, and it certainly does not tell you where to intervene. Decomposed measurement — one score for groundedness, one for instruction following — makes failures actionable.
🟢 New learning / aha momentA 0.7 score could mean very different things: good content + bad format, or bad content + good format. Same number, completely different problems. Decomposing the score tells you WHERE to look. That's like debugging with stack traces vs. "something broke."
🔴 Concern / disagreementWe've been using holistic LLM-as-judge scoring for 6 months. Now I learn it's been hiding our real failure modes? I need to decompose our existing eval pipeline ASAP. But how much effort to migrate?
🟢 New learning / aha momentThe 0.7 example perfectly illustrates why I've been frustrated with our eval dashboards. Same score, different root causes, different teams responsible. Decomposed scores let me route alerts correctly.
🟡 Question / wants more detailThe information-theoretic argument is implicit: holistic scores have lower information content than decomposed scores. Is there a formal analysis of how much information is lost in score aggregation?
Measuring Groundedness: Claim-Level Verification
Groundedness is precision over the context: what fraction of the output's claims are supported by the provided knowledge? The measurement technique follows directly from this definition.
🟡 Question / wants more detailSo measuring groundedness = checking each individual claim against the documents. That's like fact-checking a newspaper article, but automated. How does the automation work?
🟡 Question / wants more detailThe three-step groundedness measurement is clear. But Step 1 (decompose into claims) is the hard part. How do I reliably decompose a response into atomic claims? Is there a prompt template for this?
🟢 New learning / aha momentThe three-step measurement process for groundedness is clean and implementable. Good use of bold step markers. This could become a sidebar recipe card.
Step 1: Decompose the response into individual claims. A response like "The Snapdragon 8 Gen 3 has a 30% faster GPU and supports Wi-Fi 7" contains two distinct factual claims. Each must be verified independently.
🟢 New learning / aha momentBreaking a sentence into separate claims -- "30% faster GPU" and "supports Wi-Fi 7" -- so each can be checked individually. Smart. One could be true and one false.
🟡 Question / wants more detailClaim decomposition at scale: how many claims per average response? If a 200-word response has ~15 claims, and we serve 100K responses/day, that's 1.5M NLI checks per day. What's the cost profile?
Step 2: Verify each claim against the source documents. For each claim, ask: is this entailed by the retrieved documents? A claim might be true in the world but not supported by the provided context — and for a grounded system, that counts as a failure.
🔴 Concern / disagreementWait -- a claim can be TRUE but still count as a failure? Because it's not in the documents? That feels harsh. But I guess for a system that's supposed to only use its documents, sneaking in outside knowledge IS the problem, even if it's correct.
🟢 New learning / aha momentThe distinction between "true in the world" and "entailed by context" is crucial for formal evaluation. This is textual entailment applied to groundedness verification. The NLI framing makes it rigorous.
Step 3: Aggregate. The fraction of supported claims is the groundedness score. A response where 9 of 10 claims are supported scores 0.9.
🟢 New learning / aha momentSimple fraction: supported claims / total claims. 9/10 = 0.9. That's precision from my ML class! The same formula as precision in classification.
🟡 Question / wants more detail0.9 groundedness sounds good, but it means 1 in 10 claims is unsupported. At scale, that's thousands of hallucinated claims per day. What's an acceptable threshold, and how does it vary by domain (healthcare vs. e-commerce)?
You can implement a basic version of this pipeline with prompting alone — ask a capable model to list the claims, then evaluate each against the source. For production use, purpose-trained evaluation models are more reliable: they are optimized specifically for the entailment judgment at Step 2, catching subtle failures where a claim is related to but not actually supported by the source document. The FACTS benchmark (Jacovi et al., 2024) is a useful stress-test: it pairs long source documents (up to 32K tokens) with requests that require grounded, long-form responses, and uses frontier LLM judges to evaluate both responsiveness and attributability.
🟢 New learning / aha momentI can start with prompting-based verification and upgrade to purpose-trained models later. That's a good migration path: quick prototype with GPT-4 as judge, then switch to a dedicated NLI model for cost efficiency.
🟡 Question / wants more detailThe distinction between "related to" and "actually supported by" is where most evaluation errors occur. Is there work on calibrating NLI models specifically for the groundedness verification use case?
🟡 Question / wants more detailFACTS benchmark with 32K token sources -- that's representative of our production documents. Can I run FACTS on our specific domain data, or is it only for general-purpose evaluation?
🟢 New learning / aha momentLMUnit's improvement from Kappa 0.04 to 0.52 is a dramatic result. Going from near-random agreement to moderate agreement just by decomposing the evaluation -- this validates the entire measurement framework.
🟢 New learning / aha momentNatural language unit tests -- this is the approach I need. Instead of 'is the response good?' I can test each requirement separately. I can even automate this in CI/CD for my prompt changes.
Measuring Instruction Following: Natural Language Unit Tests
Instruction following is recall over requirements: what fraction of the prompt's requirements are reflected in the output? The measurement technique mirrors software testing.
🟢 New learning / aha momentNatural language unit tests! Like software unit tests, but instead of checking code output, you check model output against each instruction. "Did it use bullet points?" = one test. "Did it cite sources?" = another test.
🟢 New learning / aha momentThis maps directly to CI/CD for prompts. Every prompt change triggers a test suite that checks each instruction is still followed. I can build this into our deployment pipeline this quarter.
Step 1: Decompose the prompt's requirements into individual, testable assertions. A system prompt with twelve rules generates twelve test cases. "Does the response use bullet points?" "Does it avoid mentioning competitor products?" "Does it include inline citations?"
🟡 Question / wants more detailSo for each rule in the system prompt, you create a yes/no test. Twelve rules = twelve tests. That's very concrete and easy to implement, even for a class project.
🟡 Question / wants more detailFor complex instructions like "maintain a professional tone" -- how do I write a testable assertion? Some instructions are binary (bullet points: yes/no) but others are subjective. How do I handle the gradient?
Step 2: Evaluate each assertion against the response. Each test produces a score (pass/fail, or a continuous scale) and a rationale explaining the judgment.
🟢 New learning / aha momentThe rationale per assertion is key for debugging. When a test fails, I need to know WHY -- not just that it failed. This turns eval from a black box into a diagnostic tool.
Step 3: Aggregate. The fraction of satisfied requirements is the instruction following score.
🟢 New learning / aha momentSame as groundedness: a simple fraction. 10 out of 12 rules followed = 0.83 instruction following score. Clean and comparable across different prompts and models.
This is the "natural language unit test" metaphor: each requirement becomes a test case, and the response either passes or fails each one. The technique was formalized in LMUnit (Kamalloo et al., 2024), which takes a prompt, a response, and a natural language test assertion, and returns a score with rationale. The practical value is diagnostic: instead of knowing that "something is wrong," you know that requirements 3, 7, and 11 are failing. Inter-annotator agreement improved from a Kappa of 0.04 with holistic preference judging to 0.52 with decomposed unit tests — a meaningful shift toward reproducible evaluation.
🟢 New learning / aha momentKappa 0.04 to 0.52 -- from near-random to moderate agreement. This quantitatively validates that decomposition makes evaluation reproducible. The improvement is dramatic enough to be publishable on its own.
🟢 New learning / aha moment"Requirements 3, 7, and 11 are failing" -- that's actionable. I can fix specific prompts for specific rules instead of blind trial-and-error. This changes eval from "feel" to "engineering."
🟡 Question / wants more detailKappa 0.04 to 0.52 is great but still only "moderate" agreement. For high-stakes applications, I need higher reliability. What's the path from 0.52 to 0.8+ inter-annotator agreement?
🟡 Question / wants more detailThe Kappa improvement is impressive but might be lost on general readers. Consider adding a one-sentence translation: "In plain terms, human evaluators went from essentially random disagreement to meaningful consistency."
Finding the Breaking Points
Evaluation is only as useful as your test distribution is hard. A model that follows instructions reliably on simple examples may fail on the examples that matter most — the ones with conflicting requirements, long contexts, or edge cases that stress the model's training priors. Constructing progressively harder test cases — by adding constraints, introducing contradictions, or increasing context length — reveals the failure boundaries that easy examples hide.
🟢 New learning / aha momentTest on hard examples, not easy ones. Makes sense -- a student who aces easy quizzes might fail the final exam. You need to test at the difficulty level that matters.
🟡 Question / wants more detailHow do I systematically find my system's breaking points? We need adversarial testing, but manually crafting hard cases doesn't scale. Is there a way to automatically generate failure-inducing inputs?
🟢 New learning / aha momentThe connection to adversarial evaluation and stress testing is important. This is essentially property-based testing applied to LLM outputs -- generating inputs that probe the boundary of correct behavior.
One effective approach is synthetic generation of progressively harder test cases. Start by generating diverse natural language unit tests for each prompt, targeting fine-grained quality criteria. Then generate contrastive responses — responses that vary systematically in how well they satisfy each criterion, creating pairs that differ on exactly one dimension. This gives you test distributions where failure modes are isolated and identifiable. The key is to ensure coverage across failure types: not just easy formatting checks but subtle groundedness violations, multi-constraint interactions, and edge cases where the model's training priors conflict with the prompt's requirements.
🟢 New learning / aha momentContrastive responses that differ on exactly one dimension -- this is the key to isolating failure modes. Instead of "is this response good?", I can ask "does this response satisfy criterion X?" by comparing two responses that differ only on X.
🟡 Question / wants more detailThis seems advanced but the key takeaway is: don't just test easy cases. Generate hard cases that stress-test the model, and compare responses that differ in exactly one way to isolate what's breaking.
🔴 Concern / disagreementSynthetic test generation is promising but I worry about distribution mismatch. Synthetic tests might not represent real user behavior. We need a blend of synthetic stress tests and sampled production queries.
S6 Improving Prompt Adherence in Practice
You have the taxonomy. You can diagnose which dimension is failing. You can measure each one separately. Now: what do you do about it?
🟢 New learning / aha momentS6 is the most valuable section for O'Reilly's audience. The four-lever framework gives readers a complete action plan. This should be the section that gets the most visual treatment.
🟢 New learning / aha momentFinally -- the "what to do about it" section! Everything up to now has been diagnosis. Now we get the cures.
🟢 New learning / aha momentThis is the section I'll share with my team's tech lead. "Here are four concrete levers, ordered by effort. Start at the top, work down." That's a roadmap.
The interventions exist on a spectrum from lightweight to heavy. We organize them as four levers, ordered by what you can control. Everyone can pull the first two. The third requires system-level control. The fourth requires training access. The right starting point depends on what you control and how systematic the failure is.
🟡 Question / wants more detailFour levers from easy to hard: model selection, prompting, orchestration, training. I can do the first two right now. The last two need more infrastructure. Good to know what's possible at each level.
🟡 Question / wants more detailThe four levers are ordered by accessibility, which is practical. But I wonder about ordering by expected impact? Model selection and training probably have the highest ceiling, while prompting has the lowest.
🔴 Concern / disagreement'Everyone can pull the first two. The third requires system-level control. The fourth requires training access.' -- Excellent but buried in a paragraph. Pull it out as a key callout or table.
🟢 New learning / aha momentThe ordering by access level is smart. It matches how I'd assign work: junior engineers start with prompting, senior engineers handle orchestration, the ML team handles training. Clear ownership per lever.
Lever 1: Model Selection
🟢 New learning / aha momentStart from instruct models, not chat models, for fine-tuning. This is counterintuitive -- I assumed chat models would be better since they're more 'aligned.' But the extra post-training makes them harder to steer. Good to know.
🟡 Question / wants more detailWhat's the difference between an "instruct model" and a "chat model"? Both can follow instructions, right? Is it about how much fine-tuning they've had?
Your choice of base model matters more than most practitioners realize. Models differ significantly in their instruction-following and groundedness capabilities, and these differences are not captured by general benchmarks.
🟢 New learning / aha momentGeneral benchmarks don't capture adherence differences. I need to run adherence-specific benchmarks (IFEval, FACTS) on candidate models before committing. Adding this to our model selection checklist.
🟡 Question / wants more detailAre there published comparisons of instruction-following and groundedness across models? The IFScale data is one source, but I'd want per-task breakdowns to understand where each model excels.
Two practical insights. First, if you are fine-tuning for adherence, start from an instruct model rather than a chat model. Chat models have undergone heavier post-training that bakes in more opinionated behavior — exactly the behavior you are trying to override. Instruct models sit earlier in the post-training pipeline and are more malleable. Starting from there gives the fine-tuning more room to shape the model toward what you need.
🟢 New learning / aha momentSo chat models are too "opinionated" because they've been heavily tuned to be helpful in a general way. Instruct models are more of a blank slate -- easier to train for YOUR specific needs. That's like choosing a less specialized employee who can be trained for your specific role.
🔴 Concern / disagreementThis advice about instruct vs. chat models is useful but requires fine-tuning access, which many teams don't have. For API-only users, model selection is limited to what the provider offers. The advice should acknowledge this constraint.
🟡 Question / wants more detailIf we're fine-tuning, the instruct model tip is gold. But we also need to consider API cost, latency, and rate limits. Is there a decision matrix for model selection that includes adherence alongside operational criteria?
Second, some models are specifically trained for grounded generation — models designed to prioritize faithfulness to provided context over training knowledge. If your system's primary requirement is groundedness, choosing such a model is the single highest-leverage decision you can make. It is more impactful than any prompting technique or orchestration pattern.
🟢 New learning / aha momentA model specifically trained for grounded generation is the highest-leverage choice for groundedness. More impactful than prompt engineering? That tells me to invest in model evaluation, not prompt tweaking.
🟡 Question / wants more detailWhat models are trained specifically for groundedness? Are there specific ones I should look for? This seems like important practical advice but it doesn't name any.
🟢 New learning / aha momentThe claim that model selection outweighs prompting for groundedness is a strong empirical claim. The FACTS benchmark data supports it -- model-level differences dominate prompt-level differences in grounded generation.
Lever 2: Prompting
🟢 New learning / aha momentPositive framing! 'Use only real data' instead of 'do not use mock data.' I've been writing negative constraints and wondering why they backfire. The 'pink elephant problem' explains it perfectly.
🟡 Question / wants more detailWhat's the "pink elephant problem"? Is it like when someone says "don't think of a pink elephant" and that's all you can think about? So telling a model "don't hallucinate" makes it more likely to hallucinate?
Prompt engineering has an adherence-specific toolkit that goes beyond general "write better prompts" advice. Three techniques are worth knowing:
🔴 Concern / disagreementPrompting can improve from 85% to 92% but not from 70% to 99% -- this is the reality check I needed. I've been spending weeks on prompt engineering when maybe I need to look at training or orchestration instead.
🟡 Question / wants more detailThe prompting section could use a before/after example showing a bad prompt vs. a good prompt using the three techniques. Readers learn best from concrete diffs.
🟢 New learning / aha momentThree prompting techniques for adherence: explicit grounding, constraint ordering, positive framing. I can create a prompt review checklist from these and enforce it in our prompt management tool.
Explicit grounding instructions. If the model is reaching outside the retrieved documents, stating explicitly — "Answer only using information from the provided documents. If the documents do not contain sufficient information to answer, say so." — can move the needle. This is the simplest intervention and the first thing to try.
🟢 New learning / aha momentExplicitly telling the model "only use the provided documents" can help. It's like telling a student "only use information from this page" on an open-book exam. Simple but apparently necessary.
🟡 Question / wants more detailIs there a standard grounding instruction template that's been empirically validated? I'd rather use a tested template than write my own and hope it works.
Constraint ordering. Position matters. Research on positional attention (Liu et al., 2024) shows that models attend most reliably to the beginning and end of their context, and least to the middle. Put your most critical constraints first. Put your most commonly violated constraints early. If a rule keeps getting dropped, move it toward the top of the system prompt before you try anything else.
🟢 New learning / aha momentPut the most important rules first! The model pays more attention to the beginning. That's actionable advice I can use right now in any project.
🔴 Concern / disagreementThe claim that system/user prompt separation doesn't establish reliable priority is important but potentially confusing. Practitioners heavily rely on this distinction. Needs a concrete example of when it fails.
🟢 New learning / aha momentConstraint ordering backed by empirical research. I should audit our system prompts and reorder rules by criticality. This is a zero-cost intervention that can be done today.
Positive framing. Negative instructions can backfire. "Do not use mock data" makes the model more aware of mock data as a concept, and in some cases more likely to produce it — an effect called the "pink elephant problem." The fix is to reframe as positive commands: "Use only real data from the provided sources." Tell the model what to do, not what not to do.
🟢 New learning / aha momentYes! It IS like the pink elephant thing! "Don't think of mock data" makes the model think about mock data. Instead, say "use only real data." Positive instructions work better than negative ones. Cool trick.
🟢 New learning / aha momentI just audited my system prompt and found 8 negative instructions ("don't", "never", "avoid"). Reframing them as positive commands is an easy experiment I can run this week.
🟡 Question / wants more detailThe "pink elephant problem" is a nice analogy but is it empirically validated for LLMs? Is there a paper showing that negative instructions actually increase the probability of the negated behavior?
🔴 Concern / disagreementOur legal team writes all their compliance rules as negations: "never disclose", "do not recommend", "avoid liability". I need to work with them to reframe these as positive instructions. That's a cross-functional effort.
The ceiling on all prompting techniques is that they are brittle. They help at the margins. A well-crafted prompt can improve adherence from 85% to 92%, but it will not take you from 70% to 99%. When the model's training priors conflict strongly with your requirements, the prompt is fighting the weights — and the weights usually win.
🟢 New learning / aha moment"The prompt is fighting the weights" -- great metaphor. The prompt is temporary context; the weights are permanent. If they disagree, the weights win because they represent millions of training examples.
🔴 Concern / disagreement85% to 92% is the ceiling? That's sobering but realistic. I've spent months tweaking prompts and hit exactly this wall. Time to look at orchestration and training as the next steps.
🟢 New learning / aha momentThis is the ROI calculation I needed. If prompting can only improve 85% to 92%, and we need 99%, the remaining 7% requires orchestration and training. I can plan resource allocation accordingly.
One important caveat: research on instruction hierarchy (Geng et al., 2025) has shown that the separation between system and user prompts does not establish the reliable priority most practitioners assume. Models have inherent biases toward certain types of constraints regardless of where they appear in the prompt. Do not rely on the system/user distinction alone to enforce instruction precedence.
🔴 Concern / disagreementThis is alarming. Our entire security model assumes system prompts take precedence over user prompts. If that's not reliable, we have a prompt injection vulnerability. This needs immediate review.
🟡 Question / wants more detailIf system/user prompt separation isn't reliable, what IS reliable? Structured output? Constrained decoding? I need a concrete alternative, not just "don't rely on this."
🔴 Concern / disagreementGeng et al. (2025) is crucial but the implications are underexplored here. If instruction hierarchy is unreliable, what does this mean for all the security claims about system prompts being "privileged"?
Lever 3: Inference-Time Orchestration
🟢 New learning / aha momentSecond-pass verification -- generate, then verify. This is something I can implement today. Decompose the response, check each claim, flag unsupported ones. It adds latency but catches hallucinations.
🟢 New learning / aha momentAdherence is a "system property" -- it's not just about the model, it's about the entire pipeline around the model. The retrieval step, the generation step, and a verification step all contribute.
Prompt adherence is not just a model property — it is a system property. Every component in your pipeline has its own form of adherence to maintain. The reranker follows ranking instructions. The generator follows grounding and response instructions. Enforcing adherence at a single point is not enough; it must be trained and enforced at each layer.
🟢 New learning / aha moment"System property, not model property" -- this is how I should frame it for my architecture review. Each component needs its own adherence contract: the retriever, the reranker, the generator, the verifier. Defense in depth.
🟡 Question / wants more detailFraming adherence as a system property raises the question: how do adherence guarantees compose across components? If each component is 95% adherent, is the system 0.95^n adherent? Or can components compensate for each other?
Upstream: Instruction-aware retrieval. If your retrieved documents contain conflicts, stale information, or irrelevant results, you have made the groundedness problem harder before the generator even runs. An instruction-following reranker can enforce recency ("prioritize documents from the last six months"), source hierarchy ("internal documentation takes precedence over market reports"), and conflict resolution ("when sources disagree, prefer the most recent one") at the retrieval layer. This is adherence enforcement at the point where knowledge enters the context.
🟢 New learning / aha momentClean up the input BEFORE it reaches the model. If the retrieved documents are messy, conflicting, or outdated, the model's job is harder. An "instruction-following reranker" can filter and prioritize at the retrieval level.
🟢 New learning / aha momentInstruction-aware retrieval is where we should invest first. Our current reranker optimizes for relevance only. Adding adherence awareness (recency, source hierarchy) to the reranker would prevent many groundedness failures before generation.
🟡 Question / wants more detailInstruction-following rerankers -- are these available as libraries or APIs, or do I need to train my own? The concept is clear but I want to know the implementation path.
Downstream: Second-pass verification. Generate a response, then run it through a verification step before returning it. For groundedness: decompose the response into claims and check each against the source documents. Flag, regenerate, or remove unsupported claims. For formatting: if the model does not reliably produce structured output in a single pass, a lightweight extraction step as a fallback — asking a second call to pull structured content from the freeform response — is often more reliable than more elaborate prompting.
🟢 New learning / aha momentGenerate first, verify second. If the verification finds problems, fix them before sending to the user. It's like a spell-checker but for hallucinations. Extra step, extra cost, but much more reliable.
🟡 Question / wants more detailSecond-pass verification adds latency. For our real-time chat system with a 3-second SLA, can I afford a verification step? What's the typical latency cost, and can it run in parallel?
🔴 Concern / disagreementSecond-pass verification doubles my API costs. For high-volume systems, this is significant. Is there a lightweight version that catches 80% of failures at 20% of the cost?
Second-pass approaches are often the practical ceiling for inference-time-only solutions. A well-designed pipeline with retrieval-layer enforcement and post-generation verification can handle a significant fraction of adherence failures without touching model weights.
🟢 New learning / aha moment"Practical ceiling for inference-time-only solutions" -- this tells me when to stop investing in orchestration and start investing in training. If we're still below our target after retrieval + verification, it's time for SFT.
🟢 New learning / aha momentGood pacing -- acknowledging the ceiling of inference-time approaches before introducing training sets up the "why you might need the heavier lever" argument naturally.
Lever 4: Training
When failures are systematic — when the model's training priors conflict deeply with your requirements and no amount of prompting or orchestration overcomes them — you need to change the weights. This does not mean training from scratch. It means targeted fine-tuning, followed by reinforcement learning with the right reward signals.
🟡 Question / wants more detailFine-tuning = training the model on YOUR specific examples. RL = reinforcement learning with rewards for good behavior. Together they change the model's DEFAULT behavior. This is the heaviest intervention but the most permanent.
🟡 Question / wants more detailWe have fine-tuning access through our API provider. What's the minimum dataset size for meaningful adherence improvement? How many examples of correct grounded responses do we need?
Step 1: Supervised fine-tuning (SFT). The goal of the SFT step is to teach the model a structural distinction it does not learn in standard post-training: the difference between parametric knowledge (what it learned during pretraining) and non-parametric knowledge (what is in the provided context right now). Fine-tuning on a structured format that makes this distinction explicit — with inline attributions linking each claim to its source document — enables the deflection behavior that is central to grounded generation. A model that can distinguish "I know this from training" from "this is in the document I was given" can then be trained to prefer the latter, and to refuse to answer when neither suffices.
🟢 New learning / aha momentParametric = what the model memorized during training. Non-parametric = what's in the context right now. Teaching the model to tell these apart is the key to grounding. Like teaching a student "cite your sources" -- the model learns to attribute every claim.
🟢 New learning / aha momentTeaching the parametric/non-parametric distinction through SFT is an elegant approach. It's essentially making the model's epistemic state explicit and trainable. This connects to the distinction between semantic memory and episodic memory in cognitive science.
🟢 New learning / aha momentSFT with inline attributions -- this is the pattern I need. If the model cites its sources in every claim, we can automatically verify grounding. Attribution makes the model auditable by default.
Step 2: Reinforcement learning with decomposed rewards. The critical insight for the RL step is that you need two separate reward signals, one for each dimension of prompt adherence.
🟢 New learning / aha momentTwo separate rewards: one for "did you follow instructions?" and one for "are your claims supported?" If you combine them into one reward, the model can't tell which dimension it needs to improve.
🟢 New learning / aha momentDecomposed rewards solve the reward ambiguity problem in multi-objective RLHF. Instead of one blurry signal, two targeted signals. This is the multi-task RL approach applied to adherence dimensions.
- The groundedness reward operates at the claim level: decompose the response into individual claims, score each against the source documents using a purpose-trained evaluation model, and average. This directly targets precision — penalizing claims that are not supported by the provided context.
- The instruction following reward operates at the criteria level: extract the requirements from the prompt, score each as a natural language unit test against the response, and average. This directly targets recall — penalizing requirements that were dropped or violated.
🟡 Question / wants more detailDecomposed RL rewards are technically sound but operationally complex. Who builds the reward models? How do we validate them? What's the iteration cycle for updating rewards as our requirements change? This is a whole ML ops workstream.
🟡 Question / wants more detailCan I use off-the-shelf reward models for the groundedness and instruction-following rewards, or do I need to train custom ones? The pipeline described here seems expensive to build from scratch.
Why decomposed rewards matter: A holistic reward signal ("is this response good?") is underspecified. Different evaluators focus on different qualities, producing inconsistent signal and slow learning. Decomposed rewards give the model specific, interpretable signal per dimension. The model knows which claims were unsupported and which instructions were violated — not just that "something was off."
🟢 New learning / aha momentHolistic = "something is wrong." Decomposed = "claim 3 is unsupported AND rule 7 was violated." The decomposed version tells the model exactly what to fix. Like getting specific feedback on an essay instead of just a grade.
🟢 New learning / aha momentThe information-theoretic argument for decomposed rewards: higher information content per reward signal means faster convergence. This should be provable in the multi-armed bandit framework.
The training lever is the heaviest to pull. But for systematic failures — the cases where the model's training priors are actively working against your requirements — it is the only lever that changes the model's default behavior rather than fighting it at inference time.
🟢 New learning / aha moment"Changes default behavior rather than fighting it at inference time" -- this is the key distinction. Prompting and orchestration fight the model; training changes the model. For our most critical failures, training is the only path to reliable improvement.
🟢 New learning / aha momentClean closing for S6. The four levers are well-ordered, each with clear triggers for when to use them. This section will be the most-referenced in the book.
S7 What Happens at the Limits: Instruction Overload
Everything we have discussed so far assumes a manageable number of constraints. But what happens when your system prompt grows — ten rules, twenty, fifty?
🟢 New learning / aha momentThis section pushes the framework to its limits. What happens when you have LOTS of rules? Intuitively, more rules = harder to follow all of them. But the data shows it's worse than you'd expect.
🟡 Question / wants more detailOur production system prompt currently has 47 rules across 5 teams. This section is directly relevant. How do I know which rules are interfering with each other?
🟢 New learning / aha momentOpening with a rhetorical question that the reader is probably already asking. Good pacing -- S7 naturally follows from the prompting ceiling in S6.
The answer, established by recent empirical work (IFScale; Jaroslawicz et al., 2025), is that adherence degrades non-linearly as constraints multiply. And the pattern of degradation depends on the model architecture.
🟢 New learning / aha momentNon-linear degradation is the key finding. The three patterns (threshold, linear, exponential) give practitioners a taxonomy for their own model's behavior. This is immediately useful for system prompt design.
🟢 New learning / aha momentNon-linear degradation explains why my system prompt went from working well to falling apart when I added five more rules. It wasn't just 'more rules'; the new rules were interfering with the old ones.
🟢 New learning / aha moment"Non-linearly" means it's not a straight line of degradation. It could be fine-fine-fine-CRASH (threshold) or gradually-worse-then-much-worse (exponential). The pattern depends on the model.
IFScale tested frontier models on instruction sets scaling from 10 to 500 constraints and found three distinct degradation patterns:
🟡 Question / wants more detail500 constraints seems extreme, but 50-100 is realistic for complex enterprise prompts. The data at 50-100 is what matters for my planning. Let me focus on those columns.
- Threshold decay (reasoning models like o3): adherence holds steady up to a point, then drops sharply. The model appears to handle complexity well until it hits a cliff.
- Linear decay (models like GPT-4.1, Claude Sonnet 4): adherence degrades gradually and predictably. Each additional constraint costs roughly the same amount of adherence.
- Exponential decay (models like GPT-4o, Llama-4-Scout): rapid collapse. Adherence degrades faster with each additional constraint.
🟢 New learning / aha momentThree patterns: (1) cliff -- fine then sudden crash, (2) straight line -- steady decline, (3) exponential -- fast collapse. Different models do different things. That's like how different algorithms have different scaling behavior in my algorithms class!
🟡 Question / wants more detailThe three degradation patterns raise the question: what architectural or training differences cause threshold vs. linear vs. exponential decay? Is it the reasoning chain? The attention mechanism? The RLHF objective?
🟢 New learning / aha momentIf my model shows exponential decay, I need to keep constraints minimal. If it shows threshold decay, I need to find where the cliff is. The degradation pattern determines my system prompt design strategy.
In all three patterns, the study found a positional bias: models attend more reliably to instructions that appear earlier in the prompt. Later instructions are more likely to be dropped, regardless of importance.
🟢 New learning / aha momentLater instructions get dropped more often. So the ORDER of your rules matters -- put the most important ones first! This is consistent with the "lost in the middle" finding from S4.
🟢 New learning / aha momentPositional bias means our prompt ordering is load-bearing. I need to implement a prompt management system that enforces rule ordering by priority, not by which team added their rules last.
This is not the same as context length degradation, where information in long contexts becomes less attended to as distance increases. Instruction overload is something more specific: instruction interference. Adding constraint #11 does not just strain capacity — it can actively displace adherence to constraint #9. The model's ability to simultaneously satisfy an expanding set of requirements degrades in ways that are not simply additive. You are not overflowing a buffer. You are overloading the model's ability to track and honor competing requirements.
🟢 New learning / aha momentInstruction interference as distinct from context length degradation -- this is a subtle and important distinction. It's not just 'too much text' but 'too many competing constraints.' The interactions between constraints create emergent failure modes.
🟢 New learning / aha moment"You're not overflowing a buffer" -- it's not about running out of space. It's about the constraints INTERFERING with each other. Adding rule #11 can make the model forget rule #9. They compete for the model's "attention."
🔴 Concern / disagreementInstruction interference means I can't just keep adding rules. Every new rule has a hidden cost: it might break an existing rule. I need regression testing every time a team adds a new instruction. This is a governance problem.
The practical implications are significant:
🟡 Question / wants more detailThe IFScale table is eye-opening. GPT-4o drops from 94% at 10 constraints to 49% at 100. That's terrifying. But what about real-world prompts -- are 100 constraints realistic or is this a stress test?
- You cannot simply add more rules. At some point, each new instruction trades off against existing ones. System prompt design requires prioritization, not just accumulation.
- Know your model's degradation pattern. If you are using a model that exhibits threshold decay, test to find where the cliff is. If linear, budget a per-constraint cost. If exponential, keep constraints minimal and offload enforcement to orchestration.
- Position your most critical constraints first. This is supported by both the IFScale positional bias finding and the "Lost in the Middle" attention research. The beginning of your system prompt is prime real estate.
🟢 New learning / aha momentThree actionable takeaways: (1) don't just add rules -- prioritize, (2) test to find your model's breaking point, (3) put important rules first. Concrete advice I can use in any project.
🟢 New learning / aha moment"Prioritization, not accumulation" is the mantra I need. My teams keep adding rules. I need a system prompt budget: each team gets N rules, and adding a new one requires removing an old one.
🟡 Question / wants more detailThe three practical implications are well-structured. Consider numbering them more prominently or pulling them into a callout box -- these are the section's key takeaways.
To make these patterns concrete, here are selected results from IFScale at key constraint densities (accuracy %):
🟢 New learning / aha momentThe IFScale table with actual numbers is excellent -- this is the kind of concrete data that makes an O'Reilly book authoritative. Well-formatted with a descriptive context.
| Model | 10 | 50 | 100 | 250 | 500 |
|---|
| o3 (threshold) | 100 | 99.6 | 98.2 | 97.8 | 62.8 |
| Claude 3.7 Sonnet (linear) | 100 | 99.6 | 94.8 | 72.9 | 52.7 |
| GPT-4.1 (linear) | 98 | 98.8 | 95.4 | 74.0 | 48.9 |
| GPT-4o (exponential) | 94 | 82.8 | 49.0 | 22.2 | 15.4 |
| Llama-4-Scout (exponential) | 100 | 54.4 | 27.2 | 9.3 | 6.7 |
The error analysis reveals an important detail: at moderate constraint densities (150-200), later instructions fail at roughly twice the rate of earlier ones — a strong primacy bias. At extreme densities (300+), this bias diminishes as the model shifts from selective instruction dropping to near-universal abandonment. Reasoning models like o3 also behave differently in failure: they attempt morphological approximations of dropped instructions rather than simply omitting them, suggesting they "try harder" before failing.
🟢 New learning / aha moment"Morphological approximations" -- reasoning models try to approximate the instruction before giving up entirely. This suggests a different failure mode: degraded but still attempted compliance, vs. complete abandonment. The phenomenology of failure varies by architecture.
🟡 Question / wants more detailThis seems advanced but the key takeaway is: with too many rules, the model starts ignoring them -- especially the later ones. At extreme levels, it basically gives up on all of them. Reasoning models try harder but still fail eventually.
🟡 Question / wants more detail"2x failure rate for later instructions" at 150-200 constraints. Our prompt has ~50 rules. Are we already in the danger zone? I need to run IFScale-style tests on our specific prompt to find out.
🟡 Question / wants more detailThe detail about 'morphological approximations' by reasoning models is fascinating but feels like a tangent. Consider moving to a footnote or 'aside' box.
S8 Composition — How the Levers Stack
The four levers from S6 are not alternatives. In practice, the most robust systems compose them. The progression is instructive:
🟢 New learning / aha momentThe levers compose! Prompting + orchestration + SFT + RL. Each targets a different aspect. This gives me a roadmap: start with prompting, add verification, then consider fine-tuning if still not good enough.
🟢 New learning / aha momentThe levers aren't "pick one." You stack them! Each one adds improvement on top of the last. Like layers of defense in security -- no single layer is enough, but together they're strong.
🟢 New learning / aha momentCompositional improvement maps to quarterly engineering milestones: Q1 = prompting + model selection, Q2 = orchestration, Q3 = SFT, Q4 = RL. Each quarter adds a lever. I can plan resourcing around this.
A general-purpose model with careful prompting might achieve 70-80% adherence on your requirements. Adding retrieval-layer enforcement and second-pass verification pushes that to 85-90%. Supervised fine-tuning on a structured format that distinguishes parametric from non-parametric knowledge can move groundedness from that baseline into the low 80s. And adding RL with decomposed rewards — one for groundedness, one for instruction following — pushes further still. The final ingredient, inference-time chain-of-thought optimization, can yield additional gains.
🟢 New learning / aha momentA concrete progression: prompting gets you to 70-80%, orchestration to 85-90%, SFT to low 80s groundedness, RL pushes further. Each step adds 5-10%. Together that's the difference between "works in demo" and "works in production."
🟡 Question / wants more detailThe FACTS benchmark progression (Llama 3 from <70% to competitive with frontier models) is compelling but I want error bars. How much variance is there across different types of queries?
🟡 Question / wants more detail70-80% with prompting, 85-90% with orchestration. What's the investment required for each jump? I need cost-per-percentage-point to build a business case.
As a concrete example: on the FACTS benchmark for grounded generation (Jacovi et al., 2024), a pretrained Llama 3 baseline scores under 70% groundedness. SFT on a structured format that makes the parametric/non-parametric distinction explicit raises this to the low 80s — a gain of over 10 points from format alone. Adding RL with decomposed rewards pushes into the high 80s. Adding inference-time chain-of-thought pushes further still, reaching performance competitive with the strongest frontier models. Each step compounds because each targets a different aspect of the adherence problem — structural format, reward signal, and inference-time reasoning.
🟢 New learning / aha momentThe compounding effect is the key insight: each lever targets a different aspect, so gains are roughly additive rather than overlapping. This is unusual in ML -- most interventions show diminishing returns when combined.
🟢 New learning / aha momentFrom under 70% to competitive with frontier -- and you can do it incrementally. Start with what you can do now, add more as you grow. No need to build the whole stack at once.
🟢 New learning / aha momentThe FACTS benchmark progression is the most concrete evidence in the chapter. The numbers tell a compelling story: each lever adds measurable improvement.
The broader pattern: deflection as default behavior is the hallmark of a well-composed adherence system. A general-purpose model treats every question as an invitation to be helpful. A model trained for grounded generation treats the absence of supporting context as a reason to decline. This is not a capability limitation — it is a trained design choice. The model has learned that "I don't have enough information to answer that" is the correct response when the context does not contain the answer, even if its weights contain a plausible-sounding one.
🟢 New learning / aha moment"Deflection as default behavior" -- a well-trained system says "I don't know" when it doesn't have the info, EVEN IF it could make up a plausible answer. That's a design choice, not a limitation. Counterintuitive but smart.
🟢 New learning / aha moment'Deflection as default behavior' is a memorable phrase and an important concept. Consider making this a key callout or section header.
🟢 New learning / aha momentDeflection as default -- this is a product design decision, not just an ML decision. I need to get PM alignment on this: "Our system will refuse to answer rather than guess. Here's why that's better for users."
🟡 Question / wants more detailDeflection as default connects to calibration in selective prediction. Is there work on optimal abstention thresholds that balance coverage (how often the model answers) with accuracy (how often it's right when it does)?
Inline attribution is the other compositional design choice worth highlighting. When citations are embedded directly in the response as it is generated — each claim linked to the source document that supports it — grounding becomes auditable. You do not need to trust that the model stayed within the context. The system surfaces exactly where each claim came from.
🟢 New learning / aha momentInline citations in the model's output! Like a Wikipedia article where every claim has a [source] link. That way you can CHECK whether each claim is actually supported. Makes the model's work auditable.
🟢 New learning / aha momentInline attribution makes grounding auditable. Instead of trusting the model, I can verify each claim. This is the pattern I need for our compliance-sensitive applications.
🟢 New learning / aha momentInline attribution = automated auditability. I can build a post-processing step that extracts citations and verifies each one. If a citation doesn't match, flag it automatically. This is infrastructure I can justify to leadership.
The stakes for getting composition right are real. In 2024, Air Canada's customer support chatbot told a customer they were eligible for a bereavement discount — a promise the company's current policy did not support. The chatbot had access to the correct policy document. It hallucinated anyway, reaching into its training priors instead of staying grounded. The company was held liable. More systematic evidence comes from a Stanford study (Magesh et al., 2025) finding that RAG-based legal tools hallucinate 17-33% of the time despite vendor claims of high accuracy. These are not individual model failures. They are failures of systems that lacked the compositional adherence infrastructure this chapter describes.
🔴 Concern / disagreementAn airline chatbot promised a discount the policy didn't support, and the company had to honor it? That's a real legal consequence of hallucination. This isn't just an academic problem -- it costs real money and has legal implications.
🔴 Concern / disagreementThe Air Canada example is vivid but I want to know what specifically failed -- was it a grounding failure, an instruction following failure, or both? The case would be more pedagogically valuable with a precise diagnosis.
🔴 Concern / disagreement17-33% hallucination rate in legal tools. These are sobering numbers. My own system probably has similar issues and I haven't measured rigorously. This chapter is making me nervous (in a productive way).
🔴 Concern / disagreementAir Canada was held liable for a chatbot hallucination. This is a board-level risk. I need to present this case study to our legal team and build adherence monitoring into our risk management framework. This isn't optional anymore.
🔴 Concern / disagreementThe Air Canada example is compelling but needs a source citation. Also note this as a landmark case that established precedent.
S9 Open Problems
The prompt adherence problem expands as the systems we build grow more ambitious. Three directions are worth watching, each connected back to the taxonomy.
🟡 Question / wants more detailS9 (Open Problems) is well-scoped at three topics but each could use a sentence on expected timeline. When might we see these solved? 2 years? 5 years?
🟢 New learning / aha momentOpen problems = unsolved challenges. These are the frontiers of the field. Good to know what's still being figured out, even as a student.
🟢 New learning / aha momentThree open problems, each connected to the taxonomy. This section is a research agenda in miniature -- exactly the kind of future work discussion that's useful for identifying thesis topics.
🟡 Question / wants more detailThese open problems are my 12-18 month roadmap. Corpus-scale groundedness is relevant now (we're expanding context windows). Structured state for agents is next quarter's priority. Deterministic enforcement is a long-term goal.
Corpus-Scale Groundedness
As context windows grow — and as systems begin attending to entire corpora rather than retrieved snippets — the definition of groundedness expands with them. What manifests as hallucination in a RAG application becomes factual consistency across a corpus. Memory and personalization systems surface this challenge clearly: if a model has access to a long history of interactions, staying grounded in what the user has actually said — and not confabulating details from across that history — is groundedness at a new scale. Larger context means a larger surface for precision failures.
🟡 Question / wants more detailSo as context windows get bigger (100K+ tokens), the problem gets harder, not easier? More context = more things to potentially hallucinate about? That's counterintuitive -- I thought more context would help.
🟡 Question / wants more detailCorpus-scale groundedness is relevant for our long-context application. We feed entire document collections into the context. How do we scale the claim-level verification pipeline to 100K+ token contexts?
🔴 Concern / disagreement"Larger context = larger failure surface" -- this is a cautionary finding for our team's push to use longer context windows. We need to scale our verification pipeline proportionally, or longer context makes us LESS reliable.
🟡 Question / wants more detailCorpus-scale groundedness raises interesting formal questions. Is there a sublinear algorithm for verifying claims against a large corpus? Or does verification cost necessarily scale linearly with context size?
Deterministic Enforcement
Some constraints should not be probabilistic. A legal document generation system that follows the formatting rules 98% of the time still produces errors 2% of the time — and for some applications, that is unacceptable. Architectures that combine probabilistic model behavior with deterministic functions — where the model handles flexible reasoning and deterministic components enforce specific rules — represent a promising direction for constraints that must be satisfied with certainty, not with high probability.
🟢 New learning / aha momentSome rules need to be followed 100% of the time, not 98%. For legal documents, even 2% error rate is too high. The solution: use the model for reasoning but use regular code for enforcing strict rules. Hybrid approach.
🟢 New learning / aha momentHybrid architectures with deterministic enforcement -- this is the pattern for our compliance-critical features. Use the model for flexible reasoning, use code for hard constraints. Structured output + validation is a step in this direction.
🟡 Question / wants more detailDeterministic enforcement connects to constrained decoding (e.g., LMQL, Outlines). Is there a formal framework for composing probabilistic model output with deterministic constraints while preserving output quality?
🔴 Concern / disagreementConstrained decoding tools exist (Outlines, jsonformer) but they're mostly for FORMAT constraints. What about SEMANTIC constraints like "never mention competitor products"? Those can't be enforced deterministically... can they?
Structured State for Agents
As agentic systems grow more sophisticated, adherence becomes a multi-step problem. An agent executing a ten-step task must maintain adherence to its instructions across all ten steps — and the context at step seven may look nothing like the context at step one. Explicit, structured state — data structures the agent reads from and writes to, rather than relying on the attention window to track the plan — is emerging as adherence infrastructure for long-horizon tasks. The model's context is no longer just the information needed to answer a question; it is a workspace where the state of a complex task lives. Making that state explicit reduces the degree to which the model has to rely on its own unreliable memory of what it was supposed to do.
🟡 Question / wants more detailAgents that do multi-step tasks need to remember their instructions across all steps. Instead of trusting the model's "memory" (which is just the attention window), you give it an explicit data structure to track state. Like a to-do list for the AI.
🟢 New learning / aha momentStructured state for agents -- this is exactly what I need for my multi-step agent. The model keeps forgetting its instructions by step 5. An explicit state object that the model reads at each step could fix this.
🟢 New learning / aha momentStructured state is the key architectural pattern for our agent platform. Instead of relying on the context window to carry instructions, we externalize state into a structured format that the agent reads at each step. This is our Q2 project.
🟢 New learning / aha momentStructured state for agents connects to the planning and acting literature in AI. The model's context becomes a blackboard architecture where state is externalized and explicitly managed. This is classical AI meeting LLMs.
S10 Summary
Prompt adherence is the degree to which a model's output serves everything the context demands. It decomposes into two independently-failing dimensions:
🟢 New learning / aha momentGood summary. The whole chapter boils down to: two dimensions (instruction following + groundedness), measure them separately, fix them with the right lever, and stack the levers. Simple framework, deep implications.
🔴 Concern / disagreementThe summary is adequate but doesn't add new value beyond restating. Consider adding: (1) a 'where to start Monday morning' action list, (2) which sections to revisit for specific problems.
- Instruction following — recall over the requirements in your context. Did it do what you asked? Failures are dropped requirements: formatting rules ignored, constraints violated, scope boundaries crossed.
- Groundedness — precision over the knowledge in your context. Did it stay within what it was given? Failures are unsupported claims: fabricated details, misattributed facts, training knowledge leaking into responses that should be grounded entirely in the provided documents.
🟢 New learning / aha momentRecall (instruction following) and precision (groundedness). False negatives (dropped rules) and false positives (hallucinated claims). The whole chapter's framework in two bullet points. Perfect study summary.
🟢 New learning / aha momentThis two-bullet summary is what I'll put on the first slide of my team's architecture review. Clear, concise, actionable. Every engineer on the team should internalize this distinction.
These dimensions fail for a structural reason: language models are trained to be generally helpful, comprehensive, and confident. This is in direct tension with systems that need narrow, constrained, uncertain-when-appropriate behavior. The tension does not resolve with scale.
🟢 New learning / aha moment"The tension does not resolve with scale" -- this is the most important sentence for the research community. It means this is a permanent challenge, not a temporary one. The engineering response matters as much as the ML response.
🟢 New learning / aha moment"Does not resolve with scale" -- so I can't just wait for GPT-5. I need to build the system infrastructure NOW. That's the key mindset shift from this chapter.
The response is layered:
🟢 New learning / aha momentThe final framing -- 'a system whose failure modes are known, measurable, and bounded' -- is the right engineering mindset. Not perfection but observability. This connects to the broader SRE philosophy.
🟢 New learning / aha momentMeasure, Improve, Compose -- three verbs that structure my entire roadmap. Phase 1: build measurement. Phase 2: apply levers. Phase 3: stack them. Clear and actionable.
- Measure each dimension separately — claim-level verification for groundedness, natural language unit tests for instruction following.
- Improve using the lever matched to your failure — model selection, prompting, inference-time orchestration, or training with decomposed reward signals.
- Compose the levers — the most robust systems enforce adherence at every layer of the pipeline, from retrieval to generation to verification.
🟢 New learning / aha momentThree steps: (1) Measure each dimension separately, (2) Apply the right fix for the right problem, (3) Stack multiple fixes for maximum improvement. That's the whole methodology in three steps. Elegant.
🟢 New learning / aha momentThis is my action plan for Monday morning: (1) add decomposed metrics to my eval pipeline, (2) diagnose which dimension is failing most, (3) apply the right lever, (4) iterate.
The goal is not a model that never fails. The goal is a system whose failure modes are known, measurable, and bounded — and a mental model that lets you recognize and address them as they evolve.
🟢 New learning / aha momentPerfection isn't the goal. OBSERVABILITY is the goal. Know how it fails, measure how often, and keep the failures within bounds. That's a mature engineering mindset. Great closing thought.
🟢 New learning / aha momentThe epistemological humility here is important. Not "make the model perfect" but "make the failures visible and manageable." This is the right framing for a field where perfect adherence may be provably impossible.
🟢 New learning / aha moment"Known, measurable, and bounded" -- this is the SLA language I can bring to my leadership team. Not "zero hallucinations" but "hallucination rate below X%, measured daily, with alerts for violations." That's enterprise-ready.
🟢 New learning / aha momentPerfect closing sentence. "Known, measurable, and bounded" is the chapter's final gift to the reader. It reframes success from perfection to engineering maturity. End here. Don't add anything after this.