Lion Cipher Lab

Benchmark prompt-injection defenses with Attack Success Rate (ASR): measure whether a defense actually works — and by how much (free, local Ollama — no API key)

Why it matters

The AI-security labs before this one teach you to BUILD prompt-injection defenses — a tool broker, a hardened RAG pipeline, a detector. But building a defense and knowing it works are two different jobs, and the second is the one that keeps you honest. The failure mode everyone falls into is the anecdote: you paste one 'ignore previous instructions' payload, the model refuses, you declare victory and ship. That is not evidence — it is a single sample with no denominator. A defense can crush the exact payload you tested and be completely blind to a category you never tried; a lucky refusal on…

What you'll learn

Steps in this lab

  1. The point of this lab: measuring a defense, not building one
  2. Set up the free, local target: Ollama + a small model + Python
  3. Build the benign target 'app' with a secret and a forbidden action
  4. Build the CATEGORIZED, labeled attack corpus
  5. Write the deterministic scorer and measure BASELINE ASR
  6. Defense 1 — spotlighting / datamarking, then RE-MEASURE the delta
  7. Defense 2 — a deny-by-default OUTPUT GATE, then RE-MEASURE
  8. Defense 3 (optional) — an input filter, and building the final table
  9. The judgment: what ASR tells you, and when it lies

Open the full interactive lab →