Learn Before
Direct Computation of Output Sequence Log-Probability in LLMs
In common implementations of Large Language Models (LLMs), the log-probability of the input sequence does not need to be computed. Instead, the model directly computes the conditional log-probability of the output sequence given the input. This is done by summing the log-probabilities of each individual output token. The formula is:
In this notation, represents the context used for predicting the token . Furthermore, the expression is a common literature shorthand used to denote .
0
1
Tags
Ch.5 Inference - Foundations of Large Language Models
Foundations of Large Language Models
Foundations of Large Language Models Course
Computing Sciences
Related
Conditional Probability in Sequence-to-Sequence Generation
Next-Token Probability Calculation in Autoregressive Decoders
Example of Autoregressive Generation and Log-Probability Calculation
An auto-regressive language model is generating text following the input 'The cat sat on the'. The model's objective is to find the output sequence with the highest total log-probability. It is considering two possible two-word continuations:
Path A: 'warm mat'
- log Pr('warm' | 'The cat sat on the') = -0.9
- log Pr('mat' | 'The cat sat on the warm') = -1.5
Path B: 'plush rug'
- log Pr('plush' | 'The cat sat on the') = -1.2
- log Pr('rug' | 'The cat sat on the plush') = -1.1
Based on the provided conditional log-probabilities, which path will the model choose and why?
Debugging a Generation Model's Choice
Greedy Decoding vs. Optimal Sequence Probability
Reconciling Training Log-Likelihood with Inference-Time Sequence Selection
Diagnosing a “High-Confidence Wrong Token” Bug in Autoregressive Scoring
Explaining a Counterintuitive Decoding Outcome Using Softmax, Next-Token Conditionals, and Sequence Log-Probability
Auditing a Candidate Completion Using Softmax Next-Token Probabilities and Autoregressive Log-Probability
Investigating a Production Scoring Bug: Softmax Normalization vs. Autoregressive Sequence Log-Probability
Root-Cause Analysis: Why a “More Likely” Token-by-Token Completion Loses on Total Sequence Score
Design a Correct Sequence-Scoring Function for Autoregressive LLM Outputs
Your team is building an internal tool that ranks ...
You’re reviewing an internal evaluation script tha...
You’re reviewing an internal LLM evaluation pipeli...
Direct Computation of Output Sequence Log-Probability in LLMs
Learn After
Sequence Evaluation using Log-Probability
An engineer is using a generative language model to decide which of two possible sentences is a more likely completion for the input prompt 'Once upon a time,'. The model can compute various log-probability scores. To select the better completion, which of the following scores should the engineer compare for each candidate sentence?
Debugging a Language Model's Output Score
Rationale for Log-Probability Calculation in Generative Models
Core Computational Task in Autoregressive Generation
Step-by-Step Sequence Log-Probability Computation