Activity (Process)

Calculating Conditional Log-Probability Using an LLM

The conditional log-probability, log Pr(y|x), is computed using a large language model by finding the difference between the joint and marginal log-probabilities. The joint log-probability, log Pr([x, y]), is determined by first concatenating the input x and output y into a single sequence. A forward pass is then performed over this sequence, where for each token position, an embedding is computed and fed as the initial representation into the Transformer layers. In parallel, the marginal log-probability, log Pr(x), is calculated by running the model on the input sequence x alone. The final conditional log-probability is then given by the formula: logPr(yx)=logPr([x,y])logPr(x)\log \text{Pr}(\mathbf{y}|\mathbf{x}) = \log \text{Pr}([\mathbf{x}, \mathbf{y}]) - \log \text{Pr}(\mathbf{x})

0

1

Updated 2026-05-03

Contributors are:

Who are from:

Tags

Ch.5 Inference - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences