Model reference · open weights
codegeex4-all is an open-weight language model from zai-org. codegeex4-all-9b (BF16) weighs 18.8 GB; the smallest configuration that runs it is 2× RTX 3060 12 GB.
Summary of the zai-org/codegeex4-all-9b model card, 2026-10-01
What it is
| Released by | zai-org |
|---|---|
| Released | 2024-07-05 |
| Parameters | 9.4B |
| VRAM | 18.8 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory | |
|---|---|---|---|---|
| 8K each | 32K each | |||
| RTX 3060 12 GB … RTX 4060 Ti 16 GB 2 smaller cards | — | — | — | |
| RTX 3090 24 GB | 11 | 2 | 91K | 23.4 GB |
| RTX 4090 24 GB | 11 | 2 | 90K | 23.4 GB |
| RTX 5090 32 GB | 34 | 8 | 128K | 31.0 GB |
| L40S 48 GB | 72 | 18 | 128K | 44.0 GB |
| A100 80 GB | 174 | 43 | 128K | 78.2 GB |
| H100 80 GB | 161 | 40 | 128K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 208 | 52 | 128K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 248 | 62 | 128K | 107 GB |
| H200 141 GB | 339 | 84 | 128K | 138 GB |
| B200 180 GB | 451 | 112 | 128K | 176 GB |
| 2× RTX 3060 12 GB tensor parallel | 8 | 2 | 69K | 11.6 GB a card |
| 2× RTX 4060 Ti 16 GB tensor parallel | 31 | 7 | 128K | 15.4 GB a card |
| Requests at once | 8K tokens each | 32K tokens each |
|---|---|---|
| 1 | 19.9 GB | 20.9 GB |
| 5 | 21.2 GB | 26.3 GB |
| 8 | 22.2 GB | 30.3 GB |
| 16 | 24.9 GB | 41.0 GB |
| 32 | 30.3 GB | 62.5 GB |
| 64 | 41.0 GB | 105 GB |
One card, with vLLM's small-card settings.
From the model card
We introduce CodeGeeX4-ALL-9B, the open-source version of the latest CodeGeeX4 model series. It is a multilingual code generation model continually trained on the GLM-4-9B, significantly enhancing its code generation capabilities. Using a single CodeGeeX4-ALL-9B model, it can support comprehensive functions such as code completion and generation, code interpreter, web search, function call, repository-level code Q&A, covering various scenarios of software development. CodeGeeX4-ALL-9B has achieved highly competitive performance on public benchmarks, such as BigCodeBench and NaturalCodeBench. It is currently the most powerful code generation model with less than 10B parameters, even surpassing much larger general-purpose models, achieving the best balance in terms of inference speed and model performance.
Use 4.39.0<=transformers<=4.40.2 to quickly launch codegeex4-all-9b:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained("THUDM/codegeex4-all-9b", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"THUDM/codegeex4-all-9b",
torch_dtype=torch.bfloat16,
low_cpu_mem_usage=True,
trust_remote_code=True
).to(device).eval()
inputs = tokenizer.apply_chat_template([{"role": "user", "content": "write a quick sort"}], add_generation_prompt=True, tokenize=True, return_tensors="pt", return_dict=True ).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_length=256)
outputs = outputs[:, inputs['input_ids'].shape[1]:]
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
If you want to build the chat prompt manually, please make sure it follows the following format:
f"\n{system_prompt}\n\n{prompt}\n\n"
Default system_prompt:
你是一位智能编程助手,你叫CodeGeeX。你会为用户回答关于编程、代码、计算机方面的任何问题,并提供格式规范、可以执行、准确安全的代码,并在必要时提供详细的解释。
The English version:
You are an intelligent programming assistant named CodeGeeX. You will answer any questions users have about programming, coding, and computers, and provide code that is formatted correctly.
For infilling ability, please use (without system prompt):
f"\n{suffix}{prefix}\n"
Additional infos (like file path, programming language, mode) can be added. Example:
###PATH:src/example.py
###LANGUAGE:Python
###MODE:BLOCK
| Model | Seq Length | HumanEval | MBPP | NCB | LCB | HumanEvalFIM | CRUXEval-O |
|---|---|---|---|---|---|---|---|
| Llama3-70B-intruct | 8K | 77.4 | 82.3 | 37.0 | 27.4 | - | - |
| DeepSeek Coder 33B Instruct | 16K | 81.1 | 80.4 | 39.3 | 29.3 | 78.2 | 49.9 |
| Codestral-22B | 32K | 81.1 | 78.2 | 46.0 | 35.3 | 91.6 | 51.3 |
| CodeGeeX4-All-9B | 128K | 82.3 | 75.7 | 40.4 | 28.5 | 85.0 | 47.1 |
The model weights are licensed under the following License.
If you find our work helpful, please feel free to cite the following paper:
@inproceedings{zheng2023codegeex,
title={CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X},
author={Qinkai Zheng and Xiao Xia and Xu Zou and Yuxiao Dong and Shan Wang and Yufei Xue and Zihan Wang and Lei Shen and Andi Wang and Yang Li and Teng Su and Zhilin Yang and Jie Tang},
booktitle={Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
pages={5673--5684},
year={2023}
}
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.