Users complain that a chatbot takes a long time before the first word appears on long prompts. Which inference phase drives this?
- Exam domain
- Inference Concepts15% of the exam
- Difficulty
- Medium
- In this mock
- 8 questions on this domainPractise this domain
Why the exam asks this
Inference Concepts (15% of the exam)
Objective in the exam guide: Inference pipeline phases and modes, including prefill and decode and real-time versus batch inference.
Prefill and decode explain most latency questions.
Why D is the answer
Prefill, which processes the whole prompt
Prefill processes all prompt tokens and builds the KV cache before the first token, so long prompts raise time to first token. Decode then produces one token at a time.
Remember: Long prompts slow prefill and time to first token.
How it works
LLM inference has a compute-heavy prefill phase and a memory-bound decode phase. TTFT and throughput are measured separately.
In detail
- Prefill sets time to first token.
- Decode sets tokens per second after that.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Decode, which writes each later tokenWrongMost tempting
Decode starts after the first token.
Why it tempts: Decode generates the text, so it seems responsible.
B. Tokenizer download at install timeWrong
Tokenizers load once.
C. Model trainingWrong
Training is not part of serving.
D. Prefill, which processes the whole promptRight
Long prompts slow prefill and time to first token.
Use case
An illustrative scenario, not a real incident.
Illustrative: trimming a 20,000-token system prompt to 4,000 cuts time to first token by about 70%.
See it in different ways
sequenceDiagram participant P0 as Client participant P1 as Prefill participant P2 as Decode P0->>P1: prompt tokens P1->>P2: KV cache and first token P2-->>P0: stream next tokens one at a time
How to read this chart
- 1. Client sends "prompt tokens" to Prefill.
- 2. Prefill sends "KV cache and first token" to Decode.
- 3. Client gets a reply from Decode: "stream next tokens one at a time".
mindmap
root(("Latency"))
n1["TTFT"]
n2["Prefill"]
n3["Prompt length"]
n4["Inter-token latency"]
n5["Decode"]
n6["Throughput"]
n7["Batching"]
n8["Concurrency"]How to read this chart
- The centre is "Latency".
- "TTFT" covers "Prefill", "Prompt length".
- "Inter-token latency" covers "Decode".
- "Throughput" covers "Batching", "Concurrency".
Related questions
Learn more
- Our lesson: Inference concepts
- Practise Inference Concepts questions in the mock exam
- Source: NVIDIA Dynamo documentation
- Source: TensorRT-LLM documentation
- TensorRT-LLM documentation
- NVIDIA Dynamo documentation
- Efficient Memory Management for LLM Serving with PagedAttention (arXiv)
- Fast Inference from Transformers via Speculative Decoding (arXiv)