Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Trace every LLM call with the full prompt and output, model name/version, token counts and cost, latency, and a correlation ID — or you can't reproduce production bugs.
Imagine a chef who cooks a slightly different dish every time, even from the same order. A customer complains a meal was awful. If all you wrote down was 'served a meal,' you're stuck — you can't recreate it. So you keep a full ticket: the exact recipe used, which chef, how long it took, how much it cost, and an order number. Now you can pull the ticket and see exactly what went wrong. An LLM trace is that ticket: the prompt sent, the answer, the model, the tokens, the time, and an ID to find it all.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Spend 5-6 minutes: anchor on the 'can I re-run this exact call?' test, then justify each field group and explain why dropping the prompt is fatal.
| Field group | Why it's logged | Cost of omitting |
|---|---|---|
| Full prompt + output | Exact input/output for replay | Can't reproduce a bad answer |
| Model name + version | Pin behavior across provider updates | Silent drift is unattributable |
| Token counts + cost | Budgets, caps, routing | No cost visibility or control |
| Latency (TTFT + total) | Perf and streaming UX | Regressions go unnoticed |
| Trace / correlation ID | Thread across services and reports | Logs can't be joined |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Logging only the final user-visible answer to save storage. Without the exact prompt and model version, you can't reproduce or explain a bad response.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.