Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Modality | A kind of data: text, image, audio, video. A “multimodal” model takes or makes more than one kind. |
| Encoder | A network that reads an input (an image, a sound) in one pass and turns it into vectors. It does not generate anything. |
| Diffusion model | A generator that starts from random noise and removes a little noise per step, over many steps, until a picture or video appears. |
| DiT | Diffusion Transformer: a transformer used as the denoising network inside a diffusion model. |
| Latent | A compressed version of an image, video or sound that a model works on instead of raw pixels or samples. |
| ASR / TTS | Automatic speech recognition (speech to text) and text-to-speech (text to speech). |
| Pooling model | A model that returns one number or vector per input (an embedding, a score) instead of generated text. |
| Arithmetic intensity | FLOPs done per byte read from memory (2.f). High means compute-bound; low means bandwidth-bound. |
1. What is it?#
Most of this material studies one workload: a large language model generating text, one token at a time, behind a chat API. Real inference fleets in 2026 also run:
- Vision-language models (VLMs) that read images and video before answering in text.
- Image and video generators, mostly diffusion transformers.
- Speech: streaming recognition (ASR) and speech synthesis (TTS), often wired together with an LLM into a voice agent.
- Embedding and reranking models that turn text (or images) into vectors and scores for search and retrieval-augmented generation (RAG).
- Omni models that take and produce several modalities in one system.
This lesson is the map. It sorts these workloads by the few properties that decide how you serve them, so the next seven lessons can each go deep on one region. Facts checked on 13 November 2026.
2. Why does it matter?#
The LLM serving playbook (continuous batching, PagedAttention, prefix caching, speculative decoding) is built around one shape: a short burst of parallel work (prefill) then a long chain of tiny, memory-bound steps (decode). Other workloads have other shapes, and the playbook transfers only in part:
- An embedding request has no decode at all. The batching and caching tricks that matter for decode are irrelevant; tokenization and padding matter instead.
- A diffusion request runs the same large network 4 to 100 times over the whole output. Every step is compute-bound. There is no KV cache to page, and the user sees nothing until the end.
- Streaming speech has a hard real-time contract: audio arrives at 1 second per second, and the system must keep up with every stream forever, not just finish a request.
- A voice agent chains three or four models whose latencies add up against a human conversational budget of well under a second.
An engineer who applies text-LLM instincts everywhere will tune the wrong knobs: buying memory bandwidth for a compute-bound video model, or chasing tokens per second on an embedding service whose real limit is the tokenizer.
3. Simple analogy#
A restaurant kitchen. The text LLM is a short-order grill: many small orders, each cooked in a stream of quick steps, and you start serving the first bite before the last is cooked. Embeddings are the coffee machine: one press per order, all about how many cups per minute. Diffusion is the bakery oven: a whole cake goes in, it bakes for many minutes, nothing can be served half-way. Streaming speech is the conveyor-belt sushi bar: the belt never stops, and if you fall behind, plates pile up. One kitchen, four different ways to schedule the staff.
4. Tiny example: one request of each kind#
| Request | Input | Work | Output the user waits for |
|---|---|---|---|
| Chat | 2,000-token prompt | 1 prefill + 500 decode steps | First token, then a stream |
| VLM question | photo + 30 words | encoder pass + prefill + decode | Same as chat, but a slower first token |
| Embedding | 512-token passage | 1 forward pass | One vector of 1,024 numbers |
| Image | 20-word prompt | text encoder + 28 denoising steps + decode to pixels | One finished image |
| Video | 20-word prompt | text encoder + 50 steps × 2 (guidance) + decode | One finished clip, minutes later |
| Live captions | microphone, forever | an encoder chunk every 80–1,120 ms | Words within about half a second |
| Spoken reply | 40 words of text | autoregressive audio tokens + a vocoder | First audio within a few hundred ms |
5. Technical explanation: the five axes#
Every workload in this module can be placed on five axes. Learn these and you can reason about a model you have never seen.
Axis 1: parallel work or sequential steps#
- One pass: encoders, embedding models, rerankers, classifiers. All tokens go through once. The shape is pure prefill (12.c).
- Autoregressive: LLM decode, autoregressive speech tokens (most modern TTS), the “Talker” in omni models. One small step per output token, memory-bound at small batch (12.d).
- Iterative refinement: diffusion and flow-matching models. A fixed number of steps, each a full pass over all output tokens at once. Compute-bound, like running prefill 30 to 100 times.
Axis 2: what the user waits for#
- First token, then a stream: chat, VLMs, TTS, omni. Time to first token (TTFT) or time to first audio is the headline metric.
- The whole thing: images, video, embeddings. End-to-end latency, and for batch jobs, cost per output.
- Keeping up: streaming ASR. The metric is lag behind real time, and a stream that falls behind never recovers by itself.
Axis 3: what state lives between steps#
- LLM decode keeps a KV cache that grows with every token (12.e). Memory per request grows.
- Diffusion keeps only the latent (a few to a few hundred megabytes) and does not grow. It may keep step-to-step activation caches (26.c) but these are optional speed-ups.
- Streaming ASR keeps encoder context for each live stream for minutes or hours.
- Embeddings keep nothing. Every request is independent.
Axis 4: how many models form one request#
A chat request touches one model. A VLM request touches two (vision encoder, LLM). An image request touches three (text encoder, DiT, VAE decoder). A cascaded voice agent touches four (voice activity detector, ASR, LLM, TTS). Each extra model is another place to queue, another set of weights in GPU memory, and another hop of latency. 26.h treats the pipeline as the unit of design.
Axis 5: where the cost sits#
The program below estimates the linear-layer FLOPs of one request of each kind, using the rule from 2.f: about 2 FLOPs per parameter per token per pass. It also marks each pass compute-bound or bandwidth-bound: with 16-bit weights, the FLOPs per byte of weights read equal the tokens in the pass, so a pass with fewer tokens than the GPU’s ridge point (about 295 for an H100 in BF16) is limited by memory bandwidth.
package main
import "fmt"
// One request of each workload, reduced to the numbers that decide how it is served:
// tokens through the main network per pass, passes that must run one after another,
// and the size of that network.
type workload struct {
name string
params float64 // parameters of the main network, billions
tokens float64 // tokens per pass
passes float64 // sequential passes (decode steps or denoising steps x CFG)
}
func main() {
const ridge = 295 // H100 SXM: ~989 dense BF16 TFLOP/s ÷ 3.35 TB/s
ws := []workload{
{"chat LLM 8B: prefill 2,000 tokens", 8, 2000, 1},
{"chat LLM 8B: 500 decode steps, batch 1", 8, 1, 500},
{"embedding 0.6B: 512 tokens", 0.6, 512, 1},
{"vision encoder 0.4B: one 1080p image", 0.4, 8160, 1},
{"speech encoder 0.6B: 30 s of audio", 0.6, 1500, 1},
{"image DiT 12B: 1024², 28 steps", 12, 4096 + 512, 28},
{"video DiT 14B: 720p, 81 frames, 50x2", 14, 75600, 100},
}
fmt.Printf("%-40s %8s %7s %13s %s\n", "workload", "tok/pass", "passes", "linear GFLOP", "bound by")
for _, w := range ws {
gflop := 2 * w.params * w.tokens * w.passes // 2 FLOPs per parameter per token
// With 16-bit weights, FLOPs per byte of weights read = tokens in the pass.
bound := "compute"
if w.tokens < ridge {
bound = "memory bandwidth"
}
fmt.Printf("%-40s %8.0f %7.0f %13.0f %s\n", w.name, w.tokens, w.passes, gflop, bound)
}
chat := 2*8*2000.0 + 2*8*500.0
video := 2 * 14 * 75600.0 * 100
fmt.Printf("\none 5 s video clip ≈ %.0f chat requests of linear-layer FLOPs (attention not counted)\n", video/chat)
}Output:
workload tok/pass passes linear GFLOP bound by
chat LLM 8B: prefill 2,000 tokens 2000 1 32000 compute
chat LLM 8B: 500 decode steps, batch 1 1 500 8000 memory bandwidth
embedding 0.6B: 512 tokens 512 1 614 compute
vision encoder 0.4B: one 1080p image 8160 1 6528 compute
speech encoder 0.6B: 30 s of audio 1500 1 1800 compute
image DiT 12B: 1024², 28 steps 4608 28 3096576 compute
video DiT 14B: 720p, 81 frames, 50x2 75600 100 211680000 compute
one 5 s video clip ≈ 5292 chat requests of linear-layer FLOPs (attention not counted)Where the numbers come from:
- The vision encoder row is an image cut into 16×16-pixel patches: 120 × 68 = 8,160 patches for 1920×1080, the patch size used by Qwen3-VL’s encoder (26.b).
- The speech encoder row is Whisper’s 30-second window, which its encoder turns into 1,500 frames (26.e).
- The image DiT row is shaped like FLUX.1-dev: 12B parameters, a 1024×1024 image becomes 64 × 64 = 4,096 latent tokens plus 512 text tokens, and the model is guidance-distilled, so one pass per step (26.c).
- The video DiT row is shaped like Wan 2.1 14B: 81 frames at 1280×720 compress to 21 × 45 × 80 = 75,600 tokens; 50 steps with classifier-free guidance run two passes each (26.d).
And the video row understates the gap: at 75,600 tokens, attention (which grows with the square of the token count) costs more than the linear layers. 26.d does that sum.
6. Under the hood: the map#
flowchart LR
subgraph Understand["Understand (input is media)"]
VLM[VLM: encoder + LLM]
ASR[Streaming ASR]
EMB[Embeddings and rerankers]
end
subgraph Generate["Generate (output is media)"]
IMG[Image diffusion]
VID[Video diffusion]
TTS[TTS: AR tokens + vocoder]
end
OMNI[Omni and voice pipelines]
VLM --> OMNI
ASR --> OMNI
TTS --> OMNI
EMB --> RAG[RAG retrieval for any LLM]
class VLM,ASR,EMB compute
class IMG,VID,TTS memory
class OMNI,RAG io| Workload | Shape | Bottleneck | Headline metric | Engines in 2026 | Lesson |
|---|---|---|---|---|---|
| VLM | encoder pass + LLM | encoder + extra prefill tokens, API-server CPU | TTFT | vLLM, SGLang, TensorRT-LLM | 26.b, 18.h |
| Image diffusion | N full passes | compute | seconds per image | diffusers, SGLang Diffusion, vLLM-Omni, xDiT | 26.c |
| Video diffusion | N full passes, huge sequence | compute, attention | minutes per clip, $ per second of video | diffusers, xDiT, FastVideo, LightX2V, vLLM-Omni | 26.d |
| Streaming ASR | chunked encoder + small decoder | per-stream state, real-time factor | lag, word error rate | NeMo/Riva, vLLM realtime, faster-whisper | 26.e |
| TTS / voice | AR audio tokens + vocoder | decode latency, pipeline sum | time to first audio | vLLM-Omni, model-specific servers, Pipecat/LiveKit glue | 26.f |
| Embeddings, rerank | one pass, no decode | tokenization, padding, batching | queries per second, p99 | TEI, Infinity, vLLM pooling | 26.g |
| Omni | graph of stages | the slowest stage | first audio / first token | vLLM-Omni, SGLang | 26.h |
Colours in the diagram: understanding workloads, generating workloads, and the systems that combine them.
7. Performance implications#
- Compute-bound workloads reward FLOPs, low precision and fewer steps. For diffusion, FP8 and FP4 matmuls, faster attention kernels and step distillation are the big levers; extra HBM bandwidth helps little.
- Memory-bound workloads reward batching. TTS decoders and LLM decoders get cheaper per output as batch grows, until latency targets stop you.
- Small one-pass models are overhead-bound. A 0.6B embedding model on a big GPU finishes a forward pass in milliseconds; tokenization, padding and HTTP handling can dominate (26.g).
- Sequence length grows fastest in media. A minute of video or an hour of audio becomes tens to hundreds of thousands of tokens. Attention cost and context-parallel techniques from 14.f matter far earlier than in chat.
8. Production implications#
- Different SLOs per workload. Write separate latency targets: TTFT for VLMs, seconds per image, lag for ASR, time to first audio for TTS, p99 for embeddings. One “latency” number across a mixed fleet hides everything (23.a).
- Different units of cost. Price per million tokens fits text; image services price per image, video per generated second, ASR per audio hour, TTS per million characters. Capacity planning must use the same unit (23.c).
- Different failure modes. A slow diffusion job blocks a GPU for minutes; a stalled ASR stream silently loses words; an embedding outage breaks every RAG product at once.
- Mixed GPUs make sense. Compute-heavy generation wants the newest tensor cores; small encoders and embedding models often run well on cheaper GPUs or share one through MIG or MPS (21.d).
9. Common mistakes#
- Treating every workload as “tokens per second”. A video clip and an embedding batch do not share a unit; compare cost per useful output.
- Buying for bandwidth when the work is compute-bound. Diffusion and encoders are prefill-like.
- Ignoring the non-GPU stages. Image decoding, audio resampling, tokenization and video encoding to MP4 all run on CPUs and are frequent bottlenecks.
- Forgetting that a pipeline’s latency is a sum. Four models at 200 ms each make an 800 ms reply.
- Assuming the LLM engine is the right engine. vLLM serves pooling models and speech well; a dedicated embedding server or a diffusion runtime may still be simpler and faster for that job.
10. Hands-on exercise#
- Run the program. Change the image row to a 4-step distilled model. How many chat requests does one image now cost?
- Add a row for a 2B TTS model generating 20 seconds of speech at 12.5 audio tokens per second, one token per pass. Is it compute- or bandwidth-bound at batch 1? At batch 64 (multiply tokens per pass by 64)?
- Add a row for a VLM’s language model prefill of the 2,040 tokens that a 1080p image becomes after Qwen3-VL’s 2×2 patch merge, on an 8B model. Compare it with the encoder row.
- For a product you know (a meeting assistant, a photo app, a search box), list every model a single user action touches and place each on the five axes.
11. Interview questions#
- Name three workloads with no decode phase. What replaces continuous batching for them?
- Why is a diffusion step compute-bound while an LLM decode step at batch 1 is bandwidth-bound?
- A streaming ASR service runs at 70% GPU utilisation but users report captions falling further and further behind. What metric should you be watching, and why does the backlog not clear itself?
- Why does a five-second video cost thousands of times more compute than a chat reply?
- What changes in capacity planning when a fleet serves chat, embeddings and image generation?
12. Further reading#
Checked on 13 November 2026.