M2RC-EVAL: Massively Multilingual Repository-level Code Completion Evaluation

Jiaheng Liu, Ken Deng, Congnan Liu, Jian Yang, Shukai Liu, He Zhu, Peng Zhao, Linzheng Chai, Yanan Wu, Ke Jin, Ge Zhang, Zekun Moore Wang, Guoan Zhang, Yingshui Tan, Bangyu Xiang, Zhaoxiang Zhang, Wenbo Su, Bo Zheng

Large Language Models (LLMs) have transformed software development, yet evaluating their performance remains a challenge. Traditional benchmarks often focus on single-file "fill-in-the-blank" tasks in a handful of popular languages. However, real-world development happens at the repository level, where understanding cross-file dependencies is crucial.

Bridging the Gap in Code Completion

Researchers from Nanjing University and Alibaba Group have introduced M2RC-EVAL, a benchmark designed to evaluate LLMs on repository-level code completion across 18 diverse programming languages. This benchmark addresses the "language monoculture" of previous evaluations and provides granular insights into model performance.

The M2RC-EVAL benchmark covers 18 programming languages, ranging from C++ and Rust to Haskell and Lua.

Methodology: Fine-Grained Repository Awareness

M2RC-EVAL moves beyond random masking. It uses Abstract Syntax Tree (AST) parsing via Tree-sitter to identify meaningful completion targets like function definitions and expressions.

The benchmark introduces two primary axes for evaluation:

  1. Bucket-level (Structural Depth): Completion targets are categorized by their depth in the AST (1-10), testing if models struggle more with top-level declarations or deep nested logic.
  2. Semantic-level (Functional Category): Code is mapped to 11 categories, such as Program Structure or Control Flow, to identify specific functional weaknesses.
Examples of repository-level code completion tasks in Python, Java, and TypeScript, showing cross-file context and fine-grained annotations.

To simulate a developer's environment, the benchmark employs Retrieval-Augmented Generation (RAG), providing the model with relevant snippets from other files in the repository.

M2RC-INSTRUCT: Training for Repository Context

Alongside the benchmark, the authors released M2RC-INSTRUCT, a dataset of 50,000 files per language. This dataset is specifically designed for Supervised Fine-Tuning (SFT) to teach models how to effectively utilize cross-file context.

Key Insights and Results

The evaluation of models like StarCoder, DeepSeekCoder, and Code Llama yielded several critical findings:

  • "Shallow" Structures are Challenging: Models often find top-level declarations (shallow AST nodes) harder to complete than deep logic. This is because shallow nodes frequently depend on global repository knowledge (imports, configurations) rather than local context.
  • The Impact of Instruction Tuning: Fine-tuning on M2RC-INSTRUCT significantly boosted performance. A 3B model fine-tuned on this data could outperform a 7B base model using only retrieval.
  • Performance Gains: The combination of retrieval and instruction tuning achieved an average Exact Match (EM) of 46.8% and an Edit Similarity (ES) of 74.1% across all 18 languages. Syntax accuracy also improved to 96.9%.

Conclusion

M2RC-EVAL sets a new standard for evaluating general code intelligence. By providing a massively multilingual, repository-level benchmark with fine-grained annotations, it allows researchers to pinpoint exactly where LLMs succeed or fail in complex software environments. Future work will expand this framework to include more diverse tasks like debugging and refactoring.

Summary updated

BibTeX
@inproceedings{liu2025m,
  author = {Jiaheng Liu and Ken Deng and Congnan Liu and Jian Yang and Shukai Liu and He Zhu and Peng Zhao and Linzheng Chai and Yanan Wu and Ke Jin and Ge Zhang and Zekun Moore Wang and Guoan Zhang and Yingshui Tan and Bangyu Xiang and Zhaoxiang Zhang and Wenbo Su and Bo Zheng},
  title = {{M2RC-EVAL: Massively Multilingual Repository-level Code Completion Evaluation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure