File size: 7,486 Bytes
6a35e76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
765659b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
---

language:
  - en
license: mit
library_name: transformers
pipeline_tag: automatic-speech-recognition
base_model: openai/whisper-tiny.en
tags:
  - whisper
  - automatic-speech-recognition
  - speech-recognition
  - encoder-decoder
  - onnx
  - transformers.js
  - webgpu
  - wasm
  - browser
  - rtx-5090
---


# Streaming Speech Recognition with Whisper Encoder-Decoder

Browser-deployable automatic speech recognition system built around the Whisper encoder-decoder architecture, with LoRA/PEFT experimentation, robustness benchmarking, ONNX optimization, and static client-side deployment.

> **Production artifact in this repository:** Whisper Tiny English FP32 ONNX browser model selected from measured evaluation evidence.

## Live Resources

- **Live Demo:** https://huggingface.co/spaces/anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder
- **GitHub Project:** https://github.com/unit-mole/encoder-decoder-projects/tree/main/03-streaming-speech-recognition-whisper-encoder-decoder
- **Model Repository:** https://huggingface.co/anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model


## Evaluation Overview

![Whisper Model Comparison](images/model_comparison.png)

## Evaluation Dashboard

![Whisper Evaluation Dashboard](images/evaluation_dashboard.png)


## Model Selection

The project evaluated Whisper Tiny, Small, and Medium in both pretrained and LoRA fine-tuned configurations.

The final browser model was selected based on **accuracy, latency, memory footprint, real-time factor, and ONNX parity**, rather than assuming that fine-tuning would always improve performance.

### Test-Set Results

| Model | WER | CER | Avg. Latency |
|---|---:|---:|---:|
| Tiny pretrained | **6.09%** | 2.64% | **0.118 s** |
| Tiny LoRA | 16.76% | 6.64% | 0.262 s |
| Small pretrained | **3.46%** | 1.44% | 0.232 s |
| Small LoRA | 6.26% | 2.17% | 0.619 s |
| Medium pretrained | 4.68% | 2.50% | 0.405 s |
| Medium LoRA | 4.23% | **1.37%** | 1.188 s |

All values above come from the project's held-out **1,452-example test evaluation**.

## Why Whisper Tiny for Browser Deployment?

Whisper Small pretrained achieved the lowest overall WER, but Whisper Tiny pretrained was selected as the **browser champion** because it provided a substantially lighter runtime:

- WER: **6.09%**
- CER: **2.64%**
- Average latency: **0.118 s**
- Real-Time Factor: **0.017**
- Peak measured GPU memory: **~151 MB**

This provides a stronger quality/performance trade-off for browser deployment.

## Fine-Tuning Findings

LoRA/PEFT fine-tuning was performed for Tiny, Small, and Medium Whisper models.

Fine-tuning did **not** improve every model:

- Tiny LoRA regressed relative to Tiny pretrained.
- Small LoRA regressed relative to Small pretrained.
- Medium LoRA produced a measurable improvement.

### Successful Medium LoRA Result

| Metric | Medium pretrained | Medium LoRA |
|---|---:|---:|
| WER | 4.68% | **4.23%** |
| CER | 2.50% | **1.37%** |

The Medium LoRA experiment is retained as the strongest fine-tuning result.

**Important:** the Medium LoRA checkpoint is experimental evidence from the broader project. This Hugging Face repository contains the selected Tiny browser deployment artifact.

## ONNX Optimization

The selected Tiny browser model was exported to ONNX and evaluated in both FP32 and Q8 configurations.

| Runtime | WER | Relative WER Change | Prediction Match |
|---|---:|---:|---:|
| PyTorch | 6.12% | Baseline | — |
| **FP32 ONNX** | **5.90%** | **-3.57%** | **98%** |
| Q8 ONNX | 6.45% | +5.36% | 94% |

The project release criterion allowed no more than **2% relative WER regression**.

Therefore:

-**FP32 ONNX is the production/default browser artifact**
- ⚠️ Q8 is retained only as an experimental optimization artifact

## Robustness Evaluation

The selected Tiny pretrained model was evaluated on **1,800 robustness examples** derived from 300 source recordings.

| Condition | WER |
|---|---:|
| Clean | 6.02% |
| Clipping | 5.80% |
| Low volume | 5.76% |
| Mild Gaussian noise | 6.83% |
| Medium Gaussian noise | 11.15% |
| Heavy Gaussian noise | 21.14% |

Overall robustness WER: **9.45%**

The largest degradation occurs under heavy additive Gaussian noise.

## Browser Architecture

```text

Microphone / Audio Upload


Browser Audio Preprocessing


Whisper Feature Extraction


FP32 ONNX Encoder


Autoregressive Decoder


Chunk Aggregation


Transcript + Timestamps

```

The application performs inference client-side without requiring a Python inference server.

## Browser Features

The deployed application includes:

- Microphone recording
- Audio file upload
- Bundled sample audio
- Audio preview
- Chunked transcription
- Transcription progress
- Final transcript
- Timestamps
- Confidence/result presentation
- Evaluation dashboard
- WebGPU-capable execution
- WASM fallback

## Experimental Environment

Training and evaluation were executed locally using:

- **GPU:** NVIDIA RTX 5090
- **VRAM:** 32 GB
- **CUDA:** 13.0
- **Python:** 3.12
- **PyTorch:** 2.13
- **Transformers:** 4.57.6
- **PEFT:** 0.20.0
- **Mixed Precision:** BF16

## Evaluation Pipeline

The evaluation workflow measures:

- Word Error Rate (WER)
- Character Error Rate (CER)
- Average latency
- P95 latency
- Real-Time Factor
- GPU memory
- Robustness slices
- Noise degradation
- ONNX parity
- Quantization regression
- Browser deployment suitability

## Intended Use

This model and project are suitable for:

- Speech recognition experimentation
- Browser-side ASR demonstrations
- Whisper encoder-decoder research
- ONNX inference experimentation
- WebGPU/WASM deployment experiments
- Machine learning portfolio demonstrations
- Educational use

## Limitations

- The deployment model is English-only.
- The main benchmark is based on LibriSpeech-style English speech.
- Accent coverage in the current benchmark is limited.
- Performance degrades under severe additive environmental noise.
- Browser latency depends on hardware and browser runtime.
- Q8 quantization exceeded the project's quality-regression threshold.
- Speech recognition output may contain transcription errors.

## Responsible Use

This project is intended for experimentation, education, research, portfolio demonstration, and general transcription.

Speech recognition output should **not** be treated as infallible.

Human review should be used before relying on transcripts in:

- Medical applications
- Legal applications
- Emergency situations
- Safety-critical systems
- Security-sensitive workflows
- Other high-stakes environments

## Reproducibility

The complete source code includes:

- Dataset preparation
- Dataset auditing
- LoRA hyperparameter sweeps
- Tiny/Small/Medium Whisper training
- Pretrained vs fine-tuned evaluation
- Robustness benchmarking
- Failure analysis
- ONNX export
- Q8 quantization
- ONNX parity validation
- Browser model selection
- Static web deployment
- Automated Python tests
- JavaScript/browser testing

The full implementation is available here:

https://github.com/unit-mole/encoder-decoder-projects/tree/main/03-streaming-speech-recognition-whisper-encoder-decoder

## License

MIT