mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#562
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/490
Author: @needmorevram
Created: 10/25/2026
Status: ❌ Closed
Base:
main← Head:mm3-perf📝 Commits (10+)
d69f718maya-mm3: MiniMax-M3.1-Flash (EXL3) - its own engine, first working forward40273eamaya-mm3: decode at 16 tok/s - expert profile, pinned pool, token kernels, CPU lane2801329maya-mm3: Maya's engine protocol, and MiniMax-M3.1 in the server0471fedSetup: MiniMax-M3.1-Flash as Maya's third model (maya-mm3)6a628e6maya-mm3: DSpark drafting - exact, ~1.5x decode2134b60maya-mm3: DSpark's confidence floor 0.7 by defaultc35772fmaya-mm3: the CPU lane's pool - a late worker can no longer take a job of the next phase6daf756maya-mm3: the staging slots as an expert cache in decode768099emaya-mm3: the expert cache's copies at a forward's end, its slots live two forwards onfaf4583maya-mm3: pictures - MiniMax-M3.1-Flash's vision tower in the engine📊 Changes
42 files changed (+14919 additions, -48 deletions)
View changed files
📝
CMakeLists.txt(+11 -0)➕
data/expert-profile-mm3.bin(+0 -0)📝
maya.py(+214 -11)📝
serve/frontend.py(+246 -5)➕
serve/mm3_vision.py(+175 -0)📝
serve/server.py(+40 -18)➕
serve/test_minimax_frontend.py(+155 -0)➕
serve/test_mm3_vision.py(+70 -0)📝
serve/web/app.css(+2 -0)📝
serve/web/app.js(+38 -12)📝
serve/web/index.html(+2 -0)➕
src/mm3/mm3_cands.hpp(+33 -0)➕
src/mm3/mm3_cpu.cpp(+443 -0)➕
src/mm3/mm3_cpu.hpp(+50 -0)➕
src/mm3/mm3_dspark.cu(+404 -0)➕
src/mm3/mm3_dspark.hpp(+75 -0)➕
src/mm3/mm3_exl3.cu(+2495 -0)➕
src/mm3/mm3_exl3.hpp(+221 -0)➕
src/mm3/mm3_geo.hpp(+72 -0)➕
src/mm3/mm3_kernels.cu(+1357 -0)...and 22 more files
📄 Description
Speed and fixes for
maya-mm3, the MiniMax-M3.1-Flash engine from #477. They come from studying llama.cpp's MiniMax-M3 support and exllamav3 1.6.4. Prompts read about 4.5× faster and decode up to 13% faster. Every change is exact: perplexity doesn't move, and the checks below compare bits where they can. Also new: an opt-in rotation that cuts the INT8 K/V cache's perplexity cost by about three-quarters, and a fix for MiniMax tool calls whose parameter admits a string or null.Results
One PC: an RTX 3090 and 8 RTX 5060 Ti (PCIe 3.0 x8 each),
--tp 4, DSpark on. "Before" is #477's binary on the same PC. "Server settings" are the default config's: 128K context,--kv-cache int8 --kv-streaming on.Prompts
On the 6K prompt, the 1024-token chunk alone gives 207 tok/s, and the pipeline over the three GPU groups takes it to 349. On the 53K prompt, the pipeline is worth about 1.9×: 189 tok/s without it (that run also had the CPU cold experts on).
Decode (tok/s): 300-token answers through the serve protocol, each case three times in one process, warm runs. Single command-line runs swing ±20% on this machine.
Perplexity, 16K tokens of assistant text:
--kv-rotate onA change of prompt chunk size moves single rows' logits more than rounding would suggest: MSA's top-16 block picks are discrete. The layer-split engine moves as much between its own chunk sizes. Perplexity is the measure that matters, and it doesn't change.
What changes
Prompts (
mm3_tp.cu)--tp-chunktokens (1024, was 256): an expert not in VRAM is copied in once a chunk instead of once per 256 tokens.MM3_TP_PIPE=0takes one chunk at a time; the logits are bit-identical either way.prom_capslots; the rest are reserved for a prompt's staging, which never takes a promoted slot while another is free.p_zeroandp_outare gone.p_y.--pplworks with--tp(Model::forward_ppl): the head runs on each chunk's rows as the chunk finishes.--tp-ffn-rows Nruns the FFN half in slices of N tokens. The bits are the same. At 256: 37 more experts in VRAM at the server settings, prompts 13% slower.MM3_PROMPT_CPUruns a chunk's coldest experts on the CPU lane meanwhile; it was 4% slower once the pipeline was on.Decode
-1picks instead of an index past the cache, which used to fault.sparse_attn: a verify window's queries are split 16 ways over their kept blocks and combined in split order. A query's split doesn't depend on T, so the token path and the windows still agree bit for bit.wait_pull: waiting on the host's counter and reading its rows is one kernel, off the copy engine. The window's positions and the draft's inputs are also made on the device, so none of them queue behind the expert cache's promotion copies (28 MB experts on the 3090). Drafting time had been swinging between 7.6 and 16.8 ms.tests/mm3_lane_test.cpp).Model::forward_cands): a sampled row's top_k, plus the penalised ids, is picked on the head's GPU with a radix select. That replaces copying 800 KB of logits per row to the host and sorting them there.mm3_sample.hpp'sdist_cgives the whole row's distribution from them; ties are now broken by id in both.MM3_TP_HOST_ROUTER: router logits on the host. It saves a round trip but reads 171 MB of router weights per window, about +6 ms.MM3_SAMPLED_DRAFTS: drafts drawn from the draft's own distribution, with speculative sampling's acceptance and residual. It keeps about 3% more drafts at temperature 1, but the draws cost more than that.--dspark-cost X: cuts the drafts where their confidences' product falls below X.INT8 K/V:
--kv-rotate on(opt-in, with--kv-cache int8)q, k and v rows go through a 128-point Hadamard transform before the INT8 rows' scales, and attention's output is rotated back. That spreads an outlier over its row before quantization: perplexity is 6.998 against 7.008 without it.
Server
MiniMax tool calls keep a string-admitting parameter's value as a string. Before,
{"type": ["string","null"]}turned"12345"into 12345. The rule follows llama.cpp'smay_be_string; covered byserve.test_minimax_frontend.Checks
--tp-ffn-rowsdon't change a bit either.MM3_STRESS,--no-promote), identical logits every time.--no-promote. With promotions on, both #477 and this branch drift apart, because promotions move experts between the CPU and the GPU.tests/mm3_kernels_test.cu, on the 3090 and a 5060 Ti:topk_rowsequalshost_cands.wait_pullwork.tests/mm3_sampler_test.cpp: candidates against the whole row, 13,107 of 13,107 distributions the same. Sampled drafts' output stays within sampling noise of p (total variation ≤ 0.002 over 2M draws).serve.test_minimax_frontend,serve.test_tools,serve.test_stopandserve.test_serverpass (142 tests, 2 skipped).maya.py:["string","null"]parameterNot covered
--kv-rotateonly.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.