liveBook · Manning

Joint probability distribution

As explained in Build a Reasoning Model (From Scratch)

The probability of an entire token sequence under a model, computed by multiplying conditional token probabilities across positions.

Joint probability measures how strongly a language model supports an entire token sequence. It multiplies the conditional probability assigned to each next token after its preceding text. section 5.4

Comparing candidate answers

For “The capital of Germany is Berlin,” the joint probability is 5.9372e-08. Replacing Berlin with Bridge reduces it to 1.0481e-13, indicating much weaker model support.

How Build a Reasoning Model (From Scratch) covers it

How deep it goes
Defines conditional next-token probabilities and demonstrates their multiplication in code, while deferring later log-probability scoring.
Examples
Compares Berlin and Bridge as candidate completions using per-token probabilities and computed joint scores.
What it assumes
Assumes familiarity with token IDs, logits, and text generation, then revisits their next-token selection mechanism.
What you can do after
Apply it via PyTorch to extract per-token probabilities and multiply them into a sequence score.
How it connects
Connects logits, softmax, tokenization, next-token probabilities, sequence likelihoods, and self-refinement.

Also explained in

Compare how 5 books explain joint probability distribution →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Reasoning Model (From Scratch). The section links point to the parts of the book it draws on.