13 / 16 · Operations
Retraining and continual learning
When to retrain, what state to retain and which evidence permits a release: delayed labels, forgetting, exposure feedback and paired evaluation, with independently specified calculations.
Monitoring and drift · Experiments, reproducibility and the model registry · Rolling out models
On this page 8
Monitoring can reveal that a deployed model has deteriorated. It does not identify a safe replacement. New training data can be incomplete, the next model can forget an older case, and the evaluation sample can reflect decisions made by the current model. A retraining system must therefore produce evidence for a release, as well as produce weights.
This note follows a fictional service that checks whether a document preview needs human correction. Its numerical cases are newly specified teaching examples, evaluated with Python’s standard library. They are not measurements of a production service or neural network. The same distinctions apply to larger systems: the age of a model, the age of its labels and the age of its evidence are different clocks.
Baseline: train once, deploy forever#
Suppose a classifier was accepted on yesterday’s document templates. A new template moves a watermark into the text region. The software still returns a well-formed response, but the decision boundary may now be wrong. Restarting the server cannot supply examples of the new layout; retraining on an unchanged snapshot cannot supply them either.
Start an investigation by separating three cases. A broken parser requires a software fix. A changed mixture of otherwise familiar templates may require reweighting the evaluation sample. A genuinely new relationship between input and required correction may require new labels and a different model. Automatically treating all three as “retrain” can hide the cause and ship a regression.
A useful baseline retains the deployed artifact, its data cutoff and its acceptance evidence. This gives the next candidate something specific to beat. Deleting the baseline after every training run loses both the comparison and the rollback target.
The retraining loop#
The loop has a data boundary and a release boundary. At the data boundary, select immutable input partitions, join only labels available at the declared cutoff, validate the schema and save the configuration. At the release boundary, compare the resulting artifact with the serving baseline on the same evaluation cases. Training success by itself crosses neither boundary.
Represent one run with a manifest: data and label snapshot identifiers, feature code, initialization artifact if any, optimizer settings, evaluation version and resulting model hash. A failed evaluation leaves that manifest and the candidate intact for diagnosis. It must not move the serving alias. The registry note explains why an alias is a release decision, not a training output.
TFX’s Evaluator illustrates this separation: configured metrics and slices can produce a validation result that a Pusher consumes (TensorFlow contributors). This is an example of an interface between stages, not a guarantee that a chosen metric or dataset is sufficient. A missing critical slice must not silently become a successful check.
When to retrain#
A schedule makes resource use predictable. A trigger makes the response conditional on evidence. A manual request handles a known event such as a changed scanner format. They can use the same reproducible pipeline; the trigger should select a run, not secretly change its acceptance criteria.
For a trigger, record the measurement window, minimum label count and action. An input-distribution alarm can start inspection or data collection without proving that the model needs replacement. A performance alarm based on ten early labels can be less reliable than a slightly older, mature cohort. If several signals fire together, deduplicate the request instead of starting concurrent training jobs against different moving snapshots.
Add a cooldown and a recovery rule. Without them, a noisy metric can start repeated runs, consume the budget and repeatedly reuse the same evaluation sample. The system should distinguish “candidate rejected,” “insufficient labels” and “training infrastructure failed”; each calls for a different next action. Freshness requirements and checks before export are also emphasized by Zinkevich (Rules 8–9).
How often: retraining cost against decay#
An intentionally simple model makes the tradeoff computable. Let each retrain cost cost units. Assume instantaneous successful replacement resets model age to zero, and the loss rate grows linearly with age as , where cost units per squared hour. Over a cycle of length , integrate the rate and divide total cycle cost by its duration:
The second derivative is positive for positive , so this stationary point minimizes the assumed average cost. The two terms explain the shape: frequent retraining increases spending per hour; infrequent retraining increases average age cost.
| Interval, hours | Average cost per hour |
|---|---|
| 4 | 4.500 |
| 5 | 4.275 |
| 6 | 4.250 |
| 8 | 4.500 |
Among integer intervals from one to twelve hours, six is best. This is a solution to the stipulated cost model, not a recommended production schedule. If labels arrive after eight hours, a six-hour training cycle may repeatedly use nearly the same information. If training takes two hours or sometimes fails its gate, replacement is no longer instantaneous. Those mechanisms require a different cost model rather than a more precise decimal for this optimum.
Stateless retraining and stateful training#
Stateless retraining initializes a new run independently of the serving weights, using the selected dataset. Stateful training continues from a checkpoint. The latter can be cheaper when the new dataset is small, but it makes previous state part of the experiment. Two runs with identical new data can differ because their starting weights, optimizer moments or learning-rate counters differ.
For continued training, explicitly decide whether to restore the optimizer or reset it. Record the choice, the parent checkpoint and the order of new examples. Restoring only weights is not the same computation as resuming an interrupted optimizer. A deployment checkpoint and a training-resumption checkpoint can therefore have different contents and retention rules.
Training from scratch does not automatically remove historical bias: the selected data may still encode earlier decisions. Continuing weights does not automatically cause forgetting: the objective and replay policy matter. Compare both strategies using the same current and historical evaluation slices, as well as their computation cost. A smaller training bill is useful only if the resulting model satisfies the release contract.
Catastrophic forgetting in brief#
Consider a single shared parameter with two stipulated tasks:
Task A alone prefers ; task B alone prefers . After fitting B, A’s loss rises from zero to nine. There is no parameter that makes both losses zero: this toy has an explicit capacity conflict.
Equal replay minimizes the mean of the two losses. Differentiating gives , hence . Alternatively, add a quadratic anchor of weight two around A’s old optimum. Its derivative is
so the anchored optimum is zero.
| Training rule | Parameter | A loss | B loss |
|---|---|---|---|
| A only | 1 | 0 | 9 |
| B only | −2 | 9 | 0 |
| Equal replay | −0.5 | 2.25 | 2.25 |
| Quadratic anchor | 0 | 1 | 4 |
These are exact scalar objectives, not a neural-network benchmark. Replay retains earlier examples (Rolnick and coauthors); EWC protects parameters according to their importance to earlier tasks (Kirkpatrick and coauthors). Our uniform scalar anchor only illustrates a stability penalty. It does not estimate Fisher information or implement EWC. Both replay and anchoring make a tradeoff visible; neither promises zero forgetting or permits retaining data beyond its allowed use.
Delayed and biased labels#
Freeze six decisions made during hours zero through five. Each eventually receives a human label, but some corrections take longer to review. Truth in this retrospective table is not available to the system before its stated arrival time.
| Case | Decision hour | Prediction | Eventual truth | Label available |
|---|---|---|---|---|
| a | 0 | 0 | 0 | 4 |
| b | 1 | 1 | 1 | 2 |
| c | 2 | 0 | 1 | 10 |
| d | 3 | 1 | 0 | 12 |
| e | 4 | 0 | 0 | 5 |
| f | 5 | 1 | 1 | 7 |
At cutoff six, only a, b and e are labeled: apparent accuracy is three out of three. At cutoff twelve, the same cohort has four correct answers out of six. The model did not change. The denominator and the mix of observed cases changed. Reporting both label coverage and accuracy prevents the first snapshot from masquerading as complete evidence.
Unknown labels must remain unknown. Encoding them as negative creates an artificial relationship between label delay and the target. A mature-cohort report can wait until a chosen observation horizon, but it must still disclose cases whose labels never arrive. Merely waiting longer cannot repair permanent selection.
Selective labels arise when an earlier decision determines which outcomes can be observed (Lakkaraju and coauthors). For example, suppose this fictional service asks for review only after predicting “needs correction.” The reviewed set cannot directly estimate mistakes among previews it automatically accepted. A model’s disagreement on that unseen group is not itself a ground-truth label. Independently sampled review can supply missing evidence when the review process is appropriate; its sampling scheme and coverage must be recorded.
Feedback loops#
A model can change the data it later learns from. To isolate this mechanism, imagine two preview templates with the same true click probability, one half. The service initially exposes template A four fifths of the time. Expected click totals are proportional to exposure, even though neither template is better.
Suppose a badly designed update assigns the next exposure share in proportion to the squares of those expected totals. If A’s current share is , the common click probability cancels:
The exact expected-allocation sequence is
This is deterministic arithmetic on expected counts, not simulated users or evidence that real recommenders follow this rule. The amplification comes from treating accumulated exposure as quality and then sharpening it. There was no improvement in either template’s click probability.
Store exposure and decision-policy version alongside outcomes. Compare rates with their opportunities, not raw totals alone. Even rates can remain biased by position or user selection; Google Rules 35–36 discuss these feedback mechanisms. Evaluating a changed policy may require deliberately collected evidence. Logging a propensity without ensuring that relevant alternatives ever had a nonzero chance of exposure cannot recover their missing outcomes.
Evaluation gates: champion against challenger#
The champion is the current baseline; a challenger is a candidate. Evaluate both on identical immutable cases with the same feature-time rules. Include a recent mature cohort, important historical slices and fixed critical cases. Give each check a failure behavior. An empty historical slice is missing evidence, not zero errors.
Keep the acceptance rule outside the candidate’s training objective. If a developer repeatedly tunes on the release set, that set becomes development data. Reserve fresh evidence or a controlled update policy for the final decision, and preserve all attempted comparisons. The rollout note explains why repeatedly looking for a favorable result changes statistical error rates.
The paired comparison#
For twelve original cases, stipulate seven correct baseline predictions and eleven correct candidate predictions. Five cases improve and one regresses; the other six do not change correctness. The apparent improvement is four cases, but those changes need context.
Under an equal-marginal-accuracy null and independent, identically distributed paired items, the six discordant directions have a conditional fair-binomial distribution. The exact two-sided McNemar calculation is
This small set does not provide strong evidence of a general accuracy difference at a predeclared 0.05 threshold. Dependence between related cases would invalidate the independent-item calculation. The mechanics and resampling alternatives belong in Testing ML systems.
There is a separate reason to reject this candidate: the single regression is case 6, designated critical before evaluation. Its required check fails. An average gain cannot overrule a mandatory condition. Conversely, passing all critical cases would not establish population-wide safety; it would establish only those checks on those versions.
What changed#
Retraining now creates an auditable proposal instead of directly changing a live model. Its trigger has a reason, its labels have a cutoff, its checkpoint has a parent and its release has independent acceptance evidence. A rejected model remains a useful diagnostic artifact.
Limitations#
The cost example assumes a known linear penalty and perfect instantaneous updates. The forgetting example has one parameter and conflicting objectives. The feedback example uses expected counts. None measures a production effect. Real decisions require measured delay, dependence, annotation quality, resource limits and permissible retention. Automation can enforce those specifications; it cannot choose the acceptable tradeoffs on the team’s behalf.
What you should remember#
- A training trigger is not a release approval.
- Label coverage and decision-time features belong in evaluation evidence.
- Continued training inherits state; replay and anchoring incur different costs.
- A feedback loop can amplify exposure without improving quality.
- A mandatory regression gate survives an improvement in the average metric.
Example#
The original executable fixture uses only the standard library. Saved results contain the integer schedule sweep, exact task losses, both label snapshots, the exposure sequence and all twelve paired predictions. Assertions check the stated values. No external dataset, model training or production access is involved.
Next#
The loop needs enough computation to finish before its evidence grows stale. Distributed training examines how splitting that computation changes gradients, communication and memory. Responsible ML examines what the retained data and decisions mean for affected people.
References#
- Martin Zinkevich. Rules of Machine Learning. Google, current documentation read 13 November 2026. Rules 8–9 and 35–36: freshness, export checks and policy feedback.
- TensorFlow contributors. TFX Evaluator. Current documentation read 13 November 2026. Candidate/baseline evaluation, slices and validation consumed by Pusher.
- James Kirkpatrick and coauthors. Overcoming catastrophic forgetting in neural networks. 2017. Abstract: protecting parameters important to previous tasks. The scalar example above is independently specified and is not an EWC experiment.
- David Rolnick, Arun Ahuja, Jonathan Schwarz, Timothy P. Lillicrap and Greg Wayne. Experience Replay for Continual Learning. 2019. Abstract: replay as a mechanism for reducing forgetting.
- Himabindu Lakkaraju, Jon Kleinberg, Jure Leskovec, Jens Ludwig and Sendhil Mullainathan. The Selective Labels Problem: Evaluating Algorithmic Predictions in the Presence of Unobservables. KDD, 2017. Abstract: outcome observation depends on previous decisions; no paper dataset or case study is reproduced here.