Nemotron Speech ASR GGUF quantization
nemotron-asr.cpp
To use these quantizations, you will need the ggml port of Nemotron ASR, found here:
https://github.com/m1el/nemotron-asr.cpp
Conv Weight Reshaping for Quantization
Problem
GGML block quantization (Q8_0, Q4_0) requires ne[0] (the first dimension in GGML) to be ≥ 32. The original conv
weights had shapes that resulted in small ne[0] values after GGUF's dimension reversal:
| Tensor | PyTorch Shape | GGUF Shape (reversed) | ne[0] | Quantizable? |
|---|
| pointwise_conv1 | (2048, 1024, 1) | [1, 1024, 2048] | 1 | No |
| pointwise_conv2 | (1024, 1024, 1) | [1, 1024, 1024] | 1 | No |
| depthwise_conv | (1024, 1, 31) | [31, 1, 1024] | 31 | No |
Quantization Requirements
GGML block quantization (Q8_0, Q4_0) requires ne[0] >= 32 because:
- Q8_0: 34-byte blocks (2-byte float16 scale + 32 int8 values)
- Q4_0: 18-byte blocks (2-byte float16 scale + 16 packed bytes for 32 values)
Tensors with ne[0] < 32 cannot be quantized and must remain F32.
Conv Weight Reshaping
The Conformer conv module has three weight tensors that required special handling:
Pointwise Convolutions (conv_pw1_w, conv_pw2_w)
| Format | pointwise_conv1 | pointwise_conv2 |
|---|
| PyTorch (original) | (2048, 1024, 1) | (1024, 1024, 1) |
| GGUF (if stored as-is) | [1, 1024, 2048] | [1, 1024, 1024] |
| ne[0] | 1 ❌ | 1 ❌ |
Summary Table
| Tensor | PyTorch Shape | GGUF Shape | ne[0] | Quantized | Reshape |
|---|
| pointwise_conv1 | (2048, 1024, 1) | [1024, 2048] | 1024 | ✓ Yes | squeeze(axis=2) |
| pointwise_conv2 | (1024, 1024, 1) | [1024, 1024] | 1024 | ✓ Yes | squeeze(axis=2) |
| depthwise_conv | (1024, 1, 31) | [1024, 31] | 1024 | ✗ No (F32) | squeeze(axis=1) + transpose |
| ffn1_linear1 | (4096, 1024) | [1024, 4096] | 1024 | ✓ Yes | none |
| ffn1_linear2 | (1024, 4096) | [4096, 1024] | 4096 | ✓ Yes | none |
| attn_q/k/v/out | (1024, 1024) | [1024, 1024] | 1024 | ✓ Yes | none |
*Depthwise conv still has ne[0]=31 < 32, so it's excluded from quantization and kept as F32 (only ~31KB per layer).
Why This Works
- Pointwise convs have kernel_size=1, so the trailing dimension is redundant
- Depthwise conv has groups=1 (middle dimension), also redundant
- The squeezed 2D tensors can be used directly with
ggml_mul_mat without runtime ggml_reshape_2d
ggml_mul_mat handles quantized weights natively, dequantizing on-the-fly on GPU
Benefits
- Smaller model files (Q8: ~3.8x, Q4: ~7x compression)
- Weights stay quantized in VRAM
- No CPU dequantization at load time
- Removed reshape operations from inference graph
License
The MIT License
Copyright 2026 Igor Malovitsa
igor.mlvts@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Licensed by NVIDIA Corporation under the NVIDIA Open Model License