Views
No views yet
⚠️ Custom architecture — load withtrust_remote_code=True.
V = 49,152) and use RoPE
(θ = 1e5). Sub-model m+1 consumes sub-model m's output through a
parameter-free norm-rescaled junction: o^m is rescaled to match the norm of
a fresh embedding covering the new channels, then concatenated.| Sub-model | Incr. params | Cumul. params | Width D | Layers (cumul.) | Heads | Head dim | Intermediate |
|---|---|---|---|---|---|---|---|
| 500M | 0.50B | 0.50B | 1024 | 24 (24) | 16 | 64 | 4096 |
| 1.5B | 0.98B | 1.48B | 2304 | 10 (34) | 24 | 96 | 9216 |
| 3B | 1.72B | 3.20B | 4352 | 5 (39) | 34 | 128 | 17408 |
(n₁,n₂,n₃) = (24,10,5) (39 layers total) was chosen to match the
KV-cache and per-token FLOPs of a Vanilla 3B baseline. The 500M sub-model uses the
same width/depth as the Vanilla 500M for a strictly comparable data point.revision=. Branch
names follow:{exit}_{tokens}B[_cd|_distill] e.g. 3B_35B, 1-5B_42B, 3B_60B_cd{exit} — how many nested exits the checkpoint exposes:
500M_* → the 500M sub-model only1-5B_* → the 500M + 1.5B sub-models3B_* → the full 500M + 1.5B + 3B suitemain, main_{tokens}B → pointers to the full suite (main = default/latest){tokens}B — training tokens seen: 5, 10, 16, 21, 26, 31, 35, 42, 52, 60._cd — WSD cooldown applied (learning-rate decay), released at 60B._distill — distillation-ablation variant (small exits only). Will be discussed in a next version of the paper.*_60B_cd) and intermediate checkpoints
for studying training dynamics.500M_35B, 1-5B_35B and 3B_35B are slices of
the same trained weights — load the largest exit you need.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model = AutoModelForCausalLM.from_pretrained(
5 "nthngdy/matryoshka-3B",
6 revision="3B_35B", # full suite; use "1-5B_35B" or "500M_35B" for smaller
7 trust_remote_code=True,
8 dtype=torch.bfloat16,
9 attn_implementation="sdpa",
10).eval()
11
12tokenizer = AutoTokenizer.from_pretrained("nthngdy/matryoshka-3B", revision="3B_35B")
13
14# The nested sub-models are exposed as a dict, ordered small → large:
15for tag, submodel in model.lm_model_dict.items():
16 n = sum(p.numel() for p in submodel.parameters())
17 print(f"{tag}: {n/1e6:.0f}M params")| Data | FineWeb-Edu, sequences packed to length 2048 |
| Tokens | 35B (main); extended 60B run also released |
| Optimizer | AdamW (β₁=0.9, β₂=0.95, ε=1e-8) |
| Peak LR | 4e-4, WSD schedule (3,000 cooldown steps / 33,000 total) |
| Batch size | 512 sequences |
| Weight decay | 0.01 · Grad clip |
| Precision | bf16-mixed |
| Distillation | online, from the 3B exit to smaller ones, α_d = 0.3 |
| Hardware | NVIDIA B200 (~52 GPU-days across both suites) |
TBD