arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.05396cs.CRcs.AIcs.SE
收藏

有意但无力:通过消融分离代码大语言模型中的拒绝与能力

Willing but Unable: Separating Refusal from Capability in Code LLMs via Abliteration

University of Naples Federico II(那不勒斯费德里科二世大学);University of Coimbra(科英布拉大学);University of North Carolina at Charlotte(北卡罗来纳州夏洛特大学)

Cristina Carleo, Pietro Liguori, Naghmeh Ivaki, Domenico Cotroneo

AI总结:

本文通过消融技术(abliteration)对代码LLM进行低秩权重编辑,以消除其对安全注入提示的拒绝行为,从而分离拒绝意愿与代码生成能力,实验表明消融后拒绝率降至零而语法有效性保持93%以上,但注入率仍受模型容量限制。

摘要:

大规模生成带标签的脆弱代码是基于学习的漏洞检测的一个反复出现的障碍:挖掘的语料库带有大量标签噪声,而现有的基于LLM的增强方法传播了这些不准确性,因为它转换了脆弱的种子,而不是根据规范合成漏洞。一个补充的途径是从安全代码开始,要求经过指令调优的LLM注入指定的CWE(这将把标签负担从开放式的检测转移到有界的二元确认),但安全对齐的代码LLM系统地拒绝此类提示。本文是对消融技术(abliteration)的初步可行性研究,这是一种低秩权重编辑,通过正交投影消除残差流中的拒绝方向,作为消除这一障碍的工具。我们使用Python和CWE-89(SQL注入)作为案例研究,评估了Qwen2.5-Coder-Instruct系列在3B、7B和14B参数下对从PromSec和SafeCoder中抽取的安全样本的表现,每种条件重复三次。我们发现:(i)对注入提示的拒绝强烈依赖于大小和提示上下文:14B模型拒绝100%的提示,7B模型拒绝73%的PromSec但仅5%的SafeCoder,而3B模型基本不受阻;(ii)消融技术将所有大小模型的拒绝率降至零或接近零,同时语法有效性保持在93%以上,支持了在这种设置下拒绝可以与测量的代码生成能力分离的观点;(iii)消融后的注入率仍然受容量限制(14B为88-97%,7B为89-90%,3B为25-48%),将意愿(消融技术解锁)与能力(随参数扩展)分离。漏洞判定由三个工具的检测器集成(CodeQL、Semgrep、Bandit)产生,然后由两位作者对检测器阳性输出进行人工裁决。

英文摘要:

Producing a labeled vulnerable code at scale is a recurring obstacle for learning-based vulnerability detection: mined corpora carry substantial label noise, and existing LLM-based augmentation propagates these inaccuracies because it transforms vulnerable seeds rather than synthesising vulnerabilities from a specification. A complementary route is to start from safe code and ask an instruction-tuned LLM to inject a specified CWE (which would shift the labeling burden from open-ended detection to bounded binary confirmation) but safety-aligned code LLMs systematically refuse such prompts. This paper is a preliminary feasibility study of abliteration, a low-rank weight edit that orthogonally projects out the refusal direction in the residual stream, as a tool to remove this barrier. We use Python and CWE-89 (SQL injection) as a case study, evaluating the Qwen2.5-Coder-Instruct family at 3B, 7B, and 14B parameters on safe samples drawn from PromSec and SafeCoder, replicated three times per condition. We find that (i) refusal on injection prompts is strongly size- and prompt-context-dependent: the 14B refuses 100% of prompts, the 7B refuses 73% of PromSec but only 5% of SafeCoder, whereas the 3B is essentially never blocked; (ii) abliteration reduces refusal to zero or near-zero across all sizes while leaving syntactic validity above 93%, supporting the view that, in this setting, refusal can be detached from measured code-generation capability; and (iii) the post-abliteration injection rate remains capacity-bound (88-97% on the 14B, 89-90% on the 7B, and 25-48% on the 3B) separating willingness, which abliteration unlocks, from capability, which scales with parameters. Vulnerability verdicts are produced by a three-tool detector ensemble (CodeQL, Semgrep, Bandit) followed by manual adjudication by two authors on detector-positive outputs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑