CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding & Reasoning Capabilities of CodeLLMs

Dung Manh Nguyen, Thang Chau Phan, Nam Le Hai, Tien-Thong Doan, Nam V. Nguyen, Quang Pham, Nghi D. Q. Bui

Introduction

Recent advances in Code Large Language Models (CodeLLMs) have primarily focused on open-ended code generation, often overlooking the crucial aspect of code understanding and reasoning. To bridge this gap, researchers have introduced CodeMMLU, a massive new benchmark of nearly 20,000 multiple-choice questions designed to move beyond simple code generation. The results serve as a wake-up call: even top-tier models that excel at generating code often fail to reason about its execution or identify subtle defects, revealing a significant gap between "coding by rote" and true software comprehension.

The Need for Comprehension Benchmarks

Most current benchmarks for CodeLLMs, such as HumanEval or MBPP, focus heavily on open-ended generation (e.g., "Write a function that does X"). While useful, these benchmarks suffer from two major flaws:

  1. Data Leakage: Models may simply be reciting code they memorized during training rather than synthesizing new solutions.
  2. Superficial Understanding: Being able to generate a snippet doesn't prove a model understands the underlying logic, edge cases, or broader software engineering principles.

For AI to become a reliable "co-pilot," it needs to do more than autocomplete. It must reason about code repair, predict execution outputs, and understand architectural principles. CodeMMLU shifts the evaluation paradigm from "can you write this?" to "do you understand how this works?"

Constructing CodeMMLU

The researchers developed CodeMMLU as a comprehensive Multiple-Choice Question (MCQ) benchmark. The MCQ format allows for objective, scalable evaluation and makes it significantly harder for models to "hallucinate" their way to a correct answer without understanding the underlying logic.

CodeMMLU construction pipeline showing knowledge-based and fundamental coding skill extraction.

The creation process involved two main pipelines:

  • Knowledge-Based Tasks: Crawling educational platforms (like W3Schools and GeeksforGeeks) and web data (CommonCrawl) to gather questions on syntax, APIs, and software principles.
  • Fundamental Coding Skills: Transforming existing codebases (like HumanEval, LeetCode, QuixBugs, and IBM CodeNet) into MCQ challenges. For example, researchers took standard coding problems and used LLMs to generate "plausible but incorrect" distractors—code snippets that look correct but fail specific test cases.

To ensure high quality, the team employed a multi-stage filtering process involving LLM-based "judges" to check for clarity, alongside execution-based filters to guarantee that the "wrong" answers were genuinely incorrect when run.

Key Insights: The Limits of Current CodeLLMs

The evaluation of various models on CodeMMLU yielded several surprising insights into how current AI systems process code:

  • The "Over-Reasoning" Trap: Surprisingly, Chain-of-Thought (CoT) prompting—asking a model to "think step-by-step"—actually impaired performance on many knowledge-based tasks. Models often "over-reasoned" themselves into a wrong answer on simple factual questions.
  • Generation $\neq$ Comprehension: There is only a weak correlation between a model's success on open-ended generation benchmarks and its performance on CodeMMLU. A model might pass a HumanEval test but fail to pick the correct completion for the exact same problem in an MCQ format, suggesting a reliance on probabilistic pattern matching rather than robust logic.
  • Selection Bias: Models proved incredibly sensitive to the order of choices. Moving the correct answer from position "A" to "C" could cause a model's accuracy to plummet, highlighting a lack of robustness.
  • Scaling Laws are Family-Specific: While larger models generally perform better, architecture and data quality often trump raw parameter count. For instance, a 7B model from a strong family (like Llama 3) frequently outperformed a 30B model from a weaker family.

Model Performance and the Execution Gap

Extensive testing across the nearly 20,000 questions (spanning 52 topics and 10+ programming languages) revealed clear leaders and notable weaknesses.

Radar chart comparing top models across various CodeMMLU task categories.
  • Proprietary Dominance: GPT-4o and Claude 3.5 Sonnet consistently led the pack, with GPT o3-mini achieving the highest overall score (62.36%).
  • Open-Source Leaders: The Llama 3.1 and DeepSeek families emerged as the strongest open-source contenders. Llama 3.1 405B scored 58.23%, rivaling top proprietary models.
  • The Execution Gap: Across the board, models struggled most with Execution Prediction (predicting the output of a given snippet). Even the best models saw a significant performance drop in this category compared to simpler syntax questions.
  • Reasoning Models: Interestingly, "reasoning-heavy" models like DeepSeek-R1 underperformed compared to their base versions (DeepSeek V3) on CodeMMLU, likely due to the "over-reasoning" penalty on knowledge-seeking tasks.

Conclusion and Future Directions

CodeMMLU provides a critical resource for advancing more reliable and capable coding assistants by emphasizing the essential connection between code understanding and effective AI-assisted development.

The authors acknowledge that while MCQs are a powerful evaluation tool, they remain a proxy for real-world software engineering. A model might excel at answering a question about a "diff" but still struggle to integrate that fix into a massive, complex codebase. Future work will focus on expanding the benchmark to include more "agentic" tasks—where the model must interact with a file system or debugger—and investigating methods to mitigate the selection biases that currently plague LLM evaluations.

Summary updated

BibTeX
@inproceedings{nguyen2025codemmlu,
  author = {Dung Manh Nguyen and Thang Chau Phan and Nam Le Hai and Tien-Thong Doan and Nam V. Nguyen and Quang Pham and Nghi D. Q. Bui},
  title = {{CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding \& Reasoning Capabilities of CodeLLMs}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=CahIEKCu5Q},
}
Figure