Repository navigation
fix(audio): align Nemotron Omni frontend and subsampling biases with mlx-vlm - #3582
Conversation
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
Hardening reviewReviewed 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 ( 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): |
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
falseis 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.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
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.