Repository navigation
tools: gemma4_e4b_convert.py, an E4B BF16 checkpoint to MLX affine 4-bit g64 under mlx-lm's names - #1403
tools: gemma4_e4b_convert.py, an E4B BF16 checkpoint to MLX affine 4-bit g64 under mlx-lm's names#1403Mirrdhyn wants to merge 1 commit into
Conversation
… 4-bit g64 under mlx-lm's names (ashhart#1222)
|
Thank you for this, and for the byte check against TensorFold doesn't ship lossy conversions of a release, and this tool requantizes the BF16 E4B to 4 bits. Your own KL The engine doesn't need the tool either. The family reads MLX affine checkpoints under mlx-lm's names, so a published Thanks again for the careful work across #1222. |
What this changes
Part of #1222. Independent of #1400, #1401 and #1402.
tools/zig/gemma4_e4b_convert.pywrites an MLX affine 4/64 checkpoint from the BF16 E4B, under mlx-lm's names (language_model.model.) and its per-modulequantizationtable; it leaves out the shared layers' unreadk_proj,v_proj,k_norm. Options:--dense-plekeeps the per-layer input linears and table BF16 (markedfalse),--attn-bits 8puts the attention projections at 8 bits.--check-mlxcompares every quantized block withmx.quantize, byte for byte, on MLX's CPU device: its Metal quantize rounds a few scales differently (7 of 10,240 groups on a synthetic matrix, MLX 0.30.0 to 0.32.4).KL against BF16, forced tokens, 14 French prompts, 358 positions (measured on our Intel Arc prototype engine with these checkpoints): 4/64 with BF16 per-layer linears 0.0409, top-1 97.2 %; plus 8-bit attention 0.0176, top-1 98.9 %, at a cost of about 10 % decode and 40 % prompt speed there.
Receipt
--dense-ple --check-mlxonnvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-BF1649843eed, MLX 0.32.4, M4 Max: 1,185 tensors, 260 quantized, 0 blocks differ.python -m unittest tools/zig/gemma4_e4b_convert_test.py: 11 passed (numpy), skipped cleanly without numpy.