100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
AI Guardrails & Safety Engineering
30 minadvanced

Layered Defence: Combining Guardrail Types

A team that ships only a classifier guardrail discovers, during an incident review, that a $95,000 transfer went through because the classifier scored the request 0.58 against a 0.60 threshold — a near-miss that a one-line numeric rule would have blocked with total certainty. A team that ships only rules discovers, during a different incident review, that an attacker phrased a prompt injection in a way no rule author anticipated, and it sailed through untouched because rules only catch what they were explicitly told to look for. Neither team was using the wrong guardrail type; both teams were using only one, and single-layer defense fails predictably at exactly the boundary its one layer was never built to cover.

Layered defense is the discipline of combining input validation, rule-based checks, and classifier-based checks into an ordered pipeline where each layer catches what the layers around it structurally cannot, and where a compromise of any single layer does not compromise the whole system. This is not a hedge against uncertainty about which guardrail type is "best" — the previous two lessons established that rules and classifiers solve genuinely different problems, and layering is simply the architecture that lets a system have both without forcing a false choice between them.

This lesson builds the ordering discipline that makes layering actually work — cheap, deterministic checks first, expensive probabilistic checks later, output-side checks independent of input-side checks — and the failure-mode analysis that shows why a single point of failure anywhere in a guardrail pipeline defeats every layer behind it. The project lesson immediately following this one composes exactly this pipeline end to end, so the ordering decisions made here are the ones that project actually has to implement.

Analogy🏏Cricket
🏏 Think of it like cricket: a Test team defending a small fourth-innings target does not rely on a single mode of dismissal to win the match — the plan layers a probing new-ball spell testing technique outside off stump, a short-ball barrage testing the batter's nerve and reflexes, close-in fielders positioned for a induced false shot, and DRS as a final backstop check when the on-field call is uncertain. Each layer is built to catch a different kind of batter error, and a batter who survives the new-ball swing by playing tight and correct still has to survive the short-ball barrage, and a batter who survives that still has to beat a well-set slip cordon. No single layer in that plan is expected to take every wicket alone; the plan works because the layers cover different failure modes of the batter's technique and temperament, and a batter has to get everything right, every layer, to survive the innings. A guardrail pipeline that relies on one layer alone is the equivalent of a captain who sets only close-in fielders and no bowling plan at all — technically present, but missing everything the other layers exist specifically to catch. The insight is that layered defence: no single check has to be perfect, because the layers are built to catch different failure modes, and an attacker — like a batter — has to beat every layer in sequence, not just the one layer a single-mode defense happened to test.
Lesson 11 of 35
0% complete