Lion Cipher Lab

Probe a phishing classifier's hidden layers, catch the shortcut it learned, and prove with an intervention which concepts it actually uses

Why it matters

A phishing classifier that scores 95% on its test set is the kind of result that ships. This lab builds one that does exactly that and is close to useless, and then teaches the two-part method that catches it. The training mail was collected so that a harmless mail-gateway header tag happened to ride along with 95% of the phishing and almost none of the legitimate mail - the kind of accident that happens when one feed of known-bad mail comes through a different relay than everything else. A small neural network, trained the normal way, scores 0.9520 on a test set drawn the same way. On clean…

What you'll learn

Steps in this lab

  1. The words first: shortcut learning, MLP, hidden layer, linear probe, and why decodable is not the same as used
  2. Open a terminal, make a scratch folder, and install scikit-learn into a throwaway virtual environment
  3. Build the mail: eight features, a real signal, and a planted shortcut that only exists in training
  4. Train the network and measure the gap the normal test split hides
  5. Why the usual evaluation could not catch it, and what a clean test set has to be
  6. Pull out the hidden layers by hand and fit a linear probe per layer
  7. Read the probe table, and notice the row that should worry you
  8. Probe, then intervene: remove each concept and count how many verdicts flip
  9. Fix the data, retrain, and measure every side of the fix
  10. What the fix did not fix, measured
  11. Why this, not that - and how a professional does it better
  12. Ship it: the three numbers to put in a model review, and clean up

Open the full interactive lab →