MinP

MinP defines a minimum probability threshold relative to the top token. Any candidate whose probability is below MinP × p(top) is discarded.

Quick reference

Type float
Default 0.05
Range 0.0 to 1.0
Category Core sampling
Field on SamplerParameters.MinP

What it does

After the other filters run, compute the top candidate’s probability p_max. For every remaining token, check if its probability is at least MinP × p_max. If not, discard.

  • MinP = 0.0: filter disabled.
  • MinP = 0.05 (default): keep tokens at 5 % of the top token’s probability or higher.
  • MinP = 0.1: keep tokens at 10 % or higher (stricter).

Unlike TopP (which is cumulative-mass aware) and TopK (which is count aware), MinP is relative-to-top aware. It adapts to distribution shape differently: on a peaked distribution it keeps fewer tokens; on a flat distribution it keeps more.

When to change it

Scenario Value
Disabled 0.0
Loose tail retention 0.02
Default balance 0.05
Conservative, drops more tail 0.1 to 0.15

Some users recommend MinP as a replacement for TopP: simpler to reason about, less sensitive to vocabulary size. The default 0.05 is a conservative, broadly safe value.

Example

var preset = new Qwen25Preset();
preset.SamplerParameters.MinP = 0.1f; // stricter tail cutoff

using var api = AsposeLLMApi.Create(preset);
string reply = await api.SendMessageAsync("Describe today's weather in three words.");
Console.WriteLine(reply);

Creative writing with wider tail:

preset.SamplerParameters.MinP = 0.02f;
preset.SamplerParameters.Temperature = 0.9f;
// More diverse sampling, still filtered against very-low-probability tokens.

Interactions

  • Temperature: applied before MinP.
  • TopP: can coexist; final candidate set respects both.
  • TopK: count-based cap; stacks with MinP.
  • MinKeep: floor; MinP never cuts below MinKeep.
  • Mirostat: bypasses MinP when active.

What’s next