---
title: "Top P"
description: "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."
canonical_url: "https://promptmetheus.com/resources/llm-knowledge-base/top-p"
---

> Index of every page on this site: [llms.txt](https://promptmetheus.com/llms.txt)

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](https://promptmetheus.com/resources/llm-knowledge-base/temperature) and it is usually recommended to only adjust one of the two.

## Sitemap

See the full [sitemap](https://promptmetheus.com/sitemap.md) for all pages.
