Claude API
What are the top_p and top_k parameters in the Claude API?
QUICK ANSWER
top_k limits selection to the K highest probability next tokens, while top_p (nucleus sampling) selects from the smallest set of tokens whose cumulative probability exceeds P.
Parameters Explained
Generally, developers should adjust temperature instead of top_p or top_k. If adjusting all parameters, the model filters tokens using top_k first, then top_p, and finally samples using temperature scaling.
Verified against: Anthropic API Spec