Repository navigation
Description
Summary
gemma-4-31b-it-nvfp4 loads and generates correctly on the text path (2026-07-12 GB10 sweep: 76.38 prefill / 4.88 decode tok/s), but any request with an image fails with Images provided but model is not a vision-language model. The checkpoint is a genuine multimodal export: config.json has vision_config (plus audio_config), model_type is gemma4 exactly like the working gemma-4-31b-it-4bit sibling, and the safetensors index contains 356 vision-related tensors (model.vision_tower.*, model.embed_vision.*). The NVFP4 key remapper appears to process only the text decoder: the loader log reports remapping 1372 keys out of 1728 total in the index, and 1728 - 1372 = 356, exactly the number of vision keys. The unmapped vision tower never binds, the model registers as non-VLM, and image requests are rejected at the vlm_runtime gate.
Environment
- NVIDIA GB10 (DGX Spark), 122 GB unified LPDDR5x, Linux aarch64 kernel 6.17
- CUDA 13.0, SM 12.1,
cargo build --release --features cuda - mlxcel 0.4.0-rc.1 (main
58d0cbb), MLX pin57c66cac(0.32.1) - NVFP4 direct transcode is the default load path on all builds since perf(metal): close native NVFP4 prefill gap #705/perf: default Metal NVFP4 to native transcode (#705) #706
Repro
./target/release/mlxcel generate -m models/gemma-4-31b-it-nvfp4 \
-p "What is in this image?" --image tests/fixtures/test_image.png -n 8
Observed output:
Remapping 1372 NVFP4-style weight keys to MLX-community convention...
Repacking 180 ModelOpt NVFP4 weight groups to MLX native NVFP4 via direct triplet transcode...
Model loaded in 90.895s (resident: 29.32 GB, peak: 34.34 GB).
Loaded 1 image(s).
Error: Images provided but model is not a vision-language model
The control gemma-4-31b-it-4bit (same model_type: gemma4) passes the same image prompt (2026-07-12 VLM sweep: 277 prompt tokens, 24 generated tokens, 422.29 prefill / 8.79 decode tok/s; exact row in benchmarks/cuda_gb10_vlm_2026-07-12.csv).
Analysis
- Error site:
should_prepare_vlm_embeddingsinsrc/multimodal/vlm_runtime.rs(theis_vlm == falsebranch). This gate is behaving correctly; the defect is upstream in load. - The ModelOpt export nests projection weights one level deeper than the MLX-community convention (for example
model.vision_tower.encoder.layers.0.mlp.down_proj.linear.weight, note the extra.linearsegment), and the vision keys also carry themodel.prefix. The NVFP4-style key remapper does not translate these, so the gemma4 vision tower construction finds no usable weights and the model is registered text-only. - Key arithmetic from the checkpoint: safetensors index has 1728 tensors; the loader remaps 1372; the 356 difference matches the count of
vision/embed_visiontensors exactly. - The 2026-06-17 sweep never exercised this path (the nvfp4 checkpoint was entirely non-functional before the direct-transcode work fix(cuda): repack ModelOpt NVFP4 to native MLX layout #692/perf(nvfp4): direct-transcode ModelOpt triplets to MLX native #693/perf(nvfp4): direct-transcode ModelOpt triplets to MLX native #697), and the 2026-07-09 subset was text-only, so 2026-07-12 is the first time the NVFP4 image path was tested at all.
- Open sub-question for the fix: whether the vision tower in this export is quantized (NVFP4 groups needing transcode) or kept in bf16/fp16; the loader repacked 180 NVFP4 groups which may or may not include vision tensors. The fix needs to handle whichever layout ModelOpt actually emits (inspect the dtypes of the vision tensors in the index).
Expected behavior
The NVFP4 direct-transcode path remaps and binds the vision tower (and the audio tower, given audio_config is present, or explicitly documents audio as out of scope), so gemma-4-31b-it-nvfp4 serves image input like its 4-bit sibling.
Acceptance criteria
- Vision keys from the ModelOpt NVFP4 export are remapped/bound, and the model registers as a VLM.
- The repro command above generates tokens for the image prompt.
- A VLM benchmark row for
gemma-4-31b-it-nvfp4lands inbenchmarks/and in the VLM table ofdocs/benchmark_results/model_tests_gb10.md, which currently carries a FAIL row and a note that this needs a follow-up issue (update that note to reference this issue number). - A regression test covering vision-key remapping on an NVFP4-style key set (a unit test on the remapper is fine; no 31 GB fixture required).
References
- Benchmark evidence:
benchmarks/cuda_gb10_vlm_2026-07-12.csv(FAIL row), commite45ef02 - Doc:
docs/benchmark_results/model_tests_gb10.mdVLM table note - Related prior work: fix(cuda): repack ModelOpt NVFP4 to native MLX layout #692, perf(nvfp4): direct-transcode ModelOpt triplets to MLX native #693, perf(nvfp4): direct-transcode ModelOpt triplets to MLX native #697 (direct transcode), perf(metal): close native NVFP4 prefill gap #705/perf: default Metal NVFP4 to native transcode (#705) #706 (default flip)
Activity
docs(benchmarks): link the 2026-07-12 GB10 findings to issues #748 and …
test(detection): cover NVFP4 model.-prefixed gemma4 vision routing
fix: bind gemma-4 NVFP4 vision tower so image input works (#750)
docs(benchmarks): link the 2026-07-12 GB10 findings to issues lablup#748
fix: bind gemma-4 NVFP4 vision tower so image input works (lablup#750)