Skip to content

Add TopP and MinP sampling to all engines#48

Open
stikves wants to merge 5 commits into
apple:mainfrom
stikves:worktree-issue-43-sampler-combinations
Open

Add TopP and MinP sampling to all engines#48
stikves wants to merge 5 commits into
apple:mainfrom
stikves:worktree-issue-43-sampler-combinations

Conversation

@stikves

@stikves stikves commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Implements TopP (nucleus) and MinP sampling for both the CPU CompositeSampler and the GPU MPSGraph pipelined engine, closing the sampling gap between sequential and pipelined paths.

  • Add minP parameter to SamplingConfiguration
  • Integrate MinP filtering in CompositeSampler (logit-space threshold)
  • Rewrite MPSGraphTopKSampler → MPSGraphCompositeSampler with full TopP + MinP support via exclusive cumsum and relative probability mask
  • Remove pipelined engine's topP rejection (all configs now supported)
  • Update MPSGraphSamplerFactory to accept full SamplingConfiguration and use K=1000 window when only topP/minP is specified
  • Add --min-p CLI option to llm-runner
  • Add comprehensive tests for CPU and GPU MinP/TopP paths

Implements TopP (nucleus) and MinP sampling for both the CPU
CompositeSampler and the GPU MPSGraph pipelined engine, closing the
sampling gap between sequential and pipelined paths.

- Add `minP` parameter to SamplingConfiguration
- Integrate MinP filtering in CompositeSampler (logit-space threshold)
- Rewrite MPSGraphTopKSampler → MPSGraphCompositeSampler with full
  TopP + MinP support via exclusive cumsum and relative probability mask
- Remove pipelined engine's topP rejection (all configs now supported)
- Update MPSGraphSamplerFactory to accept full SamplingConfiguration
  and use K=1000 window when only topP/minP is specified
- Add --min-p CLI option to llm-runner
- Add comprehensive tests for CPU and GPU MinP/TopP paths
@stikves stikves self-assigned this Jun 15, 2026
@stikves stikves changed the title Add TopP and MinP sampling to all engines (#43) Add TopP and MinP sampling to all engines Jun 15, 2026
@stikves stikves force-pushed the worktree-issue-43-sampler-combinations branch from 58d7f58 to b15a895 Compare June 15, 2026 21:09
@stikves

stikves commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

These are the low hanging fruits in our samplers.

The follow ups might require larger refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants