Skip to content

AI Fundamentals

Top-P (Nucleus) Sampling

A decoding strategy that limits token selection to the smallest set whose cumulative probability exceeds a threshold p. Top-P sampling helps AI tools balance diversity and coherence in generated code.