Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
  • Derivatives0/5
  • Probability0/6
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
P(x)P(x)P(x)Maths, module 13: Probability, lesson 2 of 6

Conditional probability and the next token

The chance of the next letter depends on the letters before it. A probability that depends on context is exactly what a language model computes.

9 minute read3 things to try6 questionsFree

Read the whole lesson free

Make a free account to read on, try the interactive parts, answer the 6 practice questions and keep your progress.

Create a free accountLog in

What this lesson covers

  • P(A∣B)P(A \mid B)P(A∣B) is the probability of AAA once you know BBB happened.
  • The next letter or word depends on context, so language is modelled with conditional probabilities.
  • A language model is a function that outputs P(next token∣context)P(\text{next token} \mid \text{context})P(next token∣context).

More in Probability

  1. 1Probability and distributions
  2. 2Conditional probability and the next token
  3. 3Softmax and temperature
  4. 4Cross-entropy
  5. 5Bayes' rule
  6. 6Entropy and information