Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

CodeGeeX

> 编程语言
Open source

CodeGeeX: An Open Multilingual Code Generation Model (KDD 2023)

8.8K stars0 likes1 views
WebsiteGitHub

About

CodeGeeX: An Open Multilingual Code Generation Model (KDD 2023)

Homepage | Blog | DEMO | Download Model | Paper | 中文

VS Code, Jetbrains, Cloud Studio supported | Join our Discord, Slack, Telegram, WeChat

The newest CodeGeeX4 has been released. | 最新一代 CodeGeeX4 模型已经正式开源。

  • CodeGeeX: A Multilingual Code Generation Model
    • News
    • Getting Started
      • Installation
      • Model Weights
      • Inference on GPUs
      • VS Code and Jetbrains Extension Guidance
    • CodeGeeX: Architecture, Code Corpus, and Implementation
    • HumanEval-X: A new benchmark for Multilingual Program Synthesis
      • Multilingual Code Generation
      • Crosslingual Code Translation
      • How to use HumanEval-X and contribute to it?
    • License
    • Citation

CodeGeeX: A Multilingual Code Generation Model

We introduce CodeGeeX, a large-scale multilingual code generation model with 13 billion parameters, pre-trained on a large code corpus of more than 20 programming languages. As of June 22, 2022, CodeGeeX has been trained on more than 850 billion tokens on a cluster of 1,536 Ascend 910 AI Processors. CodeGeeX has several unique features:

  • Multilingual Code Generation: CodeGeeX has good performance for generating executable programs in several mainstream programming languages, including Python, C++, Java, JavaScript, Go, etc. DEMO
  • Crosslingual Code Translation: CodeGeeX supports the translation of code snippets between different languages. Simply by one click, CodeGeeX can transform a program into any expected language with a high accuracy. DEMO
  • Customizable Programming Assistant: CodeGeeX is available in the VS Code extension marketplace for free. It supports code completion, explanation, summarization and more, which empower users with a better coding experience. VS Code Extension
  • Open-Source and Cross-Platform: All codes and model weights are publicly available for research purposes. CodeGeeX supports both Ascend and NVIDIA platforms. It supports inference in a single Ascend 910, NVIDIA V100 or A100. Apply Model Weights

HumanEval-X for Realistic Multilingual Benchmarking. To help standardize the evaluation of multilingual code generation and translation, we develop and release the HumanEval-X Benchmark. HumanEval-X is a new multilingual benchmark that contains 820 human-crafted coding problems in 5 programming languages (Python, C++, Java, JavaScript, and Go), each of these problems is associated with tests and solutions. Usage Available in HuggingFace

CodeGeeX achieves the highest average performance compared with other open-sourced multilingual baselines.

News

  • 2023-07-24: CodeGeeX2 has been released, more powerful, faster, and lightweight. Support 100+ languages and many new features.

  • 2023-5-16: CodeGeeX paper has been accepted by KDD 2023, Long Beach and will be represented during the conference.

  • 2023-03-30: CodeGeeX paper is now available at arxiv.

  • 2023-02-14: CodeGeeX now supports Cloud Studio, a fantastic web IDE from Tencent. Click on the badge on top of this page to quickly launch an environment to test CodeGeeX.

  • 2023-02-13: Thanks a lot to OneFlow team for adding oneflow backend for CodeGeeX's inference (Even faster than FasterTransformer under FP16!). Check more details here.

  • 2023-02: We are hosting CodeGeeX "Coding With AI" Hackathon, design cool applications based on CodeGeeX and win prizes (RTX 4090, DJI drone, etc)!

  • 2022-12-31: We release the FasterTransformer version of CodeGeeX in codegeex-fastertransformer. The INT8 accelerated version reaches an a verage speed of <15ms/token. Happy new year to everyone!

  • 2022-12-13: We release the source code of CodeGeeX VS Code extension in codegeex-vscode-extension. Follow QuickStart to start development.

  • 2022-12-11: CodeGeeX is now available for Jetbrains IDEs (IntelliJ IDEA, PyCharm, GoLand, CLion, etc), download it here.

  • 2022-12-04: We release source code of quantization (requires less GPU RAM: 27GB -> 15GB) and model parallelism (possible to run on multiple GPUs with <8G RAM).

  • 2022-09-30: We release the cross-platform source code and models weights for both Ascend and NVIDIA platforms.

Getting Started

CodeGeeX is initially implemented in Mindspore and trained Ascend 910 AI Processors. We provide a torch-compatible version based on Megatron-LM to facilitate usage on GPU platforms.

Installation

Python 3.7+ / CUDA 11+ / PyTorch 1.10+ / DeepSpeed 0.6+ are required. Install codegeex package via:

bash
git clone [email protected]:THUDM/CodeGeeX.git
cd CodeGeeX
pip install -e .

Or use CodeGeeX docker to quickly set up the environment (with nvidia-docker installed):

bash
docker pull codegeex/codegeex:latest
# To enable GPU support, clarify device ids with --device
docker run --gpus '"device=0,1"' -it --ipc=host --name=codegeex codegeex/codegeex

Model Weights

Apply and download model weights through this link. You'll receive by mail urls.txt that contains temporary download links. We recommend you to use aria2 to download it via the following command (Please make sure you have enough disk space to download the checkpoint (~26GB)):

bash
aria2c -x 16 -s 16 -j 4 --continue=true -i urls.txt 

Run the following command to get the full model weights:

bash
cat codegeex_13b.tar.gz.* > codegeex_13b.tar.gz
tar xvf codegeex_13b.tar.gz

Inference on GPUs

Have a try on generating the first program with CodeGeeX. First, specify the path of the model weights in configs/codegeex_13b.sh. Second, write the prompt (natural language description or code snippet) into a file, e.g., tests/test_prompt.txt, then run the following script:

bash
# On a single GPU (with more than 27GB RAM)
bash ./scripts/test_inference.sh <GPU_ID> ./tests/test_prompt.txt

# With quantization (with more than 15GB RAM)
bash ./scripts/test_inference_quantized.sh <GPU_ID> ./tests/test_prompt.txt

# On multiple GPUs (with more than 6GB RAM, need to first convert ckpt to MP_SIZE partitions)
bash ./scripts/convert_ckpt_parallel.sh <LOAD_CKPT_PATH> <SAVE_CKPT_PATH> <MP_SIZE>
bash ./scripts/test_inference_parallel.sh <MP_SIZE> ./tests/test_prompt.txt

VS Code and Jetbrains Extension Guidance

Based on CodeGeeX, we also develop free extentions for VS Code and Jetbrains IDEs, and more in the future.

For VS Code, search "codegeex" in Marketplace or install it here. Detailed instructions can be found in VS Code Extension Guidance. For developers, we have also released the source code in codegeex-vscode-extension, please follow QuickStart to start development.

For Jetbrains IDEs, search "codegeex" in Plugins or install it here. Make sure your IDE version is 2021.1 or later. CodeGeeX now supports IntelliJ IDEA, PyCharm, GoLand, CLion, Android Studio, AppCode, Aqua, DataSpell, DataGrip, Rider, RubyMine, and WebStorm.

CodeGeeX: Architecture, Code Corpus, and Implementation

Architecture: CodeGeeX is a large-scale pre-trained programming language model based on transformers. It is a left-to-right autoregressive decoder, which takes code and natural language as input and predicts the probability of the next token. CodeGeeX contains 40 transformer layers with a hidden size of 5,120 for self-attention blocks and 20,480 for feed-forward layers, making its size reach 13 billion parameters. It supports a maximum sequence length of 2,048.

Left: the proportion of programming languages in CodeGeeX's training data. Right: the plot of training loss against the training steps of CodeGeeX.

Code Corpus: Our training data contains two parts. The first part is from open-sourced code datasets, The Pile and CodeParrot. The Pile contains a subset of code corpus that collects public repositories with more than 100 stars from GitHub, from which we select codes in 23 popular programming languages. The second part is supplementary data directly scrapped from the public GitHub repositories that do not appear in previous datasets, including Python, Java and C++. To obtain data of potentially higher quality, repositories with at least one star and its size smaller than 10MB are chosen. A file is filtered out if it 1) has more than 100 characters per line on average, 2) is automatically generated, 3) has a ratio of alphabet less than 40%, or 4) is bigger than 100KB or smaller than 1KB. To help the model distinguish different languages, we add a language-specific prefix at the beginning of each segment in the form of [Comment sign] language: [LANG], e.g., # language: Python. For tokenization, we use the same tokenizer as GPT-2 and process whitespaces as extra tokens, resulting in a vocabulary of 50,400 tokens. In total, the code corpus has 23 programming languages with 158.7B tokens.

Training: We implement CodeGeeX in Mindspore 1.7 and tr

Issues· 190 open

View all issuesOpen on GitHub
  • #304

    邀请 codegeex 加入 GithubStarMate,让更多人发现你的作品

    Updated Sep 29, 2026
  • #303

    什么时候更新支持一下visual studio2026版本?

    Updated Sep 15, 2026
  • #302

    [Community Initiative] Help get VS Code Pet to recognize CodeGeeX!

    Updated Sep 12, 2026
  • #300

    Sigap 08

    Updated Jun 22, 2026
  • #299

    Issue in Codegeex

    Updated Jun 6, 2026
  • #279

    IDEA 2025.3无法打开

    Updated Jun 2, 2026
  • #298

    ## 问题描述 sequential-thinking MCP 服务器无法正常调用工具,尽管服务器本身可以正常启动。

    Updated May 21, 2026
  • #297

    Integration Proposal: CAJAL — Scientific Paper Agent for CodeGeeX

    Updated May 4, 2026
  • #296

    能不能支持一下rider2026

    Updated Apr 29, 2026
  • #295

    请求在VS Code扩展中添加图片上传功能

    Updated Apr 29, 2026

> Tags

Pythoncode-generationpretrained-modelstools

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言