Data for AI · 12 min
The Model Is Only One Suspect: How to Investigate a Wrong AI Answer
A step-by-step playbook for tracing a wrong AI answer back through the data, so you fix the real cause instead of guessing at the prompt or the model.
Amrutha Satishkumar
November 4, 2026
On this page
- Why a wrong AI answer should not start with the prompt
- Seven explanations fit the same ticket
- Freeze the evidence before anyone fixes anything
- Walk the answer backward, one hop at a time
- Confirm the cause by replaying it
- Map the result, then repair the right layer
- The goal is not to clear the model
- Sources
Why a wrong AI answer should not start with the prompt
When an AI assistant gives a wrong answer, the usual first response is to assume the model hallucinated, rewrite the prompt or try a larger model, and close the ticket once the next test looks correct. That response is understandable, but it skips the investigation. A wrong answer can originate in the model, in the data the model received, or in the system that assembled that data, and the answer text alone does not reveal which.
This article uses a fictional example throughout. An online clothing store has added an AI shopping assistant. A shopper asks for a rain jacket in size M under $70, and the assistant replies that the Trail Jacket is on sale for $59 in size M. At checkout, the same jacket in size M costs $89, and a support ticket is filed as TICKET-1042. Nothing errored or crashed; the system produced a confident and incorrect answer.
The principle behind the method is that a model failure cannot be distinguished from a data failure by reading the answer; it can only be distinguished by tracing the answer backward through the data.
What follows is the investigation playbook I would use on TICKET-1042. It is built on STRATA, my framework for the six responsibilities behind every reliable AI answer: Sourced, Traceable, Retrievable, Aligned, Timely, Audited. The store, the product, the prices and the ticket are a fictional example, but the steps work on any assistant that answers from your data.
Seven explanations fit the same ticket
Before you touch anything, write down every explanation that could produce exactly this answer. The STRATA page lists seven for this ticket:
- A: the model made up the $59.
- B: the price data was out of date.
- C: it pulled the price for a different size or color.
- D: “sale price” meant something else, like members only.
- E: it used a reseller listing or a review, not the price list.
- F: it reused an old answer from before the sale ended.
- G: there is not enough information yet to decide.
Only one of the seven attributes the error to the model; most of the others sit in the data and in the system around the model. Rewriting the prompt or swapping the model as a first step therefore amounts to choosing explanation A without testing the alternatives.
This does not mean the model is never at fault. Sometimes the problem really is in the prompt or the model, and the purpose of the investigation is to reach that conclusion on evidence rather than by habit.
Freeze the evidence before anyone fixes anything
Investigations are often lost because repairs begin before the evidence is captured. The price list is corrected, the cache is flushed or a new version is deployed, and the system can no longer reproduce or explain the original answer.
1. Capture the answer’s record
The starting point is the specific answer the customer saw. The goal is to capture everything needed to replay it, ideally keyed by a single response ID. If the system writes a trace per request, that trace should contain something like the following:
{
"response_id": "resp_7f3a",
"asked_at": "<timestamp of the question>",
"question": "Find me a rain jacket in size M under $70.",
"answer": "The Trail Jacket is on sale for $59 in size M. Want me to order it?",
"answer_origin": "generated | cache_hit",
"model": "<model name and version>",
"prompt_template_version": "<version>",
"retrieved": [
{
"chunk_id": "<id>",
"source": "<price list | promotions sheet | reseller feed | reviews>",
"source_record_version": "<version or load id>",
"rank": 1,
"included_in_context": true
}
],
"final_context_hash": "<hash of exactly what the model received>"
}
The field names are illustrative. What matters is that the record connects the answer to the context the model received, and the context to specific source versions.
An answer that cannot be replayed from its records cannot be investigated, only guessed at.
If this step shows that most of these fields do not exist, record that before going further. The gap is already a finding, and it belongs to explanation G.
2. Snapshot the sources as they were
Copy, or at least pin by version, the price records, promotion records and any cached answer involved, as they stood when the question was asked, and do so before anyone corrects the price list. A live product page that shows $89 today says nothing about what the assistant saw at the time.
Walk the answer backward, one hop at a time
The investigation runs in the opposite direction to the request. The request moved from sources to retrieval to context to the model to the answer; the investigation moves from the answer back to the sources, ruling explanations in or out at each step.

3. Was the answer generated, or reused?
The first check is whether the answer came from a cache of earlier responses. If it was reused from before the sale ended, the model may never have seen current data at all. That is explanation F, and it points at Timely and Traceable: the cache needs to know when its answers stop being valid, and the trace needs to record that this answer was a reuse.
Then check what the cache key contains. A key built from the question text alone can serve Monday’s answer on Wednesday, unless something expires or invalidates it when the price changes. The key, or its expiry, has to depend on the source version or the effective date of the evidence behind the answer.
If the answer was generated fresh, the investigation moves to the next step.
4. Was “$59” in what the model received?
In my view, this is the most useful test in the investigation, because it splits A from everything else.
The test uses the exact final context for this response, not the top search results and not the expected retriever output, and searches it for the claim.
import re
def claim_in_context(context: str, amount: str = "59") -> list[str]:
"""Return every line of the model's final context that mentions the amount."""
pattern = re.compile(rf"(?<![\d.,])\$?\s?{re.escape(amount)}(?:\.00)?(?!\d|[.,]\d)")
return [line for line in context.splitlines() if pattern.search(line)]
This search will over-match, for example on “59 reviews” or “size 59”. That is acceptable, because its purpose is to find candidate lines to read, not to deliver a verdict.
It can also under-match. If a price came from a tool or API call rather than from retrieval, that call’s result has to be in the trace too, or this test will wrongly say “not in context”. And a matching number is not the same as a supported claim: check “on sale” and “size M” as well as “$59”. It also misses the number written another way, such as “59.0” or “fifty-nine”.
There are two possible outcomes:
- “$59” is nowhere in the context: the model produced a number it was not given. That is explanation A, and it is now a model or prompt problem with evidence behind it. Fix the generation side: for example, require that prices are only stated when they appear in the evidence, and test that rule.
- “$59” is in the context: the model did what it was told with what it was given. The fault is upstream, in the data or the system. Keep going.
The second outcome has a practical consequence: a replacement model would most likely have read the same $59 and given the same answer.
5. Was it the right record?
Find the line in the context that carries the $59, and the record behind it. Check that it was the record for this product in size M. Variants are where “close enough” retrieval goes quietly wrong: a size S record, a different color, or the price of a similar jacket can all look like a strong match.
That is explanation C, and it is a Retrievable failure. Then check completeness. To answer this question correctly, the assistant needed three pieces of evidence: the price for size M, the promotion’s end date and its conditions. If only the price reached the model, the top search hit looked right and the evidence was still incomplete.
A useful habit here is to write down, for the question, the evidence a correct answer needs, then compare it with what arrived:
| Required evidence | Reached the model? |
|---|---|
| Price for Trail Jacket, size M | Yes |
| Promotion end date | No |
| Promotion conditions (who qualifies) | No |
In this example, the two missing items are more informative than any relevance score.
Then compare what was retrieved with what was actually included in the context. A record that ranked well but was cut for context length, or filtered out by permissions, can look like a retrieval success in the logs and still be a failure in the answer, unless the trace records what was actually included in the context.
6. Where did the $59 come from, and is that source the authority?
The next question is which source that record came from. In a store like this, a $59 could come from the price list, a promotions spreadsheet, a reseller listing or a customer review that mentions $59.
Only one of those is the authority for a price. That is the Sourced question: which source is allowed to state this fact, and who owns it? If the $59 came from a reseller feed or a review, the answer quoted context as if it were truth. That is explanation E.
The repair is not a better ranking function. When two sources disagree, ranking cannot settle it. An owner has to, and the retrieval layer needs a rule that only the authoritative source may state a price.
7. What did “sale price” mean?
A record can be the right product, the right size and from the authoritative source, and still be the wrong number for this shopper.
“Sale price” could mean the public price ($89), a members-only price ($59) or a clearance price ($49). If the $59 was the members-only price, the answer was correct for someone else. That is explanation D, and it is an Aligned failure: the data had a familiar name, and the business meaning behind it was never encoded where the system could use it.
A person reading a dashboard might notice that “sale price” needs a qualifier; an agent will generally proceed without one. The check is simple to describe and often missing in practice: for the term the answer relied on, find its written definition, its units, its scope (who it applies to) and its owner. If any of those is missing, you have found the gap.
8. Was it still true when the shopper asked?
The final data question concerns timing. Suppose the price list said $59 on Monday, the sale ended on Tuesday and the price returned to $89, and the shopper asked on Wednesday. The data had been correct, but it was no longer correct when it was used. That is explanation B, and it is the Timely responsibility: valid and current are different from loaded on schedule. A successful job run is not proof of freshness. If your price history carries effective intervals, you can ask the question directly:
-- Which prices were valid at the moment the shopper asked (one row per price type),
-- and when was each loaded into the copy the assistant reads?
SELECT sku, size, price_type, price, valid_from, valid_to, loaded_at
FROM price_history
WHERE sku = 'TRAIL-JACKET'
AND size = 'M'
AND valid_from <= :asked_at -- asked_at from the trace
AND (valid_to IS NULL OR valid_to > :asked_at);
:asked_at is a bind parameter; the placeholder syntax varies by database and driver.
Then compare the result with the record version the trace says was retrieved. If the valid price at the moment of the question was $89, and the retrieved record was the $59 one, you have your answer. If the table has no valid_from and valid_to at all, only the latest value, you cannot run this check, and that is a finding too.
Then ask the second half of the question: what did the serving copy hold at that moment? Take the most recent load for each price type with loaded_at <= :asked_at: that is what the copy held when the shopper asked. If the source changed on Tuesday and the copy the assistant reads only loaded on Thursday, the price list was right and the pipeline was late. That is still B, but it has a different owner.
9. If you still cannot tell, that is the finding
Sometimes you get to the end and none of the hops can be checked, because the context was not logged, the source versions were overwritten, or nobody knows whether the answer came from a cache. That is explanation G: there is not enough information yet to decide.
It is the least satisfying result, and often the most valuable one. It is an Audited failure: noticing, investigating and acting depend on evidence kept in advance, not on someone happening to read a bad answer. The question to take away: could we have found this before the customer did?
Confirm the cause by replaying it
The steps so far show where the evidence points. A replay tests whether that conclusion is correct.
Take the frozen request and run it again twice, with the same model version, prompt template and settings recorded in the trace: once with the exact context the model received, and once with a corrected context, for example the $89 record, or the same record plus the promotion’s end date.
- The answer flips only when the context is corrected: the cause is in the data or the system, and you have tested it rather than inferred it.
- The answer stays wrong with correct context: the model or the prompt is now a real suspect, with evidence behind it.
- The answer changes from run to run either way: generation is not deterministic at your settings. Run each version several times and compare the pattern, not a single output.
The replay is also your regression test. Keep the frozen request, the corrected context and the expected answer together, so the next change to the prompt, the model or the pipeline has to pass TICKET-1042 before it ships.
Map the result, then repair the right layer
At the end of the investigation, it should be possible to write one line per explanation: ruled out, confirmed, or unknown, with the evidence for each. That line is what decides the repair.
| What you found | Explanation | Repair to consider |
|---|---|---|
| ”$59” was not in the context | A | Grounding rules and tests on the generation side |
| The context price expired before the question | B | Effective intervals, freshness rules, keeping stale evidence out |
| The record was a different size or color | C | Variant-aware retrieval and labeled test questions |
| The $59 was a members-only price | D | A written, owned definition of each price type |
| The $59 came from a reseller or review | E | Only the authoritative source may state a price |
| The answer was reused from before the sale ended | F | Cache validity tied to the source’s effective dates |
| The hops could not be checked | G | Request traces, retained source versions, a named owner |
More than one row can be true at once. A cached answer (F) built on a members-only price (D) is a perfectly realistic combination.
The investigation follows the real path of the request and maps what it finds onto STRATA afterwards, because the responsibilities overlap rather than stack.
The goal is not to clear the model
It is tempting to treat an investigation as a trial with a single verdict, either the model or the data. That framing misses the purpose. The goal is to leave behind evidence: a trace you can replay, a definition someone owns, a freshness rule the system enforces, and a test case that fails if the bug returns. Those are what make the next wrong answer cheap to explain.
When the next ticket arrives, these questions provide the order of work:
- Can we replay this exact answer from its records?
- Was the answer generated fresh, or reused?
- Was the claim in what the model received?
- Was it the right record, with all the evidence the answer needed?
- Which source did it come from, and is that source the authority?
- Did the data mean what the answer assumed it meant?
- Was it valid at the moment of the question?
- Does a replay with corrected evidence fix the answer?
- Could we have found this before the customer did?
Tracing the answer comes before tuning the model, because only the trace shows which layer needs the repair.
To see where your own assistant stands on the six responsibilities, the self-check on the STRATA page takes one assistant and one task and gives you a scorecard. For the wider gap between a working prototype and a production system, read Why AI Solutions Work in Development but Fail in Production, and for the data side of that gap, Agent-Ready Data: Why Dashboard-Ready Data Is No Longer Enough.
Sources
The framework and the fictional example are from the STRATA page. The investigation steps, code and record layouts are illustrative patterns, not a specific product.
- STRATA: Six responsibilities behind every reliable AI answer (The Data Grill)
Amrutha Satishkumar
Data & AI Solution Engineer at Microsoft