GLM · 2024-06 · Dense
GLM-4 9B
GLM-4 9B is a grouped-query attention (GQA) transformer released by GLM in 2024-06, with 40 layers, hidden size 4096 and a context window of 8,192 tokens.
Layer stack
Attention ×40 · Layers 40
Key facts
| Family | GLM |
|---|---|
| Released | 2024-06 |
| Params | 9.4 B |
| Context | 8,192 tokens |
| Attention | GQA (32:2) |
| Layers | 40 |
| Hidden | 4,096 |
| Heads | 32 |
| Vocab | — |
| Position | — |
| Norm | — |
| Activation | — |
| Dtype | bf16 |
| Architecture class | ChatGLMModel |
Architecture overview
Attention
grouped-query attention (GQA) — 32 q-heads / 2 kv-heads.
Feed-forward / MoE
It is a dense model: all 9.4B parameters participate in computing every token.
Field-level comparison
Compared against the previous model of the same lab; where none exists, against the structurally closest model. The ratio column is this model divided by the comparison model.
Full-field comparison vs predecessor ChatGLM3 6B
| Model | GLM-4 9B | ChatGLM3 6B | Ratio |
|---|---|---|---|
| model_type | chatglm | chatglm | = |
| architectures | ChatGLMModel | ChatGLMModel | = |
| hidden_size | 4096 | 4096 | ≈1 |
| num_attention_heads | 32 | 32 | ≈1 |
| torch_dtype | bfloat16 | float16 | ≠ |
| _name_or_path | THUDM/glm-4-9b | THUDM/chatglm3-6b | ≠ |
| add_bias_linear | false | false | = |
| add_qkv_bias | true | true | = |
| apply_query_key_layer_scaling | true | true | = |
| apply_residual_connection_post_layernorm | false | false | = |
| attention_dropout | 0 | 0 | = |
| attention_softmax_in_fp32 | true | true | = |
| attn_implementation | sdpa | — | |
| bias_dropout_fusion | true | true | = |
| ffn_hidden_size | 13696 | 13696 | ≈1 |
| fp32_residual_connection | false | false | = |
| hidden_dropout | 0 | 0 | = |
| kv_channels | 128 | 128 | ≈1 |
| layernorm_epsilon | 1.5625e-7 | 0.00001 | ×0.016 |
| multi_query_attention | true | true | = |
| multi_query_group_num | 2 | 2 | ≈1 |
| num_layers | 40 | 28 | ×1.43 |
| original_rope | true | true | = |
| padded_vocab_size | 151552 | 65024 | ×2.33 |
| post_layer_norm | true | true | = |
| rmsnorm | true | true | = |
Most similar architectures
- ChatGLM3 6B (GLM, 2023-10) 0.997
- Qwen3.5 27B (Qwen, 2026-02) 0.721
- Qwen3.5 9B (Qwen, 2026-02) 0.697
- Qwen3.5 9B Base (Qwen, 2026-02) 0.697
- Llama 2 70B (Meta, 2023-07) 0.696
- Llama 3.1 70B (Meta, 2024-07) 0.659
Similarity values range from 0 (no shared categorical features) to 1 (identical profiles).
Raw config fields
32 fields
| _name_or_path | THUDM/glm-4-9b |
|---|---|
| model_type | chatglm |
| architectures | ChatGLMModel |
| add_bias_linear | false |
| add_qkv_bias | true |
| apply_query_key_layer_scaling | true |
| apply_residual_connection_post_layernorm | false |
| attention_dropout | 0 |
| attention_softmax_in_fp32 | true |
| attn_implementation | sdpa |
| bias_dropout_fusion | true |
| ffn_hidden_size | 13696 |
| fp32_residual_connection | false |
| hidden_dropout | 0 |
| hidden_size | 4096 |
| kv_channels | 128 |
| layernorm_epsilon | 1.5625e-7 |
| multi_query_attention | true |
| multi_query_group_num | 2 |
| num_attention_heads | 32 |
| num_layers | 40 |
| original_rope | true |
| padded_vocab_size | 151552 |
| post_layer_norm | true |
| rmsnorm | true |
| seq_length | 8192 |
| use_cache | true |
| torch_dtype | bfloat16 |
| transformers_version | 4.44.0 |
| tie_word_embeddings | false |
| eos_token_id | 151329×1 + 151336×1 + 151338×1 |
| pad_token_id | 151329 |