Skip to content
RED SAGSkills
easyPrompt Engineer interview question

Explain temperature and top-p. How would you set them for different tasks?

What the interviewer wants to hear

  • Both control randomness in token sampling
  • Temperature reshapes the probability distribution
  • Top-p limits sampling to the most likely tokens up to a cumulative probability
  • Low values for classification and extraction, higher for creative work
  • Usually tune one at a time and test the effect

Model answer

Both settings control how random the model's word choices are. At each step the model has a probability for every possible next token. Temperature reshapes those probabilities: a low value makes the top choice dominate, so output is focused and consistent, while a high value flattens them, so output is more varied. Top-p, or nucleus sampling, keeps only the smallest group of likely tokens whose probabilities add up to p and samples from that group, cutting off the unlikely tail. For classification, extraction or anything parsed by code, I use a low temperature for consistency. For brainstorming or marketing ideas, I raise it to get variety. I usually change one setting, not both, and I check the effect on a test set, because the best value depends on the model and task.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Prompt Engineer questions