ML System Design · Module 22 of 47 · 11 concepts · about 13 min

Retraining and Feedback Loops

Keeping a model current: measuring how fast it decays, when and on how much data to retrain, champion and challenger, and the feedback loops that appear when a model's own decisions shape the data it learns from next, with the ways to break them.

At work: What separates a model that is still useful in its second year from one that is quietly switched off. Feedback loops are behind some of the most persistent failures of recommenders and risk systems.

Why models decay

What it is

A model is a snapshot of the world when its training data was collected. It decays as the world moves:

  • customer tastes and habits change;
  • the business changes: new cities, products, prices, app screens;
  • the environment changes: seasons, events, competitors;
  • adversaries adapt to the model itself.

Measure the decay: train once, then score each following week, and plot error against weeks since training.

Why it matters

The decay curve tells you how often to retrain.

  • A slow curve: monthly retraining is fine.
  • A steep one: daily retraining, or fresher features, or both.
  • It also tells you how bad things get if retraining fails for a week.

In the real world: Kirana Kart's measurements show its ETA model loses accuracy within days (traffic and store patterns move), while its product-category classifier barely changes over six months.

Visual example

Computed

ETA error 4 minutes at release, growing about 3% a week. It crosses the 10% tolerance in week 4.

error = 4 × (1 + 0.03)^weeks; illustrative
weeks since trainingerror (min)worse than at release
040%
14.123%
24.246%
34.379%
44.513%
64.7819%
85.0727%

Retraining at least every few weeks keeps error inside tolerance; Kirana Kart retrains nightly because the run is cheap.

Choosing 'retrain weekly' by habit. Without the curve, it may be far too often (wasted effort) or far too rarely (weeks of avoidable error).

Choosing retraining triggers

What it is

Combine a schedule with triggers:

  • a schedule sized from the decay curve;
  • a performance trigger: retrain when measured accuracy (or a trusted proxy) falls past a limit;
  • a drift trigger: retrain when important inputs drift persistently;
  • an event trigger: retrain after a known change (a new city launch, a price overhaul, a new app screen).

Why it matters

Schedules are reliable; triggers react to the unexpected.

  • A schedule alone misses a sudden change between runs.
  • Triggers alone depend on monitoring being right, and can fire on noise.
  • Before retraining on a trigger, check the drift is real and not a data bug (module 21).

In the real world: Kirana Kart's fraud model retrains weekly and also whenever the reviewer-overturn rate rises sharply, a sign that fraud tactics have changed.

Automatic retraining on a drift alert caused by a broken pipeline. The new model learns the broken data, passes a gate computed on the same broken data, and ships.

How much history to train on

What it is

Choosing the training window is a trade-off:

  • longer windows give more data and cover rare events (last year's festival);
  • shorter windows reflect the current world better;
  • weighting recent examples more than old ones gives some of both;
  • keeping seasonal data (the same weeks last year) helps models that must handle annual events.

Why it matters

There is no universal answer; test it.

  • Backtest models trained on 3, 6, 12 and 24 months and compare error on recent weeks.
  • Fast-changing problems (trends, fraud) prefer short windows; stable ones benefit from more data.

In the real world: Kirana Kart's demand model trains on 24 months with recent weeks weighted more, so it remembers festivals but follows recent trends.

Training only on the last few weeks and losing the memory of rare events. A demand model trained on the last two months has never seen Diwali.

Champion and challenger

What it is

The champion is the model in production; a challenger is a candidate trying to replace it:

  • every retrain produces a challenger;
  • it must beat the champion on the same recent data (the gate, module 15);
  • then prove itself on live traffic (shadow, canary, A/B; modules 17 and 20);
  • only then does it become the champion; the old champion stays ready for rollback.

Why it matters

It makes retraining safe by default.

  • A retrain that is worse, because of bad data or bad luck, never reaches users.
  • The same process covers routine retrains and new model designs.

In the real world: Kirana Kart's nightly ETA retrain produces a challenger that replaces the champion automatically only if it wins on the previous week; about one night in ten it does not, and the champion stays.

Skipping the comparison for 'routine' retrains. Routine retrains on broken data are exactly the case the gate exists for.

Feedback loops

What it is

A feedback loop forms when a model's predictions influence the data it will be trained on next:

  • a recommender shows item A more, so A gets more clicks, so the next model shows A even more;
  • a fraud model blocks certain orders, so their outcome is never seen, so the next model never learns whether blocking was right;
  • a predictive policing or credit model concentrates attention on a group, generating more records about that group.

Why it matters

Loops can amplify small, accidental differences into large ones.

  • Popular items get more popular whether or not they are better.
  • The data becomes narrower, so the model knows less and less about anything it stopped showing.
  • The model's offline scores can look better while the system gets worse, because it is being tested on data it shaped.

In the real world: Researchers have repeatedly shown recommenders converging on a narrow set of popular items when trained only on their own logged interactions; exploration and debiasing are the standard remedies.

Visual example

Computed

Two equally good products (both clicked 5% of the times shown). One starts with slightly more exposure; each round the model leans towards whatever got more clicks. Exposure runs away from equal.

Next exposure ∝ clicks^1.5; illustrative
roundproduct A shareproduct B share
155%45%
257%43%
361%39%
466%34%
573%27%

Nothing about the products changed; only the loop did.

Reading a self-reinforcing trend as success. Click-through on the top recommended items rising every month may only mean the model shows almost nothing else.

Practise it: Diagnose Model Drift, Design a Personalized News Feed

Breaking feedback loops

What it is

The standard defences:

  • exploration: show a small, random share of other options (module 14), so the model keeps learning about them;
  • holdouts: a small random group whose outcomes are observed without the model's influence (a few orders not blocked but reviewed; a few users shown non-personalised results);
  • propensity logging: record how likely each item was to be shown, and re-weight training data by its inverse;
  • position and popularity debiasing in training (module 7);
  • monitor diversity: how many distinct items get meaningful exposure.

Why it matters

Each defence restores some information the loop would destroy.

  • Exploration and holdouts generate unbiased data.
  • Propensity weighting corrects for the bias in the rest.
  • The cost is a small, measured loss of short-term performance.

In the real world: Kirana Kart reviews rather than blocks a small random share of medium-risk orders, and shows non-personalised 'popular near you' rows to a small holdout group, to keep both models honest.

Exploring without logging the probabilities. Without them, the exploration data cannot be weighted correctly and its value is mostly lost.

Practise it: Diagnose Model Drift, Design a Personalized News Feed

When the other side adapts

What it is

In fraud, spam, abuse and security, people actively study and evade the model:

  • a fraud pattern that is blocked is replaced by a new one within days or weeks;
  • spammers test messages until they pass;
  • a model's own rules leak through its decisions.

Why it matters

Adversarial problems decay fastest.

  • Retraining must be frequent, and features that are hard to fake (device, network, behavioural patterns) matter more than easily changed ones.
  • Layers help: rules for known patterns, a model for general risk, anomaly detection for the new.
  • Fast feedback channels (reviewers, user reports) become essential, since final labels arrive late.

In the real world: Kirana Kart pairs its weekly-retrained fraud model with an unsupervised detector for unusual clusters, which catches new schemes before any labelled examples exist.

Explaining exact reasons to suspected fraudsters ('blocked because the amount was over ₹10,000'). It teaches them the threshold.

Continual and online learning

What it is

Online learning updates a model continuously from a stream of new examples, every few minutes or hours, rather than in periodic full retrains:

  • the model adjusts to change almost immediately;
  • it suits fast-moving signals: trending items, ad click rates, news.

Many teams use a middle path: frequent incremental updates from the last full model, with a periodic full retrain.

Why it matters

It wins where freshness is everything, but adds risk.

  • A bad batch of data affects the model within minutes.
  • Testing every update is harder.
  • Models can drift into strange states over many small updates.
  • Safeguards: validation on every update, automatic rollback, and regular full retrains to reset.

In the real world: Ad systems at large companies update click-prediction models many times a day, with automated checks on every update and the ability to revert to the last good snapshot.

Online learning without safeguards. One hour of bot traffic teaches the model that bots' favourite items are what everyone wants.

Automating the loop safely

What it is

A mature system runs the full loop automatically, with checks at every step:

  • monitoring detects decay or a trigger fires;
  • the training pipeline builds a challenger on validated data;
  • the gate compares it with the champion;
  • release automation shadows, canaries and promotes it;
  • monitoring watches the new champion.

People review what the automation did, approve big changes, and handle what it cannot.

Why it matters

Automation is what lets a small team run many models.

  • Every step that needs a human becomes a step that is skipped under pressure.
  • The safeguards are what make the automation trustworthy; without them, it automates mistakes.

In the real world: Kirana Kart runs nightly retrain-and-release for ETA and recommendations unattended; fraud model releases still need a risk analyst's approval because of their cost.

Visual example

Loop

Every arrow has a check that can stop it.

The automated retraining loop

  1. MonitorDecay, drift, schedule, event
  2. Validate dataStop if inputs look broken
  3. Train challengerRecorded data, code, settings
  4. GateBeat the champion on the same data
  5. ReleaseShadow, canary, rollback
  6. WatchOld champion kept ready

Automating retraining before monitoring and gates exist. The loop then ships whatever the data produced, good or bad, faster than anyone can notice.

Interview questions: retraining and feedback loops

What it is

The questions interviewers ask about retraining and feedback loops, from the first screening call to the senior round. Cover the answer, say yours aloud, then compare.

Why it matters

Reading an idea and explaining it are different skills.

  • Each answer below is the two or three sentences an interviewer is listening for.
  • The reasoning behind each one is in the cards above. If an answer surprises you, go back to that card.

In the real world: Recommendation and fraud interviews often end on feedback loops: 'what happens after a year of training on your own recommendations?'.

Q: How do you decide how often to retrain?

Measure the decay curve by scoring a fixed model on later weeks, then retrain often enough to stay within a tolerance; add triggers for drift, performance drops and known events.

Q: How much data should you train on?

Backtest different windows; long windows add data and rare events, short ones reflect the present. Weight recent data or keep seasonal periods to get both.

Q: What is a feedback loop in ML?

When predictions shape future training data, such as recommendations driving the clicks the next model learns from, or blocked orders never producing labels. It narrows data and amplifies early differences.

Q: How do you break a feedback loop?

Exploration, random holdouts, logging propensities and re-weighting by them, debiasing for position and popularity, and monitoring diversity.

Q: How do you handle adversarial drift in fraud?

Frequent retraining, hard-to-fake features, layered rules plus model plus anomaly detection, fast proxy labels from reviewers, and not revealing exact decision reasons.

Q: What are the risks of online learning?

Bad data affects the model within minutes, updates are hard to test, and the model can drift oddly; use per-update validation, automatic rollback and periodic full retrains.

Proposing to retrain more often as the answer to a feedback loop. More frequent retraining on biased data tightens the loop.

Practise it: Diagnose Model Drift, Design a Personalized News Feed

Exercise: simulate a feedback loop and break it

What it is

A short build that uses this module's ideas. Write it yourself before looking anything up; the checks at the end tell you whether it works.

Why it matters

An idea you have only read fades in a week.

  • Building it once, even in fifty lines, is what makes it yours.
  • Interviewers can tell the difference between someone who has read about a loop and someone who has debugged one.

In the real world: This simulation is a common way for recommendation teams to explain to stakeholders why some traffic is spent on exploration.

Your task. Show a recommender narrowing onto a few items when trained on its own logs, then fix it with exploration and propensity weighting.

Steps

  1. Create 100 items with hidden true appeal and 10,000 simulated users whose clicks depend on appeal and on position.
  2. Round 1: show items by a random order; log impressions, positions and clicks.
  3. Each round, train a simple model (click rate per item) on all logs so far and show the top items next round.
  4. Run 20 rounds; plot how many items receive 90% of impressions, and how well the model's ranking matches true appeal.
  5. Repeat with 5% exploration, logging the probability each item was shown, and train with inverse-propensity weights.

You are done when

  • Without exploration, exposure collapses onto a few items and the model's ranking drifts away from true appeal.
  • With exploration and weighting, more items keep exposure and the ranking stays close to true appeal.
  • You can state the short-term click cost of exploring.

Stretch. Add a new item at round 10 and measure how long each version takes to learn its true appeal.