Formula for Label Selection via Probability Maximization
In classification tasks where the goal is to select a single label word, such as filling in a blank, the chosen label is the one that maximizes the conditional probability given the input context . This selection process is formalized by the equation: In this formula, represents a candidate label word, and is the predefined set of all possible label words. For example, in a polarity classification task, the set of labels could be .

0
1
Tags
Ch.3 Prompting - Foundations of Large Language Models
Foundations of Large Language Models
Foundations of Large Language Models Course
Computing Sciences
Related
Formula for Label Selection via Probability Maximization
Example of a Prompt for Polarity Classification (Negative Sentiment)
Example of a Simple Prompt for Polarity Classification
A developer is using a large language model to classify customer feedback into one of three categories: 'Positive', 'Negative', or 'Neutral'. The model correctly identifies the sentiment but often generates free-form text like 'The customer seems unhappy' instead of the specific label 'Negative'. This inconsistency is causing problems for a data analysis pipeline that expects one of the three exact labels. Which of the following approaches would be the most direct and reliable way to ensure the model always outputs one of the three predefined labels?
Automating Support Ticket Classification
Mechanism of Constrained Prediction
Learn After
A language model is tasked with classifying the sentiment of the input text: 'The plot was predictable, but the acting was superb.' The model is restricted to choosing a label from the set {positive, negative, neutral}. After processing the input, the model calculates the following conditional probabilities for each possible label:
- Pr(positive | input) = 0.45
- Pr(negative | input) = 0.20
- Pr(neutral | input) = 0.35
According to the principle of selecting the label that maximizes this probability, which label will the model output?
Analysis of a Model's Classification Decision
In a classification task, a model selects the most suitable label by using the formula:
label = argmax_{y ∈ Y} Pr(y|x). Match each component of this formula to its correct description.