# AI Sampling Parameters
Parameters that control how an LLM selects the next token during generation. Beyond temperature, the key parameters are:
- **Top-p (nucleus sampling)**: only consider tokens whose cumulative probability reaches p (e.g., 0.9 = consider the smallest set of tokens that together have 90% probability)
- **Top-k**: only consider the k most probable tokens
- **Frequency penalty**: reduces probability of tokens that already appeared (prevents repetition)
- **Presence penalty**: reduces probability of any token that appeared at all (encourages topic diversity)
These parameters interact with each other and with temperature. Most APIs let you set combinations.
## References
## Related
- [[Large Language Models (LLMs)]]
- [[Prompt Engineering]]