[Bug] FunASR-Nano INT8 produces empty output (0 tokens) on Windows x86_64 CPU (int8 overflow / premature EOS)
Describe the Bug
When running the pre-trained INT8 model (sherpa-onnx-funasr-nano-int8-2025-12-30) on Windows x86_64 CPU with sherpa-onnx, the recognizer always produces empty text output (Result: '', generated 0 tokens), regardless of the input audio.
Environment
- **OS**: Windows 10 / Windows 11 (x86_64, AVX2 enabled)
- **sherpa-onnx version**: 1.13.4 ~ 1.13.8
- **Model**: `sherpa-onnx-funasr-nano-int8-2025-12-30`
- **Execution Provider**: CPUExecutionProviderMinimal Reproduction
```python
import sherpa_onnx
import wave
import numpy as np
recognizer = sherpa_onnx.OfflineRecognizer.from_funasr_nano(
encoder_adaptor="./sherpa-onnx-funasr-nano-int8-2025-12-30/encoder_adaptor.int8.onnx",
llm="./sherpa-onnx-funasr-nano-int8-2025-12-30/llm.int8.onnx",
embedding="./sherpa-onnx-funasr-nano-int8-2025-12-30/embedding.int8.onnx",
tokenizer="./sherpa-onnx-funasr-nano-int8-2025-12-30/Qwen3-0.6B",
num_threads=4,
debug=True,
)
with wave.open("test.wav", "rb") as f:
num_samples = f.getnframes()
samples = np.frombuffer(f.readframes(num_samples), dtype=np.int16).astype(np.float32) / 32768.0
stream = recognizer.create_stream()
stream.accept_waveform(16000, samples)
recognizer.decode_stream(stream)
print("Recognized Text:", stream.result.text)
```Actual Output
```text
starting prefill with context_len=144, inputs_embeds_fp32.size()=147456
GenerateText: generated 0 tokens:
token ids:
Tokens: []
Recognized Text:
```Root Cause Analysis
1. On macOS (Apple Silicon ARM NEON), the official docs show successful transcription because ARM dot-product / SDOT instructions handle int8
accumulation differently.
2. In llm.int8.onnx, the metadata indicates quantization_type=int8, int8_mode=u8u8, reduce_range=0.
3. On x86_64 CPUs with ONNX Runtime CPUExecutionProvider (using AVX2 / VNNI), quantizing matmul operations with reduce_range=False across the 1024-
dim hidden state frequently leads to 32-bit integer accumulator overflow.
4. This causes the output logits at step 0 to predict token 151643 (<|endoftext|> / EOS), terminating the generation loop immediately before
generating any text tokens.
Suggested Fix
- When quantizing `llm.onnx` via ONNX Runtime quantization tool, specify `reduce_range=True` (or export as `int4` / `fp16` / `weight-only int8`), or
calibrate with proper activation scales to prevent intermediate accumulator overflow on x86-64 CPU.
- Could you please re-export or update the quantized INT8 model with reduce_range=True or verify it on Windows x86_64?
Source: k2-fsa/sherpa-onnx