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

Beyond Correctness: Benchmarking Multi-dimensional Code Generation for Large Language Models

Jiasheng Zheng, Boxi Cao, Zhengzhao Ma, Ruotong Pan, Hongyu Lin, Yaojie Lu, Xianpei Han, Le Sun · DOI

Abstract

Large Language Models (LLMs) have revolutionized code generation, yet evaluation remains largely focused on functional correctness. This paper introduces the RACE benchmark, a multi-dimensional framework evaluating Readability, mAintainability, Correctness, and Efficiency. By moving beyond simple unit tests, RACE reveals that even state-of-the-art models struggle with complex stylistic and performance constraints, often masking a lack of true understanding through memorization.

Introduction: The "Correctness" Trap

In the current landscape of AI-driven software development, functional correctness—measured by benchmarks like HumanEval and MBPP—has become the primary metric for success. However, professional software engineering demands more than just code that "works." High-quality code must be readable by peers, maintainable over time, and efficient enough for production environments.

Figure 1: Comparison between existing correctness-based benchmarks and the multi-dimensional RACE benchmark.

Furthermore, the prevalence of benchmark solutions in training data leads to data contamination, where models recite memorized answers rather than solving problems. The RACE benchmark addresses these gaps by evaluating if models can follow nuanced user requirements across multiple dimensions.

The RACE Framework

The authors propose evaluating code across four key dimensions using a "demand-dependent" approach, where specific constraints are provided in the prompt.

Figure 6: The RACE evaluation pipeline, from framework design and requirement customization to automated measurement.
  1. Readability (R): Assessed via static analysis of code length, naming conventions (e.g., snake_case vs. camelCase), and documentation.
  2. mAintainability (M): Measured using the Maintainability Index (MI)—incorporating Halstead Volume and Cyclomatic Complexity—and Modularity, checking the model's ability to decompose logic into sub-functions.
  3. Correctness (C): The baseline requirement of passing functional test cases.
  4. Efficiency (E): Evaluated using a Normalized Index (NI) that benchmarks execution time and memory usage against optimized human solutions.

The evaluation pipeline utilizes Abstract Syntax Trees (ASTs) and runtime monitoring to provide objective, automated scoring.

Experimental Setup

RACE is built upon four established datasets to ensure task diversity:

  • HumanEval+ and MBPP+: Standard logic problems.
  • ClassEval: Complex, class-level generation.
  • LeetCode: Competitive programming tasks for efficiency and modularity testing.

The final benchmark includes 923 cases for correctness, supplemented by hundreds of variations designed to test specific readability, maintainability, and efficiency constraints.

Key Insights and Results

The study reveals several critical gaps in current LLM capabilities:

The "Complexity Wall"

As the number of constraints increases (e.g., combining style, modularity, and efficiency), the performance of even top models like GPT-4o and o1-mini drops significantly. The "Instruction Following" (IF) rate often approaches zero when five or more simultaneous requirements are imposed.

Preference Bias and Contamination

Models exhibit strong "personalities" derived from their training data. For instance, Python models often struggle to use camelCase even when explicitly instructed, defaulting to the standard snake_case. More importantly, RACE serves as a "lie detector" for contamination: models that pass standard tests often fail when asked to solve the same problem using different logical structures (e.g., a while loop instead of a for loop).

Performance Leaders

o1-mini and Claude-3.5-Sonnet emerged as the top performers. o1-mini achieved the highest overall RACE score (63.5), excelling in correctness and time complexity. However, modularity remains a widespread weakness; most models scored below 45% in their ability to correctly structure code into requested sub-functions.

Conclusion

The RACE benchmark highlights that "how" code is written is as vital as "what" it does. Current RLHF processes focus heavily on correctness, but there is a clear need for multi-dimensional alignment to produce models that truly understand software engineering principles. Future work will expand RACE to other programming languages and explore new training algorithms to bridge the gap between functional correctness and professional code quality.

Summary updated

BibTeX
@misc{zheng2024beyond,
  author = {Jiasheng Zheng and Boxi Cao and Zhengzhao Ma and Ruotong Pan and Hongyu Lin and Yaojie Lu and Xianpei Han and Le Sun},
  title = {{Beyond Correctness: Benchmarking Multi-dimensional Code Generation for Large Language Models}},
  year = {2024},
  eprint = {2407.11470},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.11470},
}
Figure