The Lawfare Academy

Lawfare Group → Knowledge Institute → Lawfare Academy

← AI 301 — Machine Learning, Neural Networks and Language

Weeks 15–16

Model comparison, drift and deployment decisions

Learning objectives

  • Explain and trace the mechanisms in model comparison, drift and deployment decisions.
  • Apply the method to the worked example and changed-condition exercise.
  • Identify assumptions, failure cases and the evidence needed to justify a result.
  • Test the added failure-mode fixture and explain which guarantee the evidence does and does not establish.

A model is only one component of a deployed decision process. Inputs must be collected, transformed and checked; outputs must lead to a defined action; errors must be detected and handled. Evaluate the entire pipeline under realistic constraints. A model that improves an offline metric may add review work or fail on the cases most important to users.

Distribution shift changes the relationship between training evidence and deployment. Feature distributions can change, label prevalence can move and the relationship between inputs and outcomes can evolve. Monitor input quality and operational outcomes, but remember that labels may arrive late or only for selected cases. A shift alarm indicates a reason to investigate, not automatic proof that retraining will fix the problem.

A release needs a versioned model, preprocessing, feature schema, evaluation record and rollback plan. Keep a simple fallback for unavailable or out-of-scope inputs. Decide who can approve changes and which evidence triggers retirement. Compare total cost, including inference, data maintenance, review and incidents. If an intervention changes behavior, the data generated after deployment may differ from passive historical data. Treat release as an ongoing empirical responsibility rather than an endpoint reached by one benchmark.

Worked reasoning The guard rejects a currency or hours representation outside the documented model contract. It is only an example of input scope, not a complete drift detector. A value can pass the schema and still be unlike the training population. Log a minimal rejection reason, provide a safe fallback and review rejection patterns without exposing raw confidential records.

Extended teaching and laboratory

Evaluation describes a model under a particular data-generation and decision setting. Feature checks can reject values outside a contract, while distribution shift can occur entirely inside those ranges. Monitor data, predictions and outcomes where outcomes become available, and specify actions for suspected degradation. A model version change can alter behavior even when application code is unchanged.

A release decision should compare a baseline, candidate performance, operational costs and failure cases. Preserve a fallback, record versions and use a rollback trigger tied to observed behavior. Absence of an alarm is not proof that the system remains valid.

Worked problem A model is 94% accurate on an old process and 51% on fictional cases from a changed rule. All input values still pass the schema. Evaluate release readiness.

Step-by-step reasoning 1. The schema confirms representation and range, not stability of the target relationship. Both measurements can be valid for different mechanisms.

  1. Investigate whether deployment now follows the changed process. If so, the old score does not establish current usefulness.
  1. Compare the candidate with simple baselines on the relevant new data and inspect errors, costs and subgroup patterns.
  1. Delay or restrict automated use when the deployment evidence is insufficient. Use a defined fallback and collect feedback rather than silently averaging the two accuracies.

Failure-oriented laboratory: Thresholds, calibration and a held-out decision audit

A predictive score is not a decision rule. A threshold converts a score into action and therefore trades false positives against false negatives. Choose it using a development process aligned with stated costs and capacity, then evaluate it once on held-out evidence. Repeatedly adjusting the threshold after inspecting test errors consumes the independence of that test.

Precision answers how many selected positives are correct; recall answers how many actual positives were selected. Neither establishes calibrated probabilities. Calibration compares predicted probabilities with observed frequencies among comparable predictions, and its assessment requires sample size and uncertainty. A model can rank cases well while reporting unreliable probabilities.

Report counts before ratios, including abstentions and unscored cases. Subgroup or time-slice results can reveal concentrated failure, but tiny samples do not support precise claims. Monitor the consequences of decisions, not only model scores, and preserve a non-model baseline. This laboratory uses fictional labels and does not authorize decisions about real people.

Worked fixture

On a held-out synthetic set, threshold A yields TP=40, FP=10, FN=20, TN=130. Compute precision and recall. Threshold B raises TP to 50 but FP to 40.

Explain the fixture

At A, precision is 40/50 = 0.80 and recall is 40/60 ≈ 0.667. At B, recall is 50/60 ≈ 0.833 and precision is 50/90 ≈ 0.556. Higher recall does not imply universally better decisions. Compare costs and capacity using a development set rather than choosing retrospectively from the final test.

Apply the idea

A model is 94% accurate on an old process and 51% on fictional cases from a changed rule. All input values still pass the schema. Evaluate release readiness.

A monitored model has unchanged feature averages but worse outcomes. What should the investigation include?

Additional laboratory — Assume development-time costs of 2 per false positive and 10 per false negative. Calculate each rule’s illustrative error cost, then explain why selecting on this held-out set invalidates its role as a final unbiased comparison.

Read the worked reasoning

Check conditional relationships, subgroup composition, label definition and delay, data-pipeline changes and decision thresholds. Equal marginal averages can hide changed relationships or offsetting subgroup shifts. Reproduce the evaluation with versioned inputs and targets, and do not dismiss outcome degradation because one feature summary is stable.

Additional laboratory model — A has cost 10×2 + 20×10 = 220; B has cost 40×2 + 10×10 = 180. Under those fixed costs B looks preferable, but choosing it after inspecting this test makes the score part of selection. Use fresh held-out evidence or disclose the reuse; do not call the reused result an untouched final test.

Check understanding

What is required beyond a strong offline score?

  1. A validated workflow, monitored outcomes and a recovery policy
    Feedback

    The system must remain useful under actual operating conditions.

  2. Immediate unrestricted deployment
    Feedback

    Scope and consequences still require a bounded deployment decision.

  3. A promise that distributions will remain fixed
    Feedback

    Future data can change despite strong historical performance.

Further reading

Study the complete on-site source sections below, then work the original example, changed-condition problem and transfer laboratory. Complete the assigned model-evaluation sections and a small source exercise from each model family. Use synthetic or openly licensed data and document its provenance.

My learning →