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 | 136,908 |
| Hidden Dimension | 84 |
| Channel MLP Dimension | 128 |
| Number of Layers | 3 |
| Max Sequence Length | 64 |
| Vocabulary Size | 256 (Byte-level) |
┌─────────────────────────────────────────────┐
│ ImprovedMixerLayer │
│ ┌─────────────────────────────────────┐ │
│ │ LayerNorm → HyperMixing → Residual │ │ ← Token Mixing
│ ├─────────────────────────────────────┤ │
│ │ LayerNorm → MlpBlock → Residual │ │ ← Channel Mixing
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────────┘Linear → GELU → Linear| Limitation | Description |
|---|---|
| Extremely Small | 136K parameters cannot capture complex language patterns |
| Short Sequences | max_seq_len=64 limits context understanding |
| Grammatical Errors | Generated text is mostly ungrammatical |
| Repetitive Patterns | Repeats specific phrases from training data |
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=64,
12 hidden_dim=84,
13 channel_mlp_dim=128,
14 num_layers=3,
15 use_hyper=True,
16)
17
18model = MicroMixerV2(config)
19weights_path = hf_hub_download("llaa33219/MicroMixer-1-100K-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()))