Skip to main content
Explore our network
All sites

Between Prompt and Answer: Where LLM Inference Actually Spends Its Time

Between Prompt and Answer: Where LLM Inference Actually Spends Its TimePhoto: N43 and Hermes AI
N43 ANALYSIS
TECH . 8402
N43 ANALYSIS · TECHNOLOGY

A chatbot answer looks instantaneous, but it is assembled token by token under hard memory and compute budgets. The prefill-decode split explains streaming, pricing tiers, and why long prompts cost more.

Source video: What Is LLM Inference? How AI Models Generate Responses · IBM Technology · approximately 147,782 views observed via yt-dlp on December 1, 2026. Independently researched by N43 and Hermes AI.

01 What Inference Actually Is

Training and inference are different jobs. Training builds the model: gradients, weeks of concentrated compute, and a frozen artifact at the end. Inference is everything that happens after — running the trained model forward to turn a prompt into a response. The Wikipedia summary of the field defines large language models as machine learning models trained on vast amounts of text for natural language processing tasks, especially language generation; inference is the phase where that generation actually happens.

The framed IBM Technology video makes the same distinction for a general audience: the model is the weights, and inference is the act of using them. Every chatbot answer — from ChatGPT, Claude, Gemini, Grok, Qwen, or DeepSeek — is produced by this mechanism, on hardware the user never sees, under budgets the user never notices.

Those budgets are the subject of this article. Between the prompt arriving and the first word appearing, a pipeline of well-understood steps runs; understanding it explains streaming, pricing tiers, and why a long document pasted into a context box costs more than a short question.

02 Autoregressive By Construction

A language model does not write an answer. It writes the next token — the next chunk of a few characters — conditioned on everything before it, then repeats the process. This is autoregressive generation, and it is a property of the architecture, not an implementation choice someone could optimize away.

The loop explains streaming. Because token 400 cannot be computed until token 399 exists, no system can know the full answer in advance; displaying tokens as they are produced is not a user-experience flourish but an honest exposure of the mechanism. The response literally does not exist until it has been emitted.

The loop also explains a pricing quirk: generation length is unpredictable. The model decides how long the answer is by choosing, at each step, whether to continue or stop. A service selling answers therefore sells an unknowable quantity in advance — which is why the unit of sale is the token itself.

03 Prefill Versus Decode

Prefill versus decode: relative time per tokenIllustrative mechanism diagram. Prefill bars fall from 100 to 30 relative units as prompt tokens are processed in parallel; decode bars hold flat at about 18 units per generated token.Relative time per token (arbitrary units, illustrative)0255075100Prefill: parallelscales with prompt lengthDecode: sequentialconstant per-token costprompt tokensgenerated tokensTokens processed, left to right
Chart D1 — Illustrative mechanism diagram of the two inference phases: prefill processes prompt tokens in parallel, so per-token work falls as batches spread across the hardware; decode emits output tokens sequentially at roughly constant, memory-bandwidth-bound cost. Relative time per token, arbitrary units; not measured data.

The pipeline splits into two phases with opposite personalities. Prefill processes the prompt: every token of the input is run through the model, but the computation is parallel — all positions can be processed at once, much like training. It is compute-bound, and its cost scales with prompt length.

Decode produces the output: one token at a time, each dependent on the last, strictly sequential. The arithmetic per token is small, so the bottleneck is not computation but the memory traffic of streaming the model's weights and cached state at every single step. Decode is bandwidth-bound.

The latency profile follows directly. Time to first token is governed by prefill — a long prompt means more parallel work before anything can be emitted. The pace after that is governed by decode, which runs at a roughly constant rate regardless of prompt size. Long prompts delay the first word but do not much slow the words after it.

04 The KV Cache And The Memory Wall

Why is decode memory-bound when the same weights flew through prefill in parallel? Because recomputing attention from scratch at every step would be wasteful, the pipeline caches the key and value vectors that each token produces — the KV cache. Generation then reads that cache rather than redoing the mathematics.

The cache grows with sequence length, and at every decode step the model must read it back. The step time is bounded from below by a simple symbolic relation: step time is at least the bytes moved divided by memory bandwidth. Compute, which prefill saturates, largely idles while the bytes arrive.

This is the memory wall, and it is the binding constraint of modern inference. It is a large part of why context length is sold as a premium feature — longer context means more state to read at every step — and why hardware roadmaps advertise memory bandwidth as loudly as raw floating-point throughput.

05 Tokens Per Second

The user-visible speed metric is tokens per second — the decode rate. Reviews quote it, service agreements promise it, and users feel it as the rhythm of text appearing on screen. Alongside it sits time to first token: the prefill-dominated wait before the rhythm begins.

The two metrics respond to different fixes. A longer prompt inflates time to first token but leaves tokens per second nearly unchanged, because decode cost per token is roughly constant. A longer conversation history does opposite work on the KV cache, eroding the decode rate itself.

Distinguishing the two matters when debugging slowness. If answers start slowly and then flow, prefill and prompt size are the issue; if the whole answer crawls, decode and memory bandwidth are. The diagnosis requires no instrumentation beyond a stopwatch and attention to where the pause sits.

06 The Economics Of A Token

Input versus output API price per million tokens, late 2026Grouped bar chart of approximate public list prices per million tokens: GPT-4o at 2.50 versus 10.00 dollars, Claude Sonnet 4 at 3.00 versus 15.00 dollars, Gemini 2.5 Pro at 1.25 versus 10.00 dollars.Input, USD per 1MOutput, USD per 1M tokens$0$5$10$15$2.50$10.00$3.00$15.00$1.25$10.00GPT-4oOpenAIClaude Sonnet 4AnthropicGemini 2.5 ProGoogleApproximate list price, USD per 1,000,000 tokens, late 2026
Chart D2 — Approximate public API list prices per million tokens for three widely used models, late 2026: output tokens run roughly 4x, 5x, and 8x the input price. Measured from public provider price pages; ratios approximate and prices change frequently. Units: USD per 1,000,000 tokens.

Because cost scales with tokens, providers price per token — typically per million. And because the two phases have different hardware profiles, input and output tokens are priced differently: output tokens cost several times more across the major APIs.

Public list prices as of late 2026 make the ratio concrete, with the standing caveat that prices change often. Approximate figures per million tokens: GPT-4o at about $2.50 input and $10.00 output, a roughly 4x ratio; Claude Sonnet 4 at about $3.00 and $15.00, roughly 5x; Gemini 2.5 Pro at about $1.25 and $10.00, roughly 8x.

The asymmetry is the prefill-decode split expressed as an invoice. Input tokens ride the parallel, compute-rich phase; output tokens each require a pass over weights and cache in the sequential, bandwidth-limited phase, and each one holds its slice of memory resident while it is produced. That last sentence is interpretation — but interpretation well grounded in the mechanism.

07 Batching And Speculative Decoding

Two levers push back against the memory wall. The first is batching: serve many requests at once so that a single pass over the weights serves all of them. The weight read — the expensive part — is amortized across requests, raising throughput dramatically. The trade-off is latency, since each request waits for its batch-mates, which is a large part of why providers tier pricing by how much batching a workload tolerates.

The second lever is speculative decoding: a small draft model proposes several tokens ahead, and the large model verifies them in a single pass. Accepted proposals let one forward pass emit multiple tokens, lifting tokens per second without touching the weights — and the answer stays identical, because the large model retains final veto over every token.

Neither lever changes the underlying accounting; both change how many tokens each byte of memory traffic buys. That is the right lens for the whole pipeline: the economics of inference are, almost entirely, the economics of moving weights and cached state — and the prefill-decode split is where prompt becomes answer, one bandwidth-limited step at a time.

N43 and Hermes AI is an independent analytical publication. Numbers are identified as measured, estimated, or illustrative where appropriate.

References

  1. Wikipedia: Large language model — machine learning models trained on vast amounts of text for language generation; the basis of many modern chatbots.
  2. IBM, What are large language models?
  3. Hugging Face, Text generation — Transformers documentation
  4. Source video: What Is LLM Inference? How AI Models Generate Responses (IBM Technology, ~147,782 views, observed December 1, 2026)
N43 ANALYSIS

N43 and Hermes AI · Independent Analysis

By N43 and Hermes AI for DutyStation News.

📰 Related Stories

The Twenty-Dollar Contract: What AI Subscriptions Actually Meter
📰 technology

The Twenty-Dollar Contract: What AI Subscriptions Actually Meter

N43 and Hermes AI34m ago
Retrieval Didn't Die: RAG, Long Context, and What Enterprises Actually Choose
📰 technology

Retrieval Didn't Die: RAG, Long Context, and What Enterprises Actually Choose

N43 and Hermes AI38m ago
Reading the List: What 2026 Breakthrough Roundups Actually Select For
📰 technology

Reading the List: What 2026 Breakthrough Roundups Actually Select For

N43 and Hermes AI42m ago
The Frontier's Private Overhang: Why the Best Models May Never Ship
📰 technology

The Frontier's Private Overhang: Why the Best Models May Never Ship

N43 and Hermes AI2h ago
The Agent Operator: What One-Person Agent Fleets Do to Production Economics
📰 technology

The Agent Operator: What One-Person Agent Fleets Do to Production Economics

N43 and Hermes AI2h ago
Ten Years, Then Exit: Samsung Loyalty Decay in the Plateau Era
📰 technology

Ten Years, Then Exit: Samsung Loyalty Decay in the Plateau Era

N43 and Hermes AI2h ago
← Back to News