Three sources of fabricated commitments (the model invents it, retrieval supplies it, your own content is stale) feeding four checkpoints in code: question, context, answer and transport

AI Hallucination Guardrails: When a Prompt Rule Is Not Enough

TL;DR: A commitment hallucination is when an AI assistant states a price, discount, policy or promise the business never authorized. Prompt rules lower the rate but cannot reach zero, so we block these claims with deterministic checks in code at four points: the question, the retrieved context, the finished answer and the stream that delivers it.

Our pet-care assistant told an owner that a product was free and gave them a discount code to prove it. Checkout charged for the product, and the code was never ours. Neither statement was a reasoning error the model could have caught; both were commitments it had no authority to make. A prompt rule against exactly this was already in place and did not hold. What fixed it was a set of deterministic checks running outside the model, at four points a question passes through.

This post, part of our LLM engineering series, covers why commitment hallucinations are a different class of failure, the three places a fabricated commitment actually comes from, the checkpoint pattern we now use for all of them, and how we decide which claims are worth checking at all.

The short version

  • A hallucination that creates an obligation, a code, a price, a policy, is not an accuracy problem. It is a liability problem, and accuracy techniques do not fix it.
  • Fabricated commitments come from three sources, and only one is the model inventing something. The others are retrieval and your own stale content.
  • We run deterministic checks at four points: the question, the retrieved context, the finished answer, and the transport that delivers it.
  • We do not check everything. A claim earns a deterministic check when a wrong answer creates an obligation or a safety risk, not when it is merely embarrassing.

What is a commitment hallucination, and why is it its own class?

Most work on hallucination treats it as an accuracy problem: the model stated something false, so ground it better, retrieve better, cite sources. That framing is right for a question about a breed’s typical weight and wrong for a question about what something costs.

When an assistant states a price, a discount, a delivery date or a policy, it is not reporting a fact that can be checked later. It is making a representation on behalf of the company, in writing, to a customer who will act on it. In Moffatt v. Air Canada (2024), a tribunal held the airline liable for what its chatbot said about a discount. The practical consequence is that the acceptable failure rate is not low. It is zero, and no amount of grounding gets you to zero.

That is why this class belongs in code. The same reasoning led us to compute a dog’s daily food portion in code rather than trusting the model’s arithmetic: when a number will be acted on, a probabilistic system should explain it, not decide it.

Where does a fabricated commitment actually come from?

Three sources of a fabricated commitment: the model generates it, retrieval supplies it, or your own content is stale, with the control that works for each: check the answer, drop the passage before the prompt, or fix the page and check the answer

Calling all three of these “hallucination” is what makes them hard to fix, because each needs a different control.

  • The model generates it. The classic case. The answer is fluent, plausible and unsupported by anything in the context. This is the only one a better prompt has any real chance against, and even here the chance is partial.
  • Retrieval supplies it. A passage carries a figure, a code or a policy belonging to someone else, and the model treats it as authoritative because it arrived as context. The model is doing exactly what it was told to do. This is what happened to us: a third-party document, pulled in as a weak match because retrieval applied no minimum relevance score, carried a code the model presented as ours. We have written before about why retrieving more documents does not always help; this was that failure arriving as a financial claim.
  • Your own content is stale. The least glamorous and the most common. A published FAQ claimed a product was free, written when it was, and the model repeated it faithfully. Nothing hallucinated at all, and the customer was still told something untrue.

A control aimed at the first source does nothing about the second or third. This is the most useful thing we learned: before building a guardrail, work out which of the three you are actually defending against.

Why do prompt rules fail against all three?

We told the model never to state a discount code, and we kept that rule because it does lower the rate. It did not stop the leak, for a structural reason.

The model is also instructed to answer from its retrieved context. When a code sits in that context looking authoritative, the two instructions compete and the outcome is a probability, not a guarantee. Against stale owned content the prompt rule is not even in the fight: the model has no way to know the FAQ is out of date.

We also evaluated a managed filter. Amazon Bedrock Guardrails can block or mask text matching a custom pattern, and it did not fit.

Prompt ruleManaged guardrailChecks in our own code
Catches a fabricated commitmentSometimesYesYes
Catches one that retrieval suppliedNoYes, at the outputYes, before the model sees it
Allows claims we have approvedYesNo allowlistYes, from a setting
Holds across model providersYesProvider-specificYes
Handles streamed textYesBlocks after emissionHands back to the buffered path

Our answers can be served by more than one provider, so a control bound to one leaves a gap the day traffic shifts. And we do want to state some commitments: an offer that operations has approved should pass. Both requirements pointed to a check we own, written as a pure function with no I/O.

Four checkpoints for AI hallucination guardrails

The pattern follows the split described in the anatomy of an LLM guardrail, extended with a checkpoint most designs miss.

Four guardrail checkpoints: answer a commitment question with a fixed reply, drop any retrieved passage carrying a commitment, replace a bad answer whole, and open no stream for commitment questions, with the rule that a commercial check never runs on a safety answer
  1. The question. If a question can only be answered with a commitment, answer it with a fixed, honest reply and never call the model. It costs nothing and it cannot be argued out of its answer. In our case, a question asking for a discount code gets a fixed reply pointing to support.
  2. The retrieved context. Before passages are joined into the prompt, drop any that carry a commitment. This is the one that addresses the second source, and it is the strongest control available, because it removes the cause rather than the symptom. The model cannot repeat what it never saw.
  3. The finished answer. Scan the answer before it is stored or shown. If it states a commitment that is not on an approved list and was not supplied by the customer, replace the whole answer rather than editing the claim out. An answer with the code removed still reads like an offer, with the sentence explaining the terms still in it.
  4. The transport. A streamed token cannot be withdrawn once the customer has seen it, so the streaming path runs the question checkpoint first and opens no stream for a commitment question. Our client already falls back to the buffered endpoint, so this shipped without an app release. A guardrail that only works on buffered responses is not a guardrail, and this is the checkpoint most teams discover last.

The hard part is precision, not detection

Detecting something that looks like a code or a price is easy. Doing it without breaking the assistant is not.

Pet-health text is full of commitment-shaped tokens: vaccine abbreviations, strain names, dose strengths, microchip numbers, product identifiers with digits in them. A detector aggressive enough to catch every fabricated code also fires on the vocabulary the assistant exists to handle, and an assistant that answers a vaccine question with “I cannot share discount codes” is broken in a way that matters more than the leak. Over-refusing guardrails were also the most common failure we found when building LLM evals from production chat.

Two decisions resolved it. The detector treats a token as a candidate only when the surrounding answer gives it reason to, so health vocabulary in a health answer never qualifies. And anything the customer typed is exempt, because repeating their own words back is not a fabrication. The matching rules themselves stay out of this post, because a guardrail that publishes its own patterns and exemptions has published its bypass.

The third decision outranks both: the check has its own flag and never runs on an emergency answer. An owner asking about poisoning must never receive a commercial refusal. A guardrail that can suppress a safety answer has traded a financial risk for a worse one, and that ordering has to be explicit in the code rather than assumed.

Our first version was also too narrow, and we found that only by attacking it. We planted deliberately bad answers and the detector missed most of them, because it assumed a commitment takes one shape. It takes whatever shape the writer chose. Every finding from an independent review, mostly false positives on legitimate health questions, became a unit test in both directions: the text that must trigger, and the near-miss that must not. A test that only proves a detector fires passes happily on a detector that fires on everything. That pairing is the same habit as our golden journeys.

Which AI claims earn a deterministic check?

You cannot write a deterministic check for every sentence an assistant produces, and trying to is how teams end up with an assistant that refuses everything. The question is which claims earn one, and the answer is not “the ones most likely to be wrong”.

Two columns: claims where being wrong creates an obligation or safety risk, such as prices, discounts, policies and dosages, are checked in code; claims where being wrong only costs credibility, such as breed generalizations and training tips, are grounded, cited and hedged
  • Checked in code, or not stated at all: claims where being wrong creates an obligation or a safety risk, such as prices, discounts, entitlements, delivery commitments, policy statements, dosages and medical thresholds.
  • Grounded, cited and hedged: claims that are merely likely to be wrong, such as a breed generalization or a training suggestion. That is what grounding and citations are good for.

The two groups rank differently by frequency and by cost. Commitment claims are rare and expensive; accuracy claims are constant and cheap. Teams that sort by frequency spend their guardrail budget in the wrong place. We apply the same split to structured output, as covered in the validation layer LLMs still need.

The honest limit on our own work: the offending document is still in the knowledge index, and retrieval still has no relevance floor. The checks make the leak impossible to show, not impossible to retrieve. We described the direction in retrieval allow-lists for secure RAG; cleaning the corpus is the work that actually fixes the cause.

What this means for EverBowl

The same assistant explains what EverBowl™ learns from a dog’s meals in the Hoomanely app, and the rule carries over. EverBowl recognizes what a dog actually ate; the assistant puts that into words and must never claim more than the record supports.

The honest limit is the same as everywhere else here. A check in code covers what we thought to check, so we keep adding cases as real conversations surface them. EverBowl does not diagnose; the value is the record.

Conclusion

Separate the hallucinations that cost money from the ones that cost credibility, and stop treating them with the same tools. Work out which of the three sources you are defending against before you build anything. Put deterministic checks at the question, the context, the answer and the transport, replace a bad answer whole rather than editing it, and never let a commercial check override a safety answer. Then attack your own detector, because the one you have not attacked is the one you have not tested.

FAQs

What is a commitment hallucination?

An answer that states a price, discount, entitlement, policy or delivery promise the business never authorized. It differs from an accuracy error because a customer can act on it and may hold the company to it, so the acceptable rate is zero rather than low.

Can better prompting or RAG stop hallucinated commitments?

Both lower the rate and neither reaches zero. A prompt rule competes with the instruction to answer from retrieved context, and retrieval itself can supply the false commitment. Deterministic checks outside the model are what make the outcome a guarantee.

Why replace the whole answer instead of removing the false claim?

Removing the claim leaves text that still reads like an offer, including sentences explaining terms that no longer have a subject. A fixed reply gives the customer an honest next step instead.

Do AI hallucination guardrails work for streamed answers?

Only if you plan for it. A streamed token cannot be withdrawn once shown, so the check has to run before the stream opens. Our streaming path runs the question checkpoint first and hands commitment questions back to the buffered endpoint.

How do you avoid blocking legitimate domain vocabulary?

The detector only treats a token as a candidate when the surrounding answer gives it reason to, and anything the customer typed is exempt. Every false positive found in review became a unit test paired with a near-miss that must not fire.

References