zai-org/GLM-OCR
Original1.1Bparameters
Fixture8.8Mparameters
Layer stacks2compared
Findings0to review
✓ Same architecture, smaller
Every module class, layer kind and checked property of the original is in the fixture.
Layer stacks
One square per layer, colored by kind: the layer's module classes and type attributes. Hover a square for its index and kind.
model.visual.blocks
Original · 24
Fixture · 24
| Kind | Original | Fixture | |
|---|---|---|---|
| VisionBlock | 24 | 24 | ✓ kept |
model.language_model.layers
Original · 16
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| TextDecoderLayer | 16 | 2 | ✓ kept |
Where the parameters are
Share of each model's parameters per component. Vocabulary and patch sizes are kept, so embeddings usually take a larger share of the fixture.
Original
Fixture
| Component | Original | Share | Fixture | Share |
|---|---|---|---|---|
| model.language_model.layers | 490.8M | 44.3% | 74.2K | 0.8% |
| model.visual.blocks | 403.0M | 36.4% | 1.0M | 11.4% |
| model.language_model | 91.2M | 8.2% | 3.8M | 43.1% |
| lm_head | 91.2M | 8.2% | 3.8M | 43.1% |
| model.visual | 31.1M | 2.8% | 132.9K | 1.5% |
Preserved properties
| Config | Property | Original | Fixture | |
|---|---|---|---|---|
| model | model_type | glm_ocr | glm_ocr | ✓ kept |
| model | tie_word_embeddings | False | False | ✓ kept |
| text_config | attention style | GQA (16 heads, 8 KV) | GQA (4 heads, 2 KV) | ✓ kept |
| text_config | RoPE type | default | default | ✓ kept |
| text_config | model_type | glm_ocr_text | glm_ocr_text | ✓ kept |
| text_config | vocab_size | 59392 | 59392 | ✓ kept |
| text_config | tie_word_embeddings | False | False | ✓ kept |
| text_config | hidden_act | silu | silu | ✓ kept |
| text_config | max_position_embeddings | 131072 | 131072 | ✓ kept |
| vision_config | RoPE type | axial | axial | ✓ kept |
| vision_config | model_type | glm_ocr_vision | glm_ocr_vision | ✓ kept |
| vision_config | hidden_act | silu | silu | ✓ kept |
| vision_config | image_size | 336 | 336 | ✓ kept |
| vision_config | patch_size | 14 | 14 | ✓ kept |
Module classes
Instances of each class in the built model (prefix GlmOcr omitted).
| Class | Original | Fixture |
|---|---|---|
| Linear | 221 | 137 |
| RMSNorm | 162 | 106 |
| SiLUActivation | 41 | 27 |
| VisionAttention | 24 | 24 |
| VisionBlock | 24 | 24 |
| VisionMlp | 24 | 24 |
| TextAttention | 16 | 2 |
| TextDecoderLayer | 16 | 2 |
| TextMLP | 16 | 2 |
| ModuleList | 2 | 2 |
| Conv2d | 1 | 1 |
| Conv3d | 1 | 1 |
| Embedding | 1 | 1 |
| GELU | 1 | 1 |
| ForConditionalGeneration | 1 | 1 |
| Model | 1 | 1 |
| TextModel | 1 | 1 |
| TextRotaryEmbedding | 1 | 1 |
| VisionModel | 1 | 1 |
| VisionPatchEmbed | 1 | 1 |
| VisionPatchMerger | 1 | 1 |
| VisionRotaryEmbedding | 1 | 1 |
| LayerNorm | 1 | 1 |
Config changes
11 fields changed, 59 unchanged.
| Field | Original | Fixture |
|---|---|---|
| text_config.head_dim | 128 | 16 |
| text_config.hidden_size | 1536 | 64 |
| text_config.intermediate_size | 4608 | 128 |
| text_config.num_attention_heads | 16 | 4 |
| text_config.num_hidden_layers | 16 | 2 |
| text_config.num_key_value_heads | 8 | 2 |
| text_config.rope_parameters | {"mrope_section": [16, 24, 24], "partial_rotary_factor": 1.0, "rope_theta": 1… | {"mrope_section": [2, 3, 3], "partial_rotary_factor": 1.0, "rope_theta": 1000… |
| vision_config.hidden_size | 1024 | 64 |
| vision_config.intermediate_size | 4096 | 128 |
| vision_config.num_heads | 16 | 4 |
| vision_config.out_hidden_size | 1536 | 64 |