The Top P parameter is a setting used in language models to control the diversity and focus of the text generated during prompting. It influences which words (tokens) the model considers when deciding the next word in a sequence.
According to the provided information, Top P defines the probabilistic sum of tokens that should be considered for each subsequent token during text generation.
Key Aspects of Top P
- Function: It limits the selection pool of potential next tokens based on their cumulative probability.
- Value Range: Top P values range from 0.0 to 1.0.
- Nature: Crucially, Top P defines a probabilistic sum, not simply a percentage. This means it sums the likelihoods of the most probable tokens until the sum reaches the Top P value, and only tokens within this group are considered.
Example: Top P in Action
To illustrate how this works:
- For example, if you set Top P to 0.5, the model will evaluate the probabilities of all possible next tokens. It will then select the most probable tokens, starting from the highest likelihood, and sum their probabilities. The consideration set for the next token will include only those tokens whose relative likelihoods cumulatively add up to 50%.
By adjusting the Top P value, you can tune the output: a lower Top P results in less diverse, more predictable text (sticking to the most probable words), while a higher Top P allows for more varied and potentially creative output by including a wider range of less probable words.