# How Do You Detect Drift?

> What drift is, how it shows up in a live AI app, and the nightly checks that catch it, explained simply for your AI interview.

**In short:** Drift is when an AI app gets worse after launch because the data, the world or the model has changed. You catch it by comparing live traffic and a fixed test set with a baseline from launch week, and alerting when the gap passes a threshold you chose.

AI and LLM interview question Q261, Evaluation and observability. Intermediate, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-do-you-detect-drift

## Say it in 30 seconds

Drift is when an AI app gets worse after launch, even though its code did not change. The data, the world or the model moves. I detect it by saving a baseline at launch, then checking every night: I compare live questions and a fixed test set with that baseline. When a number moves past a threshold I set, someone checks what changed before anything is fixed.

## Say it in 2 minutes

Drift is the gap that grows between what an AI app was built for and what it now sees. A model can pass its tests at launch and get worse later, with no code change. The questions customers ask shift, the documents it reads get updated, or the model behind the name is changed by its provider.

So I start with a baseline. In launch week I record the mix of questions, the answer lengths and a score on a fixed test set. Every night I run that test set again, and I compare this week's live questions with the baseline using a distance score. When a number moves past the threshold I set, someone gets an alert.

The alert starts a check. I look at what changed: a new product that customers now ask about, a fee table that was updated while the bot's search store still held the old copy, or a model version the provider changed. Then I fix the prompt, the documents or the test set, re-run the checks, and save a new baseline.

I also treat evaluation, which means testing answers against known good ones, as a continuous process, as OpenAI puts it. Google's monitoring guide says that after an alert you re-evaluate or retrain the model. So the checks keep running after launch as well as before it. Teams that plan for this need a baseline, a test set that grows over time and an owner for every alert.

## What is drift, in plain words?

An AI app is built and tested on data from one moment. Drift is the gap that opens after that moment. The world, the data or the model changes, and the app gets worse, even though its code has not changed.

NIST, the US standards body, describes it as AI systems that no longer meet the assumptions and limitations of their original design.

Think of a call-centre agent at a mid-size bank who learned the fee sheet last year. She was right on the day she trained. Then the fees changed, and she still quotes the old ones. Nobody touched her, yet her answers drifted. A real AI case works the same way: a card-fee support bot learned the fee sheet in March, the fees changed later in the year, and the bot still quoted the old ones.

- **Drift:** The gap that grows between an AI app's launch behaviour and what it sees or should say now.
- **Baseline:** A saved record of the app at launch: the question mix, answer lengths and test scores.
- **Fixed test set:** Questions with known good answers, run again and again on the same schedule.
- **Threshold:** The size of change you accept before someone has to look.

## What kinds of drift are there?

- **Input: Customers ask new things.** The mix of questions shifts, such as a new product or a new kind of customer. Customers ask things like "Can I send an instant transfer to my landlord?", which the tests rarely covered.
- **Meaning: The right answer changes.** Prices, policies or rules change, so an answer that was right last month is wrong now. The model may be fine. The world moved.
- **Model: The model underneath changes.** A provider can update or retire a model. Anthropic says older models are retired regularly, and apps may need updates to keep working.

A close cousin is training-serving skew. Here the live inputs already differ from the data the model was trained on. Google's Model Monitoring v1 guide draws the line this way: skew compares production with training, and drift is the change over time.

> **Tip:** In an interview, name which one you mean. The input moved, the right answer moved, or the model moved. Each has a different fix.

## How do you catch it in practice?

I set up the checks before launch, then keep them running. Evaluation means testing the app's answers against known good ones. This is the setup I would use.

1. **Save a baseline:** In launch week, record the question mix, the answer lengths and the score on a fixed test set.
2. **Re-run the test set every night:** The same questions with known good answers. Each real failure becomes a new question for the set.
3. **Compare live questions with the baseline:** Measure how far the mix has moved, using one number that sums up the difference. Google's Model Monitoring v1 guide scores numerical features with Jensen-Shannon divergence, a score for how different two patterns of numbers are.
4. **Score a small sample of live answers:** A reviewer, or an automatic checker that scores answers against rules, reads a sample each week. That catches quality problems the test set misses.
5. **Alert past a threshold you set:** A threshold is a line you choose in advance. Crossing it sends someone to look at the cause.

> "This effect, often referred to as "drift", means AI systems no longer meet the assumptions and limitations of the original design." (NIST)
>
> "Set up continuous evaluation (CE) to run evals on every change, monitor your app to identify new cases of nondeterminism, and grow the eval set over time." (OpenAI)

*Diagram, How drift gets caught: Live questions and a fixed test set are compared with launch week every night. A moved mix or a lower score sends someone to check the cause, then to fix it. The numbers in the boxes are made up.*
1. Real questions from this week flow into the comparison.
2. The same fixed questions are scored again every night.
3. The question mix is compared with launch week and flagged.
4. The nightly score is compared with launch and flagged.
5. A moved mix goes to a person who checks the cause.
6. A fall in score goes to a person who checks the cause.

Here is a worked case. A mid-size bank runs a card-fee support bot. All numbers are made up for this example.

- **Launch, March:** Instant transfers are 2% of live questions. The bot scores 91% on 500 fixed questions.
- **Week 30, nightly checks:** Instant transfers are now 14% of live questions. The mix shift is 0.14, past the 0.10 line, so it alerts.
- **Same 500 questions, week 30:** The score is 84%. Thirty-five answers now quote an old fee, so that alert fires too.

The question mix moved, which is input drift. The score fell on questions that did not change, so something under the app changed as well. The fee sheet had been updated, but the search store the bot reads still held the old copy. The fix was to rebuild the search store, add 40 instant-transfer questions to the test set and re-run. The score went back to 90%.

```python
# A simplified drift check: compare this week's question mix with launch week.
LAUNCH = {"fees": 0.40, "cards": 0.35, "instant transfers": 0.02, "loans": 0.23}
THIS_WEEK = {"fees": 0.31, "cards": 0.30, "instant transfers": 0.14, "loans": 0.25}
ALERT_AT = 0.10  # a mix shift this big is worth a look

def mix_shift(old, new):
    # Half the total change across all topics: 0 means the same mix.
    topics = sorted(set(old) | set(new))
    return sum(abs(old.get(t, 0) - new.get(t, 0)) for t in topics) / 2

shift = mix_shift(LAUNCH, THIS_WEEK)
print("Mix shift: %.2f" % shift)
if shift > ALERT_AT:
    print("ALERT: the questions have moved since launch")
score_launch, score_now = 91, 84
print("Test score: %d to %d" % (score_launch, score_now))
if score_launch - score_now > 5:
    print("ALERT: the fixed test set fell more than 5 points")
```

Output:

```text
Mix shift: 0.14
ALERT: the questions have moved since launch
Test score: 91 to 84
ALERT: the fixed test set fell more than 5 points
```

The last step is the one people forget. When a policy changes, the test set's expected answers must change with it, or the test measures the wrong thing.

## What do you do when the alarm goes off?

An alert starts a check. The fix comes after. I work through the causes in this order, because the cheap checks come first.

- **Did the questions change?:** Compare the mix and look for new products, seasons or kinds of customer.
- **Did the model or provider change?:** Check the model version your app calls, and any notice from the provider.
- **Did a document, tool or prompt change?:** Check your release log and the search store the bot reads.
- **Is the test set still right?:** If the policy changed, update the expected answers before you trust the score.
- **Fix, re-run, then reset the baseline:** Only after the fix passes, save a new baseline, so the next alert compares with the right past.

Google's guide makes the same point at the end of its loop. After an alert, you re-evaluate or retrain the model so that it behaves as intended. NIST's playbook adds a question for the team: how much drift from baseline performance is acceptable? Someone on the team has to decide that number, because the model cannot choose it.

### How would you set up drift checks for a hospital note summariser?

A hospital team turns doctors' notes into short summaries for discharge letters. They have no baseline yet, so they start by sampling 200 real notes from last quarter and having two clinicians score the summaries. Those scores and questions become the fixed test set.

Clinical language moves. New drug names, new coding rules and a new note template each change the mix, so the team tracks the mix of note types every week. Any alert goes to a clinical lead as well as the engineers, because a drop on one safety check matters more than a small change in the average.

> **Tip:** Name the alert owner out loud in an interview. A drift alarm with no one assigned to read it is just a log.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] Drift means the app gets worse while its code stays the same.
- [ ] Input, meaning and model drift, named separately.
- [ ] A saved baseline, a fixed test set and a sample of live answers.
- [ ] Alerts with thresholds chosen in advance, and an owner for each.
- [ ] A plan for the cause: the questions, the documents or the model version.
- [ ] Checks that keep running after launch, because evaluation (testing answers against known good ones) is a continuous process.

**Common traps**

- Trap: "We will notice when users complain." Better: Complaints come late and mostly from unhappy users. Score a sample and track a fixed test set on a schedule.
- Trap: "Accuracy was 91% at launch, so we are fine." Better: A launch score is a snapshot. Compare live questions and scores against that baseline, over time.
- Trap: "Nothing changed in our code, so nothing changed." Better: The model or the world can change without a code change. Check the model version and the documents too.

## Can you spot the drift?

**Spot the drift:** Which log line from your fee bot points to drift, not to a release or a test result?

A. Nightly test run 412: 500 questions, mean score 91%.
B. Release 2026-11-02: system prompt v7 reworded the refund answer.
C. Last 7 days: instant transfers were 14% of questions, against 2% at launch.
D. Model kept on the version tested in March.

**Answer:** C. The question mix has moved away from launch. That is input drift, found by comparing live traffic with the baseline. The other lines are a test result, a planned change and a version pin.

**Quick check:** A bot that passed last month's tests now gives worse answers, and nobody changed the code. What do you check first?

A. Rewrite the system prompt to be clearer
B. Re-run the fixed test set, then check the model version and documents
C. Switch to a bigger model
D. Turn down the temperature (the randomness setting)

**Answer:** B. Re-running the fixed test set shows whether the score really fell. Then check what changed under the app: the model version or the documents it reads. Rewriting prompts or switching models first is guessing.

## Can you answer these from memory?

**Flash cards**

- **What is drift?** The gap that grows when the data, the world or the model changes after launch.
- **Input, meaning or model drift?** Questions shift, right answers change, or the model underneath changes.
- **What is a baseline?** A saved record of the app at launch: question mix, answer lengths and test score.
- **Why keep a fixed test set?** It shows whether the app got worse on the same questions, not on new ones.
- **What does an alert do?** It starts a check of the cause. The fix comes after.
- **Training-serving skew?** Live inputs differ from the data the model was trained on.

## Likely follow-up questions

- Q259 Which production metrics matter for a chatbot? https://designervenkat.online/interview/ai/production-metrics-for-a-chatbot
- Q262 "The model got worse after an upgrade." What do you do? https://designervenkat.online/interview/ai/the-model-got-worse-after-an-upgrade-what-do-you-do
- Q257 How do you regression-test prompts? https://designervenkat.online/interview/ai/how-to-regression-test-prompts
- Q265 How do you sample production traffic for evals? (full answer coming)
- Q260 What is tracing for LLM apps? https://designervenkat.online/interview/ai/what-is-tracing-for-llm-apps
- Q246 How do you know your AI system actually works? https://designervenkat.online/interview/ai/how-to-know-your-ai-system-works

## Learn it in depth

- [Seeing inside your AI app](https://designervenkat.online/learn/ai-engineering/llm-observability)
- [LLM Evaluations](https://designervenkat.online/learn/ai-engineering/llm-evaluations)
