Qwen3代码正确性在隐藏状态中的可解码性
Code Correctness Signals in LLM Hidden States: Pre-Generation Probing and Repair Geometry
论文揭示Qwen3隐藏状态如何预测代码正确性
该论文使用Qwen3-4B-Instruct模型在444个LiveCodeBench任务上研究代码正确性信号。
首次尝试的代码正确性可从提示最终隐藏状态线性解码,无泄漏AUC为0.931±0.
008。去除提示长度线性效应后AUC仍为0.
911±0.010,高于基线0.
754±0.014。
在236个修复案例中,隐藏状态变化存在对比方向,但去除修复上下文协变量后不显著,表明其为修复上下文相关特征。
Code Correctness Signals in LLM Hidden States: Pre-Generation Probing and Repair Geometry
Large language models encode rich information in their hidden states. This work asks whether code correctness is legible in the hidden states of Qwen3-4B-Instruct-2507, before it generates and as it repairs a failed attempt, studied on 444 LiveCodeBench tasks. It reports two findings connected by a single confound-control tool: residualization. First, the correctness of the model's first-attempt code is linearly decodable from the prompt-final hidden state, with a leakage-free held-out AUC of 0.931 +/- 0.008 across 50 outer splits. After the linear effect of prompt length is removed from each hidden state dimension, the probe still reaches 0.911 +/- 0.010, well above a prompt-length baseline of 0.754 +/- 0.014. Second, on 236 cleaned cases where the model attempts to repair a failed first attempt, the hidden state shift from the failing attempt to its repair carries a statistically detectable contrastive direction, significant on both a magnitude and a split-half test against label-shuffled nulls. This direction does not survive a conditional residualization against repair-context covariates that differ between successful and failed repairs, marking it as a correlate of repair success driven by the repair context rather than an isolated repair-comprehension feature. The probe layer is selected by nested cross-validation, and the same residualization approach that upholds the pre-generation correctness result overturns the repair-direction interpretation. The contribution is as much methodological as empirical: a diagnostic honest enough to report a negative result alongside a positive one.
This report is categorized under AITOP's "Papers" desk, focusing on China's AI industry and domestic foundation model ecosystem. Key entities and technical topics under continuous tracking include Qwen3, code correctness, hidden states, LiveCodeBench.
Source attribution: curated from arXiv cs.LG (@Carlo Di Cicco).