Routing Ceilings Are Domain-Independent: Structural Prior Injection in Code Security Vulnerability Detection
作者: Manuel Israel Cázares
分类: cs.CL, cs.CR
发布日期: 2026-07-16
备注: 12 pages, 5 tables
🔗 代码/项目: GITHUB
💡 一句话要点
提出结构先验以解决代码安全漏洞检测中的路由问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 代码安全 漏洞检测 大型语言模型 结构先验 分布感知训练 性能评估 路由假设
📋 核心要点
- 现有方法在不同分布下的性能表现不一致,尤其在真实数据上经常出现性能崩溃。
- 论文通过引入结构先验(如备忘单)来提升模型在代码安全漏洞检测中的表现,探索其跨领域的有效性。
- 实验结果显示,结构先验在合成数据上将语义漏洞召回率从20%提升至100%,但在真实数据上却出现了显著的性能下降。
📝 摘要(中文)
大型语言模型(LLMs)在潜在能力与一致激活之间存在显著差距。路由假设认为模型具备解决任务的知识,但缺乏可靠的内部路由来激活这些知识。本文通过在源代码安全漏洞检测中重现SAIR设计,评估三种LLM在不同漏洞类别下的表现,发现结构先验显著提升语义漏洞的召回率,但在真实数据上表现不佳,验证了路由假设的跨领域特性,并提出了基于分布感知训练的建议。
🔬 方法详解
问题定义:本文解决的是大型语言模型在代码安全漏洞检测中的性能不一致性问题,尤其是在真实数据上表现不佳的现象。现有方法在合成数据上表现良好,但在真实世界的应用中却遭遇性能崩溃。
核心思路:论文的核心思路是通过引入结构先验(备忘单)来提升模型的性能,尤其是在语义复杂性较高的任务中。通过这种方式,模型能够更好地激活其潜在知识,从而提高漏洞检测的准确性。
技术框架:整体架构包括三个主要模块:首先是模型选择与评估,其次是结构先验的设计与注入,最后是对模型在真实数据集上的性能评估。实验中使用了三种大型语言模型,并在不同的漏洞类别下进行测试。
关键创新:最重要的技术创新在于验证了结构先验在跨领域任务中的有效性,尤其是在代码安全领域。与现有方法相比,本文揭示了结构先验在合成数据与真实数据之间的性能差异,强调了分布感知训练的重要性。
关键设计:在实验中,使用了不同的备忘单设计,并对模型进行了迭代校准。关键参数设置包括模型的超参数调优和损失函数的选择,以确保在不同数据分布下的最佳性能。
🖼️ 关键图片
📊 实验亮点
实验结果显示,结构先验使得语义漏洞的召回率从20.0%提升至100.0%。然而,在真实数据集VUDENC上,模型的性能却从合成数据的100% F1降至48.9%,表现出51.1个百分点的下降,验证了分布转移的影响。
🎯 应用场景
该研究的潜在应用领域包括代码审计、自动化漏洞检测和安全性评估等。通过提升模型在真实世界中的表现,能够有效减少软件中的安全漏洞,从而提高整体系统的安全性和可靠性。未来,该方法可能会推动更多基于AI的安全工具的开发与应用。
📄 摘要(原文)
Large language models (LLMs) exhibit a well-documented gap between latent capability and consistent activation: the router hypothesis posits that models possess the knowledge to solve a task but lack reliable internal routing to activate it. Prior work in formal mathematical reasoning (SAIR, Cázares 2026) reports that structural priors (cheatsheets) raise in-distribution performance dramatically, yet collapse below the zero-shot baseline out-of-distribution (OOD) -- and that iterative recalibration amplifies rather than corrects the collapse. We test whether this phenomenon is cross-domain by reproducing the SAIR design in source-code security vulnerability detection, evaluating three LLMs (GPT-OSS-120B, Llama-3.3-70B, Gemma-4-31B) across three vulnerability categories (CWE-798, CWE-284, and the non-CWE N+1 anti-pattern) spanning syntactic, contextual, and semantic complexity, then transferring cheatsheet-augmented prompts to real-world CVE data from VUDENC (CWE-89, CWE-22). Our findings replicate and extend SAIR: (F1) structural priors lift semantic-vulnerability recall from 20.0% to 100.0% across all models; (F2) zero-shot performance degrades along a semantic complexity gradient; (F3) the same cheatsheets that saturate synthetic performance amplify distribution-shift collapse on real CVE data (CWE-89: 100% synthetic F1 to 48.9% on VUDENC, -51.1pp); (F5) iterative recalibration produces a v2 cheatsheet that performs worse than v1 on real data, mirroring SAIR's AN45c-vs-AN38 finding. These results provide evidence that the cross-distribution trade-off surface documented in SAIR generalises to code security, and that the router hypothesis is cross-domain. We argue the structural nature of the collapse motivates distribution-aware training over prompt calibration. Code and evaluation scripts: https://github.com/bytepro-ai/bitcoder-v2-research