Conversation
Ports lightning attention to InfiniOps (CPU + CUDA) with pytest; adds docs/minimax handover notes and both op patches.
…ate rows, dtype-aware reference)
y258dd
marked this pull request as ready for review
September 19, 2026 09:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
MiniMaxForCausalLMsupport undercsrc/models/minimax/._remap_minimaxHuggingFace weight remapper inpython/infinilm/modeling_utils.py.test/models/minimax/.Motivation
MiniMax-Text-01 and MiniMax-M2 use hybrid attention and a recurrent linear-attention state. The linear-attention path evaluates:
The recurrent state is read from
initial_state[initial_state_indices[b]]and written toinitial_state[final_state_indices[b]]. This model adaptation is needed to run MiniMax models in InfiniLM.Closes # (N/A: internal model-support work; no tracking issue in this fork)
Type of Change
feat— new feature / new modelfix— bug fixperf— performance improvement (no behavioral change)refactor— code restructuring without behavior changetest— adding or fixing tests onlydocs— documentation onlybuild/ci— build system or CI configurationchore— tooling, formatting, or other non-code changesTest Results of Involved Models on Supported Platforms (Please attach screenshots)
1.16e-105.59e-4, decode1.59e-4Not yet run:
examples/test_infer.py: pending NVIDIA/real-model validation.examples/bench.py: no performance claim.test/bench/test_benchmark.py: pending.python/infinilm/server/inference_server.py+scripts/test_perf.py: pending.Benchmark / Performance Impact
N/A. This PR adds model support and does not claim performance improvements.
Notes for Reviewers
InfiniLM-v0.2.9cbranch as requested by the administrator.minimaxandminimax_m2model types.lightning_attentionInfiniCore operator.num_experts=1, which exercises the dense fallback. The full multi-expert MoE comparison is the next validation step.CI / ChatOps
CI does not run automatically on pull requests. Trigger it manually from the Actions tab, or ask a maintainer to comment
/retestor/teston this PR.Checklist
Title, Branch, and Commits
feat(minimax): support MiniMax-Text-01 and MiniMax-M2.<type>/xxx-yyyy-zzzz:feat/minimax-model-support.fixup!,squash!, orwipcommits remain.InfiniLM-v0.2.9c, not the refactored main branch.Scope and Design
TODO/FIXMEwere found in the MiniMax source and test paths.General Code Hygiene
scripts/format.pyon this branch.C++ Specific
scripts/format.pyverification are still pending.new/deletewere intentionally introduced.csrc/models/llama_legacy/.Python Specific
scripts/format.pyverification is still pending.python/infinilm/auto_config.py.Testing
Build, CI, and Tooling
Documentation
docs/minimax/.Security and Safety
NVIDIA RTX 4090 / sm_89 Validation (2026-09-19)
Validated with:
feat/minimax-lightning-attentionat7bcaa623feat/minimax-model-supportate23eba79sm_89, driver570.124.06, CUDA12.8(V12.8.61)2.6.0a0+ecf3bae40a.nv25.01with CUDA12.8,torch.cuda.is_available() == True3.12.3, g++13.3.0, xmake3.1.1+20260919Results
4.768e-07, state2.384e-07; prefill: out1.907e-06, state4.768e-073.127381e-065.257875e-04; decode2.117679e-047.324219e-04; decode3.662109e-04All tests are below the
1e-2model-level tolerance. The 4-expert top-2 result exercises the CUDA Fused MoE path rather than the dense fallback.Validation Commands
Fixes Included
block_sparse_moe.experts.{i}.{w1,w2,w3}tomoe.experts.{i}.{gate_proj,up_proj,down_proj}andblock_sparse_moe.gatetomoe.gate.Server Logs
/data/minimax-final-gpu-op.log/data/minimax-final-gpu-smoke.log/data/minimax-final-gpu-vs-hf.log/data/minimax-gpu-test-moe4-top2-fp16-final.log