Conditional Probability & Why Temperature Exists

~15 min read

The conditional-probability foundation of next-token prediction, and why sampling (not always picking the highest-probability token) is necessary for useful, non-repetitive LLM output.

Conditional Probability & Why Temperature Exists is a Pro topic

Sign in, then upgrade to Pro or Power to unlock this topic and the full AI Engineering curriculum.

Key points

  • Conditional probability P(A|B) is 'the probability of A given B has occurred' — e.g., P(rain | cloudy)
  • Next-token prediction is exactly this: P(next_token | previous_tokens)
  • Always picking the single highest-probability token (greedy) leads to repetitive, low-creativity output
  • Temperature reshapes the softmax distribution before sampling: low temperature → nearly greedy; high temperature → more uniform/random
  • This conditional-probability framing is the conceptual foundation for the full sampling pipeline (temperature, top-k, top-p, min-p) covered elsewhere in this topic