mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[GH-ISSUE #602] maya-mm3: the single-conversation server ignores the calibrated chunk from prefill-tune.txt (v1.1.34/v1.1.35: prompts read at ~155 tok/s instead of ~340 on one 48 GB GPU) #248
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#248
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?
Originally created by @talisp on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/602
In short: on v1.1.34,
./maya.sh --calibratepicks chunk 4096 for MiniMax-M3.1 here and writes it toprefill-tune.txt. The engine sizes its buffers for 4096 (so fewer experts fit in VRAM: 878 instead of 961), but the server of one conversation still reads prompts in chunks of 1024. We pay for the bigger chunk and get none of its speed: prompts read at 155-161 tok/s, the same as before the calibration.The cause is one argument.
serve()getso.chunkfrommain, andmain's options never seeprefill-tune.txt.Model::loadapplies the calibrated chunk to its own copy of the options.serve_multi(--parallel) already asks the model (m.chunk()), so only the one-conversation server is affected. With a one-line change (below), the same calibration reads prompts at 340-365 tok/s, exactly what--chunk 4096given by hand gives.A follow-up from #552, where the larger chunk was found. Thanks for the quick turnaround there!
Where it happens (v1.1.34, and still in v1.1.35)
src/mm3/mm3_model.cu:3058:Options o = o_in;-Model::loadworks on a copy.src/mm3/mm3_model.cu:3099:if (k == "chunk" && !o.chunk_given && v >= 64 && v <= 16384) o.chunk = v;- the calibrated chunk lands in that copy (the buffers are sized from it).src/mm3/mm3_main.cpp:1767(v1.1.35; 1764 in v1.1.34):return serve(m, eos, o.chunk, ...)-main's owno.chunk, still the default 1024.src/mm3/mm3_main.cpp:416:serve()reads the prompt in calls ofchunktokens.src/mm3/mm3_main.cpp:993:serve_multiusesm.chunk() > 0 ? m.chunk() : chunk- correct.--chunk Non the command line,mainsees N too, which is why--chunk 8192always worked for us.The change we tested (local only)
The same expression
serve_multiuses.m.chunk()returns 0 on the tensor-parallel path, which keepso.chunkthere. (Line 1766, theserve_multicall, could take the same for consistency; it doesn't need it.)Numbers
Same model, pack, context and flags in every row; only the chunk changes (and the threads, in the one row that says so). One start each, the model files' page cache dropped before each start. Prompt reading in tok/s at three lengths (9.6K, 39K and 159K tokens), decode is the mean of six code prompts (600 tokens each).
prefill-tune.txtfrom v1.1.32: chunk=1024)./maya.sh --calibrate(chunk=4096)--chunk 4096by hand--chunk--chunk 8192 --cpu-threads 28(earlier, #552)--chunk 8192(30 threads)--chunk 16384(30 threads)The calibration's own line:
Its 371.6 tok/s matches what the server reaches once it really uses 4096 (337-365).
Why the old calibration wrote 1024
Before v1.1.34 the rule only raised the chunk above the default where every routed expert fits in VRAM. Here they don't (961 resident), so it kept the default and wrote
chunk=1024. That is why the bug never showed until v1.1.34 started picking larger chunks where experts are staged. Anyone who recalibrates on v1.1.34 with experts outside VRAM and serves one conversation (no--parallel) is affected. That may include #580 (4x RTX 3090, Maya-S, calibration wrote chunk 1024, asks about prefill chunking), if a recalibration there picks a larger chunk.A second, smaller point: the calibration can't see chunks above 4096
tools/calibrate_mm3_prefill.pymeasures on a ~4K-token prompt (TOKENS = 4096), so a chunk of 8192 or more reads that prompt in one call, the same as 4096, and can never win. On real prompts here it does:DECODE_LOSS = 0.03.--cpu-threads 28row is from #552: in that single start, the 2 threads fewer cost ~5% of decode; the chunk did not.)Measuring on a longer prompt (16K, say, or the chunk's own size times two) would let the calibration weigh that trade itself. The Strata engine saw the same per-chunk cost of copying the experts VRAM doesn't hold, in its hybrid mode (Niko1221/Strata#4332: its chunk rule had no 4096 arm; adding one read prompts 51-76% faster on a 16 GB card).
Setup
maya-mm3built with-DCMAKE_CUDA_ARCHITECTURES=89).--max-context 262144 --kv-streaming on --vision on --dspark on --profile data/expert-profile-mm3.bin, no--cpu-threads(30 threads), no--parallel.maya.py --plain, one request at a time.@mw00 commented on GitHub (Oct 28, 2026):
Fixed in v1.1.36: the single-conversation MiniMax server now reads the prompt in the chunk from
prefill-tune.txt, the same one the model was sized for. Thank you @talisp for the exact line inserve(); it was a one-line fix because of that. Please tell us if your 48 GB card now gets the speed you measured with the calibrated chunk.Released in v1.1.36: https://github.com/mw00/project-maya/releases/tag/v1.1.36
@talisp commented on GitHub (Oct 29, 2026):
Confirmed on v1.1.36, thanks! Same box as the report (1× L40S 48 GB, 32-vCPU Xeon VM, ~504 GB RAM), same pack and calibration (
prefill-tune.txt: chunk=4096), and no--chunkon the command line:The start line reads the calibration (
prefill: this PC's calibration (<pack>/prefill-tune.txt): chunk 4096), with 878 experts resident as before. Decode is at the low end of our run-to-run spread (17.2-18.4); it's one start, with the page cache dropped before it.