Inference is the act of running a trained language model to produce output. A model is trained once but run every time anyone sends a prompt, so for a widely used model inference accounts for most of the computing cost. The speed at which a model produces text, and the price per token that providers charge, are both properties of how inference is done.
Generating text has a structure that makes it unusually wasteful for modern chips. A model writes one token at a time, and to write each token it has to read all of its weights from memory. The chip's arithmetic units spend most of that time waiting, so generation speed is set by memory bandwidth rather than by compute. Most speed-up techniques work around that limit, either by producing several tokens per read or by making the weights smaller.
These limits decide whether cheap and local models are practical for agent work (Cheaper models are enough for most work), and what models cost to serve (Model economics and access, AI compute and power).
How it works
Prefill and decode
Inference has two phases. In prefill, the model reads the whole prompt at once. Every prompt token can be processed in parallel, so prefill keeps the chip's arithmetic units busy and is relatively fast per token. In decode, the model generates the answer one token at a time, and each new token depends on the previous one. The model keeps a cache of intermediate values for earlier tokens (the KV cache) so it does not recompute them, but it still reads every weight for every new token.
The bandwidth limit
A rough upper bound on decode speed is the chip's memory bandwidth divided by the size of the model's weights in bytes.[1] A model whose weights take 16 GB, on a GPU that moves about 1 TB per second, cannot decode much faster than about 60 tokens a second for a single user, however fast its arithmetic is. Serving many users at once helps, because one read of the weights can serve a whole batch of requests. That is why a large hosted provider gets far more tokens per chip than one person running a model at home.
Speculative decoding
Speculative decoding uses a small, fast draft model to guess the next several tokens, then has the large model check all the guesses in a single pass. Checking several tokens costs about the same as generating one, because the weights are read once either way. Accepted guesses are kept, and the output follows exactly the same probabilities as the large model working alone, so when the model always picks its single most likely token (sampling turned off) the text is identical.[2][3] The idea grew out of earlier work on predicting blocks of tokens in parallel.[4] The draft does not have to be a separate model. Self-speculative decoding drafts with the large model itself by skipping some of its middle layers, then checks the draft with the full model, which gave up to about twice the speed on Llama 2 models with no extra memory.[24] What makes a draft model good is not obvious. A study of more than 350 runs found that the gain depended heavily on the draft model's speed, while its skill at modeling language barely predicted the gain. A draft model designed around that finding gave 60 percent more throughput than existing drafts for a 65-billion-parameter model.[25] A newer variant drafts the next guesses while the large model is still checking the current ones, and claims about twice the speed of leading serving software.[5]
Multi-token prediction and diffusion
Other approaches change what the model predicts. Multi-token prediction trains a small addition to an ordinary model so it proposes several future tokens at once, which made code and math generation nearly five times faster in one study with no loss in quality.[6] Diffusion language models go further. Instead of writing left to right, they start from a block of placeholder tokens and refine all of them over a few steps, the way image diffusion models refine noise into a picture. Mercury, a commercial diffusion coding model, reports more than a thousand tokens a second on a single data-center GPU,[7] and the independent benchmarking firm Artificial Analysis reported its successor, Mercury 2, at more than a thousand output tokens a second in February 2026.[26] In June 2026 Google released DiffusionGemma, an open diffusion text model announced as up to four times faster on consumer GPUs than a standard left-to-right model.[8] I saw an open, trainable diffusion model as a significant step, because it lets others experiment with the approach.[9]
Quantization
Quantization stores weights in fewer bits, which shrinks the model and so raises the bandwidth limit directly. Early work found that a small number of outlier values carry much of a model's behavior, and kept those in higher precision while compressing the rest to 8 bits.[10] AWQ (activation-aware weight quantization) finds the roughly one percent of weights that matter most, judged by the size of the values that flow through them, and scales them up before rounding so they lose less precision. All weights then go to 4 bits with little loss in quality.[11] At the extreme, ternary models store each weight as -1, 0 or +1. BitNet b1.58, which introduced the approach for language models in 2024, claimed to match full-precision models of the same size and training data, because it is trained that way from the start instead of compressed afterward.[20] A 2026 paper found that up to half of the weights in real ternary models are zero and used that to store them in under 1.5 bits per weight, with faster decoding as a result.[12] How far down to go is still argued. A unified comparison of 1-bit to 4-bit schemes found a sharp change between 2 and 3 bits: above it, a quantized model stays close to the original, and below it, the model has to relearn its representations. Even so, ternary, 2-bit and 3-bit models generally beat 4-bit ones at the same memory size, and a 600-million-parameter ternary model beat an earlier 3-billion-parameter one.[23]
The KV cache can be compressed as well, which matters for long agent sessions where it grows large. Speculative KV coding, described in May 2026, borrows the logic of speculative decoding. A cheaper version of the model predicts each cache value, and only the difference from the true value is stored, using arithmetic coding, so nothing is lost. On Qwen3 models it reported about 3 to 4 times compression on top of an 8-bit cache, though its compute overhead was not yet measured.[21]
Kernels
A kernel is a single program the GPU runs, such as one matrix multiplication. Producing one token (a forward pass through the model) normally launches hundreds or, for larger models, thousands of kernels, and the gaps between them leave the chip idle. Fusing the whole pass into one "megakernel" removed those gaps and cut latency for a small model substantially.[13] Similar engineering lets hobbyists push consumer cards well beyond popular open-source serving software such as llama.cpp, for example by recording the sequence of kernel launches once and replaying it, which cut launches per token from thousands to hundreds.[14]
Determinism
Running a model with sampling turned off, so it always picks the most likely next token, should give the same answer every time, but in practice it often doesn't. The cause lies in the arithmetic. Many GPU kernels compute slightly different results depending on how many requests share a batch, and batch sizes change with server load. Kernels written to give identical results regardless of batch size fix this, at some cost in speed.[15] Reproducible output matters for debugging and for fair comparisons between models (Evals and benchmarks).
Local inference
Running models on one's own hardware is a popular hobby and a real option for privacy-sensitive work. The bandwidth limit explains which hardware works: machines whose processor and graphics share one large, fast pool of memory, such as recent Macs, can hold big models, and memory bandwidth decides how fast they run. Published figures for popular machines range from 120 GB per second for a base Mac mini to 936 GB per second for an RTX 3090 and 1,792 GB per second for an RTX 5090.[28] By the rule above, a model whose weights take 8 GB would decode at roughly 15 tokens a second on the first and about 220 on the last. I have recommended running a large open model on a machine with a large pool of such memory as a usable local setup,[16] and others have shown aggressive 2-bit quantization as a route to strong models on ordinary laptops.[17] Local inference still loses to hosted inference on cost per token, because a single user can't batch requests the way a provider can.[18] My own trial with a consumer graphics card is in A home GPU against a $10 plan.
History and timeline
- 2018: blockwise parallel decoding proposes predicting several tokens and verifying them.[4]
- 2022 to 2023: 8-bit and 4-bit weight quantization make large open models practical on single GPUs,[10][11] and speculative decoding is published by two groups.[2][3]
- Sep 2023: self-speculative decoding drafts with the model's own layers.[24]
- Feb 2024: a large study shows that draft-model speed matters more than draft-model quality.[25]
- Feb 2024: BitNet b1.58 trains language models with ternary weights.[20]
- Nov 2024: precision-aware scaling laws suggest that heavily trained models lose more from quantization.[22]
- Feb 2025: a unified comparison finds 2-bit and 3-bit models competitive with 4-bit ones.[23]
- May 2025: I start reading closely on decoding, quantization and kernels, including the megakernel work.[13]
- Jun to Jul 2025: commercial diffusion coding models and multi-token prediction from ordinary models appear.[7][6]
- Sep 2025: batch-invariant kernels show how to make inference deterministic.[15]
- Dec 2025: I argue that complaints about hosted models being secretly quantized after release are mostly mistaken.[19]
- Feb 2026: Mercury 2 passes a thousand output tokens a second.[26]
- Mar 2026: speculative speculative decoding claims about twice the speed of leading engines.[5]
- May 2026: speculative KV coding compresses the KV cache losslessly with a cheaper predictor model.[21]
- May 2026: GLM-5.1-HighSpeed, from the Chinese lab Zhipu, serves a flagship model at 400 tokens a second through its API.[27]
- Jun 2026: an open diffusion text model is released.[8]
- Aug 2026: I argue that local hardware doesn't win on token cost.[18]
- Sep 2026: sparse layouts push ternary models below 1.5 bits per weight.[12]
My position
My working view is that hosted inference of open models is the cheapest way to buy tokens, and that local hardware is worth it when data must stay private or for learning how inference works, but not to save money.[18] What could change that is decoding that escapes the bandwidth limit for a single user. Diffusion models and multi-token prediction are the candidates I'm watching most closely, because they speed up exactly the case a single-user machine is stuck in.[9]
I also push back on a popular theory about hosted models. Users often claim that a provider secretly quantizes a model after launch to save money, making it worse. In December 2025 I argued that the large labs almost certainly quantize and otherwise optimize a model before release, as part of choosing what to ship, but that degrading a released API model in secret is implausible. Businesses building on these APIs run their own evals whenever anything changes, and a drop in quality, or a sudden jump in speed, would be noticed quickly. Chat products are a different case, because a provider can route requests to different models depending on load. Confirmed incidents, and context windows filled past what a model handles well, could explain other bad days.[19] The hardware theory in the open questions below is a later and more speculative addition to the same argument.
Criticism and counterpoints
Speed numbers in this field are hard to compare. Papers report results on different hardware, batch sizes and tasks, and speculative methods gain most on predictable text like code. Quantization losses that look small on benchmarks can show up in long agent runs. There may also be a ceiling on quantization as models train longer. Precision-aware scaling laws, fitted on more than 465 training runs of small models, predict that the damage from quantizing after training grows with the amount of training data, to the point where more pretraining data can make the quantized model worse.[22] Those experiments stop at 1.7 billion parameters, so how far the result carries to frontier models is open. And hosted prices include margins and subsidies that can change, so the hosted-versus-local comparison describes 2026 prices and may not hold later.
Open questions
- Will diffusion or multi-token decoding make single-user local inference fast enough to change the economics?
- How much quality do aggressive quantization schemes lose on long, multi-step agent tasks?
- Do providers serve the same model on different hardware with different results? Users sometimes report that a hosted model seems worse on some days, and I suspect that different chips, with different kernels and rounding, are one cause (AI compute and power).
See also
Change log
- 2026-12-03: Enriched with BitNet b1.58, lossless KV cache compression, and further reading on speculative decoding.
- 2026-12-03: Enriched with self-speculative decoding and draft-model research, low-bit quantization trade-offs and the precision scaling limit, memory bandwidth figures for local machines, my argument against the secret-quantization theory, and a longer timeline.
Reading
- Kapoulkine, LLM inference speed of light. The clearest short explanation of the bandwidth limit
- Austin et al. (Google DeepMind), How To Scale Your Model
- Leviathan et al., Fast Inference from Transformers via Speculative Decoding
- Inception Labs, Mercury
- Lin et al., AWQ
- Hazy Research, Look Ma, No Bubbles!
- Thinking Machines Lab, Defeating Nondeterminism in LLM Inference
- PyTorch, A Hitchhiker's Guide to Speculative Decoding
- Karpathy on why speculative decoding works (Aug 2023)
- Yan et al., Decoding Speculative Decoding. Over 350 experiments on what makes a good draft model
- Kumar et al., Scaling Laws for Precision
- Liu et al., ParetoQ
References
- ^ Kapoulkine, LLM inference speed of light
- ^ Leviathan et al., Fast Inference from Transformers via Speculative Decoding
- ^ Chen et al., Accelerating Large Language Model Decoding with Speculative Sampling
- ^ Stern et al., Blockwise Parallel Decoding for Deep Autoregressive Models
- ^ Speculative speculative decoding, up to 2x over the fastest engines (@tanishqkumar07, Mar 2026)
- ^ Samragh et al., Your LLM Knows the Future: Uncovering Its Multi-Token Prediction Potential
- ^ Inception Labs, Mercury: Ultra-Fast Language Models Based on Diffusion
- ^ DiffusionGemma, an open diffusion text model (@osanseviero, Jun 2026)
- ^ A trainable open diffusion text model is a big deal (@trashpandaemoji, Jun 2026), since deleted
@LottoLabs A trainable diffusion text model is big
- ^ Dettmers et al., LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale
- ^ Lin et al., AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration
- ^ Georganas et al., Breaking the 1.58-bit Barrier for Ternary LLMs
- ^ Hazy Research, Look Ma, No Bubbles! Designing a Low-Latency Megakernel for Llama-1B
- ^ A custom engine reaches 129 tokens a second on one RTX 3090 (@superalesha, Nov 2026)
- ^ Thinking Machines Lab, Defeating Nondeterminism in LLM Inference
- ^ Running a large open model locally on a large shared-memory machine (@trashpandaemoji, Jun 2026), since deleted
@jeremy_daly @joelhooks @opencode You can run @antirez's ds4 with Deepseek V4 Flash on a 128GB machine like a Mac or a dgx spark for much less than that. Around 5K for something usable.
- ^ 2-bit weights plus n-gram data on SSD for 64 GB laptops (@antirez, Aug 2026)
- ^ Tokens from your own hardware cost more (@trashpandaemoji, Aug 2026), since deleted
You pay more for tokens you serve from your own hardware though. If you buy tokens for the same open model from something like open router, you get benefits from the economies of scale from the batched inference. You get guaranteed capacity and other benefits like privacy or education from local hardware which might justify the cost. But token cost alone is not really a good justification for running local hardware.
- ^ The Quantization Conspiracy Theory (post, Dec 2025)
- ^ Ma et al., The Era of 1-bit LLMs: All Large Language Models are in 1.58 Bits
- ^ Finn, Speculative KV coding (Doubleword, May 2026)
- ^ Kumar et al., Scaling Laws for Precision
- ^ Liu et al., ParetoQ: Scaling Laws in Extremely Low-bit LLM Quantization
- ^ Zhang et al., Draft & Verify: Lossless Large Language Model Acceleration via Self-Speculative Decoding
- ^ Yan et al., Decoding Speculative Decoding
- ^ Mercury 2 passes 1,000 output tokens a second (@ArtificialAnlys, Feb 2026)
- ^ GLM-5.1-HighSpeed serves a flagship model at 400 tokens a second (@zRdianjiao, May 2026)
- ^ Memory bandwidth of common local inference machines (@MikeBradleyAI, May 2026)