feat(vlm): add Nemotron 3.5 Super VL (nemotron_h_omni) support

Abierto
#3,258 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
12/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start with the model detection arm in src/models/detection.rs and the loader in src/loading/vlm_nemotron_h_nano_omni.rs, then the forward path in src/vision/nemotron_h_nano_omni_vl.rs. Scope spans model routing, weight sanitizing, a new final LayerNorm, resize and pos-embed numerics, and multi-image concatenation, so it needs a maintainer to split it first. Done means the listed unit tests pass and a real Super VL pack generates matching greedy output.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

arch:hybrid area:models modelsize:large modeltype:vlm priority:medium status:ready type:enhancement

Summary

Load Nemotron 3.5 Super VL (model_type: nemotron_h_omni, NemotronH_Omni_Reasoning_V3) on the existing Nemotron Omni VLM path. The decoder is the Nemotron-H hybrid that mlxcel already runs (88 Mamba/attention/LatentMoE layers, 512 experts, top-22, moe_latent_size 1024) and the vision side is the same C-RADIO tower and mlp1 projector as Nemotron 3 Nano Omni. What is new is the model type, an optional vision final LayerNorm, two extra checkpoint keys, and three numerics fixes in the shared Omni image path. The bundled MTP head is a separate issue (linked below).

Upstream reference

Neywa-Labs/mlx-vlm#2528, commit 63fc9795:

Checkpoint facts (Hub API, 2026-11-23)

  • nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-NVFP4, 75.1 GB: llm_config.model_type nemotron_h, hidden_size 4096, num_nextn_predict_layers 1, time_step_limit [0.0, {"__float__": "Infinity"}], downsample_ratio 0.5, vit_hidden_size 1280, projector_hidden_size 20480, img_context_token_id 18, video_pruning_rate 0.7. Keys vision_projector.vision_final_layernorm.{weight,bias} and vision_model.summary_idxs. Quantization quant_method: modelopt_mixed (NVFP4 experts plus FP8 dense), which mlxcel cannot load until #3201.
  • Duckets/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-MLX-4bit, 69.4 GB: nemotron_h_omni, affine 4-bit gs 64, 392 vision tensors, top-level vision_final_layernorm.*, no mtp.*.
  • nativ-community/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-NVFP4, 80.2 GB: nemotron_h_omni, MLX mode: nvfp4 gs 16 with weight_scale_2 global scales, top-level vision_final_layernorm.*, and the 26-tensor MTP head under language_model.mtp.*.
  • rapid-mlx/...-MLX-4bit and -MLX-3bit are text-only nemotron_h exports (no vision tensors); they belong to the text path, not this issue.

Current mlxcel behavior

  • src/models/detection.rs:1083 maps only nemotron_h_nano_omni and nemotronh_nano_omni_reasoning_v3 to ModelType::NemotronHNanoOmniVLM; nemotron_h_omni has no arm.
  • load_nemotron_h_nano_omni_vlm (src/loading/vlm_nemotron_h_nano_omni.rs:328) already reads llm_config (parse_text_config, :198), parses the tagged infinity (src/models/nemotron_h.rs:152-170), drops mtp.* in NemotronHModel::sanitize_weights (nemotron_h.rs:2361), and loads LatentMoE (fc1_latent_proj, nemotron_h.rs:1313) and NVFP4 weight_scale_2 planes (src/models/switch_layers.rs:714). It renames only mlp1.{0,1,3} (rename_projector_weights, :163) and has no handling for vision_final_layernorm, vision_projector.* or summary_idxs.
  • NemotronHNanoOmniVlModel::extract_image_features_single (src/vision/nemotron_h_nano_omni_vl.rs:196-220) goes RADIO -> reshape -> pixel_shuffle -> projector with no final LayerNorm. extract_image_features (:226-241) concatenates the per-image [1, n_i, H] results on axis 0, which only works when every image yields the same token count.
  • src/vision/processors/nemotron_h_nano_omni.rs:145-150 resizes with image::imageops::FilterType::CatmullRom on u8 pixels.
  • The RADIO pos-embed resample (src/vision/encoders/nemotron_h_nano_omni.rs:530-560) runs in the stored weight dtype and casts after (:609).

Required changes

  1. src/models/detection.rs: add nemotron_h_omni to the NemotronHNanoOmniVLM arm; add it to the alias list at src/models/registry.rs:1229-1231.
  2. src/loading/vlm_nemotron_h_nano_omni.rs:
    • Drop vision_model.summary_idxs and vision_model.radio_model.summary_idxs.
    • Rename vision_projector.vision_final_layernorm.* to vision_final_layernorm.*.
    • Parse vision_config.layer_norm_eps (default 1e-6) and the top-level vision_final_layernorm (default: num_nextn_predict_layers > 0). When enabled and the tensors are missing, fail the load naming vision_final_layernorm.weight.
  3. src/vision/nemotron_h_nano_omni_vl.rs: hold vision_final_layernorm: Option<LayerNorm> and apply it to the RADIO features before the reshape in extract_image_features_single. Flatten each image's projected features to [n_i, H] before concatenating, then restore the leading batch axis the scatter expects. Nano Omni has no such tensors and stays unchanged.
  4. src/vision/processors/nemotron_h_nano_omni.rs: resize the float32 image with the antialiased bicubic matrix from src/vision/encoders/resample_matrix.rs:104 (interp_matrix, the one #2465 established), applied separably on the unrounded [0, 255] floats, then normalize. Do not write a second bicubic.
  5. src/vision/encoders/nemotron_h_nano_omni.rs get_pos_embeddings: cast pos_embed to float32 before the resample and back to the activation dtype afterwards.
  6. docs/supported-models.md: Super VL row with its memory need (the 4-bit pack is 69 GB; fits a 128 GB machine for short contexts).

Items 4 and 5 change Nano Omni numerics as well; report both families in the trace (see Validation).

Scope

In scope: text and image requests for Super VL on the two MLX packs above, CLI and server.

Out of scope: the native ModelOpt NVFP4 pack (#3201); the MTP head (#3260, blocked by this one); Nemotron 3.5 Bolt and its Puzzle block_configs per-layer overrides (no MLX pack, 150 GB BF16, a follow-up issue); native video input and its efficient video sampling (compute_retention_mask, video_pruning_rate), since mlxcel's Omni VL module has no native video path (src/vision/nemotron_h_nano_omni_vl.rs has no video handling); a follow-up issue if wanted.

Acceptance criteria

  • src/models/detection_tests.rs nemotron_h_omni_routes_to_the_omni_vlm: a config with model_type: nemotron_h_omni and llm_config.model_type: nemotron_h resolves to NemotronHNanoOmniVLM.
  • src/loading/vlm_nemotron_h_nano_omni.rs tests (its inline mod tests): vision_projector_final_layernorm_is_renamed_and_summary_idxs_dropped, and final_layernorm_defaults_on_when_mtp_layers_declared (absent key plus num_nextn_predict_layers: 1 enables it; absent plus 0 disables it; an explicit false wins).
  • src/vision/nemotron_h_nano_omni_vl_tests.rs: two_images_with_different_token_counts_concatenate builds features for a 512x512 and a 512x1024 tile set and gets n_1 + n_2 rows; expected to fail on current code (possibly as a shape error rather than a wrong count).
  • src/vision/processors/nemotron_h_nano_omni_tests.rs: resize_is_float_antialiased_bicubic downsamples a 64x64 ramp to 32x32 and equals the interp_matrix(.., antialias = true) product within 1e-4, and differs from the CatmullRom u8 result by more than 0.5/255 somewhere.
  • src/vision/encoders/nemotron_h_nano_omni_tests.rs: pos_embed_resample_runs_in_f32 with a bf16 table equals the f32 resample cast to bf16.
  • Real checkpoint: mlxcel generate -m models/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-MLX-4bit --image cat.jpg -p "Describe this image." -n 128 --temp 0 describes the image, and a text-only prompt is coherent. Greedy output matches mlx_vlm.generate --temperature 0 on the same pack for the first 64 tokens, using the logit trace in docs/benchmarks.md. The nativ-community NVFP4 pack also loads and answers.
  • Served through mlxcel-server /v1/chat/completions with an image_url part; mlxcel arch lists nemotron_h_omni. Nano Omni (nativ-community/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-4bit) still answers, and its trace against mlx-vlm main improves or holds.

Validation

Hardware: the 4-bit pack is 69.4 GB and the NVFP4 pack 80.2 GB, so both fit a 128 GB machine for short contexts.

make verify-test
cargo test --profile test-fast nemotron_h_nano_omni
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --check
python3 scripts/ci/check_cross_repo_refs.py
./target/release/mlxcel download Duckets/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-MLX-4bit
./target/release/mlxcel generate -m models/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-MLX-4bit --image cat.jpg -p "Describe this image." -n 128 --temp 0

The resize and pos-embed changes move numbers on Nano Omni too; per docs/benchmarks.md#judging-a-change-that-moves-the-numbers, run the logit trace with the change reverted and report both arms for both families.

Related

#3201 (ModelOpt MIXED_PRECISION loading, needed for the native NVIDIA pack), #2465 (antialiased cubic coefficient), #2351 (weight_scale_2 sidecars). #3260 (the bundled MTP head, blocked by this issue).

Lenguaje dominante
Rust
Estrellas
505
Forks
81
Merge medio
14 h 2 min
PR fusionados (30 d)
448

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lablup/mlxcel

Todos los issues de lablup/mlxcel

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.