SPLASH:用于检测和定位生成代码中安全幻觉的对比审计压力方法
SPLASH: Contrastive Audit Pressure for Detecting and Localizing Security Hallucinations in Generated Code
AI总结:
本研究提出SPLASH方法,通过对比审计压力检测定位生成代码的安全幻觉,在63684个程序上表现优于前沿LLM评判器。
摘要:
大型语言模型生成的代码常通过所有功能测试却仍存在安全问题,这类安全幻觉很常见,置信度高且在样本中重复出现,因此生成模型自身的不确定性或静态分析器都无法可靠检测。我们提出SPLASH,它受名为审计压力的新度量引导,对比生成程序在安全审查和风格审查下的教师强制对数概率。审计压力可聚合到语句和程序层面,基于竞争编辑的概率模型,使SPLASH无需模型训练、CWE特定规则或生成模型的内部访问,就能在模型的候选程序中选择安全程序并定位易受攻击的语句。在12个模型为899个任务生成的63684个程序上,SPLASH在74%的案例中能选出安全代码,在58%的不安全程序中能将易受攻击语句排在首位,且表现优于前沿大语言模型评判器。
英文摘要:
Code generated by large language models often passes every functional test while remaining insecure. These security hallucinations are common, written with high confidence, and repeated across samples, so neither the generator's own uncertainty nor static analyzers reliably catch them. We introduce SPLASH, which is guided by a new measure called audit pressure. It contrasts teacher-forced log-probabilities for the generated program under a security review and a style review. Aggregated to statements and programs, and grounded in a probabilistic model of competing edits, audit pressure allows SPLASH to choose the secure program among a model's candidate programs and locate the vulnerable statement, with no model training, CWE-specific rules, or internal access to the generating model. On 63,684 programs generated by 12 models for 899 tasks, SPLASH picks secure code in 74% of cases, places the vulnerable statement first in 58% of insecure programs, and chooses better than a frontier LLM judge.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。