AWS AI Practitioner AIF-C01 · Fundamentals of Generative AI · medium

You are configuring an Amazon Bedrock foundation model to generate deterministic, factual SQL queries from natural-language prompts, where creativity and randomness must be minimized. How should you set the Temperature inference parameter?

Published · Last updated · checked before publication — how we verify questions

Options

  • ASet temperature to 1.0 to maximize creative token variety
  • BSet max_tokens to 1 so the model outputs only one character
  • CSet top_k to 500 with temperature at 0.95 for diverse sampling
  • DSet temperature to 0 (or near 0) for greedy deterministic outputCorrect answer

Answer: D. Set temperature to 0 (or near 0) for greedy deterministic output

Temperature controls the randomness of token sampling by scaling the logits before softmax. Setting temperature = 0 (greedy decoding) makes the model consistently select the highest-probability next token, maximizing determinism and factual consistency for code/SQL generation.

Why the other options are wrong

  • A. Set temperature to 1.0 to maximize creative token variety — A high temperature (1.0) flattens token probabilities and increases randomness, risking invalid SQL syntax.
  • B. Set max_tokens to 1 so the model outputs only one character — Setting max_tokens = 1 truncates the response after a single token, preventing complete SQL query output.
  • C. Set top_k to 500 with temperature at 0.95 for diverse sampling — High top_k and high temperature increase output variability rather than making SQL generation deterministic.

All Fundamentals of Generative AI questions and the topic overview →

AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.