Lion Cipher Lab

Catch base-rate neglect in a triage model's verdict confidence, and fix it with an explicit prior

Why it matters

A detector that catches 99% of attacks and false-alarms on only 1% of clean events sounds excellent. Put it on a network where 1 event in 1,000 is malicious and, when it fires, the alert is malicious about 9% of the time. That is not a flaw in the detector; it is arithmetic, and Stefan Axelsson showed in 2000 that it is the central difficulty of intrusion detection: when attacks are rare, false alarms outnumber true ones unless the false-positive rate is tiny. People get this wrong reliably - Tversky and Kahneman documented in 1974 that we judge by how well the evidence fits and neglect how…

What you'll learn

Steps in this lab

  1. The words first: prevalence, base-rate neglect, Bayes' rule, likelihood ratio, calibration - and the fact that the model is a stub
  2. Open a terminal, check Python, make a scratch folder (Windows, macOS, Linux)
  3. One-step recap: the race lab measured accuracy by difficulty; this lab measures whether the stated probability is true
  4. Build three sites that differ only in how rare attacks are
  5. Write the System-1 stub: it reports the detector's hit rate and never looks at the base rate
  6. Write the calibration ruler: Brier score, ECE and a reliability table
  7. Measure BEFORE: the stub's probabilities at three sites
  8. System 2, by hand once: 99% sensitive, 1% false positives, 0.1% prevalence is a 9% posterior
  9. Measure AFTER: Bayes with each site's own prior, one detector and then two
  10. Three honest negatives: the wrong prior, verification bias, and two detectors that are not independent
  11. Why this, not that - and when NOT to bolt Bayes onto a triage model
  12. The way a pro does it: priors per site and per time, likelihoods from a random audit, a log of every posterior
  13. Ship it: re-run, break a constant on purpose, and clean up

Open the full interactive lab →