How should be set in production?
easyAnswer
- Set it to the maximum reasonable output length + a small buffer.
- Too low: outputs get truncated mid-sentence.
- Too high: encourages the model to ramble (RLHF sometimes over-generates), and increases latency + cost.
- Also matters for cost estimation and SLA — a cap prevents pathological runaway generations.
- In streaming APIs, caps the total tokens streamed, so users see truncation.
- Best practice: measure typical output lengths from your prompts and set .
Check yourself — multiple choice
- Set to 4096 always
- Measure P95 output length × 1.5 → too low truncates, too high rambles + adds cost/latency
- No max needed
- Same as temperature
: sized by observed P95 output + buffer; controls cost / latency / truncation.
#generation#production#cost
Practise LLMs & GenAI
214 interview questions in this topic.