Inference Parameters
Randomness and diversity (verified, Bedrock inference parameters docs)
| Parameter | Lower value | Higher value |
|---|---|---|
| Temperature | Higher-probability tokens more likely → more deterministic, focused | Lower-probability tokens more likely → more random, creative |
| Top K | Fewer candidate tokens (a fixed number of the most likely) | More candidates, allowing less likely tokens |
| Top P | A smaller share of the cumulative probability (pool size varies per token) | A larger share, allowing less likely tokens |
The docs' example: next-word candidates horses 0.7, zebras 0.2, unicorns 0.1. - High temperature flattens the distribution, so unicorns becomes more likely. - Top K = 2 → only horses and zebras. - Top P = 0.7 → only horses; Top P = 0.9 → horses and zebras.
Length
- Response length: minimum or maximum number of tokens to generate (often "max tokens").
- Penalties: penalise length or repeated tokens.
- Stop sequences end generation when a given string appears (general background).
- Defaults and ranges depend on the model.
Choosing (design guidance)
| Task | Setting |
|---|---|
| Extraction, classification, factual Q&A | Low temperature (near 0) |
| Brainstorming, marketing copy, fiction | Higher temperature |
| Cost control, short answers | Lower max tokens |
Exam traps
- Raising temperature to reduce hallucinations. Lower temperature makes output more predictable; it doesn't add facts. Grounding (RAG) does.
- Max tokens limits the input. It limits the output.
- Confusing Top K (a count) with Top P (a probability share).
References
- Bedrock inference parameters — checked Oct 19, 2026
Check your understanding
Answers must be consistent for the same invoice. Temperature?Show answerHide answer
Answer
Low.A marketing team wants varied slogan ideas. Temperature?Show answerHide answer
Answer
Higher.Responses get cut off mid-sentence. Which parameter?Show answerHide answer
Answer
Maximum response length (max tokens) is too low.