CCrepairBench: A High-Fidelity Benchmark and Reinforcement Learning Framework for C++ Compilation Repair

Weixuan Sun, Jucai Zhai, Dengfeng Liu, Xin Zhang, Xiaojun Wu, Qiaobo Hao, AIMgroup, Yang Fang, Jiuyang TangarXiv 2025 · DOI

Introduction

Automated program repair (APR) has traditionally focused on resolving logical bugs identified during execution. However, fixing compilation errors remains a significant hurdle, particularly in syntactically complex languages like C++. Current approaches primarily utilize Supervised Fine-Tuning (SFT), which suffers from data scarcity and the "Trivial Fix" trap—where models learn to achieve successful compilation by simply deleting problematic code rather than fixing it.

To address these challenges, we introduce CCrepairBench, a large-scale, high-fidelity dataset for C++ compilation errors, and a novel Reinforcement Learning (RL) framework. By incorporating an "LLM-as-a-Judge" to provide semantic guidance, our framework ensures that code fixes are functionally correct and semantically meaningful.

Methodology

Our approach consists of three integrated components designed to improve the quality and reliability of automated C++ repair.

Overview of the CCrepair dataset construction, hybrid evaluation environment, and reinforcement learning framework.

1. Generate-and-Verify Pipeline

We constructed CCrepairBench by scraping official Microsoft Visual C++ (MSVC) documentation. We employed a powerful LLM (Qwen3-32B) to generate diverse code snippets that trigger specific error categories. These snippets were then verified against real-world compilers (MSVC and GCC) to ensure they accurately represent compilation failures.

2. Hybrid Evaluation Framework

Standard compiler checks provide only binary feedback (pass/fail). We implemented a hybrid environment where an LLM-as-a-Judge (72B parameter model) categorizes proposed fixes into four distinct types: Genuine Fix, Trivial Deletion, Excessive Modification, or Invalid Fix. This provides the granular feedback necessary for sophisticated training.

3. Gated Reinforcement Learning

We utilized the Group Relative Policy Optimization (GRPO) algorithm to train an "Actor" model. A critical innovation is the Gated Reward Function: the model receives a compilation bonus only if the LLM-Judge confirms the fix is "Genuine." This mechanism penalizes trivial deletions and forces the model to maintain semantic integrity.

Dataset Overview

CCrepairBench contains 5,522 annotated C++ compilation error instances. It spans various difficulty levels and error types, ensuring broad coverage of the language's complexities. Additionally, we use standard benchmarks like MBPP and HumanEval to evaluate the transferability of the learned repair skills to general code generation tasks.

Key Insights and Results

The integration of semantic guidance proved essential for effective learning. Our ablation studies demonstrate the risks of unguided RL in this domain.

Ablation study and performance comparison across different model variants and judge influence settings.

The Necessity of Semantic Guidance

As shown in the experimental results, when the judge's influence is removed ($S_{judge} = 0$), the model achieves a high Compilation Success Rate (CSR) of 97.0%, but a Genuine Fix Rate (GFR) of only 0.9%. This confirms that without semantic constraints, models prioritize trivial deletions to maximize rewards. Increasing the judge's influence ($S_{judge} = 0.9$) dramatically improves the GFR to 69.4% while maintaining a high CSR.

Efficiency and Scaling

Our RL-trained 1.5B parameter model achieved a GFR of 70.8%, nearly matching the performance of the 14B parameter model (71.1%) trained with standard methods. This suggests that high-quality interactive feedback can compensate for smaller model sizes. Furthermore, training on CCrepairBench improved performance on HumanEval and MBPP, indicating that learning to fix compilation errors enhances a model's fundamental understanding of code structure.

Conclusion

CCrepairBench and its associated RL framework represent a significant step toward robust automated C++ repair. By moving beyond simple compilation checks and rewarding semantic correctness, we enable models to produce genuine fixes rather than trivial deletions. Future work will explore multi-judge ensembles and the integration of static analysis tools to further refine the reward loop.

Summary updated

BibTeX
@misc{sun2025ccrepairbench,
  author = {Weixuan Sun and Jucai Zhai and Dengfeng Liu and Xin Zhang and Xiaojun Wu and Qiaobo Hao and AIMgroup and Yang Fang and Jiuyang Tang},
  title = {{CCrepairBench: A High-Fidelity Benchmark and Reinforcement Learning Framework for C++ Compilation Repair}},
  year = {2025},
  eprint = {2509.15690},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.15690},
}
Figure