Lion Cipher Lab

Evade a text classifier with word-substitution attacks — then measure the defense

Why it matters

A spam filter, an abuse/toxicity classifier, a phishing detector, a resume screener, a prompt-safety classifier that decides whether to let a message through — these are all TEXT classifiers, and organizations increasingly wire them in as a control: 'the model will catch it.' This lab is the reason you never trust a single ML content filter as your sole control. In the image world an adversarial example adds a tiny, imperceptible perturbation to every pixel; text is different in kind, because you cannot nudge a word by 0.01 — so a text attacker SUBSTITUTES tokens that a human still reads the…

What you'll learn

Steps in this lab

  1. The text threat model: you substitute words, you don't add noise
  2. Set up: train a local spam-vs-ham classifier and record CLEAN accuracy
  3. Word-importance ranking: find the tokens the classifier leans on
  4. The greedy substitution attack — and measure ASR
  5. Defense 1: input normalization — crushes the character attack, misses the synonym attack
  6. Defense 2: adversarial training — and the honest cross-attack test
  7. The verdict — name the failure modes, and why one filter is never the wall

Open the full interactive lab →