[Paper Review] CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X
CodeGeeX is a 13B multilingual code generation model trained on 850B tokens across 23 languages, outperforming similar-scale baselines on code generation and translation, with an open-source release and HumanEval-X benchmark.
Large pre-trained code generation models, such as OpenAI Codex, can generate syntax- and function-correct code, making the coding of programmers more productive and our pursuit of artificial general intelligence closer. In this paper, we introduce CodeGeeX, a multilingual model with 13 billion parameters for code generation. CodeGeeX is pre-trained on 850 billion tokens of 23 programming languages as of June 2022. Our extensive experiments suggest that CodeGeeX outperforms multilingual code models of similar scale for both the tasks of code generation and translation on HumanEval-X. Building upon HumanEval (Python only), we develop the HumanEval-X benchmark for evaluating multilingual models by hand-writing the solutions in C++, Java, JavaScript, and Go. In addition, we build CodeGeeX-based extensions on Visual Studio Code, JetBrains, and Cloud Studio, generating 4.7 billion tokens for tens of thousands of active users per week. Our user study demonstrates that CodeGeeX can help to increase coding efficiency for 83.4% of its users. Finally, CodeGeeX is publicly accessible and in Sep. 2022, we open-sourced its code, model weights (the version of 850B tokens), API, extensions, and HumanEval-X at https://github.com/THUDM/CodeGeeX.
Motivation & Objective
- Develop a multilingual code generation model with broad language support (23 languages) and strong cross-language capabilities.
- Create and release HumanEval-X to evaluate multilingual code models on both generation and translation tasks with functional correctness.
- Provide practical tooling (IDE extensions) to improve coding productivity and demonstrate real-world impact.
- Open-source the model, weights, API, and evaluation benchmarks to enable reproducibility and further research.
Proposed method
- Adopt a GPT-style decoder architecture with 39 transformer layers for autoregressive code modeling.
- Train CodeGeeX (13B parameters) on 850B tokens from a code corpus spanning 23 languages using a two-month Ascend 910 cluster run.
- Tag input sequences with language indicators to help the model distinguish languages during training.
- Use a Top Query Layer for final token prediction and expose multiple decoding strategies (greedy, top-k, nucleus, beam search).
- Evaluate with pass@k on the HumanEval-X benchmark and via multilingual budget allocation to optimize cross-language solve rates.
- Provide inference optimizations including FP16/FP32 precision tuning, post-training quantization to INT8, and acceleration via NVIDIA FasterTransformer.

Experimental results
Research questions
- RQ1How does CodeGeeX perform on code generation across Python, C++, Java, JavaScript, and Go compared to multilingual baselines of similar scale?
- RQ2How well does CodeGeeX handle code translation between language pairs (5 languages with 20 source-target pairs) in terms of functional correctness?
- RQ3What is the impact of distributing generation budgets across multiple languages on solving performance (pass@k) for multilingual models?
- RQ4What practical benefits do CodeGeeX extensions (VS Code, JetBrains, Cloud Studio) offer in real-world coding tasks?
Key findings
- CodeGeeX outperforms multilingual baseline models of similar scale on both code generation and translation tasks in HumanEval-X.
- CodeGeeX achieves the best average performance across languages, with gains over several baselines and competitive results against larger CodeGen-Multi-16B.
- HumanEval-X comprises 164 problems with 820 language-specific solutions, enabling evaluation of cross-language generation and translation with functional correctness via test cases.
- CodeGeeX extensions in IDEs support code completion, generation, translation, and explanation, with user surveys reporting 83.4% efficiency improvement.
- The project is open-sourced (model weights for the 850B-token version), API, extensions, and HumanEval-X, released Sep 2022, and has reported substantial real-world usage (4.7B tokens generated per week).

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.