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

CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X

Qinkai Zheng, Xiao Xia, Xu Zou, Yuxiao Dong, Shan Wang, Yufei Xue, Lei Shen, Zihan Wang, Andi Wang, Yang Li, Teng Su, Zhilin Yang, Jie Tang

TL;DR

CodeGeeX is a 13-billion parameter, multilingual code generation model trained on 23 programming languages. It demonstrates strong performance on code generation and translation tasks, outperforming existing multilingual models of similar scale. The paper also introduces HumanEval-X, a new benchmark for evaluating multilingual code models, and shows that CodeGeeX can significantly improve coding efficiency for users.

What Problem Does This Paper Address?

The paper addresses the growing need for effective code generation models that can handle multiple programming languages. While large language models like OpenAI's Codex have shown promise in generating syntactically correct Python code, there's a gap in evaluating and developing models that are proficient across a diverse set of languages. Existing benchmarks like HumanEval are primarily Python-focused, and multilingual code generation models often struggle to achieve consistent performance across different languages. The authors aim to bridge this gap by introducing CodeGeeX, a multilingual model, and HumanEval-X, a benchmark designed to rigorously evaluate such models.

Methods

CodeGeeX utilizes a standard Transformer decoder-only architecture, similar to GPT-3, for autoregressive language modeling. It boasts a 39-layer decoder with multi-head self-attention and MLP layers. A key aspect is its multilingual pre-training on a massive dataset of 850 billion tokens spanning 23 programming languages. For evaluation, the authors introduce HumanEval-X, which extends the original HumanEval benchmark by manually creating problem-solution pairs in C++, Java, JavaScript, and Go, in addition to Python. This allows for the evaluation of both code generation and code translation capabilities in a functionally correct manner. They also employ quantization techniques (FP16 to INT8) and optimization with NVIDIA FasterTransformer for efficient inference.

Datasets

  • Training Data:
    • The Pile (Gao et al., 2020) and CodeParrot, containing code from 23 popular programming languages.
  • Supplementary Python, Java, and C++ data scraped from GitHub.
  • Total: 850 billion tokens.
  • Evaluation Datasets:
    • HumanEval-X: A newly introduced benchmark comprising 820 hand-written problem-solution pairs across C++, Java, JavaScript, Go, and Python. It supports both code generation and code translation tasks.
  • HumanEval: Used for Python-specific evaluation.
  • MBPP: Used for evaluating Python code generation with few-shot settings.
  • CodeXGLUE: Used for code summarization tasks.
  • XLCOST: Used for cross-lingual code translation tasks.

Key Insights and Ideas

  • Multilingualism Matters: CodeGeeX's strong performance across multiple languages highlights the benefit of training on diverse code corpora. This suggests that models can learn to generalize code generation and translation capabilities beyond a single language.
  • HumanEval-X is Crucial: The creation of HumanEval-X is a significant contribution, providing a much-needed tool for systematically evaluating multilingual code models on functional correctness, moving beyond simple string similarity metrics.
  • Trade-off in Multilingual Models: The paper observes that performance can vary significantly between language pairs in translation (e.g., A-to-B vs. B-to-A), suggesting that models might have imbalanced focus or that certain languages present unique challenges.
  • User Impact is Real: The development of CodeGeeX extensions for popular IDEs and the positive user study results (83.4% efficiency increase) demonstrate the practical utility of these models in real-world software development.

Key Results

  • Code Generation: CodeGeeX-13B consistently outperforms comparable multilingual models on HumanEval-X across Python, C++, Java, JavaScript, and Go, achieving the highest average pass@k scores. For instance, it achieves a pass@100 of 60.92% on Python, surpassing other models of similar scale.
  • Code Translation: CodeGeeX-13B-FT (fine-tuned) shows strong performance in code translation, outperforming baselines on many language pairs, particularly when translating to Python and C++.
  • Efficiency: Quantization to INT8 reduces CodeGeeX's memory consumption by 45.4% with minimal performance degradation. The optimized inference with FasterTransformer achieves very fast inference speeds.
  • User Study: 83.4% of users reported that CodeGeeX extensions improved their coding efficiency.

Limitations and Future Work

  • Model Capacity: The authors suggest that multilingual programming ability is strongly tied to model capacity. It's a research challenge to enable models to learn multiple languages efficiently, similar to how humans abstract programming concepts.
  • Reasoning Ability: While CodeGeeX can solve problems in different languages, its performance varies, indicating that it doesn't yet possess robust, general reasoning abilities across all languages. This could be due to language-specific features or training data biases.
  • Few-Shot Learning: The paper suggests exploring the few-shot ability of CodeGeeX, potentially using techniques like chain-of-thought prompting to achieve comparable performance without costly fine-tuning.
  • Professional Domain: The training corpus, largely based on open-source repositories, may not fully represent the complexities of production code. Future work could focus on incorporating more professional, closed-source code to improve performance in that domain.

Summary updated

BibTeX
@inproceedings{zheng2023codegeex,
  author = {Qinkai Zheng and Xiao Xia and Xu Zou and Yuxiao Dong and Shan Wang and Yufei Xue and Lei Shen and Zihan Wang and Andi Wang and Yang Li and Teng Su and Zhilin Yang and Jie Tang},
  title = {{CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2023},
  url = {https://openreview.net/forum?id=1WUXu66Ud8f},
}
Figure