On the Robustness of LLMs' Internal Representation of Code Correctness
- URL: http://arxiv.org/abs/2608.08266v1
- Date: Sat, 08 Aug 2026 17:56:31 GMT
- Title: On the Robustness of LLMs' Internal Representation of Code Correctness
- Abstract summary: Research shows that models' own confidence signals are poorly calibrated with actual correctness.<n>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.<n>We study this question systematically, varying how the signal is extracted from the model internals.
- Score: 0.3653697742557465
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: 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.
Related papers
- The Knowing-Saying Gap: When Probes See Errors that Confidence Misses [20.46211358172975]
Linear probes detect corrupted context in language models with near-perfect accuracy, yet this does not translate into reliable failure prediction.<n>Across multi-hop arithmetic chains, probes that detect corruption turn out to be uninformative about final answer correctness.<n>As a real-time monitor, probe-based interventions are sharply model and error-type dependent.
arXiv Detail & Related papers (2026-07-21T12:13:10Z) - CaliDist: Calibrating Large Language Models via Behavioral Robustness to Distraction [51.56484100374058]
Existing calibration methods for Large Language Models (LLMs) often overlook a critical dimension of trustworthiness: a model's behavioral robustness.<n>We introduce textscCaliDist, a novel post-hoc calibration approach that directly measures and penalizes a model's susceptibility to distraction.<n>textscCaliDist consistently achieves lower Expected Error (ECE) and Brier Score compared with strong baselines.
arXiv Detail & Related papers (2026-06-04T07:27:53Z) - How LLMs Detect and Correct Their Own Errors: The Role of Internal Confidence Signals [6.467495925520036]
Large language models can detect their own errors and sometimes correct them without external feedback.<n>We investigate this through the lens of second-order models of confidence from decision neuroscience.
arXiv Detail & Related papers (2026-04-24T06:33:32Z) - Cross-Model Disagreement as a Label-Free Correctness Signal [10.66607150500579]
Cross-model disagreement is a correctness indicator that can be dropped into existing production systems.<n>No generation from the verifying model is required, and no correctness labels are needed.<n>Results establish cross-model disagreement as a practical, training-free approach to label-free correctness estimation.
arXiv Detail & Related papers (2026-03-26T13:46:22Z) - Decomposed Prompting Does Not Fix Knowledge Gaps, But Helps Models Say "I Don't Know" [47.930782177987446]
Large language models often struggle to recognize their knowledge limits in closed-book question answering, leading to confident hallucinations.<n>We evaluate three task-equivalent prompting regimes: Direct, Assistive, and Incremental, across different model scales and multi-hop QA benchmarks.<n>Because factual knowledge is stable while hallucinations are agreement, cross-regime provides a precise signal of internal uncertainty.
arXiv Detail & Related papers (2026-02-04T18:39:58Z) - CLUE: Non-parametric Verification from Experience via Hidden-State Clustering [64.50919789875233]
We show that correctness of a solution is encoded as a geometrically separable signature within the trajectory of hidden activations.<n>ClUE consistently outperforms LLM-as-a-judge baselines and matches or exceeds modern confidence-based methods in reranking candidates.
arXiv Detail & Related papers (2025-10-02T02:14:33Z) - Probing for Arithmetic Errors in Language Models [86.8227317662622]
Internal activations in language models can be used to detect arithmetic errors.<n>We show that simple probes can accurately decode both the model's predicted output and the correct answer from hidden states.<n>We train lightweight error detectors that predict model correctness with over 90% accuracy.
arXiv Detail & Related papers (2025-07-16T16:27:50Z) - LACIE: Listener-Aware Finetuning for Confidence Calibration in Large Language Models [69.68379406317682]
We introduce a listener-aware finetuning method (LACIE) to calibrate implicit and explicit confidence markers.
We show that LACIE models the listener, considering not only whether an answer is right, but whether it will be accepted by a listener.
We find that training with LACIE results in 47% fewer incorrect answers being accepted while maintaining the same level of acceptance for correct answers.
arXiv Detail & Related papers (2024-05-31T17:16:38Z) - How Can We Know When Language Models Know? On the Calibration of
Language Models for Question Answering [80.82194311274694]
We examine the question "how can we know when language models know, with confidence, the answer to a particular query?"
We examine three strong generative models -- T5, BART, and GPT-2 -- and study whether their probabilities on QA tasks are well calibrated.
We then examine methods to calibrate such models to make their confidence scores correlate better with the likelihood of correctness.
arXiv Detail & Related papers (2020-12-02T03:53:13Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.