eclipse
Byte-level distillation rig for Ornith 1.5 9B. Exact EOT targets, a 48M byte student, and a reproducible feasibility study.
Turns a 9B teacher’s token distribution into exact byte / End-Of-Token targets, then measures what a small byte student actually learns.
Loading latest commits…
Held-out BPB
0.818
Teacher KL
0.317
Observed top-1
0.865
Byte student
48M
Problem
Token-level distillation assumes the student shares the teacher’s tokenizer. A byte-level student does not, so the teacher’s next-token distribution has to be converted into a next-byte distribution with a well-defined terminal state.
This project tests whether that conversion can be exact, whether a small byte student can learn from it, and whether End-Of-Token targets beat Marginalize-It and plain byte cross-entropy in a controlled comparison.
Setup
The teacher is Ornith-1.5-9B, a Qwen3.5 hybrid 9B model, quantized to Q5_K_M for bulk extraction and Q8_0 for the precision audit. The student is a ~48M dense byte Transformer with a 1,024-byte context and a 260-symbol vocabulary. The corpus is ~20 MB of NFC-normalized text and code: 6,592,718 training tokens and 136,916 validation tokens. Training runs on a single RTX 3070 8 GB.
Method
Teacher logits stream from llama.cpp and are converted against a byte-trie of the 248k-token vocabulary in DFS order, so each prefix subtree is a contiguous range. Byte distributions come from child subtree masses; the terminal node receives p(token) / mass(prefix) on the EOT symbol.
Marginalize-It is derived from the same 260-dimensional row by zeroing EOT and renormalizing. Raw logits are never persisted; targets are stored as fp16 shards with explicit next-symbol labels.
Target conversion
A float32 cumulative sum in the Python converter could misallocate rare-prefix targets (up to 0.789 against a float64 reference). The C++ converter is the reference path and matches float64 to 1.3e-7.
The 1M extraction produced 4,014,129 positions from 1,000,497 teacher tokens: 2.087 GB, 431 tokens/s, 38.7 minutes. Five positions underflow in fp16; the shard otherwise validates with exact row sums and counts.
Objective comparison
| Objective | Val BPB | EOT-incl BPB | Teacher KL | Top-1 |
|---|---|---|---|---|
| EOT | 0.860 | 0.921 | 0.348 | 0.862 |
| Marginalize-It | 0.771 | 6.418 | 0.404 | 0.637 |
| Byte CE | 0.872 | 0.937 | 0.488 | 0.865 |
1M tokens, 2,000 steps, 300,653 validation bytes. Marginalize-It wins content-only BPB by discarding EOT mass, which makes it undeployable.
Held-out documents
| Objective | BPB | EOT-incl BPB | Teacher KL | Top-1 | Greedy prefix |
|---|---|---|---|---|---|
| EOT | 1.362 | 1.473 | 0.617 | 0.790 | 2.5 |
| Marginalize-It | 1.228 | 6.562 | 3.287 | 0.583 | 2.9 |
| Byte CE | 1.483 | 1.615 | 0.826 | 0.787 | 14.2 |
36 unseen documents, 420,313 bytes scored. The same documents were used for objective selection, so there is no untouched test split.
Full-data training
| Metric | 1M positions | Full 26.2M positions |
|---|---|---|
| BPB | 1.276 | 0.818 |
| EOT-inclusive BPB | 1.378 | 0.879 |
| Teacher KL | 0.575 | 0.317 |
| Observed next-symbol top-1 | 0.801 | 0.865 |
| Valid UTF-8 | 0.90 | 1.00 |
| Greedy prefix (bytes) | 6.35 | 7.25 |
Full run: 10,000 steps, ~3.1 epochs. The validation curve is flat after ~8k steps; documentation reaches BPB 0.764, Python 1.143.
What it proves
The pipeline works end to end
A 48M byte student learns the 9B teacher’s next-byte distribution on unseen documents: held-out BPB 0.818, teacher KL 0.317, observed next-symbol top-1 0.865, valid UTF-8 1.00.
Objective choice matters
EOT + 10% CE beat pure EOT and pure byte CE in the controlled 1M comparison. EOT is the only method with usable token boundaries; MI wins content BPB by discarding EOT mass.
Limits
- Not a usable language model: free-running generation still compounds error (7.25-byte greedy match)
- No untouched test split; the 36 validation documents were also used for objective selection
- Teacher context (4,096 tokens) exceeds the student’s 1,024-symbol window, and windows can cross document boundaries
- Validated on a single RTX 3070 8 GB; scale is the dominant lever
- The result proves the pipeline, not the model
Next work
Next: a 24 GB GPU path with a 100–300M student and on-the-fly targets, a generation-focused objective, and a second seed or token-student control. The current result is a feasibility study, not a trained product.