Skip to main content
Technical Enough
Next: Give the model tools

Give the model the facts it wasn't trained on

Chapter 6 of 10 in Add AI Features · 19 min

Eleven minutes into a demo call, the owner of a gym chain with nine locations asks the new help assistant in your app the question you hoped she would: "What happens when we outgrow the Starter plan?" The assistant answers instantly: Starter is $29 a month, and upgrading takes one click. But you retired Starter in March, and the current plan is Essentials at $39. The wrong price is now on a shared screen, and the buyer is multiplying the difference across nine locations. Nothing malfunctioned. Your old pricing page was public for three years, long enough to be included in the model's training snapshot, the large collection of mostly public text the model was trained on, gathered up to a fixed date. Your March change came after that date, and your prompt carried no price list that said otherwise. Given a question about money and no current facts, the model produced the most plausible answer its training data supported, and that answer was your old pricing.

A model answers from two sources, and you control one

A model is trained once on an enormous snapshot of mostly public text and then frozen. The provider's page for each model gives the date its snapshot stops, called the cutoff date, and nothing after that date gets in. At run time, while people use your site, the model produces its reply from that snapshot plus whatever your call sends: the prompt, also called the context, which Data, where information lives described as the bundle your backend puts together fresh for each request. There is no third source. The demo failed on both at once: the snapshot held your three-year-old pricing page, and the prompt held nothing newer.

Our FuelTheFam fridge feature depends on the second source. When a user takes a photo of their fridge, the call that produces their shopping list carries the fact that matters most: the photo, taken seconds ago. Training data supplies what spinach and a dozen eggs look like; the photo supplies which of them are in this fridge. We add one line to the prompt, "return only items visible in the photo", because training data is also full of fridges holding milk and ketchup, and without that line the model produces a list padded with plausible items the picture does not show.

At run time a model produces its reply from exactly two sources, the frozen training snapshot and whatever the prompt carries, so every fact your feature needs that the snapshot lacks has to be in the prompt.

You might object that the model was already trained on the whole internet, your pricing page included. It was, but that does not help. The snapshot stopped months before your call, so March's pricing, June's policy change, and yesterday's outage are not in it. And facts that were never public are not in it either: no snapshot of the internet contains this customer's order number, that account's renewal date, or a fridge photographed a minute ago.

Put the facts in the prompt: stuffing

The fix for the demo takes ten lines. Write the current facts down and send them with every call, ahead of the question. Pasting facts into every prompt like this is called stuffing:

You are the billing assistant for our app. Answer only from
the FACTS block. If the facts do not cover the question, say so
and point the customer to support.

FACTS (last updated 2026-06-30):
- Current plans: Essentials at $39/month, Team at $99/month.
- The Starter plan ($29/month) was retired in March 2026.
- Existing Starter subscribers keep $29/month until January 2027.

Customer question: {question}

Now the same demo question gets two different answers. Without the block: "Starter is $29 a month, and upgrading takes one click." With it: "Starter was retired in March 2026; new signups begin on Essentials at $39/month, and Team at $99/month sits above it." The same model produced both replies; only the second call carried the facts.

The two sentences after the first one, "Answer only from the FACTS block" and "If the facts do not cover the question, say so and point the customer to support," are the grounding rule. It tells the model which source to use when your facts and the snapshot disagree, and it gives the model an allowed answer when the facts do not cover the question, the same way the fridge feature asks for a retake instead of guessing at an unreadable photo. An answer built only from facts you supplied is called grounded in those facts. The dated header ("last updated 2026-06-30") lets you catch out-of-date facts before a customer does.

The threshold for stuffing: stuffing is enough when the facts fit on a few pages and change rarely. Sending the block costs well under a cent per call at mid-tier rates (the price of a provider's middle model), you add nothing new that can break, and an update is a text edit. Most first features never need more than this.

When the facts fill a whole manual, fetch only the few that match

You pass that threshold as soon as the collection of facts gets large. Once the help center behind the assistant holds two hundred articles, roughly four hundred pages, sending all of it with every call means paying for tokens on the whole pile and burying the two lines that answer the question. So you store the articles outside the prompt and, for each question, fetch only the few that match, as snippets (short passages taken from the matching articles). Here is that step, done once by hand.

The question: "Can I change my sign-in email without losing my order history?"

The three snippets the search returns:

  • From Change your sign-in email: the setting lives under Settings > Account > Email, and a confirmation link goes to both addresses.
  • From What stays with your account: orders, receipts, and saved addresses attach to the account, not to its email.
  • From Confirmation emails that never arrive: links expire after 24 hours; resend from the same screen.

The answer, grounded in them: "Yes. Update it under Settings > Account > Email and confirm from both addresses. Your order history stays, because orders attach to your account, not your email. If the link does not arrive, check spam and resend; links expire after 24 hours."

What matters is that every sentence of the answer comes from one of the snippets. Engineers call this pattern retrieval-augmented generation, RAG for short. The name sounds like far more machinery than the step you just walked through: store the documents, find the few that match the question, put them in the prompt, and have the model answer from them.

The engineering that makes "find the few that match" accurate across a large collection (search by meaning, splitting documents into pieces, ranking the results) is covered in The Frontier. Why hallucinations are context failures, not model failures shows that most wrong answers in production, including the confident wrong answers people call hallucinations, happen because the app did not fetch the right facts, not because of the model, and Retrieval: let the product look things up before it answers builds the machinery. Your decision here is simpler: retrieve when the facts are too large to send every time, change too often to paste, or differ for each user.

When the fact is live, give the model a tool

Some facts are true only at the moment someone asks, such as an order's status, an account balance, or whether the 6 a.m. class still has spots. These are live facts, and for them you use a third way to get facts to the model, after stuffing and retrieval: you give the model a tool, a function (a named piece of your code that does one job) or a connector (a ready-made link that gives an AI assistant another app's tools) that the model can request partway through an answer, and your systems return the fact as it is right then. Tools, and the Model Context Protocol standard behind today's menus of connectors, are the subject of the whole next chapter, Give the model tools to fetch and act.

Match the method to your facts: stuff (paste in) what fits on a few pages and rarely changes, retrieve from collections too large to send, and give the model a tool when the fact is live.

The drawing shows retrieval in its short version. The question ("What's our refund window?") goes into the prompt together with the two matching documents from a stack of your docs, and the model answers "30 days", grounded in your docs. Below that, three cards sum up the decision: STUFF, RETRIEVE, and TOOL, with the tool card marked as the next chapter.

Stuffing, retrieval, and tools also follow the customization ladder from Write the prompt as a spec, not a sentence: change the instructions first, then add facts (stuffed or retrieved), then tools, and train a custom model only for the rare feature that none of those cheaper rungs can handle.

Try it now

The drill takes fifteen minutes; the first path costs nothing and the second fractions of a cent. You bring the schema that set the structure of your feature's output in Get output you can build on. You leave with your feature's facts added: a facts block stuffed into your prompt, plus a written decision on whether the feature will ever need retrieval.

No setup: Use our billing prompt as the template and draft your feature's FACTS block on paper: every fact your feature's answers depend on that a frozen snapshot of the public web would not hold, such as prices, policies, and anything recent or specific to one user. For the running club's support assistant, the block reads:

FACTS (last updated 2026-11-21):
- Membership: 40 dollars a year, paid on the Join page. It renews
  every year until the member cancels from their account page.
- Shop: club T-shirt, 25 dollars, sizes S to XL. Cap, 18 dollars,
  one size. Members collect shop orders at the weekly run.
- This week's run: (the site's code fills in the day, the time,
  and the meeting point from the database for each question)
- Anything else, including refunds: write to [email protected].
  A person replies within 48 hours.

Then apply the threshold: does the block fit on a few pages, change rarely, and stay the same for every user? If all three answers are yes, stuffing is enough for this feature, so write "no retrieval, because" and finish the sentence. If any answer is no, name the collection the feature would fetch from. Either way, the sentence you write is your retrieval decision. The club's reads: "No retrieval, because the facts fit on one page and are the same for every member. The run details change every week, so the site's code fills in that line from the database. A member's own shop order is different for every member, so it needs a tool."

With your tools: Open Claude Code, give it the block, and ask it to add the facts, the grounding rule, and the dated header to your feature's prompt, above the schema instruction from the last drill. Then rerun two real inputs and check that the answers now quote your facts. Same move in Codex or Cursor: paste the block above the schema, add the grounding rule, rerun. If your tools are not set up yet, the Setup Clinic gets you there in one sitting.

Keep both artifacts; in the next drill you add a tool to this same prompt.

Chapter Summary

  • At run time a model produces its reply from exactly two sources, the frozen training snapshot and whatever the prompt carries, and there is no third source.
  • When a question needs a fact that is in neither place, the model still answers, in the same confident tone, with the most plausible answer its training data supports.
  • The snapshot falls short in two ways: it stopped months before your call, and the facts your users need from your site (orders, balances, this afternoon's fridge photo) were never on the public web at all.
  • When the facts fit on a few pages and change rarely, stuff them into the prompt with a grounding rule and a dated header; most first features need nothing more.
  • When the collection is too large to send every time, retrieve: store the documents, fetch the few that match the question, and have the model answer from those; that whole pattern is what RAG means.
  • Sending more facts does not make answers better: you pay for every extra token you send, and the one line that answers gets lost in the pile.
  • Facts that are true only at the moment someone asks need a tool the model can call to fetch them as they are right then.
  • You leave this chapter with your feature's facts stuffed into its prompt and a written decision on retrieval.
  • Next, Give the model tools to fetch and act covers the step beyond fetching facts: letting the model request actions that your code carries out.

Sources

  • Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. NeurIPS.
  • OpenAI, Anthropic, and Google documentation on knowledge cutoffs and on providing context to models (last verified July 2026).
  • Model Context Protocol specification and provider connector documentation (last verified July 2026).