Skip to content

fix(audio): align Nemotron Omni frontend and subsampling biases with mlx-vlm - #3582

Merged
inureyes merged 3 commits into
lablup:mainfrom
Jaeyeong-CHOI:fix/nemotron-omni-audio-parity
Nov 30, 2026
Merged

inureyes merged 3 commits into
lablup:mainfrom
Jaeyeong-CHOI:fix/nemotron-omni-audio-parity

Conversation

@Jaeyeong-CHOI

Copy link
Copy Markdown
Contributor

Refs #3566.

The default Nemotron-H Nano Omni audio frontend now uses the same symmetric Hann window and counts the same complete, centered FFT windows as mlx-audio. A one-second 16 kHz clip with the released settings has 101 frames, not 103. The shared frontend no longer needs a d1-omni-specific STFT switch.

Match mlx-vlm's subsampling convolution bias default both when constructing the Rust configuration and when deserializing a checkpoint that omits the setting. Explicit false is still honored. Bias-enabled checkpoints must still provide the weights; missing tensors are not replaced with zeroes. A regression test holds the synthetic encoder weights and input fixed, changing only the subsampler biases.

Real-checkpoint comparison

Compared the 4-bit Nemotron-3-Nano-Omni checkpoint against mlx-vlm 0.8.1 with mlx-audio 0.6.8 on a GB10 (CUDA). The input was the first 2 s of tests/fixtures/audio/speech.flac, resampled to mono 16 kHz. Both implementations received the identical PCM samples and the same transcription request and audio-token prefix. Quantities below are from the first decode distribution after prefill; there is no sampling or transcript-quality metric.

Quantity mlxcel vs mlx-vlm 0.8.1
Log-mel frames × bins 201 × 128 on both
Log-mel max abs / RMS 2.3425e-5 / 1.3561e-6
Projected audio rows × width 26 × 2,688 on both
Audio projection max abs / relative L2 0.125 / 0.01479
First-step logits max abs / RMS (131,072 entries) 2.6875 / 0.5890
First greedy token ID 12 on both (reference top-two gap 31.25)

For a negative control, the same binary probe was recompiled with the three production source files restored from the parent commit. Both runs used exactly the same 40 prompt IDs. The parent produced 203 log-mel frames (201 in the reference); on those first 201 rows its max error was 0.11902, versus 2.3425e-5 after the fix. The relative L2 error in the projected audio embeddings fell from 1.11354 to 0.01479. First-step logit max error fell from 4.9140625 to 2.6875 and RMS from 1.0223 to 0.5890; the greedy token was ID 12 in all three runs.

This is a frontend correction, not a claim that the complete logit vectors match. Holding the mlx-vlm decoder fixed and swapping in the native projected audio embeddings changed the logits by at most 0.5 (RMS 0.1018). Holding those embeddings fixed across both decoders gave a max difference of 2.875 (RMS 0.5882). On the text-only control the two implementations differed by up to 4.515625. The mlx-vlm result with a fresh live decode cache matched its cache-free prefill exactly.

Validation

  • The dedicated audio suite passed (18 tests) and the d1-omni suite passed (40 tests).
  • The 5 real-checkpoint d1-omni parity tests also passed with MLXCEL_REQUIRE_MODELS=1 (f32 and 8-bit).
  • make verify-test-cuda: 18,084 passed; 0 failed; 530 ignored. Only documentation of the measured results changed afterwards.
  • Workspace rustfmt and CUDA clippy with all targets and warnings denied passed.
  • Metal and ROCm not tested.

@inureyes inureyes added status:review Under review type:bug Bug fixes, error corrections, or issue resolutions priority:medium Medium priority labels Nov 30, 2026
The d1-omni audio constructor still said the shared Nemotron extractor differs from mlx-audio's STFT, which stopped being true once the symmetric Hann window and complete-window frame count became the default. The comment now states that the shared extractor already frames like mlx-audio.

Validated on Metal (M3 Ultra): nemotron_h_nano_omni and d1_omni unit tests, and the 41 d1-omni tests with MLXCEL_REQUIRE_MODELS=1 against the f32 and 8-bit checkpoints, including the speech log-mel and speech parity tests.

Refs lablup#3566, lablup#3582
@inureyes

Copy link
Copy Markdown
Member

Hardening review

Reviewed against #3566 and the PR description. The frame-count change is consistent end to end: the server and VLM paths derive the audio token count from the extractor's output (subsampling_output_length on features_shape[1]), so prompt placeholders and encoder rows cannot disagree, and the new formula never yields zero frames because padded_len >= n_fft. The subsampling_conv_bias default of true loads real biases and still errors on a missing tensor; explicit false is honored.

One fix pushed (557d615): the d1-omni constructor comment still said the shared extractor differs from mlx-audio's STFT. It now says the opposite, matching the code.

Security and performance: no new input surface; the frontend does fewer FFT frames per clip than before.

Validation on Metal (M3 Ultra, which the PR had not covered): nemotron_h_nano_omni and d1_omni lib tests pass, including all 41 d1-omni tests with MLXCEL_REQUIRE_MODELS=1 against the f32 and 8-bit checkpoints (speech log-mel and speech parity included). fmt and clippy (metal,accelerate, all targets, -D warnings) pass. The Nemotron-3-Nano-Omni checkpoint is not on this host, so its real-checkpoint check rests on the GB10 run in the description.

@inureyes
inureyes merged commit dfbd904 into lablup:main Nov 30, 2026
36 checks passed
@inureyes inureyes added this to the 0.9 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium priority status:review Under review type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants