arXiv:2604.17587cs.SEcs.AI2026-04

AI生成代码常悄悄失效,AIRA框架可检测此类隐藏风险。

AIRA: AI-Induced Risk Audit: A Structured Inspection Framework for AI-Generated Code

  • 设计15项检查清单,系统化审计AI生成代码的失真行为
  • 实测显示AI代码高危缺陷是人工代码的1.8倍,尤其在异常处理中
  • 适合需要严格安全管控的金融、医疗等关键系统使用

实践者报告称,AI辅助生成的代码往往呈现‘静默失败’现象:外表功能正常,实则隐藏可靠性退化或保证缺失。本文提出‘奖励塑形失败假说’,认为这种现象可能是人类反馈优化过程带来的产物,而非随机错误分布。定义‘失败真实性’为系统输出准确反映内部成败状态的属性。提出AIRA(AI诱导风险审计)框架,一种确定性的15项检查机制,用于识别代码中的失败不真实模式。通过三项研究验证:(1) 匿名企业环境审计,(2) 600个文件的公开语料库预研,(3) 严格配对对照复现实验,对比955个AI生成文件与955个人工代码文件。结果显示,AI文件每份含0.435个高危发现,而人工文件为0.242个(1.80倍)。该效应在JavaScript、Python和TypeScript中均一致,且集中在异常处理相关模式。结果支持AI辅助代码存在定向性‘软失败’倾向。AIRA适用于治理、合规及安全关键系统,要求‘故障闭合’行为的场景。

原文摘要 · Abstract (English)

Practitioners have reported a directional pattern in AI-assisted code generation: AI-generated code tends to fail quietly, preserving the appearance of functionality while degrading or concealing guarantees. This paper introduces the Reward-Shaped Failure Hypothesis - the proposal that this pattern may reflect an artifact of optimization through human feedback rather than a random distribution of bugs. We define failure truthfulness as the property that a system's observable outputs accurately represent its internal success or failure state. We then present AIRA (AI-Induced Risk Audit), a deterministic 15-check inspection framework designed to detect failure-untruthful patterns in code. We report results from three studies: (1) an anonymized enterprise environment audit, (2) a balanced 600-file public corpus pilot, and (3) a strict matched-control replication comparing 955 AI-attributed files against 955 human-control files. In the final replication, AI-attributed files show 0.435 high-severity findings per file versus 0.242 in human controls (1.80x). The effect is consistent across JavaScript, Python, and TypeScript, with strongest concentration in exception-handling-related patterns. These findings are consistent with a directional skew toward fail-soft behavior in AI-assisted code. AIRA is designed for governance, compliance, and safety-critical systems where fail-closed behavior is required.

AI安全代码审计风险评估

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。