A rule that blocks any message containing the word "ignore" also blocks a customer asking your support agent to "ignore the previous shipping address, use my new one instead" — a completely legitimate request that happens to share vocabulary with a prompt-injection attempt. Rules are fast, auditable, and precise about the exact strings they match, but natural language attacks rarely repeat the exact string a rule was written to catch, and legitimate traffic constantly brushes up against the vocabulary attacks use. This is the gap classifier-based guardrails exist to close: a model trained to recognize the pattern of an attack, not a fixed string.
A classifier guardrail is a separate, purpose-built model that sits in the request path and scores a piece of text — a user message, a model's draft response, a retrieved document — against categories like "prompt injection attempt," "jailbreak attempt," or "policy-violating content," and returns a score or label the pipeline acts on. It generalizes past the exact wording a rule would need spelled out in advance, which is precisely what makes it valuable against attacks nobody has seen a specific string for yet, and precisely what makes it probabilistic rather than certain — a property the next lesson pushes hard on when it compares classifiers against rules directly.
This lesson covers how a classifier guardrail is actually built and deployed: what makes a good training set for one, the precision/recall trade-off that determines what a threshold decision actually costs you in production, and the latency and calibration considerations that separate a classifier that works in a notebook from one that survives real traffic. It sets up the direct comparison against rule-based guardrails in the next lesson, and the layered combination of both in the lesson after that.