baidu/Unlimited-OCR
Original3.3Bparameters
Fixture18.6Mparameters
Layer stacks3compared
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.vision_tower.sam_encoder.layers
Original · 12
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| SamMLPBlock | 12 | 2 | ✓ kept |
model.vision_tower.vision_encoder.encoder.layers
Original · 24
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| EncoderLayer | 24 | 2 | ✓ kept |
model.language_model.layers
Original · 12
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| no TextExperts | 1 | 1 | ✓ kept |
| TextExperts, TextMoe, TextTopkRouter | 11 | 1 | ✓ 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 | 2.6B | 78.1% | 94.7K | 0.5% |
| model.vision_tower.vision_encoder.encoder.layers | 302.3M | 9.1% | 66.9K | 0.4% |
| model.language_model | 165.5M | 5.0% | 8.3M | 44.5% |
| lm_head | 165.5M | 5.0% | 8.3M | 44.5% |
| model.vision_tower.sam_encoder.layers | 85.1M | 2.6% | 828.2K | 4.5% |
| model.vision_tower | 10.7M | 0.3% | 1.0M | 5.5% |
| model.multi_modal_projector | 2.6M | 0.1% | 8.3K | 0.0% |
| 1 others | 2.6K | 0.0% | 128 | 0.0% |
Preserved properties
| Config | Property | Original | Fixture | |
|---|---|---|---|---|
| model | attention style | MHA (10 heads, 10 KV) | MHA (4 heads, 4 KV) | ✓ kept |
| model | MoE routing | top-6 of 64 experts | top-2 of 4 experts | ✓ kept |
| model | model_type | unlimited_ocr | unlimited_ocr | ✓ kept |
| model | vocab_size | 129280 | 129280 | ✓ kept |
| model | tie_word_embeddings | False | False | ✓ kept |
| model | max_position_embeddings | 32768 | 32768 | ✓ kept |
| vision_config | model_type | unlimited_ocr_vision | unlimited_ocr_vision | ✓ kept |
| vision_config | image_size | 1024 | 1024 | ✓ kept |
| vision_config.sam_config | model_type | unlimited_ocr_sam_vision_model | unlimited_ocr_sam_vision_model | ✓ kept |
| vision_config.sam_config | hidden_act | gelu | gelu | ✓ kept |
| vision_config.sam_config | image_size | 1024 | 1024 | ✓ kept |
| vision_config.sam_config | patch_size | 16 | 16 | ✓ kept |
| vision_config.sam_config | num_channels | 3 | 3 | ✓ kept |
| vision_config.encoder_config | model_type | unlimited_ocr_vision_encoder | unlimited_ocr_vision_encoder | ✓ kept |
| vision_config.encoder_config | hidden_act | quick_gelu | quick_gelu | ✓ kept |
| vision_config.encoder_config | image_size | 224 | 224 | ✓ kept |
| vision_config.encoder_config | patch_size | 14 | 14 | ✓ kept |
| vision_config.encoder_config | num_channels | 3 | 3 | ✓ kept |
| text_config | attention style | MHA (10 heads, 10 KV) | MHA (4 heads, 4 KV) | ✓ kept |
| text_config | MoE routing | top-6 of 64 experts | top-2 of 4 experts | ✓ kept |
| text_config | RoPE type | default | default | ✓ kept |
| text_config | model_type | unlimited_ocr_text | unlimited_ocr_text | ✓ kept |
| text_config | vocab_size | 129280 | 129280 | ✓ kept |
| text_config | tie_word_embeddings | False | False | ✓ kept |
| text_config | hidden_act | silu | silu | ✓ kept |
| text_config | max_position_embeddings | 32768 | 32768 | ✓ kept |
| projector_config | model_type | mlp_projector | mlp_projector | ✓ kept |
Module classes
Instances of each class in the built model (prefix UnlimitedOcr omitted).
| Class | Original | Fixture |
|---|---|---|
| Linear | 278 | 36 |
| LayerNorm | 73 | 9 |
| TextRMSNorm | 25 | 5 |
| QuickGELUActivation | 24 | 2 |
| Attention | 24 | 2 |
| EncoderLayer | 24 | 2 |
| MLP | 24 | 2 |
| SiLUActivation | 23 | 3 |
| GELUActivation | 12 | 2 |
| SamMLPBlock | 12 | 2 |
| SamVisionLayer | 12 | 2 |
| SamVisionSdpaAttention | 12 | 2 |
| TextAttention | 12 | 2 |
| TextDecoderLayer | 12 | 2 |
| TextMLP | 12 | 2 |
| TextExperts | 11 | 1 |
| TextMoe | 11 | 1 |
| TextTopkRouter | 11 | 1 |
| Conv2d | 5 | 5 |
| ModuleList | 3 | 3 |
| Embedding | 2 | 2 |
| SamLayerNorm | 2 | 2 |
| Encoder | 1 | 1 |
| ForConditionalGeneration | 1 | 1 |
| Model | 1 | 1 |
| SamPatchEmbeddings | 1 | 1 |
| SamVisionEncoder | 1 | 1 |
| SamVisionNeck | 1 | 1 |
| SamVisionProj | 1 | 1 |
| TextModel | 1 | 1 |
| TextRotaryEmbedding | 1 | 1 |
| VisionEmbeddings | 1 | 1 |
| VisionEncoder | 1 | 1 |
| VisionModel | 1 | 1 |
Config changes
30 fields changed, 128 unchanged.
| Field | Original | Fixture |
|---|---|---|
| hidden_size | 1280 | 64 |
| intermediate_size | 6848 | 128 |
| moe_intermediate_size | 896 | 32 |
| n_routed_experts | 64 | 4 |
| num_attention_heads | 10 | 4 |
| num_experts_per_tok | 6 | 2 |
| num_hidden_layers | 12 | 2 |
| num_key_value_heads | 10 | 4 |
| text_config.head_dim | 128 | 16 |
| text_config.hidden_size | 1280 | 64 |
| text_config.intermediate_size | 6848 | 128 |
| text_config.layer_types | 12 entries: 12× reference_sliding_attention | ["reference_sliding_attention", "reference_sliding_attention"] |
| text_config.mlp_layer_types | 12 entries: 11× sparse, 1× dense | ["dense", "sparse"] |
| text_config.moe_intermediate_size | 896 | 32 |
| text_config.n_routed_experts | 64 | 4 |
| text_config.num_attention_heads | 10 | 4 |
| text_config.num_experts_per_tok | 6 | 2 |
| text_config.num_hidden_layers | 12 | 2 |
| text_config.num_key_value_heads | 10 | 4 |
| text_config.v_head_dim | 128 | 16 |
| v_head_dim | 128 | 16 |
| vision_config.encoder_config.hidden_size | 1024 | 64 |
| vision_config.encoder_config.intermediate_size | 4096 | 128 |
| vision_config.encoder_config.num_attention_heads | 16 | 4 |
| vision_config.encoder_config.num_hidden_layers | 24 | 2 |
| vision_config.sam_config.downsample_channels | [512, 1024] | [32, 64] |
| vision_config.sam_config.hidden_size | 768 | 64 |
| vision_config.sam_config.initializer_range | 1e-10 | 0.02 |
| vision_config.sam_config.num_attention_heads | 12 | 4 |
| vision_config.sam_config.num_hidden_layers | 12 | 2 |