Papers › ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools

ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools

18 Jun 2024arXiv:2406.12793archive 2025-07-28

Team GLM, :, Aohan Zeng, Bin Xu, Bowen Wang, Chenhui Zhang, Da Yin, Dan Zhang, Diego Rojas, Guanyu Feng, Hanlin Zhao, Hanyu Lai, Hao Yu, Hongning Wang, Jiadai Sun, Jiajie Zhang, Jiale Cheng, Jiayi Gui, Jie Tang, Jing Zhang, Jingyu Sun, Juanzi Li, Lei Zhao, Lindong Wu, Lucen Zhong, Mingdao Liu, Minlie Huang, Peng Zhang, Qinkai Zheng, Rui Lu, Shuaiqi Duan, Shudan Zhang, Shulin Cao, Shuxun Yang, Weng Lam Tam, Wenyi Zhao, Xiao Liu, Xiao Xia, Xiaohan Zhang, Xiaotao Gu, Xin Lv, Xinghan Liu, Xinyi Liu, Xinyue Yang, Xixuan Song, Xunkai Zhang, Yifan An, Yifan Xu, Yilin Niu, Yuantao Yang, Yueyan Li, Yushi Bai, Yuxiao Dong, Zehan Qi, Zhaoyu Wang, Zhen Yang, Zhengxiao Du, Zhenyu Hou, Zihan Wang

We introduce ChatGLM, an evolving family of large language models that we have been developing over time. This report primarily focuses on the GLM-4 language series, which includes GLM-4, GLM-4-Air, and GLM-4-9B. They represent our most capable models that are trained with all the insights and lessons gained from the preceding three generations of ChatGLM. To date, the GLM-4 models are pre-trained on ten trillions of tokens mostly in Chinese and English, along with a small set of corpus from 24 languages, and aligned primarily for Chinese and English usage. The high-quality alignment is achieved via a multi-stage post-training process, which involves supervised fine-tuning and learning from human feedback. Evaluations show that GLM-4 1) closely rivals or outperforms GPT-4 in terms of general metrics such as MMLU, GSM8K, MATH, BBH, GPQA, and HumanEval, 2) gets close to GPT-4-Turbo in instruction following as measured by IFEval, 3) matches GPT-4 Turbo (128K) and Claude 3 for long context tasks, and 4) outperforms GPT-4 in Chinese alignments as measured by AlignBench. The GLM-4 All Tools model is further aligned to understand user intent and autonomously decide when and which tool(s) touse -- including web browser, Python interpreter, text-to-image model, and user-defined functions -- to effectively complete complex tasks. In practical applications, it matches and even surpasses GPT-4 All Tools in tasks like accessing online information via web browsing and solving math problems using Python interpreter. Over the course, we have open-sourced a series of models, including ChatGLM-6B (three generations), GLM-4-9B (128K, 1M), GLM-4V-9B, WebGLM, and CodeGeeX, attracting over 10 million downloads on Hugging face in the year 2023 alone. The open models can be accessed through https://github.com/THUDM and https://huggingface.co/THUDM.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2406.12793")

Code

Syntology Ran 15 of 29 code samples harvested from 3 repositories linked to this paper; 14 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 14 ran with no contract checked.

By repository: official repository: 5 samples from 1 repository, 4 ran; community (archive-listed): 24 samples from 2 repositories, 11 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

thudm/chatglm-6b officialmentioned in papermentioned on GitHubpytorchApache-2.0 report
thudm/chatglm mentioned on GitHubpytorchApache-2.0 report
thudm/chatglm3 mentioned on GitHubpytorch report
thudm/chatglm4 mentioned on GitHubpytorchApache-2.0 report
thudm/glm-4 mentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

29 samples harvested; 15 ran; 0 honoured the contract we drafted; 14 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
14ran
14unverified

Licence: 0 of the 29 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

auto_configure_device_map thudm/chatglm-6b/utils.py official repository ran fingerprinted Apache-2.0 (permissive) · bda4be9967b8d807 · report
build_prompt thudm/chatglm-6b/cli_demo.py official repository ran Apache-2.0 (permissive) · 20f3c3d6999848e9 · report
build_prompt thudm/chatglm-6b/cli_demo_vision.py official repository ran Apache-2.0 (permissive) · 7ce6ba0a6898058f · report
parse_text thudm/chatglm-6b/web_demo.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 826ceb601fb31250 · report
load_model_on_gpus thudm/chatglm-6b/utils.py official repository unverified Apache-2.0 (permissive) · b461f4040f1eec9d · report
encode_image thudm/chatglm4/inference/glm4v_api_request.py community (archive-listed) ran Apache-2.0 (permissive) · c0b1c7a482944767 · report
get_image thudm/chatglm4/inference/trans_web_vision_demo.py community (archive-listed) ran Apache-2.0 (permissive) · 3ff3af9bca0ae239 · report
parse_text thudm/chatglm/basic_demo/web_demo_gradio.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · ca6cfdfc224a6e07 · report
preprocess_messages thudm/chatglm4/inference/trans_web_demo.py community (archive-listed) ran Apache-2.0 (permissive) · 86830d055a7a9c5d · report
process_batch thudm/chatglm4/finetune/finetune.py community (archive-listed) ran Apache-2.0 (permissive) · 6c594f1eecbcd9c8 · report
process_batch thudm/chatglm4/finetune/finetune_vision.py community (archive-listed) ran Apache-2.0 (permissive) · 57df729a586c895a · report
process_batch thudm/chatglm/finetune_demo/finetune_hf.py community (archive-listed) ran Apache-2.0 (permissive) · 31316bb1bf2a96b2 · report
process_batch_eval thudm/chatglm4/finetune/finetune.py community (archive-listed) ran Apache-2.0 (permissive) · 2cc2c269bdedbd33 · report
process_batch_eval thudm/chatglm/finetune_demo/finetune_hf.py community (archive-listed) ran Apache-2.0 (permissive) · 5abe708b88a719ff · report
process_message thudm/chatglm4/finetune/finetune.py community (archive-listed) ran Apache-2.0 (permissive) · 7e93b9f509accf1c · report
process_response thudm/chatglm4/demo/composite_demo/src/client.py community (archive-listed) ran Apache-2.0 (permissive) · 51ffd8516205ff45 · report
b64_2_img thudm/chatglm/composite_demo/demo_ci.py community (archive-listed) unverified Apache-2.0 (permissive) · 1f225fd39a7d3dcd · report
build_prompt thudm/chatglm/basic_demo/cli_demo.py community (archive-listed) unverified Apache-2.0 (permissive) · 45ac4198df42b5f0 · report
clean_ansi_codes thudm/chatglm/composite_demo/demo_ci.py community (archive-listed) unverified Apache-2.0 (permissive) · 9b5960772df6a819 · report
extract_code thudm/chatglm/composite_demo/demo_tool.py community (archive-listed) unverified Apache-2.0 (permissive) · e4671affec558222 · report
generate_glm4v thudm/chatglm4/inference/glm4v_server.py community (archive-listed) unverified Apache-2.0 (permissive) · 66a222f9124359df · report
load_model_and_tokenizer thudm/chatglm/finetune_demo/inference_hf.py community (archive-listed) unverified Apache-2.0 (permissive) · 91958a6f1719c4f7 · report
load_model_and_tokenizer thudm/chatglm/basic_demo/web_demo_gradio.py community (archive-listed) unverified Apache-2.0 (permissive) · bb6e915ee912453d · report
load_tokenizer_and_model thudm/chatglm/finetune_demo/finetune_hf.py community (archive-listed) unverified Apache-2.0 (permissive) · 632dd3e505d6e594 · report
load_tokenizer_and_model thudm/chatglm4/finetune/finetune_vision.py community (archive-listed) unverified Apache-2.0 (permissive) · a000febbe236a229 · report
postprocess_text thudm/chatglm/composite_demo/conversation.py community (archive-listed) unverified Apache-2.0 (permissive) · 554545dbb567c8a2 · report
process_batch_eval thudm/chatglm4/finetune/finetune_vision.py community (archive-listed) unverified Apache-2.0 (permissive) · e816697d6260afdd · report
stream_chat thudm/chatglm/composite_demo/client.py community (archive-listed) unverified Apache-2.0 (permissive) · 1003bb97b27ee006 · report
yaml_to_dict thudm/chatglm/composite_demo/demo_tool.py community (archive-listed) unverified Apache-2.0 (permissive) · 22605b28667a4139 · report

Tasks

AllGSM8KHumanEvalInstruction FollowingMMLUMath

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutGPT-4Label SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSETSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections