Mirostat
Contents
[
Hide
]
Mirostat is an adaptive sampler that targets a specific output entropy (roughly perplexity) instead of relying on fixed temperature and nucleus filters. When enabled, it bypasses Temperature, TopP, TopK, and MinP.
Quick reference
| Type | int |
| Default | 0 (disabled) |
| Range | 0 = disabled, 1 = Mirostat 1.0, 2 = Mirostat 2.0 |
| Category | Adaptive sampler |
| Field on | SamplerParameters.Mirostat |
What it does
Mirostat monitors the entropy of the output distribution and adjusts the sampling process to match a target entropy (MirostatTau). Higher measured entropy → Mirostat tightens. Lower → Mirostat relaxes.
Mirostat = 0(default) — disabled. StandardTemperature+TopP+TopK+MinPpipeline is used.Mirostat = 1— Mirostat 1.0. Original algorithm from the paper.Mirostat = 2— Mirostat 2.0. Simplified and usually preferred; faster convergence.
When Mirostat is enabled, the standard filters (TopP, TopK, MinP, TypicalP, TopNSigma) are effectively bypassed. Temperature tuning is ignored — Mirostat manages its own temperature-like adjustments internally.
When to change it
| Scenario | Value |
|---|---|
| Default — use standard filters | 0 |
| Adaptive perplexity-targeting (preferred) | 2 |
| Older Mirostat 1.0 (rarely preferred) | 1 |
Consider Mirostat when:
- You want consistent perplexity across very long outputs.
- Fixed temperature produces output that is either too tight or too loose in different parts of the same generation.
- Research / experimentation with entropy-aware sampling.
Example
var preset = new Qwen25Preset();
preset.SamplerParameters.Mirostat = 2; // Mirostat 2.0
preset.SamplerParameters.MirostatTau = 5.0f; // target entropy
preset.SamplerParameters.MirostatEta = 0.1f; // learning rate
using var api = AsposeLLMApi.Create(preset);
Interactions
MirostatTau— target entropy.MirostatEta— learning rate.Temperature,TopP,TopK,MinP,TypicalP,TopNSigma— all bypassed when Mirostat is active.DynatempRange— alternative entropy-aware sampler; do not combine.Seed— still affects the RNG; reproducibility works with Mirostat.
What’s next
- MirostatTau — entropy target.
- MirostatEta — learning rate.
- DynatempRange — alternative adaptive approach.