NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

CODE-DITING: A Reasoning-Based Metric for Functional Alignment in Code Evaluation

Guang Yang, Yu Zhou, Xiang Chen, Wei Zheng, Xing Hu, Xin Zhou, David Lo, Taolue ChenarXiv 2025 · DOI

Abstract

As Large Language Models (LLMs) increasingly dominate software development, the need for accurate, efficient, and transparent code evaluation metrics has become critical. Traditional reference-based and test-based metrics often fall short in flexibility or security. This paper introduces CODE-DITING, a framework that distills the reasoning capabilities of massive models like DeepSeek-R1 into compact 1.5B and 7B parameter versions. By internalizing reasoning paths, these smaller models outperform industry giants like GPT-4o and DeepSeek-V3 in judging code correctness while providing explainable feedback. Our results demonstrate that high-quality reasoning distillation allows small models to achieve superior functional alignment and robustness in code evaluation.

Introduction

The "judging the judge" problem is a significant hurdle in LLM-based code generation. Current evaluation methods generally fall into two categories, each with distinct drawbacks:

  1. Reference-based metrics (e.g., BLEU): These measure surface-level similarity to human-written examples, often penalizing functionally correct code that deviates from the reference style.
  2. Test-based metrics (e.g., Pass@k): These rely on executing code against test cases. While accurate, they require exhaustive human-authored tests and secure execution environments to mitigate risks from potentially malicious code.

While the industry has pivoted toward "LLM-as-Judge" approaches, general-purpose models often lack transparency and require expensive, complex prompting. Specialized reasoning models, while effective, are typically too large for high-frequency evaluation tasks. CODE-DITING addresses these challenges by creating efficient, reasoning-capable judges.

Methodology

The CODE-DITING framework is built upon three technical pillars designed to optimize accuracy and efficiency:

1. Reasoning Knowledge Distillation

The authors utilized the DeepSeek-R1-671B model to generate detailed "reasoning paths" for 17,000 code samples. This process transforms a simple binary label (Correct/Incorrect) into a rich dataset where the model explains the logic behind its verdict. This distillation allows smaller models to learn the underlying principles of code evaluation rather than just memorizing patterns.

2. Efficient Training with PiSSA and LoRA

To train the 1.5B and 7B models, the framework employs Low-Rank Adaptation (LoRA) combined with Principal Singular Vector Adaptation (PiSSA). PiSSA enhances the training process by initializing based on the most significant components of the model's architecture, leading to faster convergence and improved performance on specialized tasks.

3. Majority Vote Inference

To stabilize evaluation results and minimize hallucinations, CODE-DITING uses a majority vote mechanism. During inference, the model generates multiple independent reasoning paths (T=7) for a single code snippet. The final decision is determined by the consensus of these outputs, significantly increasing the reliability of the judge.

Datasets and Benchmarks

The researchers developed several high-coverage benchmarks to rigorously test the judging capabilities of LLMs:

  • Enhanced Benchmarks: HumanEval-Judge, MBPP-Judge, and BigCodeBench-Judge were curated with near 100% test coverage to ensure ground-truth labels are indisputable.
  • CODEJUDGE-17K: A specialized training dataset containing 17,000 samples, each featuring natural language descriptions, code snippets, correctness labels, and distilled reasoning paths.

Key Results and Insights

Performance and Efficiency

CODE-DITING 7B demonstrated remarkable efficiency, surpassing GPT-4o and DeepSeek-V3 671B in evaluation accuracy while utilizing only 1% of the parameters. Even the 1.5B version performed at a level typically reserved for models five times its size, proving that specialized reasoning distillation is a powerful alternative to raw scale.

Robustness and Consistency

The model exhibited a 93-98% agreement rate when evaluating code from diverse model families (e.g., GPT-4o, Claude), indicating a strong resistance to "preference leakage"—the tendency of judges to favor code styles similar to their own training data. Furthermore, the models remained accurate even when problem descriptions were paraphrased, showcasing a deep semantic understanding of functional requirements.

Conclusion and Future Work

CODE-DITING proves that small, reasoning-focused models can serve as highly effective and transparent judges for code generation. While currently focused on function-level Python tasks, future work aims to expand the framework to other programming languages and more complex, repository-level evaluations. Additionally, CODE-DITING holds potential as a reward model for reinforcement learning, providing the high-quality, explainable feedback necessary to train the next generation of code-generating LLMs.

Summary updated

BibTeX
@misc{yang2025code,
  author = {Guang Yang and Yu Zhou and Xiang Chen and Wei Zheng and Xing Hu and Xin Zhou and David Lo and Taolue Chen},
  title = {{CODE-DITING: A Reasoning-Based Metric for Functional Alignment in Code Evaluation}},
  year = {2025},
  eprint = {2505.19502},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.19502},
}
Figure