SamplerParams class final

Declarative configuration for sampling.

Immutable, JSON-friendly. Holds no native memory.

Constructors

SamplerParams({int seed = defaultSeed, double temperature = 0.8, int topK = 40, double topP = 0.95, double minP = 0.05, double typicalP = 1.0, double topNSigma = 0.0, int minKeep = 1, double repeatPenalty = 1.0, int penaltyLastN = 64, double frequencyPenalty = 0.0, double presencePenalty = 0.0, bool greedy = false, bool infill = false, MirostatConfig mirostat = MirostatConfig.disabled, DynamicTempConfig dynamicTemp = DynamicTempConfig.disabled, XtcConfig xtc = XtcConfig.disabled, DryConfig dry = DryConfig.disabled, AdaptivePConfig adaptiveP = AdaptivePConfig.disabled, GrammarConfig grammar = GrammarConfig.disabled, List<LogitBiasEntry> logitBias = const []})
const
SamplerParams.fromJson(Map<String, Object?> json)
factory

Properties

adaptiveP AdaptivePConfig
Adaptive-P sampler configuration (terminal sampler when enabled).
final
dry DryConfig
DRY sampler configuration.
final
dynamicTemp DynamicTempConfig
Dynamic temperature configuration.
final
frequencyPenalty double
Frequency penalty (additive, OpenAI-style). 0.0 disables.
final
grammar GrammarConfig
Grammar / GBNF constraint.
final
greedy bool
Force argmax sampling. Overrides every other knob.
final
hashCode int
The hash code for this object.
no setterinherited
infill bool
Enable infill (fill-in-the-middle) sampler. Goes after top-k/top-p.
final
logitBias List<LogitBiasEntry>
Token-level logit biases applied at the start of the chain.
final
minKeep int
Minimum tokens kept by top-p / min-p / typical / xtc filters. Most llama.cpp call sites use 1.
final
minP double
Minimum P sampling. 0.0 disables.
final
mirostat MirostatConfig
Mirostat configuration (terminal sampler when enabled).
final
penaltyLastN int
Window size for repeat / frequency / presence penalties.
final
presencePenalty double
Presence penalty (additive, OpenAI-style). 0.0 disables.
final
repeatPenalty double
Repeat penalty (multiplicative). 1.0 disables.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
seed int
Random seed. defaultSeed (0xFFFFFFFF) means runtime-chosen.
final
temperature double
Sampling temperature. 0.0 collapses to greedy (after filters).
final
topK int
Top-K sampling. 0 disables.
final
topNSigma double
Top-n-sigma sampling. <= 0 disables.
final
topP double
Top-P (nucleus) sampling. 1.0 disables.
final
typicalP double
Locally-typical sampling. 1.0 disables.
final
xtc XtcConfig
XTC sampler configuration.
final

Methods

copyWith({int? seed, double? temperature, int? topK, double? topP, double? minP, double? typicalP, double? topNSigma, int? minKeep, double? repeatPenalty, int? penaltyLastN, double? frequencyPenalty, double? presencePenalty, bool? greedy, bool? infill, MirostatConfig? mirostat, DynamicTempConfig? dynamicTemp, XtcConfig? xtc, DryConfig? dry, AdaptivePConfig? adaptiveP, GrammarConfig? grammar, List<LogitBiasEntry>? logitBias}) SamplerParams
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, Object?>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

greedyDefault → const SamplerParams
Argmax sampling (deterministic).