Question 18
Domain 2: ML Model DevelopmentA company has a conversational AI assistant that sends requests through Amazon Bedrock to an Anthropic Claude large language model (LLM). Users report that when they ask similar questions multiple times, they sometimes receive different answers. An ML engineer needs to improve the responses to be more consistent and less random. Which solution will meet these requirements?
Correct answer: D
Explanation
Temperature controls randomness in generation, so lowering it makes outputs more consistent and less varied. Top-k sampling limits the model to the highest-probability tokens, and decreasing it further reduces randomness in the response. Together, these settings make similar prompts more likely to produce similar answers.
Why each option is right or wrong
A. Increase the temperature parameter and the top_k parameter.
Higher temperature and higher top-k both increase variability, making outputs less consistent.
B. Increase the temperature parameter. Decrease the top_k parameter.
Lower top-k helps consistency, but higher temperature still adds randomness to token selection.
C. Decrease the temperature parameter. Increase the top_k parameter.
Lower temperature helps, but higher top-k allows more candidate tokens and more variation.
D. Decrease the temperature parameter and the top_k parameter.
Anthropic Claude on Amazon Bedrock exposes decoding controls that directly affect sampling variability. In the Bedrock InvokeModel request, lowering temperature reduces randomness in token selection, and reducing top_k narrows sampling to fewer high-probability candidates, which makes repeated runs on similar prompts less divergent. By contrast, increasing either setting would widen the candidate pool and make outputs less stable.