Llama::Sampler::Typical
Inherits Llama::Sampler::Base / Reference / Object
Typical sampler
The Typical sampler selects tokens based on their "typicality" (entropy). It filters out tokens that are either too predictable or too surprising, leading to more natural and diverse text generation.
Based on the paper: https://arxiv.org/abs/2202.00666
Example:
sampler = Llama::Sampler::Typical.new(0.95, 1) # Keep tokens with typicality >= 0.95