Top-p sampling
Top-p sampling, also known as nucleus sampling, is a method used in text generation tasks to select the next word by considering the smallest possible set of most likely candidates that collectively reach a probability mass threshold, 'p'. For instance, if 'p' is 0.9, only the words that together hold 90% probability are considered, providing a balance between randomness and coherence in generated text compared to methods like greedy search or temperature sampling.