Self-Improving Code Generation via Semantic Entropy and Behavioral Consensus Conference: 34th IEEE/ACM International Conference on Program Comprehension; April 12–13, 2026; Rio de Janeiro, Brazil 34th IEEE/ACM International Conference on Program Comprehension (ICPC ’26), April 12–13, 2026, Rio de Janeiro, Brazil DOI: 10.1145/3794763.3794798 ISBN: 979-8-4007-2482-4/2026/04 CCS: Software and its engineering Automatic programming
Huan Zhang, Wei Cheng, Wei Hu · 2026
Read Self-Improving Code Generation via Semantic Entropy and Behavioral Consensus Conference: 34th IEEE/ACM International Conference on Program Comprehension; April 12–13, 2026; Rio de Janeiro, Brazil 34th IEEE/ACM International Conference on Program Comprehension (ICPC ’26), April 12–13, 2026, Rio de Janeiro, Brazil DOI: 10.1145/3794763.3794798 ISBN: 979-8-4007-2482-4/2026/04 CCS: Software and its engineering Automatic programming by Huan Zhang, Wei Cheng, Wei Hu (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2603-29292.txt.
Introduction
Zhang and co-authors present ConSelf, a way for code models to improve without a teacher or test oracle. Fine-tuning usually needs costly external help. Their first tool is code semantic entropy. It measures how varied the behaviors of sampled programs are. That score builds a curriculum of the most learnable problems. Their second tool weights preference pairs by behavioral consensus. Noisy self-made supervision then does less damage. Experiments show gains over baselines on several benchmarks.
Catalog record
| CREATOR | Huan Zhang, Wei Cheng, Wei Hu |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 59471 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2603.29292
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Self-Improving Code Generation via Semantic Entropy and Behavioral Consensus Conference: 34th IEEE/ACM International Conference on Program Comprehension; April 12–13, 2026; Rio de Janeiro, Brazil 34th IEEE/ACM International Conference on Program Comprehension (ICPC ’26), April 12–13, 2026, Rio de Janeiro, Brazil DOI: 10.1145/3794763.3794798 ISBN: 979-8-4007-2482-4/2026/04 CCS: Software and its engineering Automatic programming Huan Zhang, Wei Cheng, Wei Hu Abstract . Improving the code generation capabilities of large language models (LLMs) typically relies on supervised fine-tuning or preference optimization, both of which require costly external resources such as powerful teacher models or reliable test units. However, in real-world scenarios, it is much harder to obtain reference solutions and test oracles than problem descriptions and test inputs. In this paper, we tackle a challenging yet realistic question: Can a code language model improve itself without access to a superior teacher and a test oracle? To answer this, we propose ConSelf , a self-improving approach built upon two key ideas. First, we introduce code semantic entropy , a novel metric that measures problem-level uncertainty by assessing the functional diversity of program behaviors, enabling a curriculum construction with the most learnable problems. Second, we present consensus-driven direct preference optimization (Con-DPO) , a preference-based fine-tuning method that weights each preference pair by its behavioral consensus, thereby mitigating the impact of noisy self-generated supervision. Experiments on various benchmarks and backbone LLMs demonstrate that ConSelf significantly outperforms baselines, validating the effectiveness of semantic entropy-based curriculum construction and consensus-driven optimization in improving code generation without external supervision. † † cc-license: by 1. Introduction Automated code generation has become increasingly vital in modern software development, significantly enhancing programming productivity and reducing development costs. Large language models (LLMs) have demonstrated remarkable progress in this area, with recent models ( 39 ; 40 ; 13 ; 20 ) achieving impressive performance across a range of code-related tasks and benchmarks. As the field evolves, researchers have explored various directions to further improve code generation capabilities. One important research direction is to improve the performance of open-source models, which are more accessible but often lag behind proprietary alternatives. The predominant paradigm for improving these models is supervised fine-tuning (SFT) on large volumes of high-quality annotated data. Since manual annotation at scale is prohibitively expensive, numerous data synthesis approaches ( 36 ; 50 ; 1 ; 51 ) have emerged. These approaches typically rely on powerful teacher models to generate diverse problem descriptions paired with reference solutions, which are then used to train target models. Beyond direct SFT, preference-based approaches ( 45 ; 56 ; 57 ; 54 ; 11 ) have also shown promise by constructing preference pairs to guide model training. These approaches generally leverage the execution results of candidate programs on test cases to establish preferences, driving the model to generate preferred code that is functionally correct or more efficient. Candidate programs used for preference construction are typically sampled from a teacher model ( 56 ; 57 ) or generated by the model itself ( 54 ; 11 ; 45 ) . While effective, these approaches hinge on two costly prerequisites: access to a powerful teacher model or the availability of trustworthy test cases. First, relying on a superior teacher model is not always feasible, as a more capable model may not always exist for specialized or frontier domains. Moreover, many data synthesis practices typically depend on proprietary LLMs through paid APIs, which introduce significant costs, potential licensing or compliance issues ( 49 ) , limiting reproducibility and broader adoption. Second, the use of test cases (consisting of test inputs and corresponding oracles) poses another fundamental barrier. Although test inputs can often be synthesized automatically using conventional tools ( 10 ; 35 ) or LLM-based techniques ( 4 ; 24 ; 30 ; 33 ; 23 ) , obtaining reliable test oracles remains a persistent challenge, commonly referred to as the test oracle problem ( 3 ) in software testing. Even state-of-the-art LLMs frequently struggle to produce correct oracles ( 47 ; 34 ; 6 ; 16 ) , leading to false positives that degrade training quality. Efforts to improve oracle quality via external tools ( 29 ) or additional fine-tuning ( 8 ; 42 ; 16 ; 37 ) invariably add to significant cost and complexity. This disparity motivates our research question: Can a code language model effectively improve itself with access only to problem descriptions and test inputs, without relying on a superior teacher model or pre-existing test oracles? This reflects a challenging yet realistic scenario: problem descriptions and test inputs are relatively easy to obtain, whereas reference solutions and reliable test oracles remain expensive and labor-intensive. Figure 1. The dilemma of learning from “noisy data” generated for an intractable problem. When all self-generated solutions are flawed, any learning method (SFT/DPO) becomes futile, highlighting the need to identify and filter out such problems. The dilemma of learning from ``noisy data'' generated for an intractable problem. When all self-generated solutions are flawed, any learning method (SFT/DPO) becomes futile, highlighting the need to identify and filter out such problems. In this unsupervised setting, a fundamental challenge arises: Not all problems are equally learnable. Without external supervision, the model must depend solely on its self-generated outputs. However, for problems that exceed the model’s current capabilities, these outputs are often highly noisy and devoid of meaningful learning signals. Figure 1 illustrates this dilemma using the example of count_primes(n) . For such a challenging problem, the model may produce several distinct yet flawed solutions. This diversity of erroneous behaviors makes it nearly impossible for standard self-training approaches ( 18 ; 24 ) to identify a reliable learning direction, resulting in what we refer to as “noisy data”. Training on such low-quality data not only fails to improve the model but also degrades the overall performance and squanders training resources. Moreover, some problems may already be mastered by the model, offering little marginal value for further training. We argue that effective unsupervised self-improvement for code generation necessitates a dual-pronged strategy that addresses two complementary challenges. First, what to learn? Select suitable problems and construct a high-quality, learnable curriculum derived from the model’s own outputs. Second, how to learn? Design a robust training algorithm to extract meaningful learning signals while tolerating residual noise in the constructed training samples. In this paper, we propose ConSelf , a consensus-guided approach for self-improving code generation. To address the challenge of what to learn , we introduce a novel metric, code semantic entropy , which quantifies the model’s epistemic uncertainty for each problem by measuring the diversity of execution behaviors across multiple generated samples. High semantic entropy indicates that the model lacks a coherent solving strategy for a given problem. Training on such outputs would likely be unproductive. ConSelf implements this insight via a simple yet effective entropy-based filtering mechanism, ensuring that training focuses on problems for which the model can produce meaningful, low-entropy solutions. As we show shortly, this behavioral metric offers a substantially more reliable indicator of problem difficulty than conventional internal confidence scores, such as token-level entropy and log-likelihood ( 12 ) . To address the challenge of how to learn , we move beyond the standard direct preference optimization (DPO) paradigm ( 43 ) . We argue