Concept

Constraining LLM Predictions to a Predefined Label Set

When using a Large Language Model for classification by reframing the task as text completion, there is no guarantee that the model will generate one of the desired label words (e.g., 'positive', 'negative'). To solve this, a technique can be used to constrain the model's predictions to a predefined set of labels. This method restricts the model's vocabulary to only the valid label words for the task. The final output is then determined by selecting the label from this set that has the highest assigned probability.

0

1

Updated 2026-05-02

Contributors are:

Who are from:

Tags

Ch.3 Prompting - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences

Related