microsoft/phi-2
Original2.8Bparameters
Fixture6.7Mparameters
Layer stacks1compared
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.layers
Original · 32
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| DecoderLayer | 32 | 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.layers | 2.5B | 90.6% | 66.7K | 1.0% |
| lm_head | 131.1M | 4.7% | 3.3M | 49.9% |
| model.embed_tokens | 131.1M | 4.7% | 3.3M | 49.1% |
| model.final_layernorm | 5.1K | 0.0% | 128 | 0.0% |
Preserved properties
| Config | Property | Original | Fixture | |
|---|---|---|---|---|
| model | attention style | MHA (32 heads, 32 KV) | MHA (4 heads, 4 KV) | ✓ kept |
| model | RoPE type | default | default | ✓ kept |
| model | model_type | phi | phi | ✓ kept |
| model | vocab_size | 51200 | 51200 | ✓ kept |
| model | tie_word_embeddings | False | False | ✓ kept |
| model | hidden_act | gelu_new | gelu_new | ✓ kept |
| model | max_position_embeddings | 2048 | 2048 | ✓ kept |
Module classes
Instances of each class in the built model (prefix Phi omitted).
| Class | Original | Fixture |
|---|---|---|
| Linear | 193 | 13 |
| Dropout | 33 | 3 |
| LayerNorm | 33 | 3 |
| NewGELUActivation | 32 | 2 |
| Attention | 32 | 2 |
| DecoderLayer | 32 | 2 |
| MLP | 32 | 2 |
| Embedding | 1 | 1 |
| ModuleList | 1 | 1 |
| ForCausalLM | 1 | 1 |
| Model | 1 | 1 |
| RotaryEmbedding | 1 | 1 |
Config changes
5 fields changed, 24 unchanged.
| Field | Original | Fixture |
|---|---|---|
| hidden_size | 2560 | 64 |
| intermediate_size | 10240 | 128 |
| num_attention_heads | 32 | 4 |
| num_hidden_layers | 32 | 2 |
| num_key_value_heads | 32 | 4 |