AI Dictionary › Fondamenti AI

Top-p (nucleus sampling)

Definition

Top-p, or nucleus sampling, is a sampling technique that limits the model's choices to the smallest group of tokens whose cumulative probability reaches a threshold p, for example 0.9. Picture candidates ranked from most to least likely: you keep them until their probabilities sum to 90% of the total, then discard the rest and draw only within this "nucleus". The count is not fixed: if the model is confident the nucleus is small, if uncertain it widens. It is like inviting to a meeting only the people who together hold 90% of the expertise.

Top-p matters because it cuts improbable tails that produce nonsense while keeping flexibility. It is often preferred over top-k because it adapts to the model's confidence step by step.

Definizione (italiano)

Il top-p, o nucleus sampling, è una tecnica di campionamento che limita le scelte del modello al gruppo più piccolo di token la cui probabilità cumulata raggiunge una soglia p, ad esempio 0,9. Immagina una fila di candidati ordinati dal più al meno probabile: continui a chiamarli finché la somma delle loro probabilità copre il 90% del totale, poi scarti tutti gli altri e peschi solo dentro questo "nucleo". Il numero di candidati non è fisso: se il modello è molto sicuro, il nucleo è piccolo; se è incerto, si allarga. È come invitare a una riunione solo le persone che insieme rappresentano il 90% delle competenze, ignorando i marginali.

Il top-p conta perché taglia via le code improbabili che generano assurdità, mantenendo però flessibilità. È spesso preferito al top-k perché si adatta automaticamente alla fiducia del modello passo per passo.

Related terms

More in Fondamenti AI

From our network

AGORÀ Intelligence — Enterprise AI Governance Platform

Govern AI at scale: policies, adoption and measurable results on your data. Built for boards and C-suite.

Visit agora-intelligence.com →

From the Agora Intelligence blog

More on agora-intelligence.com →

📱 Download the Android app (beta) iOS coming soon

Say what you mean. Get what you need.

Grace Certified — the AI coach that trains and certifies your prompt engineering — by Agora Intelligence.