Optimize topk sigmoid in minimax_m2 #14047
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This PR optimizes the topk sigmoid in minimax_m2, using the
topk_sigmoidkernel implementation from #13049.Modifications
Make the
TopKto support thescoring_funcparameter.Accuracy Tests
We have validated the correctness of this change on MiniMax-M2, achieving an accuracy of 0.9249 on GSM8K. Previous PR #13049 results was 0.93 on GSM8K and 0.803 on AIME2025. Original AIME2025 score was 0.78.
lm_eval --model local-completions \ --model_args base_url=http://localhost:8000/v1/completions,tokenizer=/model,model=/model \ --tasks gsm8k_cot \ --batch_size 128 \ --num_fewshot 5 local-completions (base_url=http://localhost:8000/v1/completions,tokenizer=/model,model=/model), gen_kwargs: (None), limit: None, num_fewshot: 5, batch_size: 128 | Tasks |Version| Filter |n-shot| Metric | |Value | |Stderr| |---------|------:|----------------|-----:|-----------|---|-----:|---|-----:| |gsm8k_cot| 3|flexible-extract| 5|exact_match|↑ |0.9249|± |0.0073| | | |strict-match | 5|exact_match|↑ |0.9121|± |0.0078|Benchmarking and Profiling
Original.
Optimized.
Checklist