10ML · Distillation research

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.

PythonPyTorchllama.cppCUDA
Latest repository commit

Loading latest commits…

Held-out BPB

0.818

Teacher KL

0.317

Observed top-1

0.865

Byte student

48M

01

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.

02

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.

03

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.

04

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.

05

Objective comparison

Objective comparison
ObjectiveVal BPBEOT-incl BPBTeacher KLTop-1
EOT0.8600.9210.3480.862
Marginalize-It0.7716.4180.4040.637
Byte CE0.8720.9370.4880.865

1M tokens, 2,000 steps, 300,653 validation bytes. Marginalize-It wins content-only BPB by discarding EOT mass, which makes it undeployable.

06

Held-out documents

Held-out documents
ObjectiveBPBEOT-incl BPBTeacher KLTop-1Greedy prefix
EOT1.3621.4730.6170.7902.5
Marginalize-It1.2286.5623.2870.5832.9
Byte CE1.4831.6150.8260.78714.2

36 unseen documents, 420,313 bytes scored. The same documents were used for objective selection, so there is no untouched test split.

07

Full-data training

Full-data training
Metric1M positionsFull 26.2M positions
BPB1.2760.818
EOT-inclusive BPB1.3780.879
Teacher KL0.5750.317
Observed next-symbol top-10.8010.865
Valid UTF-80.901.00
Greedy prefix (bytes)6.357.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.

08

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.

09

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
10

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.