Java Zero to All All questionsPractise free
Interview questions › Build AI Features as a Java Backend Engineer › Start Here — Build Your First AI Feature

Why can the same prompt give different answers, and what levers control that variability in a backend service?

Level IV · SeniorStart Here — Build Your First AI Feature
Short answer

Generation samples from a probability distribution over next tokens, so unless sampling is fully greedy there is inherent randomness, and even at temperature zero you can see variation across model versions, hardware, or batching.

Explanation

The main levers are temperature (lower is more focused and repeatable, higher is more creative), top-p/top-k sampling limits, and a seed parameter where the provider supports it, plus pinning the exact model version so a silent upgrade does not change behavior. For backend reliability you typically run extraction and classification tasks at low temperature for consistency, and you never assume bit-for-bit reproducibility even so. Interviewers are checking that you know determinism is not guaranteed, which is exactly why you validate outputs, pin models, and build evals rather than trusting a single golden response.

Common mistakes
  • Not knowing temperature and sampling cause variation.
  • Expecting temperature 0 to be fully deterministic across providers.

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for Start Here — Build Your First AI Feature.

Practise free

More on Start Here — Build Your First AI Feature