护栏(Guardrails)是在输入、决策、工具和输出各层检测或阻止不允许行为的控制集合。分层不是为了追求零误差,而是让不同失效有独立闸门、指标和责任边界。Guardrails are controls that detect or block disallowed behavior across
input, decision, tool, and output layers. Layers do not promise zero
error; they give different failures independent gates, metrics, and
owners.
01 · 一扇门能守住整栋楼吗01 · Can one door protect an entire building?
注入从输入进来,越权在工具前发生,敏感信息到输出才出现——只写“请安全”够吗?Injection enters at input, overreach happens before a tool call,
and sensitive data appears at output. Is “please be safe”
enough?
╫
02四层闸门:送入攻击,再逐层断电Four Gates: Send a Test, Then Power Layers Down
漏检 + 误拦同屏misses + false blocks
当前样本Current sample
BLOCK
input layer
威胁漏检率Threat miss rate
0%
0/9 threats
正常误拦率Benign false-block rate
15%
3/20 benign
03四层各守一个时刻Each Layer Guards a Different Moment
控制对象不可混算different control targets
INPUT
输入层看进门材料Input screens incoming material
识别已知注入模式、恶意附件或不允许的数据类型;它看不到尚未发生的工具动作。Detects known injection patterns, malicious attachments, or
forbidden data types; it cannot see a tool action that has not
happened.
DECISION
决策层看意图与策略Decision checks intent and policy
对模型提出的计划做策略判断,能补住部分绕过输入模式的攻击。Evaluates the proposed plan against policy and can catch some
attacks that evade input patterns.
TOOL
工具层看真实权限Tool checks real authorization
按主体、动作、资源和范围授权;即使模型决策错了,也限制影响半径。Authorizes subject, action, resource, and scope, limiting impact
even when model judgment fails.
OUTPUT
输出层看交付内容Output screens delivery
在内容离开系统前检测敏感字段、策略禁项或不允许的结构。Detects sensitive fields, policy exclusions, or forbidden
structures before content leaves the system.
04最小测量:既看漏检,也看误拦Minimal Measurement: Track Misses and False Blocks
关层可能减少误拦,却增加漏检。两个分母固定,不能只报“拦了多少”来证明安全。Disabling layers may reduce false blocks while increasing misses.
With fixed denominators, “number blocked” alone cannot prove
safety.
威胁样本走全链Threats traverse the chain注入、越权、敏感输出injection, privilege, sensitive output
正常样本也测试Benign samples also tested测量业务摩擦measure business friction
按层定位责任Attribute by layer知道该调哪道门know which gate to tune
05边界实验:只留一道输入门Boundary Test: Leave Only the Input Gate
主动制造失败Create a failure
注入被挡住,越权与敏感输出仍漏出Injection is blocked; privilege and sensitive output still
leak
只开输入层并送入越权样本。单层看似“拦过攻击”,却覆盖不了后续决策、工具与输出失效。Enable only input and send a privilege sample. One layer may have
blocked an attack before, yet it cannot cover later decision,
tool, and output failures.
尚未执行。四层护栏当前开启。Not run yet. All four guardrail layers are enabled.
✗ 系统提示写“不得越权”就是护栏。A system prompt saying “do not overreach” is a
guardrail.
→ ✓ 提示只是输入控制面,真实工具权限必须独立执行。A prompt is one control surface; real tool authorization must
be enforced independently.
✗ 拦得越多,护栏越好。A guardrail is better if it blocks more.
→ ✓ 要同时报告威胁漏检与正常误拦。Report both threat misses and benign false blocks.
✗ 一层做得足够强,就不用其他层。One strong layer makes the others unnecessary.
→ ✓ 不同失效出现在不同时间点,需要分层控制。Different failures emerge at different moments and need layered
controls.
06 · 一句话带走06 · One line to keep
护栏用输入、决策、工具和输出四层独立控制覆盖不同失效;开关任何一层,都要在固定威胁与正常样本上同时观察漏检率和误拦率。Guardrails use independent input, decision, tool, and output
controls for different failures. Whenever a layer changes, measure
both miss rate and benign false-block rate on fixed test
sets.