Sampling and deterministic PRNG

Documents greedy defaults, temperature/top-k/top-p validation, fixed candidate buffers, XorShift64 seed behavior, and reproducibility limits.

Experimental
Last verified
2026-06-25 00:00 UTC
Updated
Reading time
2 minutes

Documents greedy defaults, temperature/top-k/top-p validation, fixed candidate buffers, XorShift64 seed behavior, and reproducibility limits.

Implementation evidence: this topic is grounded in the reviewed GGUF.MiRust.com source snapshot. It documents observed code and artifacts without claiming broad deployment, model quality, or production readiness.

Default

Temperature 0, top-k 1, top-p 1, and seed 1 select deterministic greedy decoding. This supports repeatable smoke tests.

Stochastic path

For positive temperature, logits are scaled, the highest candidates are retained, probabilities are normalized, top-p truncation is applied, and XorShift64 supplies a deterministic pseudo-random draw.

Allocation bound

Candidate scores and IDs use fixed stack arrays capped at 1,024 entries. This avoids a vocabulary-sized heap allocation per token and supports the 262-token BPE fixture. A requested top-k above the cap is rejected.

Validation

Temperature must be finite and nonnegative. top-k must be positive and bounded. top-p must be finite and in the accepted range. Invalid settings preserve the loaded model and record an error.

Reproducibility scope

Matching seed and settings are necessary but not sufficient across future runtimes; floating-point ordering, softmax, quantized kernels, and candidate tie handling must also remain compatible.

Scope

This starter page defines the questions, boundaries, evidence, and failure modes that should be recorded before a capability is presented as supported.

Engineering considerations

  • Identify the source, version, target environment, and owner.
  • Separate observed values from estimates and externally reported values.
  • Record trade-offs, unsupported cases, and fallback behavior.
  • Link performance statements to a compatible benchmark methodology.

Verification questions

  • What exact artifact, revision, backend, and environment were reviewed?
  • Which assumptions could change the result?
  • Which data should be retained so another engineer can reproduce the conclusion?