class

Llama::Sampler::Dist

Inherits Llama::Sampler::Base / Reference / Object

Distribution sampler (final sampler in a chain)

The Distribution sampler is typically the final sampler in a chain. It samples a token from the probability distribution after all other samplers have filtered the logits. This sampler is required to actually select a token from the distribution.

Example:

sampler = Llama::Sampler::Dist.new(42) # Use seed 42 for reproducibility

Constructors

new(seed : UInt32 = LibLlama::LLAMA_DEFAULT_SEED)

Creates a new distribution sampler

Parameters:

  • seed: Random seed for sampling (default: LLAMA_DEFAULT_SEED)

Raises:

  • Llama::Error if the sampler cannot be created
Source