anhndbk's picture
Create README.md
29c076f verified
---
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**.