Repository navigation
gemma4: admit the 31B's MTP assistant as a drafter - #1385
Conversation
|
Thanks @ThomasHalwax for #1383 and the receipts: 28.3 against 12.2 tokens a second with identical texts is a real step for the 31B. The CUDA side reads well.
Once that's in, we'll run the 31B MLX 4-bit with the assistant on a GB10: drafted == plain, greedy and sampled, concurrent == solo at four streams, images with |
|
Thanks for the review. Done in 2db58ff:
|
|
Thanks @ThomasHalwax, and sorry this sat after your fixes. Both points are answered in 2db58ff: Metal is back as on main, and CUDA refuses assistants by type with a test. We've rebased it onto main (clean) with a changelog line from your suggestion. We don't have the 31B assistant on our GB10s, so it lands on your receipts for the drafted path. We're running the 31B on a GB10 without a drafter, main against this, to confirm nothing else moved. Then it lands. |
|
Result, @ThomasHalwax: Gemma 4 31B MLX 4-bit on a GB10 without a drafter, main against this, alternating fresh servers. Prompt tokens are equal to main (0 of 20 rows differ), and the stream sweep is level at 1, 2, 4 and 8 streams (0.0%). Prefill is level from 2k to 32k, and 64k reads 0.3% lower (552 against 550.6 tok/s). The only lines on that path are an error message and a comment, and the assistant parser runs only with |
…, with the target's query heads google/gemma-4-31B-it-assistant has the 12B assistant's tensors, depth and width and no ordered embeddings; it differs only in its type names (gemma4_assistant / gemma4_text) and in 32 query heads, its target's. Both parsers (CUDA, Metal) take either type pair and require the target's query heads instead of a fixed 16. Fixture: the 31B assistant's config.
… type and query heads
2db58ff to
66d0fdd
Compare
|
Thank you @ThomasHalwax. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in 1.2.1, credited to you in the changelog and the release notes. |
|
Thanks @ThomasHalwax! Gemma 4 31B on CUDA drafting with Google's MTP assistant is in 1.2.1: https://github.com/ashhart/TensorFold/releases/tag/v1.2.1 |
Fixes #1383.
On CUDA, the assistant parser (
cuda_assistant_weights.zig) takes either type pair (gemma4_unified_assistant/gemma4_unified_textorgemma4_assistant/gemma4_text) and requires the target's query heads instead of a fixed 16. A mismatched pair isBadDraftConfig, another typeUnsupportedAssistantType. The--draftermessage names both assistants. Fixture: the 31B assistant'sconfig.jsonat627c5ec1; tests admit it against the dense 31B and refuse it against the 12B, and refuse an unknown assistant type,gemma4_assistantover agemma4_unified_textconfig and the 31B's config with 16 query heads (the last two are red onmain). No forward or kernel change. Metal stays as onmain.Receipts (one GB10, CUDA 13.0, driver 580.173.02; target
mlx-community/gemma-4-31B-it-4bit@696d436c, assistant @627c5ec1; server--context 131072 --parallel 4 --vision --no-thinking):"draft": false: 16/16 texts identical.--vision: 8/8.faccd11c; rebased on40c6406b, the same prompts give identical texts.Host:
zig build test-cuda-hostpasses (theFAIL CPU reference comparisonlines appear onmainas well);test-gemma4-cuda-host31/31;tools/zig/lean_check.pyadds no findings overmain(433). The CI steps ofno-gpu.yml(zig build test,test-kernel-contract,test-golden,test-server-security test-pull-security) andzig fmt --check build.zig zigpass locally on Linux.Changelog suggestion: Gemma 4 31B takes Google's MTP assistant (
google/gemma-4-31B-it-assistant) as--drafteron CUDA (#1383). On a GB10 it decodes German prose at 28.3 tokens/s against 12.2 undrafted and 20.3 with DFlash, with identical tokens.