condition stringclasses 8
values | label stringclasses 8
values | policy stringclasses 3
values | kills int64 0 5 | n_prompts int64 5 5 | worst_itl_ms float64 79.8 4.59k | mean_itl_ms float64 57.9 664 ⌀ | mean_ttft_ms float64 801 2.65k ⌀ | migrations float64 0 2.2 | switch_cost_ms float64 0 3.61k | handoff_jsd float64 0.04 0.23 ⌀ | handoff_jsd_raw float64 0.02 0.27 ⌀ | judge_agreement float64 0.72 0.98 ⌀ | judge_ppl float64 1.37 24.1 ⌀ | accuracy float64 0 1 | needle_recall float64 0 1 | repetition_rate float64 0 0.02 | peak_mb float64 1.9k 7.8k | frac_tokens_top_tier float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | A · Static-large | static | 5 | 5 | 245.7839 | null | null | 0 | 0 | null | null | null | null | 0 | 0 | 0 | 5,915.3811 | 1 |
B | B · Static-small | static | 0 | 5 | 79.821 | 57.929 | 801.0194 | 0 | 0 | null | null | 0.75 | 2.5872 | 0.6667 | 1 | 0.0182 | 1,896.3512 | 0 |
C | C · Restart-on-pressure | restart | 0 | 5 | 4,528.4325 | 654.9981 | 2,117.3079 | 2.2 | 3,614.5179 | 0.0386 | 0.0197 | 0.975 | 1.3673 | 1 | 1 | 0 | 5,915.3811 | 0.3917 |
D | D · Molt | molt | 0 | 5 | 4,585.6446 | 605.9511 | 2,241.4563 | 2.2 | 899.6464 | 0.2199 | 0.2313 | 0.8167 | 3.0945 | 1 | 1 | 0.0217 | 7,802.3016 | 0.3917 |
D-nocal | D⁻ · Molt, no calibration | molt | 0 | 5 | 2,561.1411 | 566.8181 | 2,189.9231 | 2.2 | 755.0189 | 0.2313 | 0.2313 | 0.7917 | 3.6883 | 1 | 1 | 0.0043 | 5,918.2288 | 0.3917 |
D-noproj | D⁻ · Molt, no learned projection | molt | 0 | 5 | 3,664.0618 | 571.1014 | 2,278.567 | 2.2 | 22.2647 | 0.1917 | 0.2745 | 0.7167 | 24.1381 | 1 | 1 | 0 | 7,799.3353 | 0.3917 |
D-norecompute | D⁻ · Molt, no top-k recompute | molt | 0 | 5 | 3,707.7794 | 664.1104 | 2,646.4325 | 2.2 | 28.8073 | 0.2243 | 0.2424 | 0.8167 | 3.2068 | 1 | 1 | 0 | 7,799.2479 | 0.3917 |
D-reqbound | D⁻ · Molt, request-boundary only | molt | 5 | 5 | 209.6381 | null | null | 0 | 0 | null | null | null | null | 0 | 0 | 0 | 5,918.2288 | 1 |
Molt · elastic on-device inference measurements
Everything measured while building Molt, a runtime that moves a running generation onto a smaller model between two tokens, carrying the KV cache across, so an on-device LLM under memory pressure is neither reclaimed by the OS nor restarted from the prompt.
Published so the claims can be checked rather than taken on trust. The figures in the repo README and the results page are generated from these files; nothing is transcribed by hand.
Setup
Qwen2.5 ladder on CPU (float32), five prompts per condition, the same memory-pressure trace for every arm:
| rung | model | footprint |
|---|---|---|
tier0 |
Qwen2.5-1.5B-Instruct fp32 | 5 889 MiB |
tier1 |
Qwen2.5-1.5B-Instruct int8 | 2 143 MiB |
tier2 |
Qwen2.5-0.5B-Instruct fp32 | 1 885 MiB |
The trace drops the budget to 2 002 MiB in two steps, timed to land mid-answer.
Configs
conditions — one row per experimental arm
The headline table. A is always-large, B always-small, C restart-on-pressure,
D Molt; D-* are ablations.
| condition | reclaimed | switch cost | accuracy | judge agreement |
|---|---|---|---|---|
| A · static-large | 5/5 | — | 0.00 | — |
| B · static-small | 0/5 | — | 0.67 | 0.750 |
| C · restart-on-pressure | 0/5 | 3 615 ms | 1.00 | 0.975 |
| D · Molt | 0/5 | 900 ms | 1.00 | 0.817 |
| D⁻ no calibration | 0/5 | 755 ms | 1.00 | 0.792 |
| D⁻ no learned projection | 0/5 | 22 ms | 1.00 | 0.717 |
| D⁻ no top-k recompute | 0/5 | 29 ms | 1.00 | 0.817 |
| D⁻ request-boundary only | 5/5 | — | 0.00 | — |
cost_sweep — transplant vs re-prefill by context length
Both rungs kept warm, so this isolates the KV work from model loading (which both strategies pay identically). 4.4–5.1× faster, 74–79% of the FLOPs avoided, 128→1 024 tokens.
token_series — per-token latency, 1 040 rows
One row per generated token: inter-token latency, which rung produced it, the memory pressure at that moment, and the resident footprint. This is the raw data behind the hero figure, and it is the file to look at if you want to check that the "no long stall" story holds token by token.
projector_residuals — how well the learned maps fit
Held-out relative RMS error per route, with the training residual alongside. Reported this way because a dense 257×128 map fitted on a few hundred tokens drives the training number to ~0.01 while generalising not at all.
Also included
results/*.json— the full benchmark output, including every event logpressure_traces/*.json— the memory-pressure traces (replayable)demo_session.json— the raw SSE stream of a live service session, timestamps and migration costs included.figures/demo.gifis a replay of exactly this.figures/*.png— every figure, regenerable fromresults/
Three findings that argue against the design
Included because an ablation table that only confirms its own design is not an ablation table.
- Top-k layer recompute did not earn its cost. Recomputing the destination's last 6 of 24 layers natively bought a 2% smoother seam for 31× the switch cost (900 ms against 29 ms). On this ladder, turn it off.
- A naive truncated map beats the learned one on the seam metric (handoff JSD 0.192 vs 0.220) while producing perplexity 24.1 against 3.1. JSD is bounded and rewards blurring: the naive map induces attention 11.4× flatter than the destination model's own. Two metrics, read together, or you get fooled.
- Step-to-step JSD is useless as a continuity metric on real text. It
saturates at
ln 2 ≈ 0.693(measured steady state 0.65–0.69), so a migration's contribution sits below the floor. It is retained in the JSON only so the reader can see why it was rejected.
Reproduce
git clone https://github.com/NagaYu/molt && cd molt
pip install -r requirements.txt
python scripts/train_projectors.py --ladder qwen
python benchmarks/run.py --ladder qwen --conditions all --cost-sweep --qos
python figures/make_figures.py
The hermetic test-suite (pytest, 72 tests, ~1 min) needs no downloads at all —
it runs the same code paths on randomly-initialised tiny models.
Caveats
- Single machine, single run per condition; no error bars. The kill counts are categorical and robust; the millisecond figures are one sample each.
- CPU only. The portable INT8 path dequantises on use (bitsandbytes is CUDA-only),
so
tier1buys memory and costs ~4× decode speed. - Memory pressure is a replayed trace by default, for reproducibility. A real
allocating child process is available (
--real-hog) and gives the same qualitative result, noisier.
Model (the fitted maps): NagaYu/molt-kv-projectors-qwen2.5
· Demo: NagaYu/molt
· Code: github.com/NagaYu/molt
- Downloads last month
- 35