File size: 11,822 Bytes
29c076f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
---
language:
  - vi
license: cc-by-nc-sa-4.0
multilinguality: monolingual
size_categories:
  - n<1K
source_datasets:
  - linhtran92/viet_bud500
task_categories:
  - automatic-speech-recognition
tags:
  - vietnamese
  - benchmark
  - quantization
  - asr
  - wer
  - cer
  - calibration
  - evaluation
  - audio
  - speech
pretty_name: ViASR-Bench
dataset_info:
  features:
    - name: id
      dtype: string
    - name: transcript
      dtype: string
    - name: duration_s
      dtype: float32
    - name: sampling_rate
      dtype: int32
    - name: source_split
      dtype: string
    - name: audio
      dtype:
        audio:
          sampling_rate: 16000
  splits:
    - name: calibration
      num_examples: 256
    - name: evaluation
      num_examples: 600
  download_size: 73400320
  dataset_size: 73400320
---

# ViASR-Bench 🇻🇳🎙️

**Vietnamese benchmark dataset for ASR model quantization — providing both a calibration set and an evaluation set.**

ViASR-Bench is a curated sample from [BUD500](https://huggingface.co/datasets/linhtran92/viet_bud500),
the largest public Vietnamese podcast speech dataset.
It is designed specifically for the **two-phase lifecycle of ASR quantization**:

| Phase | Split | Purpose |
|-------|-------|---------|
| **Calibration** | `calibration` (256 utterances) | Feed to AWQ / GPTQ / SmoothQuant to compute activation statistics and compensation factors |
| **Evaluation**  | `evaluation` (600 utterances)  | Measure WER / CER degradation after quantization |

> **Important:** This dataset is a **subsample of BUD500**, not a standalone corpus.
> Audio content is sourced from BUD500 (CC-BY-NC-SA 4.0) and is intended for
> **non-commercial research use only**.

---

## Dataset Summary

| Split | Utterances | Duration | Size (~) | Source in BUD500 |
|-------|-----------|----------|----------|------------------|
| `calibration` | 256 | ~10.9 min | ~21 MB | `train` split |
| `evaluation`  | 600 | ~25.6 min | ~49 MB | `test` split  |
| **Total**     | **856** | **~36.5 min** | **~70 MB** | |

**Audio format:** 16 kHz · Mono · PCM-16 (WAV)

**Utterance duration statistics:**

| Split | Mean (s) | Median (s) | P10 (s) | P90 (s) | Max (s) |
|-------|---------|-----------|---------|---------|---------|
| calibration | 2.56 | 2.12 | 1.10 | 4.48 | 19.2 |
| evaluation  | 2.56 | 2.11 | 1.09 | 4.52 | 19.8 |

---

## Motivation

### Why a Vietnamese-specific ASR quantization benchmark?

Existing quantization tools (AWQ, GPTQ, SmoothQuant) require a **calibration dataset**
whose acoustic distribution matches the target language. Using English speech data
to calibrate a Vietnamese ASR model leads to suboptimal quantization because:

1. **6-tone tonal system.** Vietnamese has six tones (ngang, huyền, sắc, hỏi, ngã, nặng)
   that create unique patterns in mel-spectrograms and encoder feature spaces,
   distinct from non-tonal languages.

2. **Regional dialect variation.** Three major dialects (Northern, Central, Southern)
   differ significantly in formant distributions and prosody, affecting attention
   and convolution layers in ASR encoders.

3. **Monosyllabic structure.** Vietnamese is predominantly monosyllabic, producing
   different sequence-length and attention-pattern distributions than English.

Calibrating on English audio leaves these activation patterns unrepresented,
degrading quantization quality specifically for Vietnamese phonemes.

### Why CER over WER for Vietnamese?

Vietnamese words average **1.7–2.2 characters**, making tone confusion errors
(e.g., *khoẻ**khoề*: a single diacritic change) inflate WER disproportionately:

```
Reference:  "bạn có khoẻ không"   (4 words, 15 chars)
Hypothesis: "bạn có khoề không"

WER = 1/4 = 25.0%   ← one wrong word
CER = 1/15 = 6.7%   ← one wrong character
```

CER is a more sensitive and fair metric for detecting tone-level degradation
caused by quantization on Vietnamese. **Both WER and CER are reported.**

---

## Source Data: BUD500

BUD500 is the largest public Vietnamese speech dataset (~500 hours of podcast audio
with manually verified transcripts, covering diverse topics and all three major dialects).

| Property | Value |
|----------|-------|
| Total duration | ~500 hours |
| Utterances | ~150,000 |
| Sampling rate | 16,000 Hz |
| Content type | Podcast (multi-topic) |
| Dialect coverage | Northern, Central, Southern |
| HuggingFace ID | `linhtran92/viet_bud500` |
| License | CC-BY-NC-SA 4.0 |

**Why BUD500 over alternatives?**

| Dataset | Hours | Quality | Diversity | Public |
|---------|-------|---------|-----------|--------|
| **BUD500** | ~500h | High | High | ✅ |
| VIVOS | 15h | High | Low (read speech) | ✅ |
| FLEURS vi | ~10h | Medium | Medium | ✅ |
| CommonVoice vi | ~30h | Medium | Medium | ✅ |
| VLSP | 100h+ | High | High | ❌ |

BUD500's size ensures that random sampling still yields diverse coverage.
Its podcast format is closer to real-world deployment conditions than
studio read-speech datasets like VIVOS.

---

## Sampling Methodology

### Non-overlapping splits

Calibration and evaluation sets are **guaranteed non-overlapping by transcript**:

```
eval_transcripts = {s["transcript"] for s in eval_samples}

# Calibration: skip any utterance whose transcript appears in eval
if transcript in eval_transcripts:
    continue
```

This prevents data leakage between calibration and evaluation.

### Quality filter

Each utterance passes a 2-condition filter:

```
keep(u) = True  iff:
  1.0s ≤ duration(u) ≤ 20.0s     # remove noise clips and unusually long segments
  AND  len(transcript(u)) > 0     # non-empty transcript
```

### Sampling procedure

```
1. Stream BUD500 (streaming=True) — no full download required
2. Collect buffer = 5× target size from filtered utterances
3. random.sample(buffer, n_target, seed=42)  — fixed seed for reproducibility
```

**Calibration** is drawn from BUD500 `train` split (seed=43).
**Evaluation** is drawn from BUD500 `test` split (seed=42).

### Transcript normalization

All transcripts are stored in **Unicode NFC** normalized form.
Before computing WER/CER, apply the same normalization to model hypotheses:

```python
import unicodedata, re

def normalise_vi(text: str) -> str:
    text = unicodedata.normalize("NFC", text)   # critical for Vietnamese diacritics
    text = text.lower()
    text = re.sub(r"[^\w\s]", " ", text, flags=re.UNICODE)
    text = re.sub(r"\s+", " ", text).strip()
    return text
```

NFC normalization is critical because Vietnamese characters can be encoded two ways:
- Decomposed: `e` + combining hook above + combining dot below
- Precomposed: single codepoint `ệ`

Without normalization, visually identical strings may have non-zero edit distance.

---

## Usage

### Installation

```bash
pip install datasets soundfile jiwer transformers torch tqdm numpy
```

### Load the dataset

```python
from datasets import load_dataset

# Evaluation split
eval_ds = load_dataset("your-org/vi-asr-bench", split="evaluation")

# Calibration split
calib_ds = load_dataset("your-org/vi-asr-bench", split="calibration")

# Each sample:
# {
#   "id":            "sample_0042",
#   "audio":         {"array": np.ndarray, "sampling_rate": 16000},
#   "transcript":    "xin chào thế giới",
#   "duration_s":    3.21,
#   "source_split":  "test"
# }
```

### AWQ / GPTQ Calibration

```python
import torch
from datasets import load_dataset

calib_ds = load_dataset("your-org/vi-asr-bench", split="calibration")

# Extract audio arrays for the encoder
audio_inputs = [
    torch.tensor(sample["audio"]["array"]).unsqueeze(0)   # (1, T)
    for sample in calib_ds
]

# Feed into your quantization calibration loop:
# for audio in audio_inputs:
#     model.encoder(audio)   # collect activation statistics
```

### WER / CER Evaluation

```python
import unicodedata, re
from datasets import load_dataset
from jiwer import wer, cer
from transformers import pipeline

def normalise_vi(text):
    text = unicodedata.normalize("NFC", text)
    text = text.lower()
    text = re.sub(r"[^\w\s]", " ", text, flags=re.UNICODE)
    return re.sub(r"\s+", " ", text).strip()

eval_ds  = load_dataset("your-org/vi-asr-bench", split="evaluation")
asr_pipe = pipeline("automatic-speech-recognition",
                    model="your-quantized-model",
                    generate_kwargs={"language": "vi", "task": "transcribe"})

references  = [normalise_vi(s["transcript"]) for s in eval_ds]
hypotheses  = [normalise_vi(r["text"]) for r in asr_pipe(
                   [s["audio"] for s in eval_ds], batch_size=8)]

print(f"WER: {wer(references, hypotheses)*100:.2f}%")
print(f"CER: {cer(references, hypotheses)*100:.2f}%")
```

### Compare quantized vs. baseline

```bash
python vi_asr_eval.py \
    --model   openai/whisper-large-v3 \
    --compare your-org/whisper-large-v3-int4 \
    --output  results.json
```

Expected output format:

```
================================================================
Metric        openai/whisper-large-v3   your-org/...-int4    Delta
----------------------------------------------------------------
WER                          8.24%              8.91%       +0.67%
CER                          3.11%              3.38%       +0.27%
```

---

## Reproducibility

Full metadata is stored in `metadata.json` for each split:

```json
{
  "split": "evaluation",
  "n_samples": 600,
  "seed": 42,
  "source": "linhtran92/viet_bud500",
  "source_split": "test",
  "sampling_rate": 16000,
  "total_duration_s": 1536.0,
  "total_duration_min": 25.6,
  "total_size_mb": 49.1,
  "filter": {"min_dur_s": 1.0, "max_dur_s": 20.0},
  "normalization": "unicode_nfc"
}
```

---

## Relation to ViWiki-Bench

ViASR-Bench is the **speech counterpart** of ViWiki-Bench (Vietnamese LLM benchmark).
Together they form a complete Vietnamese quantization benchmark suite:

| | ViWiki-Bench (LLM) | ViASR-Bench (ASR) |
|---|---|---|
| Input modality | Text (token IDs) | Audio (float32 arrays) |
| Calibration | 128 sequences from Wikipedia vi | 256 utterances from BUD500 train |
| Evaluation | ~280k tokens from Wikipedia vi | 600 utterances from BUD500 test |
| Metric | Perplexity (PPL) | WER / CER |
| Source dataset | `wikimedia/wikipedia` 20231101.vi | `linhtran92/viet_bud500` |

---

## Limitations

- **Single source:** Only BUD500 (podcast). Read speech (VIVOS), spontaneous conversation,
  and children's speech are not represented.
- **No dialect labels:** BUD500 does not tag individual utterances with Northern/Central/Southern
  dialect, so stratified sampling by dialect is not possible.
- **Small evaluation set:** 600 utterances (~26 min) is sufficient for relative comparison
  between quantization methods, but not for high-precision absolute WER estimation
  (vs. LibriSpeech test-clean at 5.4 hours).
- **Non-commercial license:** Inherited from BUD500 (CC-BY-NC-SA 4.0).
  Not suitable for commercial product deployment.

---

## Citation

If you use ViASR-Bench in your research, please cite both this dataset and BUD500:

```bibtex
@techreport{viasr_bench2024,
  title     = {ViASR-Bench: A Vietnamese Benchmark Dataset for
               ASR Model Quantization Calibration and Evaluation},
  author    = {AnhND},
  year      = {2026},
  note      = {Technical Report v1.0. Sampled from linhtran92/viet\_bud500},
  url       = {https://huggingface.co/datasets/your-org/vi-asr-bench}
}

@dataset{bud500,
  title     = {BUD500: A Large-Scale Vietnamese Podcast Speech Dataset},
  author    = {Linh Tran},
  publisher = {HuggingFace},
  url       = {https://huggingface.co/datasets/linhtran92/viet_bud500}
}
```

---

## License

This dataset inherits the license of its source:
**CC-BY-NC-SA 4.0** (Non-Commercial).

The sampling and evaluation code is released under **MIT License**.