mel: skip zero-weight filterbank entries in the mel projection - #64
Merged
Merged
Conversation
The mel filterbank matrix is ~98% zeros (426 nonzero of 20 560 on the 110m). frame_logmel now iterates a precomputed nonzero (bin, weight) index instead of all n_bins per mel filter, cutting the per-frame filterbank multiply-adds ~48x. Skipping an exact-zero weight contributes exactly 0.0, so the output is bit-identical (verified by checksum and the NeMo mel parity test test_mel). Measured: ~55% faster mel frontend on the 110m (bit-identical). Assisted-by: AI:DeepSeek-V4-Flash
Collaborator
|
The sparse projection preserves the accumulation order of every non-zero term and removes only exact-zero multiplications; the storage is built once and the hot path stays allocation-free. This is a focused, worthwhile frontend optimization. @mudler this looks good to merge. One non-blocking housekeeping note: the |
mudler
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mel filterbank matrix is ~98% zeros (426 nonzero of 20 560 on the 110m). frame_logmel now iterates a precomputed nonzero (bin, weight) index instead of all n_bins per mel filter, cutting the per-frame filterbank multiply-adds ~48x. Skipping an exact-zero weight contributes exactly 0.0, so the output is bit-identical (verified by checksum and the NeMo mel parity test test_mel).
Measured: ~55% faster mel frontend on the 110m (bit-identical).
Assisted-by: AI:DeepSeek-V4-Flash