LLM Knowledge Base

Top P

Top P, also known as Nucleus Sampling, is a strategy used in language models for text generation. Instead of choosing the most likely next word in a sequence, the model considers a set of possible next words, known as the "nucleus", based on their cumulative probability exceeding a certain threshold, P. This approach provides a balance between randomness and predictability, resulting in more diverse and realistic text generation.

In the context of tuning model parameters, Top P is very similar to temperature and it is usually recommended to only adjust one of the two.