class Llama::Sampler::MinP

Overview

Min-P sampler

The Min-P sampler keeps tokens with probability >= P * max_probability. This is similar to Top-P but uses a minimum probability threshold relative to the most likely token, rather than a cumulative probability threshold.

Example:

sampler = Llama::Sampler::MinP.new(0.05, 1) # Keep tokens with prob >= 5% of max prob

Defined in:

llama/sampler/min_p.cr

Constructors

Instance methods inherited from class Llama::Sampler::Base

to_unsafe : Pointer(Llama::LibLlama::LlamaSampler) to_unsafe

Constructor methods inherited from class Llama::Sampler::Base

new(handle : Pointer(LibLlama::LlamaSampler)) new

Constructor Detail

def self.new(p : Float32, min_keep : Int32 = 1) #

Creates a new Min-P sampler

Parameters:

  • p: The minimum probability threshold (0.0 to 1.0)
  • min_keep: Minimum number of tokens to keep

Raises:

  • Llama::Error if the sampler cannot be created

[View source]