A comprehensive benchmarking framework for evaluating discrete audio tokenizer performance across different models and datasets.
This repository provides tools and scripts for systematically evaluating audio tokenizers on multilingual speech data. The project runs on Clariden (CSCS Alps) and supports multiple datasets (EuroSpeech, FLEURS, GTZAN, NatureLM) with automatic dataset detection and unified evaluation pipeline.
The benchmarking framework focuses on two main objectives:
Statistical Evaluation: Compute comprehensive metrics (MSE, SNR, SDR, PESQ, STOI, ESTOI) on 100 samples per language to assess tokenizer performance statistically.
Sample Generation: Generate 5 audio samples per tokenizer-dataset-language combination for listening evaluation and qualitative assessment.
infra01 group with proper .edf configuration (recommended)uv package manager (recommended, for creating virtual environments)git clone <your-repo-url>
cd benchmark-audio-tokenizer
Important: Virtual environments should be created within the NGC 24.11 environment on Clariden.
The project uses uv for fast virtual environment management. We use a two-stage dependency compilation approach:
requirements-*-topdeps.txt): High-level packages specified by the userrequirements-*-subdeps.txt): All transitive dependencies compiled by uv pip compileThis approach allows us to use system-installed PyTorch from NGC (avoiding CUDA compatibility issues) and install dependencies in a controlled, reproducible manner
# Make sure you're in NGC 24.11 environment
# Then create all venvs:
make venvs
This creates virtual environments for all tokenizers:
.venv-neucodec/.venv-cosyvoice2/.venv-xcodec2/.venv-wavtokenizer/# Create a specific tokenizer environment
make neucodec # CPU-only PyTorch
make cosyvoice2 # Uses system-site-packages for PyTorch
make xcodec2 # CPU-only PyTorch
make wavtokenizer # Uses system-site-packages for PyTorch
Each Makefile target:
uvBefore running evaluations, we recommend testing your setup with the example notebooks in the examples/ directory:
# Activate a tokenizer environment
source .venv-neucodec/bin/activate
# Start Jupyter
jupyter notebook examples/neucodec.ipynb
Available notebooks:
neucodec.ipynbcosyvoice2.ipynbxcodec2.ipynbwavtokenizer.ipynbThese notebooks demonstrate basic tokenizer usage and help verify that your environment is correctly configured.
.
├── examples/ # Example notebooks for testing tokenizers
├── logs/ # Execution logs (.out and .err files per job)
├── metrics/ # Evaluation results and metrics (JSON output)
├── samples/ # Generated audio samples for listening evaluation
├── scripts/ # All Python scripts and shell scripts
│ ├── tokenizer_evaluation.py # Main evaluation script
│ ├── generate_samples.py # Sample generation script
│ ├── submit_missing_jobs.py # Automatic job submission
│ ├── analyze_tokenizers.py # Analysis and visualization
│ └── ...
├── src/
│ ├── audio_tokenizers/ # Tokenizer implementations and wrappers
│ └── repos/ # External repository dependencies
├── .venv-*/ # Virtual environments for each tokenizer
├── requirements-*-topdeps.txt # Top-level dependencies
├── requirements-*-subdeps.txt # Compiled sub-dependencies
└── Makefile # Environment setup automation
EuroSpeech:
FLEURS:
GTZAN:
NatureLM:
Total Coverage: 78+ languages/datasets across 4 dataset types
The recommended approach is to use submit_missing_jobs.py to automatically detect and submit missing tokenizer-language combinations.
Always start with a dry run to see what would be submitted:
python scripts/submit_missing_jobs.py --dry-run
This shows:
Before submitting all missing jobs, test with a single submission:
python scripts/submit_missing_jobs.py --submit-one
This submits only one job per task (metrics and samples) to verify everything works correctly.
Once verified, submit all missing combinations:
# Submit both metrics and samples (default)
python scripts/submit_missing_jobs.py
# Or submit only one task
python scripts/submit_missing_jobs.py --task metrics
python scripts/submit_missing_jobs.py --task samples
Validation (--validate-metrics):
python scripts/submit_missing_jobs.py --validate-metrics
Grouping (--group-by):
dataset (default): Groups missing languages by dataset, creating one job per tokenizer-dataset combination
language: Creates one job per tokenizer-language combination
# Group by dataset (default, recommended)
python scripts/submit_missing_jobs.py --group-by dataset
# Group by language
python scripts/submit_missing_jobs.py --group-by language
Prerequisites for Job Submission:
infra01 group.edf file must be properly configured for SLURMYou can also run evaluations manually:
source .venv-neucodec/bin/activate
# Single language
python scripts/tokenizer_evaluation.py --tokenizer neucodec --language germany
# Multiple languages
python scripts/tokenizer_evaluation.py --tokenizer neucodec --languages germany en_us ja_jp
# Entire dataset
python scripts/tokenizer_evaluation.py --tokenizer neucodec --dataset eurospeech
Results are automatically organized:
metrics/
├── neucodec_eurospeech_germany_results.json # Per-language results
├── neucodec_fleurs_en_us_results.json # Per-language results
└── ...
samples/
├── neucodec/
│ ├── eurospeech/
│ │ └── germany/
│ │ ├── metadata.json
│ │ └── sample_*.wav
│ └── fleurs/
│ └── en_us/
│ ├── metadata.json
│ └── sample_*.wav
└── ...
Each metrics file includes:
After collecting results, use analyze_tokenizers.py to generate comprehensive analysis and visualizations.
Create a simple virtual environment with standard packages for analysis:
uv venv .venv-analysis
source .venv-analysis/bin/activate
uv pip install pandas matplotlib seaborn numpy
source .venv-analysis/bin/activate
python scripts/analyze_tokenizers.py
The script automatically:
metrics/All outputs are saved to the results/ directory:
Visualizations:
language_coverage.png - Heatmap showing which languages each tokenizer has (with metrics completeness)overall_comparison.png - Performance comparison across all languages (may not be fair if tokenizers tested different languages)common_languages_comparison.png - Fair comparison using only languages all tokenizers havemetric_comparison_bars.png - Bar charts comparing mean performance by metricdataset_comparison.png - Performance breakdown by datasetcompression_efficiency.png - Compression ratio and tokens per second analysiscorrelation_heatmap.png - Correlation matrix between metricstop_bottom_languages_*.png - Top and bottom performing languages for key metricsscatter_*_vs_*.png - Scatter plots comparing metric relationshipsStatistics:
analysis_summary.txt - Comprehensive text summary including:
Key Features:
The framework computes comprehensive reconstruction quality metrics:
All metrics include: mean, standard deviation, min, max, and median values computed across 100 samples per language.
uv package managerinfra01 group and .edf is configuredsqueuesubmit_missing_jobs.py or use SLURM with more memoryThis project is part of the Data Science Lab course at ETH Zurich, autumn semester 2025.
If you use this benchmarking framework, please cite the relevant datasets.
Jupyter Notebook
90.7%
Python
9.0%
A comprehensive benchmarking framework for evaluating discrete audio tokenizer performance across different models and datasets.
This repository provides tools and scripts for systematically evaluating audio tokenizers on multilingual speech data. The project runs on Clariden (CSCS Alps) and supports multiple datasets (EuroSpeech, FLEURS, GTZAN, NatureLM) with automatic dataset detection and unified evaluation pipeline.
The benchmarking framework focuses on two main objectives:
Statistical Evaluation: Compute comprehensive metrics (MSE, SNR, SDR, PESQ, STOI, ESTOI) on 100 samples per language to assess tokenizer performance statistically.
Sample Generation: Generate 5 audio samples per tokenizer-dataset-language combination for listening evaluation and qualitative assessment.
infra01 group with proper .edf configuration (recommended)uv package manager (recommended, for creating virtual environments)git clone <your-repo-url>
cd benchmark-audio-tokenizer
Important: Virtual environments should be created within the NGC 24.11 environment on Clariden.
The project uses uv for fast virtual environment management. We use a two-stage dependency compilation approach:
requirements-*-topdeps.txt): High-level packages specified by the userrequirements-*-subdeps.txt): All transitive dependencies compiled by uv pip compileThis approach allows us to use system-installed PyTorch from NGC (avoiding CUDA compatibility issues) and install dependencies in a controlled, reproducible manner
# Make sure you're in NGC 24.11 environment
# Then create all venvs:
make venvs
This creates virtual environments for all tokenizers:
.venv-neucodec/.venv-cosyvoice2/.venv-xcodec2/.venv-wavtokenizer/# Create a specific tokenizer environment
make neucodec # CPU-only PyTorch
make cosyvoice2 # Uses system-site-packages for PyTorch
make xcodec2 # CPU-only PyTorch
make wavtokenizer # Uses system-site-packages for PyTorch
Each Makefile target:
uvBefore running evaluations, we recommend testing your setup with the example notebooks in the examples/ directory:
# Activate a tokenizer environment
source .venv-neucodec/bin/activate
# Start Jupyter
jupyter notebook examples/neucodec.ipynb
Available notebooks:
neucodec.ipynbcosyvoice2.ipynbxcodec2.ipynbwavtokenizer.ipynbThese notebooks demonstrate basic tokenizer usage and help verify that your environment is correctly configured.
.
├── examples/ # Example notebooks for testing tokenizers
├── logs/ # Execution logs (.out and .err files per job)
├── metrics/ # Evaluation results and metrics (JSON output)
├── samples/ # Generated audio samples for listening evaluation
├── scripts/ # All Python scripts and shell scripts
│ ├── tokenizer_evaluation.py # Main evaluation script
│ ├── generate_samples.py # Sample generation script
│ ├── submit_missing_jobs.py # Automatic job submission
│ ├── analyze_tokenizers.py # Analysis and visualization
│ └── ...
├── src/
│ ├── audio_tokenizers/ # Tokenizer implementations and wrappers
│ └── repos/ # External repository dependencies
├── .venv-*/ # Virtual environments for each tokenizer
├── requirements-*-topdeps.txt # Top-level dependencies
├── requirements-*-subdeps.txt # Compiled sub-dependencies
└── Makefile # Environment setup automation
EuroSpeech:
FLEURS:
GTZAN:
NatureLM:
Total Coverage: 78+ languages/datasets across 4 dataset types
The recommended approach is to use submit_missing_jobs.py to automatically detect and submit missing tokenizer-language combinations.
Always start with a dry run to see what would be submitted:
python scripts/submit_missing_jobs.py --dry-run
This shows:
Before submitting all missing jobs, test with a single submission:
python scripts/submit_missing_jobs.py --submit-one
This submits only one job per task (metrics and samples) to verify everything works correctly.
Once verified, submit all missing combinations:
# Submit both metrics and samples (default)
python scripts/submit_missing_jobs.py
# Or submit only one task
python scripts/submit_missing_jobs.py --task metrics
python scripts/submit_missing_jobs.py --task samples
Validation (--validate-metrics):
python scripts/submit_missing_jobs.py --validate-metrics
Grouping (--group-by):
dataset (default): Groups missing languages by dataset, creating one job per tokenizer-dataset combination
language: Creates one job per tokenizer-language combination
# Group by dataset (default, recommended)
python scripts/submit_missing_jobs.py --group-by dataset
# Group by language
python scripts/submit_missing_jobs.py --group-by language
Prerequisites for Job Submission:
infra01 group.edf file must be properly configured for SLURMYou can also run evaluations manually:
source .venv-neucodec/bin/activate
# Single language
python scripts/tokenizer_evaluation.py --tokenizer neucodec --language germany
# Multiple languages
python scripts/tokenizer_evaluation.py --tokenizer neucodec --languages germany en_us ja_jp
# Entire dataset
python scripts/tokenizer_evaluation.py --tokenizer neucodec --dataset eurospeech
Results are automatically organized:
metrics/
├── neucodec_eurospeech_germany_results.json # Per-language results
├── neucodec_fleurs_en_us_results.json # Per-language results
└── ...
samples/
├── neucodec/
│ ├── eurospeech/
│ │ └── germany/
│ │ ├── metadata.json
│ │ └── sample_*.wav
│ └── fleurs/
│ └── en_us/
│ ├── metadata.json
│ └── sample_*.wav
└── ...
Each metrics file includes:
After collecting results, use analyze_tokenizers.py to generate comprehensive analysis and visualizations.
Create a simple virtual environment with standard packages for analysis:
uv venv .venv-analysis
source .venv-analysis/bin/activate
uv pip install pandas matplotlib seaborn numpy
source .venv-analysis/bin/activate
python scripts/analyze_tokenizers.py
The script automatically:
metrics/All outputs are saved to the results/ directory:
Visualizations:
language_coverage.png - Heatmap showing which languages each tokenizer has (with metrics completeness)overall_comparison.png - Performance comparison across all languages (may not be fair if tokenizers tested different languages)common_languages_comparison.png - Fair comparison using only languages all tokenizers havemetric_comparison_bars.png - Bar charts comparing mean performance by metricdataset_comparison.png - Performance breakdown by datasetcompression_efficiency.png - Compression ratio and tokens per second analysiscorrelation_heatmap.png - Correlation matrix between metricstop_bottom_languages_*.png - Top and bottom performing languages for key metricsscatter_*_vs_*.png - Scatter plots comparing metric relationshipsStatistics:
analysis_summary.txt - Comprehensive text summary including:
Key Features:
The framework computes comprehensive reconstruction quality metrics:
All metrics include: mean, standard deviation, min, max, and median values computed across 100 samples per language.
uv package managerinfra01 group and .edf is configuredsqueuesubmit_missing_jobs.py or use SLURM with more memoryThis project is part of the Data Science Lab course at ETH Zurich, autumn semester 2025.
If you use this benchmarking framework, please cite the relevant datasets.
Jupyter Notebook
90.7%
Python
9.0%