Guessing Ahead
SwarmLLM writes replies faster by guessing. Something cheap guesses the next few words, the model you asked checks all of them at once, and every guess the model agrees with is kept. The reply is still the model's own: a guess never puts a word in the reply that the model would not have chosen there. The guesses only decide how many words each step produces. Researchers call this speculative decoding.
Why guess at all
A language model writes one token at a time (a token is a word or a piece of one). Each token needs a full pass through the model, and a pass costs almost the same whether it handles one token or several: most of its time goes on reading the model from memory, not on the arithmetic. So checking five guessed tokens costs little more than writing one.
When a model is split across computers, every pass also crosses the network. Between Thailand and Australia that trip takes about 115-135 ms there and back, which on its own would cap a reply at roughly eight tokens a second however fast the graphics cards are. A check of several guesses makes the same trip and brings back several tokens.
How a guess becomes words
- A guesser proposes the next few tokens.
- The model reads all of them in one pass, as if it had written them itself.
- Left to right, each guess is kept while it matches what the model would have written there. At the first mismatch the model's own word is used instead, and the guesses after it are thrown away.
- The next round starts from the new end of the reply.
Say the reply so far is "The capital of France", and the guesser proposes "is Paris. It". The model agrees with "is", "Paris" and "." but would have written "The" where the guess said "It". One pass has added four words: "is Paris. The". A wrong guess costs a little time. It never costs a wrong word.
How many tokens to guess is not fixed: SwarmLLM measures what a check and a guess actually cost on the computers involved and guesses as many as pay.
Does it change the reply?
No. Every word in the reply is one the model chose:
- With no randomness (temperature 0), a guess is kept only where it is the model's own likeliest word.
- With randomness (a temperature above 0, which most chat apps use), the model draws its own word as usual and the guess is kept only when the two agree. A guess is therefore kept exactly as often as the model would have picked that word, so replies keep the same variety.
One fine point: checking several tokens in one pass adds the same numbers in a slightly different order. Where two words score almost exactly alike, a guessed reply can take the other one. Either way the word is the model's choice, never the guesser's.
The guessers
| Guesser | Where it is used | What it needs |
|---|---|---|
| The conversation itself | Any model, on one computer or split | Nothing: it reuses runs of words already in the prompt or the reply |
| A small model of the same family | A model split across computers | A small model sharing the big one's vocabulary, fetched automatically |
| The model's own guess head | Qwen 3.5 and 3.6 models whose file carries one | 120-900 MB more memory on the device it sits on |
| The block drafter | Qwen 3.5 and 3.6, on a computer with a graphics card | A separate 0.4-1.85 GB file per model, fetched automatically |
The conversation itself
Replies often repeat what is already on the page: a function name, a quoted sentence, a list's pattern. SwarmLLM looks for the last few tokens earlier in the prompt or the reply and guesses that what followed them then follows them again. Nothing is downloaded and no second model runs. It pays most where a reply copies from its input (summaries, editing code, answering from a document) and makes little difference to free-flowing prose.
It also looks in your own earlier replies. A question asked again, or an agent repeating steps from an earlier session, is mostly guessed right and written much faster. That store of replies:
- holds only replies to requests made with this computer's own key, and only those requests read it;
- lives in memory, never on disk, and is never shared or announced (at most 4 models and 4,096 replies);
- feeds a split only where every computer in it served the earlier reply, so no computer is sent words it had not already seen.
A small model of the same family
When a model is split across computers, the computer that asked runs a much smaller model of the same family as the guesser: Qwen2.5-1.5B guessing for Qwen2.5-14B, for example. The two must share a vocabulary, so a guess means the same token to both.
- It is chosen automatically: the largest model this computer holds that shares the big model's vocabulary and is at most a quarter of its size (up to half, for a small one, when this computer's graphics card is in use).
- It is fetched when missing. A computer that splits a model with no guesser fetches the largest suitable one other computers already share: never more than 2 GiB, never one that is not trusted, never over a metered connection. It keeps it while splits use it and for a week after the last.
- It uses only graphics memory that is free, never the card memory of the model it guesses for, and runs on the processor otherwise.
- If it fails, the reply finishes without guessing.
The model's own guess head and the block drafter (Qwen 3.5 and 3.6)
Some newer models come with their own guessers:
- The guess head is a small next-word block carried inside the model's own file. It works from values the model computes anyway, so when the model is split nothing new crosses the network, and while the far computer checks one round of guesses, the head already guesses the next.
- The block drafter is a separate small file for each model that guesses a block of up to 15 tokens in one pass from the model's own working values. It comes from a fixed list, its size and checksum are verified before it is kept, it waits while the connection is metered, it never takes the disk's last 10%, and it is deleted with the model. A computer that runs models only on its processor does not fetch it: the guess head is faster there.
Why it matters most for a split model
On one computer, guessing saves passes through the model. In a split it saves round trips, and round trips are what make a split slow. Two things make each trip count:
- A tree of guesses, not a single line. The helper proposes several alternatives at each step, typically 8 per level, and the far computer checks every branch in the same pass. Whichever branch the model really takes, its longest matching run is kept, so one wrong word does not waste the round.
- Guesses flow without waiting, on links of 110 ms or more there and back. The computer you asked from keeps growing the tree and sending new rows while earlier ones are still on their way. The far computer answers each row with the word the model would pick there, and each word is written out as soon as its answer arrives. A full round trip is waited out only where no guess held the model's word. On shorter links, guesses go in rounds instead.
This is how a model split between two continents can write faster than one computer alone, most of all for code. It depends on the helper having room: when other programs fill the graphics card, the helper runs on the processor, guesses more slowly, and the split slows with it.
When it helps, and when it does not
- Code and structured text gain the most. They are easy to guess, so most guesses are kept. Prose gains less.
- Randomness makes guessing harder. A random pick is harder to predict; on a 14B model split across two continents, replies at a temperature of 0.7-1.0 ran a tenth to a quarter slower than replies with none.
- Computers side by side gain little. Where the round trip is short there is little time to save, and guessing can cost more than it saves: on two computers side by side with the helper on a processor, it once made replies six times slower. SwarmLLM now measures what each round costs, guesses nothing where that does not pay, and leaves guessing out of requests on those same computers for the next ten minutes.
- On one computer with a graphics card the card is already quick per token, so copying from the conversation makes a difference of a few percent either way. On a processor it is 1.3-1.5 times as fast on replies that copy from their input.
Current speeds, with and without a split, are in the README's How fast is it? section.
Settings
Guessing is on by default and needs no setup; the dashboard has no switch for
it. These settings, in the [inference] section of config.toml
(full reference), change it:
| Setting | Default | What it does |
|---|---|---|
speculative_decoding | true | false switches guessing off |
decentralized_spec_decoding | true | false stops guessing for models split across computers |
ngram_lookup_enabled | true | false stops guessing from the conversation itself |
draft_model | none | Names the small model (by its id) to guess with, instead of the automatic choice |
speculative_gamma | 4 | How many tokens to guess per check to start with; a split then adjusts it each round |
For comparing speeds, these environment variables switch single parts off:
SWARMLLM_MTP=0 (no guess head anywhere), SWARMLLM_SPLIT_GUESS_HEAD=0 (no
guess head beside a split), SWARMLLM_SPLIT_HEAD_AHEAD=0 (no guessing the next
round during a check), SWARMLLM_BLOCK_DRAFTER=0 (no block drafter),
SWARMLLM_SPEC_STREAM=0 (checks one batch at a time) and
SWARMLLM_FLOW_COPY_STORE=0 (no guessing from your earlier replies).
Questions people ask
Why was the second answer to the same question so much faster? The first answer was kept in memory, and the second was guessed from it (see The conversation itself above). The model still checked every word.
Does guessing send my words anywhere new? No computer is added to a request for it. Guesses go only to computers already running part of the request, and like the rest of a split request they can read what they are sent. Pipeline Privacy Model explains what each computer in a split sees.
Does the helper take memory from my model? It uses only graphics memory that is free, never the memory of the model it guesses for, and runs on the processor when the card is full. On disk it takes at most 2 GiB, given back a week after a split last used it.
Why does a split sometimes not guess? Usually one of three reasons: this computer has no helper for that model family yet and is still fetching one; guessing cost more than it saved on those computers in the last ten minutes; or guessing is switched off in the settings.
Can I see it working? Not as a number in the dashboard. It shows up as speed: the same model writes more tokens a second, most of all for code and for text that repeats what came before.
Further reading
- Performance & Inference Speedups — each guessing method in technical detail, with measurements.
- Inference Pipeline — how a split request travels between computers.