arXiv:2608.08266cs.SEcs.AI2026-08被引 1

探究大模型代码正确性内部信号的可靠性,发现其效果受提取方式影响且无法通过故障隔离提升。

On the Robustness of LLMs' Internal Representation of Code Correctness

  • 通过对比正确与错误代码的隐藏状态,提取内部正确性信号
  • 不同提取方式下信号表现差异大,无最优配置
  • 仅修改故障点的程序对信号质量无提升,说明非鲁棒机制

现代语言模型生成的代码虽读起来自然,但常未能实现预期功能。研究显示模型自身置信度与实际正确性关联较弱。一种有前景的方法是分析模型内部:通过对比正确与错误程序的隐藏状态,可捕捉到优于词元级置信度的内部正确性信号,且无需执行测试。然而该信号基于特定提取方式,其是否反映模型的稳定属性仍未知。本文系统研究不同提取策略的影响,并构建仅在故障点不同的程序对,以检验数据来源对信号质量的限制。结果表明:不存在单一最优配置;故障隔离未提升信号性能。

原文摘要 · Abstract (English)

Code generated by modern language models often reads naturally. Yet, it also often fails to implement what was asked. This should be no surprise, as research shows the models' own confidence signals are poorly calibrated with actual correctness. A promising way to assess correctness looks inside the model: by contrasting the hidden states of correct and incorrect programs, recent work captured an internal signal of code correctness that is able to judge candidate solutions better than the model's token-level or stated confidence, with no test execution. However, this signal was captured under one particular way, leaving open an important question: whether it reflects a robust property of the model or an artifact of that choice. We study this question systematically, varying how the signal is extracted from the model internals. Besides this, we also ask if the signal's quality is limited by the data used to extract it, by constructing program pairs that differ only in the fault that makes them incorrect. Our results show that no single configuration is best, and that isolating the fault does not help.

大模型代码正确性内部表示鲁棒性

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