arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.03308cs.CR
收藏

代码大语言模型的安全预算:一种信息论容量-安全界限

The Security Budget of Code-LLM Prompt Hardening: Provable Limits Under Pass-Only Acceptance

Anhui University(安徽大学)

Jianwei Tai

AI总结:

本文提出一种信息论框架,通过容量-安全界限量化代码大语言模型在提示扰动下的功能容量与扰动保留之间的权衡,并利用输出隐藏状态进行实证验证。

摘要:

AI编程助手将自然语言提示作为软件开发接口,因此小的提示扰动会带来可用性和安全风险。我们研究了代码大语言模型在功能容量 $\Cap= mI(c^*;c_\pi)$ 和扰动保留 $\Sec= mI(c_\pi; ilde c_\pi)$ 之间的信息论权衡。这里 $\Sec$ 是一个保留信道量,并非对利用成功或脆弱代码生成的直接度量。对于建模为 $p o c_\pi$ 且带有扰动提示 $ ilde p$ 的代码补全,我们证明了 $\Cap+\Sec\le mH(c^*)+ mI(p; ilde p)$,将预算分解为任务熵和提示泄露。一个确定性嵌入推论给出了隐藏状态版本,而一个分词器/gzip伴随界限给出了序列级任务熵的模型无关上限。实验上,我们从仅输出最后一个令牌的隐藏状态估计嵌入的 $\Cap$ 和 $\Sec$,排除了 $\Sec$ 信道中的提示上下文。两个模型、两个数据集、INT4/BF16精度以及估计器消融实验中的六个独立验证行满足嵌入检查 $(\Cap+\max_T\Sec)/( mH(z^*)+\max_T mI(p; ilde p))\le1$。饱和度为0.27–0.92,定理松弛为2.36–26.94 nats;一个单独的三种子稳定性诊断的平均饱和度为0.87。一个上下文混合余弦(仅用作每个问题的生成-提示对齐信号)与CodeLlama-HumanEval ($ ho{=}0.36$, $p{<}10^{-4}$)、Qwen-HumanEval ($ ho{=}0.22$, $p{=}0.005$)和CodeLlama-MBPP ($ ho{=}0.225$, $p{=}0.0038$; 所有 $n{=}164$) 上的pass@1相关。使用23个扰动的池、固定通用后缀和提示嵌入PGD的自适应压力测试均留下正松弛。

英文摘要:

We give a quantitative impossibility result for pass-only prompt hardening of code LLMs. For any deterministic prompt filter $h$ and a registered family of finite executable-equivalence task variables $\mathcal Y_{\mathrm{exec}}$, the shared filtered-prompt channel $\rmI(h(p);h(\tilde p))$ is lower-bounded by a worst-$Y$ Fano floor; on HumanEval and MBPP the universal pass-only floor evaluates to $\mathcal F^{\mathrm{op}}\ge 0.84$ and $1.20$ nats at $η=0.05$ task-collapse tolerance, and the identity row realizes $\mathcal F^{\mathrm{id}}\ge 1.67$ and $1.80$ nats. An estimator-invariance corollary lifts the floor to any deterministic embedding pipeline; a dataset-agnostic corollary states the floor in visible-spec entropy and is empirically witnessed by $164/164$ HumanEval+ and $224/224$ MBPP+ $V(p)$-invariance. We operationalize the floor as the \emph{Tri-Audit Protocol}, a two-axis reporting protocol that separates a prompt-side deductive registry attribute (Shannon nats on the visible-spec representation) from a model-side empirical proxy (KSG-1 primary, MINE secondary, on hidden states). A constrained best-of-family search over deterministic and guarded learned filters on CodeLlama-7B, Qwen2.5-Coder-7B/1.5B and DeepSeek-Coder-6.7B at $n=164$ yields the \emph{Cross-Model Tri-Audit Invariance}: of twenty-eight pass-preserving rows, twelve antecedent-preserving deterministic rows fail proxy-axis leakage reduction on every backbone with sign-invariant positive deviations, twelve antecedent-changed-of-record learned-canonicalizer rows fail proxy-axis leakage on every backbone, and four antecedent-violating rows are reported as registered-family collapse; no filter produces a shared Tri-pass on a nine-cell gate-sensitivity sweep. Pass@1 alone cannot certify code-LLM prompt hardening.

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

↑