Views
No views yet
|
Micro Language Model Attention-Free • MLP-Only • Byte-Level |
1graph TD
2 A[Byte Input] --> B[Token Embedding]
3 B --> C[RoPE Position Encoding]
4 C --> D[ImprovedMixerLayer ×3]
5 D --> E[LayerNorm]
6 E --> F[LM Head]
7 F --> G[Byte Output]
8
9 style A fill:#007BFF,color:#fff
10 style G fill:#00D620,color:#fff
11 style D fill:#AE00FF,color:#fff| Parameter | Value |
|---|---|
| Total Parameters | 967,584 |
| Hidden Dimension | 224 |
| Channel MLP Dimension | 576 |
| Number of Layers | 3 |
| Max Sequence Length | 256 |
| Vocabulary Size | 256 (Byte-level) |
┌─────────────────────────────────────────────┐
│ ImprovedMixerLayer │
│ ┌─────────────────────────────────────┐ │
│ │ LayerNorm → HyperMixing → Residual │ │ ← Token Mixing
│ ├─────────────────────────────────────┤ │
│ │ LayerNorm → MlpBlock → Residual │ │ ← Channel Mixing
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────────┘Linear → GELU → Linear| Metric | 500K | 1M | Change |
|---|---|---|---|
| Parameters | 557,328 | 967,584 | 1.7x |
| Hidden Dim | 176 | 224 | 1.3x |
| Channel MLP | 384 | 576 | 1.5x |
| Sequence Length | 128 | 256 | 2x |
Prompt: "Once upon a time"
Output: "Once upon a time there was a little girl named Lily. She loved t..."
Prompt: "Hello"
Output: "Hellog ann he grit litle girls. She love loved in the"| Model | Parameters | Hidden | Seq Len | Quality |
|---|---|---|---|---|
| 100K | 136,908 | 84 | 64 | ⭐ |
| 300K | 331,680 | 128 | 128 | ⭐⭐ |
| 500K | 557,328 | 176 | 128 | ⭐⭐⭐ |
| 1M | 967,584 | 224 | 256 | ⭐⭐⭐⭐ |
| Limitation | Description |
|---|---|
| Grammatical Errors | Fully grammatical sentences still difficult |
| Name Instability | Same name varies: "Lily", "Limmy", "Amby" |
| Short Prompt Issues | "Hello", "The weather is" produce near-random output |
| Overfitting | Overfits to specific TinyStories phrases |
1import torch
2from huggingface_hub import hf_hub_download
3from src.model import MicroMixerV2, MicroMixerV2Config
4from src.tokenizer import ByteTokenizer
5
6# Clone the repository first:
7# git clone https://github.com/llaa33219/MicroMixer-1.git
8# cd MicroMixer-1
9
10config = MicroMixerV2Config(
11 max_seq_len=256,
12 hidden_dim=224,
13 channel_mlp_dim=576,
14 num_layers=3,
15 use_hyper=True,
16)
17
18model = MicroMixerV2(config)
19weights_path = hf_hub_download("llaa33219/MicroMixer-1-1M-TinyStories", "model.pt")
20model.load_state_dict(torch.load(weights_path, map_location="cpu"))
21model.eval()
22
23tokenizer = ByteTokenizer()
24input_ids = torch.tensor([tokenizer.encode("Once upon a time")])
25
26with torch.no_grad():
27 output = model.generate(input_ids, max_new_tokens=64, temperature=0.8, top_k=40)
28
29print(tokenizer.decode(output[0].tolist()))