muggsofcode // under the hood ← → to navigate
the ai powering the tool

How the machine writes your page

What actually happens between COMPILE and your finished page — and the three ways we can make it fast.

start here

A model only does one thing

Give it some text, and it predicts the next token — the next little chunk of text (a word, part of a word, a symbol).

That’s the whole trick. To write a page, it predicts one token, sticks it on the end, and predicts again. Over and over, thousands of times. This is called autoregressive generation — each token feeds back in to help pick the next.

under the hood · one step

How it picks a token

The text runs through the model once (a forward pass). Out comes a probability for every token it knows — then it takes one of the likeliest.

“The water cycle ___
moves61%
is22%
begins9%
describes5%

Then it appends “moves” and runs the whole thing again for the next token.

method 1 · plain decoding

Why one-at-a-time is slow

Every single token means loading all 9 billion of the model’s numbers from memory and running a full pass — just to produce one token.

And it’s strictly in order: token #5 can’t start until #4 exists. A page is thousands of these, one after another.

The sneaky part: loading that giant model is the expensive step, and you pay it in full for each token. The GPU spends most of its time fetching weights, not doing math. That waste is exactly the opening the next two methods exploit.

the key insight

Checking is cheaper than writing

A model can verify a whole batch of tokens in a single forward pass — all at once, in parallel — even though it can only generate one at a time.

It’s faster to grade a finished answer than to write one from scratch. Both fast methods below are built on this one fact.

method 2 · speculative decoding

Guess ahead, then check

Let something fast guess the next few tokens. The big model then checks all the guesses in one pass and keeps the ones it agrees with.

Think of a fast intern drafting the next few words in pencil, and the expert reading them in a single glance — checking off the right ones and crossing out from the first mistake. Reading is quicker than writing, so the expert gets ahead.

Crucially: the big model still approves every token. Same output as plain — just fewer slow passes to get there.

under the hood · one verify pass

Accept the streak, stop at the first miss

the draft guessed 5 tokens:

thewatercycleisa

the big model checks them all in one pass:

the ✓water ✓cycle ✓is+ moves

It accepts the matching streak (the water cycle), rejects at the first mismatch, and adds its own token there (moves). That’s 4 tokens from one pass instead of 1. How often guesses land is the acceptance rate — higher means faster.

doing the guessing · way a

A separate draft model

The classic setup: pair a small draft model with the big target. The little one guesses; the big one verifies.

draft — guesses
0.8B model
target — verifies a batch
9B model

The catch: you now load and run two models, and the draft is a different network — it can guess things the target wouldn’t, and every wrong guess is wasted work.

doing the guessing · way b

MTP: the model guesses for itself

Instead of a second model, give the model extra output heads — small add-ons trained to predict token +2, +3 straight from the thinking it already did for the current token.

one model — drafts & verifies itself
9B + MTP heads

The heads read the model’s own internal state, so drafting is nearly free — no second model to load — and the guesses agree with the target far more often, because they come from the same brain. MTP = Multi-Token Prediction.

the big picture

External draft → self-draft

01Plainone token per full pass — simple, slow
02Speculative decodinga separate draft model guesses ahead
03MTPthe draft moves inside the model itself

This is where frontier open models are heading (DeepSeek-V3, Qwen 3.5). Not the final word — other approaches like EAGLE-3 are right behind — but the current direction.

so which one do we run?

We didn’t guess. We measured.

Same model — Qwen3.5-9B — run three ways, on our real job: turn a spec into a full HTML page, with all five build groups generating at once. One RTX 4090, same prompt.

contender
Plain 9B
contender
9B + 0.8B draft
contender
9B MTP
results · speed for one user

Tokens per second

Plain 9Bno speculation
132
9B + 0.8B draftspeculative decoding
100
9B MTPbuilt-in drafting
247
tok/s — higher is faster  ·  our old 8B setup was ~110

MTP is nearly plain. And the “clever” separate-draft method? The shortest bar on the chart.

the twist

The proven trick made it slower

The separate draft guessed right ~86% of the time — almost as often as MTP’s ~88%. So why was it slower than doing nothing?

86%
draft accepted — yet slower than plain
88%
MTP accepted — 2× faster
≈0
MTP’s cost to draft — the heads ride along free

Because the little draft model has to run first, every token — and that extra work cost more than it saved. High accuracy couldn’t rescue a second model. MTP’s heads are free; a separate model never is.

and under real classroom load

All five groups at once

540
tok/s combined across 5 pods
133
tok/s per pod — same as going solo
24s
worst wait for a full page

MTP’s lead actually widened under load. Each group generates as if it had the whole GPU to itself.

the takeaway

Newer isn’t automatically better. Measure.

MTP won — but not because it was the newest. It won because on our hardware, our model, and our workload, the numbers said so. The older, “safer” method would have made things worse.

You only ever know which one wins by testing it on the thing you actually do.

That’s the real skill — not picking the newest trick, but measuring it.

recap

Three ways to run one model

MethodHow it draftsSolo tok/sVerdict
Plain 9Bno drafting132baseline
9B + 0.8B draftseparate model100slower than plain
9B MTPbuilt-in heads2472× — shipped

muggsofcode runs Qwen3.5-9B with MTP.

speculative decoding & mtp 01 / 16