AI Engineering Glossary
Search
view all

Top-k sampling

Top-k sampling is a method used in generating text where only the top *k* most likely options are considered at each step. After identifying the top *k* probabilities from a word distribution as predicted by a model, a word is randomly selected from this narrowed pool. This ensures more control over randomness compared to complete probabilistic sampling, balancing coherence and creativity in outputs. It's often compared with nucleus sampling, where choices are determined dynamically based on cumulative probability.

Search Perplexity | Ask ChatGPT | Ask Clade

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

r

s

t

u

v

w

z