zai-org / glm-4-9b-chat-hf

huggingface.co
Total runs: 5.4K
24-hour runs: 0
7-day runs: -1.2K
30-day runs: -12.0K
Model's Last Updated: January 27 2025
text-generation

Introduction of glm-4-9b-chat-hf

Model Details of glm-4-9b-chat-hf

GLM-4-9B-Chat

中文阅读,请看 这里 .

If you are using the weights from this repository, please update to

transformers>=4.46.0

These weights are not compatible with older versions of the transformers library.

Model Introduction

GLM-4-9B is the open-source version of the latest generation of pre-trained models in the GLM-4 series launched by Zhipu AI. In the evaluation of data sets in semantics, mathematics, reasoning, code, and knowledge, GLM-4-9B and its human preference-aligned version GLM-4-9B-Chat have shown superior performance beyond Llama-3-8B. In addition to multi-round conversations, GLM-4-9B-Chat also has advanced features such as web browsing, code execution, custom tool calls (Function Call), and long context reasoning (supporting up to 128K context). This generation of models has added multi-language support, supporting 26 languages including Japanese, Korean, and German. We have also launched the GLM-4-9B-Chat-1M model that supports 1M context length (about 2 million Chinese characters) and the multimodal model GLM-4V-9B based on GLM-4-9B. GLM-4V-9B possesses dialogue capabilities in both Chinese and English at a high resolution of 1120*1120. In various multimodal evaluations, including comprehensive abilities in Chinese and English, perception & reasoning, text recognition, and chart understanding, GLM-4V-9B demonstrates superior performance compared to GPT-4-turbo-2024-04-09, Gemini 1.0 Pro, Qwen-VL-Max, and Claude 3 Opus.

Benchmark

We evaluated the GLM-4-9B-Chat model on some classic tasks and obtained the following results:

Model AlignBench-v2 MT-Bench IFEval MMLU C-Eval GSM8K MATH HumanEval NCB
Llama-3-8B-Instruct 5.12 8.00 68.58 68.4 51.3 79.6 30.0 62.2 24.7
ChatGLM3-6B 3.97 5.50 28.1 66.4 69.0 72.3 25.7 58.5 11.3
GLM-4-9B-Chat 6.61 8.35 69.0 72.4 75.6 79.6 50.6 71.8 32.2
Long Context

The eval_needle experiment was conducted with a context length of 1M, and the results are as follows:

needle

The long text capability was further evaluated on LongBench, and the results are as follows:

leaderboard

Multi Language

The tests for GLM-4-9B-Chat and Llama-3-8B-Instruct are conducted on six multilingual datasets. The test results and the corresponding languages selected for each dataset are shown in the table below:

Dataset Llama-3-8B-Instruct GLM-4-9B-Chat Languages
M-MMLU 49.6 56.6 all
FLORES 25.0 28.8 ru, es, de, fr, it, pt, pl, ja, nl, ar, tr, cs, vi, fa, hu, el, ro, sv, uk, fi, ko, da, bg, no
MGSM 54.0 65.3 zh, en, bn, de, es, fr, ja, ru, sw, te, th
XWinograd 61.7 73.1 zh, en, fr, jp, ru, pt
XStoryCloze 84.7 90.7 zh, en, ar, es, eu, hi, id, my, ru, sw, te
XCOPA 73.3 80.1 zh, et, ht, id, it, qu, sw, ta, th, tr, vi
Function Call

Tested on Berkeley Function Calling Leaderboard .

Model Overall Acc. AST Summary Exec Summary Relevance
Llama-3-8B-Instruct 58.88 59.25 70.01 45.83
gpt-4-turbo-2024-04-09 81.24 82.14 78.61 88.75
ChatGLM3-6B 57.88 62.18 69.78 5.42
GLM-4-9B-Chat 81.00 80.26 84.40 87.92

This repository is the model repository of GLM-4-9B-Chat, supporting 128K context length.

Quick Start

For more inference code and requirements, please visit our github page .

Please strictly follow the dependencies to install, otherwise it will not run properly

Transformers Lib(4.46.0 and later version) for inference:
from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained('THUDM/glm-4-9b-chat-hf')
model = AutoModelForCausalLM.from_pretrained('THUDM/glm-4-9b-chat-hf', device_map="auto")

message = [
    {
        "role": "system",
        "content": "Answer the following question."
    },
    {
        "role": "user",
        "content": "How many legs does a cat have?"
    }
]

inputs = tokenizer.apply_chat_template(
    message,
    return_tensors='pt',
    add_generation_prompt=True,
    return_dict=True,
).to(model.device)

input_len = inputs['input_ids'].shape[1]
generate_kwargs = {
    "input_ids": inputs['input_ids'],
    "attention_mask": inputs['attention_mask'],
    "max_new_tokens": 128,
    "do_sample": False,
}
out = model.generate(**generate_kwargs)
print(tokenizer.decode(out[0][input_len:], skip_special_tokens=True))
vLLM Lib(0.6.4 and later version) for inference:
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams

# GLM-4-9B-Chat-1M
# max_model_len, tp_size = 1048576, 4
# If you encounter OOM phenomenon, it is recommended to reduce max_model_len or increase tp_size
max_model_len, tp_size = 131072, 1
model_name = "THUDM/glm-4-9b-chat-hf"
prompt = [{"role": "user", "content": "what is your name?"}]

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
llm = LLM(
    model=model_name,
    tensor_parallel_size=tp_size,
    max_model_len=max_model_len,
    trust_remote_code=True,
    enforce_eager=True,
    # GLM-4-9B-Chat-1M-HF If you encounter OOM phenomenon, it is recommended to enable the following parameters
    # enable_chunked_prefill=True,
    # max_num_batched_tokens=8192
)
stop_token_ids = [151329, 151336, 151338]
sampling_params = SamplingParams(temperature=0.95, max_tokens=1024, stop_token_ids=stop_token_ids)

inputs = tokenizer.apply_chat_template(prompt, tokenize=False, add_generation_prompt=True)
outputs = llm.generate(prompts=inputs, sampling_params=sampling_params)

print(outputs[0].outputs[0].text)
LICENSE

The weights of the GLM-4 model are available under the terms of LICENSE .

Citations

If you find our work useful, please consider citing the following paper.

@misc{glm2024chatglm,
      title={ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools}, 
      author={Team GLM and Aohan Zeng and Bin Xu and Bowen Wang and Chenhui Zhang and Da Yin and Diego Rojas and Guanyu Feng and Hanlin Zhao and Hanyu Lai and Hao Yu and Hongning Wang and Jiadai Sun and Jiajie Zhang and Jiale Cheng and Jiayi Gui and Jie Tang and Jing Zhang and Juanzi Li and Lei Zhao and Lindong Wu and Lucen Zhong and Mingdao Liu and Minlie Huang and Peng Zhang and Qinkai Zheng and Rui Lu and Shuaiqi Duan and Shudan Zhang and Shulin Cao and Shuxun Yang and Weng Lam Tam and Wenyi Zhao and Xiao Liu and Xiao Xia and Xiaohan Zhang and Xiaotao Gu and Xin Lv and Xinghan Liu and Xinyi Liu and Xinyue Yang and Xixuan Song and Xunkai Zhang and Yifan An and Yifan Xu and Yilin Niu and Yuantao Yang and Yueyan Li and Yushi Bai and Yuxiao Dong and Zehan Qi and Zhaoyu Wang and Zhen Yang and Zhengxiao Du and Zhenyu Hou and Zihan Wang},
      year={2024},
      eprint={2406.12793},
      archivePrefix={arXiv},
      primaryClass={id='cs.CL' full_name='Computation and Language' is_active=True alt_name='cmp-lg' in_archive='cs' is_general=False description='Covers natural language processing. Roughly includes material in ACM Subject Class I.2.7. Note that work on artificial languages (programming languages, logics, formal systems) that does not explicitly address natural-language issues broadly construed (natural-language processing, computational linguistics, speech, text retrieval, etc.) is not appropriate for this area.'}
}

Runs of zai-org glm-4-9b-chat-hf on huggingface.co

5.4K
Total runs
0
24-hour runs
-132
3-day runs
-1.2K
7-day runs
-12.0K
30-day runs

More Information About glm-4-9b-chat-hf huggingface.co Model

More glm-4-9b-chat-hf license Visit here:

https://choosealicense.com/licenses/glm-4

glm-4-9b-chat-hf huggingface.co

glm-4-9b-chat-hf huggingface.co is an AI model on huggingface.co that provides glm-4-9b-chat-hf's model effect (), which can be used instantly with this zai-org glm-4-9b-chat-hf model. huggingface.co supports a free trial of the glm-4-9b-chat-hf model, and also provides paid use of the glm-4-9b-chat-hf. Support call glm-4-9b-chat-hf model through api, including Node.js, Python, http.

glm-4-9b-chat-hf huggingface.co Url

https://huggingface.co/zai-org/glm-4-9b-chat-hf

zai-org glm-4-9b-chat-hf online free

glm-4-9b-chat-hf huggingface.co is an online trial and call api platform, which integrates glm-4-9b-chat-hf's modeling effects, including api services, and provides a free online trial of glm-4-9b-chat-hf, you can try glm-4-9b-chat-hf online for free by clicking the link below.

zai-org glm-4-9b-chat-hf online free url in huggingface.co:

https://huggingface.co/zai-org/glm-4-9b-chat-hf

glm-4-9b-chat-hf install

glm-4-9b-chat-hf is an open source model from GitHub that offers a free installation service, and any user can find glm-4-9b-chat-hf on GitHub to install. At the same time, huggingface.co provides the effect of glm-4-9b-chat-hf install, users can directly use glm-4-9b-chat-hf installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

glm-4-9b-chat-hf install url in huggingface.co:

https://huggingface.co/zai-org/glm-4-9b-chat-hf

Url of glm-4-9b-chat-hf

glm-4-9b-chat-hf huggingface.co Url

Provider of glm-4-9b-chat-hf huggingface.co

zai-org
ORGANIZATIONS

Other API from zai-org

huggingface.co

Total runs: 1.9M
Run Growth: -1.4M
Growth Rate: -72.24%
Updated:September 11 2026
huggingface.co

Total runs: 1.9M
Run Growth: -106.5K
Growth Rate: -5.66%
Updated:January 29 2026
huggingface.co

Total runs: 1.6M
Run Growth: 1.3M
Growth Rate: 100.00%
Updated:September 07 2026
huggingface.co

Total runs: 1.3M
Run Growth: -706.1K
Growth Rate: -53.41%
Updated:September 01 2026
huggingface.co

Total runs: 941.9K
Run Growth: -1.8M
Growth Rate: -188.05%
Updated:September 01 2026
huggingface.co

Total runs: 669.0K
Run Growth: 626.7K
Growth Rate: 98.61%
Updated:September 04 2026
huggingface.co

Total runs: 442.1K
Run Growth: -4.8K
Growth Rate: -1.09%
Updated:August 04 2024
huggingface.co

Total runs: 250.3K
Run Growth: -212.3K
Growth Rate: -80.46%
Updated:April 16 2026
huggingface.co

Total runs: 203.0K
Run Growth: -733.7K
Growth Rate: -269.02%
Updated:April 05 2026
huggingface.co

Total runs: 97.0K
Run Growth: -187.4K
Growth Rate: -184.31%
Updated:August 11 2025
huggingface.co

Total runs: 87.1K
Run Growth: -1.8K
Growth Rate: -2.07%
Updated:March 13 2025
huggingface.co

Total runs: 84.0K
Run Growth: 3.7K
Growth Rate: 4.86%
Updated:January 29 2026
huggingface.co

Total runs: 80.8K
Run Growth: -43.5K
Growth Rate: -54.00%
Updated:August 11 2025
huggingface.co

Total runs: 78.8K
Run Growth: 8.0K
Growth Rate: 9.73%
Updated:May 13 2026
huggingface.co

Total runs: 77.4K
Run Growth: -82.6K
Growth Rate: -105.42%
Updated:December 10 2025
huggingface.co

Total runs: 76.3K
Run Growth: -8.1K
Growth Rate: -10.65%
Updated:December 05 2024
huggingface.co

Total runs: 58.9K
Run Growth: -63.5K
Growth Rate: -108.01%
Updated:August 11 2026
huggingface.co

Total runs: 44.9K
Run Growth: -82.9K
Growth Rate: -182.81%
Updated:October 25 2025
huggingface.co

Total runs: 22.0K
Run Growth: -2.3K
Growth Rate: -10.22%
Updated:November 23 2024
huggingface.co

Total runs: 20.5K
Run Growth: -62.9K
Growth Rate: -303.60%
Updated:March 03 2025
huggingface.co

Total runs: 20.1K
Run Growth: -20.8K
Growth Rate: -100.51%
Updated:April 14 2025
huggingface.co

Total runs: 18.3K
Run Growth: -9.7K
Growth Rate: -52.88%
Updated:September 30 2025
huggingface.co

Total runs: 15.4K
Run Growth: -2.5K
Growth Rate: -16.41%
Updated:November 23 2024
huggingface.co

Total runs: 14.0K
Run Growth: -13.3K
Growth Rate: -93.35%
Updated:December 23 2025
huggingface.co

Total runs: 14.0K
Run Growth: 13.0K
Growth Rate: 96.42%
Updated:September 04 2026
huggingface.co

Total runs: 13.1K
Run Growth: 2.5K
Growth Rate: 18.98%
Updated:December 09 2025
huggingface.co

Total runs: 9.8K
Run Growth: 1.4K
Growth Rate: 14.29%
Updated:January 15 2026
huggingface.co

Total runs: 7.9K
Run Growth: -3.6K
Growth Rate: -45.43%
Updated:October 16 2025
huggingface.co

Total runs: 7.1K
Run Growth: -7.1K
Growth Rate: -99.58%
Updated:April 22 2025
huggingface.co

Total runs: 6.2K
Run Growth: -1.7K
Growth Rate: -28.22%
Updated:March 11 2025
huggingface.co

Total runs: 5.3K
Run Growth: -1.9K
Growth Rate: -36.13%
Updated:January 27 2025
huggingface.co

Total runs: 3.9K
Run Growth: -5.3K
Growth Rate: -142.00%
Updated:December 09 2025
huggingface.co

Total runs: 3.1K
Run Growth: 1.1K
Growth Rate: 36.55%
Updated:August 04 2024
huggingface.co

Total runs: 2.9K
Run Growth: -1.6K
Growth Rate: -53.96%
Updated:October 25 2025
huggingface.co

Total runs: 1.8K
Run Growth: 773
Growth Rate: 47.25%
Updated:August 12 2025
huggingface.co

Total runs: 679
Run Growth: 309
Growth Rate: 44.98%
Updated:March 02 2023
huggingface.co

Total runs: 587
Run Growth: -31
Growth Rate: -5.27%
Updated:August 11 2025
huggingface.co

Total runs: 433
Run Growth: -1.2K
Growth Rate: -294.09%
Updated:January 02 2025
huggingface.co

Total runs: 419
Run Growth: 244
Growth Rate: 59.51%
Updated:October 20 2023
huggingface.co

Total runs: 322
Run Growth: 76
Growth Rate: 23.60%
Updated:December 10 2024
huggingface.co

Total runs: 321
Run Growth: -419
Growth Rate: -137.38%
Updated:October 25 2025
huggingface.co

Total runs: 300
Run Growth: 144
Growth Rate: 47.37%
Updated:March 02 2023
huggingface.co

Total runs: 277
Run Growth: 70
Growth Rate: 25.27%
Updated:November 20 2023
huggingface.co

Total runs: 258
Run Growth: 111
Growth Rate: 44.22%
Updated:October 20 2023
huggingface.co

Total runs: 249
Run Growth: 107
Growth Rate: 43.85%
Updated:October 20 2023