Skip to content
AWS Certified AI Practitioner (AIF-C01) Exam Prep

Lesson 19 of 34 · 6 min

x
19/34

Inference Parameters

Video lesson: AIF-C01 19/34: Inference Parameters

Randomness and diversity (verified, Bedrock inference parameters docs)

ParameterLower valueHigher value
TemperatureHigher-probability tokens more likely → more deterministic, focusedLower-probability tokens more likely → more random, creative
Top KFewer candidate tokens (a fixed number of the most likely)More candidates, allowing less likely tokens
Top PA 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)

TaskSetting
Extraction, classification, factual Q&ALow temperature (near 0)
Brainstorming, marketing copy, fictionHigher temperature
Cost control, short answersLower 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

  1. Bedrock inference parameters — checked Oct 19, 2026

Check your understanding

  • Answers must be consistent for the same invoice. Temperature?Show answer

    Answer

    Low.
  • A marketing team wants varied slogan ideas. Temperature?Show answer

    Answer

    Higher.
  • Responses get cut off mid-sentence. Which parameter?Show answer

    Answer

    Maximum response length (max tokens) is too low.
Previous

Progress is saved in this browser.

Next Lesson