AI Safety Engineering / STPA:控制结构
一句话:
AI Safety Engineering / STPA / Control Structure 解读
面向对象: AI Architect / AI PM / Senior BA / Risk Lead / Security / Operations / Model Governance。 核心问题: Agentic AI 把系统从“生成建议”推进到“读取、调用、写入、执行”。传统 checklist 很难覆盖系统级事故: 错误目标、缺失反馈、权限过大、人工误信、工具链失控、监控滞后、责任边界不清。 学习目标: 用 STPA 的 system-theoretic safety 思维, 把 AI 风险从“模型会不会错”扩展到 control structure、unsafe control action、causal scenario、safety constraint 和 feedback loop。
Source Anchors
| Source | Link | 用途 |
|---|---|---|
| STPA Handbook | https://psas.scripts.mit.edu/home/get_file.php?name=STPA_handbook.pdf | 参考 loss、hazard、unsafe control action、control structure、causal scenario、constraint 的系统安全分析 |
| NIST AI Risk Management Framework | https://www.nist.gov/itl/ai-risk-management-framework | 将 AI safety 分析连接到 Govern / Map / Measure / Manage |
| NIST GenAI Profile | https://www.nist.gov/itl/ai-risk-management-framework/generative-artificial-intelligence-profile | 参考生成式 AI 特有风险, 如 confabulation、prompt injection、information integrity、overreliance |
| OWASP Top 10 for LLM Applications | https://owasp.org/www-project-top-10-for-large-language-model-applications/ | 参考 prompt injection、sensitive information disclosure、excessive agency 等 LLM 应用安全风险 |
一句话:
AI STPA 不是预测模型会不会出错, 而是分析整个 AI 工作系统如何在控制、反馈、权限、目标和人机协作失配时产生不可接受损失。
1. 为什么 AI Agent 需要系统安全工程
当 AI 只是生成草稿, 风险主要是内容错误、误导、泄露和过度信任。当 AI 可以调用工具、写入系统、发起交易、改变客户状态时, 风险变成系统控制问题。
| 能力阶段 | 风险类型 | 典型事故 |
|---|---|---|
| Draft | 错误内容、幻觉、语气不当 | 客服话术误导客户 |
| Recommend | 错误建议、过度信任 | analyst 接受错误 AML 总结 |
| Decide | 决策偏差、解释不足、客户权益损害 | 信贷边界客户被错误拒绝 |
| Act | 权限滥用、工具误调用、资金/账户状态变化 | agent 错误退款、冻结账户、修改限额 |
| Coordinate | 多 agent 目标冲突、反馈丢失 | 风控、客服、运营 agent 相互覆盖动作 |
STPA 的价值在于: 它不把事故简化成“某组件失败”, 而是看系统是否施加了正确控制, 控制是否在正确时间、正确上下文、正确强度下发生, 以及反馈是否足以让 controller 理解系统状态。
2. STPA 基本概念迁移
| STPA 概念 | AI 系统中的对应 |
|---|---|
| Loss | 不可接受损失: 客户伤害、资金损失、合规违规、歧视、隐私泄露、运营中断 |
| Hazard | 在特定系统状态下会导致 loss 的危险条件 |
| Safety Constraint | 系统必须满足的约束, 防止 hazard |
| Control Structure | 控制者、被控过程、控制动作、反馈和模型 |
| Unsafe Control Action | 控制动作在错误时机、错误上下文、缺失或持续过久导致 hazard |
| Causal Scenario | 为什么会产生 unsafe control action 的因果路径 |
| Process Model | controller 对系统状态的理解, 在 AI 中包括用户意图、权限、风险、上下文、工具结果 |
AI safety 的关键不只是降低模型错误率, 而是确保:
- AI 不在错误上下文中执行动作。
- 人类 controller 能看见足够反馈。
- 工具权限和业务规则约束能拦住错误动作。
- 监控能发现退化和异常。
- 系统能降级、熔断、回滚、人工接管。
3. AI Control Structure
一个金融零售 AI agent 的控制结构可以描述为:
Business Policy / Regulation
-> Product Policy
-> AI Orchestrator / Agent
-> Model
-> Retrieval System
-> Tool Layer
-> Core Banking API
-> CRM
-> Case Management
-> Payment / Refund Service
-> Guardrail / Policy Engine
-> Audit Log
-> Human Reviewer / Operator
-> Monitoring and Incident Response
-> Customer / Analyst / Advisor
关键 feedback:
- tool execution result。
- risk score。
- customer status。
- policy version。
- model confidence / uncertainty signal。
- human override。
- incident alert。
- downstream complaint / loss event。
如果 feedback 不足, AI 或人类就会基于错误 process model 做控制动作。
4. Loss / Hazard / Constraint 示例
4.1 支付退款 Agent
Loss:
- L1: 客户资金被错误扣减或错误补偿。
- L2: 未授权退款造成财务损失。
- L3: 客户投诉和监管风险。
- L4: 内部人员通过 agent 绕过授权。
Hazard:
| Hazard | 描述 |
|---|---|
| H1 | Agent 在客户身份或交易状态未确认时发起退款 |
| H2 | Agent 在超过授权额度时执行退款 |
| H3 | Agent 对 disputed transaction 分类错误 |
| H4 | Agent 无法区分建议话术和真实执行动作 |
| H5 | Human reviewer 在缺少证据时批准 agent 建议 |
Safety Constraints:
| Constraint | 说明 |
|---|---|
| SC1 | Agent 不得在身份、交易状态、退款资格任一项缺失时执行退款 |
| SC2 | 超过额度、监管投诉、欺诈疑似、VIP 例外必须人工复核 |
| SC3 | 所有退款动作必须带 evidence bundle 和 policy citation |
| SC4 | Agent 输出建议和执行动作必须在 UI 与 API 层强隔离 |
| SC5 | 执行动作必须可审计、可回滚或有补偿流程 |
5. Unsafe Control Action 表
以退款 Agent 的控制动作 Issue Refund 为例:
| UCA 类型 | Unsafe Control Action | 可能导致的 Hazard |
|---|---|---|
| Not providing causes hazard | 该退款合法且承诺时效内, 但 agent 没有发起或升级 | 客户权益受损、投诉 |
| Providing causes hazard | 身份未确认、交易未结算或疑似欺诈时发起退款 | 资金损失、欺诈扩大 |
| Too early / too late | 在争议证据收集前退款, 或超过 SLA 才升级 | 错误补偿或客户投诉 |
| Stopped too soon / applied too long | 部分退款流程被中断, 或重复执行退款 | 账务不一致、重复补偿 |
每个 UCA 继续分析 causal scenarios:
- Retrieval 取到过期政策。
- LLM 把“建议联系二线”误转成“执行退款”。
- Tool schema 缺少 amount limit。
- Human reviewer 只看到总结, 没看到证据。
- Guardrail 只检查文本, 不检查 tool call。
- Monitoring 只看成功率, 不看异常退款分布。
6. AI Safety Engineering 工作流
1. Define unacceptable losses
- 客户、财务、合规、隐私、运营、声誉
2. Identify hazards
- 哪些系统状态可能导致 loss
3. Model control structure
- controller, controlled process, action, feedback
4. Identify unsafe control actions
- wrong action, missing action, wrong timing, wrong duration
5. Derive safety constraints
- system must / must not
6. Analyze causal scenarios
- model, data, prompt, retrieval, tool, human, policy, monitoring
7. Design controls
- permission, guardrail, HITL, limit, confirmation, logging, fallback
8. Bind to eval and monitoring
- safety test, red-team, production alert, rollback trigger
9. Record ADR and risk acceptance
- who accepted what residual risk, until when
7. 金融零售案例
7.1 AML Agent
危险不是“总结不够好”, 而是:
- AI 让 analyst 过早关闭 alert。
- AI 漏掉高风险 typology。
- AI 把历史误判当依据。
- AI 无法暴露证据链缺口。
Safety Constraints:
- AI 只能生成 draft rationale, 不得自动关闭 high-risk alert。
- 关闭建议必须显示证据、反证和 missing evidence。
- 高风险 typology 必须二线复核。
7.2 信贷 Agent
Loss:
- 合格客户被系统性拒绝。
- 不合格客户被错误批准。
- adverse action reason 与真实原因不一致。
- 人工 override 未记录。
关键 UCA:
- Agent 在数据缺失时给出低置信拒绝建议。
- Agent 使用禁止变量或代理变量。
- Agent 没有在边界 case 升级人工。
7.3 客服 Copilot
UCA:
- AI 在监管投诉场景未升级。
- AI 输出未经授权承诺。
- AI 隐藏不确定性。
- AI 给出政策错误引用。
8. Safety Controls
| 控制 | 用途 |
|---|---|
| Tool allowlist | 限定 agent 可调用能力 |
| Amount / risk limit | 限制资金、客户状态和业务影响 |
| Context validation | 执行前确认身份、权限、状态、政策版本 |
| Dual-channel confirmation | UI 确认和 API 层策略同时控制 |
| Evidence bundle | 动作必须附带证据和引用 |
| Human approval gate | 高风险动作必须人工批准 |
| Runtime policy engine | tool call 前检查规则 |
| Immutable audit log | 保留输入、版本、动作、反馈 |
| Circuit breaker | 异常分布、错误率、投诉触发暂停 |
| Fallback path | 模型或工具失败时转人工/规则流程 |
9. 面试回答
Q1: Agentic AI 为什么不能只靠权限控制?
30 秒版本:
权限控制只回答 agent 能不能调用某个工具, 但安全问题还包括什么时候调用、基于什么状态调用、缺少什么反馈、人工是否误信、监控是否能发现异常。STPA 会把 agent 放进完整控制结构里分析 unsafe control action 和 causal scenario。
Q2: 如何设计一个可上线的退款 Agent?
30 秒版本:
我会先定义不可接受损失, 再建 control structure, 找出退款动作的 unsafe control actions, 例如身份未确认时退款、超过额度退款、过早退款或重复退款。然后设计 safety constraints: tool allowlist、额度限制、证据包、人工审批、API 层 policy check、审计日志和熔断监控, 最后用 safety eval 和 pilot 验证。
10. 作品集交付物
- AI Loss / Hazard Register。
- Control Structure Diagram。
- Unsafe Control Action Matrix。
- Causal Scenario Analysis。
- Safety Constraint Set。
- Agent Permission Matrix。
- HITL and Escalation Matrix。
- Runtime Monitoring and Circuit Breaker Design。
- AI Safety ADR。
这套材料能展示你把 AI agent 看成真实业务系统, 而不是只看成一个会调用 API 的聊天机器人。