研究比较六种免执行代码正确性预测器在分布偏移下的表现
Which Signals of Code Correctness Survive Distribution Shift? Hidden-State and Causal Predictors of Program and Verdict Correctness
让模型自己判断代码对不对,又不想跑测试?这篇论文测了六种免执行预测器在换语言、换基准后还靠不靠谱,结论很具体。
论文在 Qwen3-Coder-30B 和 gpt-oss-20b 上比较了来自四个家族的六种免执行代码正确性预测器,涵盖 LiveCodeBench 与 BigCodeBench 之间的基准偏移,以及 Python、C++、Java 三种语言之间的语言偏移。作者将两种因果定位方法迁移到代码场景。在判定正确性任务上,因果定位在 Qwen3-Coder 上的语言偏移场景领先输出置信度 0.09 AUROC,平均超过最佳非因果预测器 0.04 AUROC,但该优势在 gpt-oss 和基准偏移下不成立。在程序正确性任务上,预测器跨基准迁移较好,但难以在同一问题的候选解之间排序。
Which Signals of Code Correctness Survive Distribution Shift? Hidden-State and Causal Predictors of Program and Verdict Correctness
Large language models increasingly judge code, yet without external feedback such judgments are unreliable, and verifying them by executing tests or by extended reasoning is costly. Instead, execution-free correctness predictors use signals from the model's output probabilities, sampled solutions, or hidden states to identify judgments that warrant further verification. However, these predictors may degrade under distribution shifts when generalizing across projects and languages. We compare six execution-free predictors from four families on Qwen3-Coder-30B and gpt-oss-20b under benchmark shift between LiveCodeBench and BigCodeBench and language shift across Python, C++ and Java. We evaluate two targets: whether the model's own verdict on a program can be trusted, and whether the program itself is correct. Besides established approaches, we adapt two novel causal localization methods to code, which have been shown to be more robust out-of-distribution on natural language tasks. For verdict correctness, causal localization improves robustness to language shift. For Qwen3-Coder a probe on the causally localized subspace stays 0.09 AUROC ahead of output confidence under language shift (0.11 in distribution), significantly outperforming the best non-causal predictor by 0.04 AUROC on average. This advantage, however, does not generalize consistently to gpt-oss or to benchmark shift. For program correctness, predictors transfer more successfully between benchmarks, largely by identifying problems on which the model tends to fail. However, their ability to rank candidates within the same problem is limited.