How zelinzhu-richard/scai-duke-2026 works
What this project is (type + purpose)
This repo is an offline, batch-style benchmarking pipeline (not a deployed service) that measures ASR equity for customer-support-like calls across accent / native vs ESL groups. It ingests speech samples (Mozilla Common Voice or similar), requires a manual ground-truth labeling step, runs Whisper transcription, performs intent classification (before/after normalization), then computes equity metrics (CER, disparity index) and generates plots + a demo notebook.
What the file tree says about architecture
Top-level structure strongly indicates a script-driven pipeline:
• scripts/organize_mozilla_cv.py → data ingestion / sampling / balancing into data/audio/, creates a ground truth template.
• data/ground_truth.csv (and ground_truth_template.csv created by scripts) → human-labeled source of truth.
• scripts/run_whisper.py → ASR batch job producing results/transcripts.csv.
• scripts/classify_intent.py → intent labeling and evaluation producing results/intents.csv (includes “before/after normalization” concept from README).
• scripts/calculate_metrics.py → computes CER + disparity + failure examples into results/metrics.json.
• demo/demo_notebook_template.py → presentation layer consuming outputs for interactive review.
• scripts/_python_version_check.py → explicit runtime constraint enforcement (Python 3.12.12).
• requirements.txt → core runtime deps (PyTorch, Transformers, pandas, etc.).
• data/ground_truth.csv in repo indicates a “checked-in example” dataset.
Architecturally: this is a linear pipeline with checkpoints (files), plus one manual intervention step (ground truth authoring).
Goal: show what’s *outside* vs *inside* the repo.
External entities to include
• Mozilla Common Voice dataset (local download): audio files + metadata TSV/CSV.
• Human annotator: creates/edits data/ground_truth.csv.
• OpenAI Whisper model weights (downloaded/cached) + ffmpeg (audio decoding).
• Optional: Hugging Face models (if zero-shot intent classification is used).
Inside-system
• “Benchmark Pipeline (Python scripts)” producing results + visuals.
• Common Voice → organize_mozilla_cv.py → data/audio/*
• Human annotator ↔ data/ground_truth.csv
• data/audio/* → Whisper → results/transcripts.csv
• transcripts + ground_truth → intent classifier → results/intents.csv
• intents → metrics → results/metrics.json
• intents/metrics → visualization → visualizations/*.png
• all outputs → demo notebook
Level 1: Container / Dataflow DAG (most important for this project)
Recommended nodes (map 1:1 to repo)
Data Ingestion & Sampling
• scripts/organize_mozilla_cv.py
• Inputs: cv_dir, metadata CSV/TSV (optional)
• Outputs:
• data/audio/ (directory of selected wav files)
• data/ground_truth_template.csv (implied by README)
Ground Truth Authoring (Manual Step)
• Human edits data/ground_truth.csv
ASR Transcription
• scripts/run_whisper.py
• Dependencies: whisper, torch, ffmpeg
• Output: results/transcripts.csv
Intent Classification + Before/After Normalization
• scripts/classify_intent.py
• Inputs: results/transcripts.csv, data/ground_truth.csv
• Output: results/intents.csv
• Make “Before normalization” and “After normalization” explicit as two sub-steps or two labeled outputs/columns (since the README emphasizes this comparison).
Metrics Computation
• scripts/calculate_metrics.py
• Output: results/metrics.json
• Includes: CER by accent, disparity index vs baseline, failure examples
Visualization
• Output: visualizations/*.png
Demo / Reporting
• demo/demo_notebook_template.py consumes results/visualizations
• data/audio/ (filesystem)
• data/ground_truth.csv
• results/transcripts.csv
• results/intents.csv
• results/metrics.json
• visualizations/ (PNGs)
Important flows to label
• “Audio (wav)” vs “Metadata (accent labels, transcripts)” vs “Predictions” vs “Metrics”
• Accent grouping logic (from README: default accent tokens in organize_mozilla_cv.py)
• Baseline selection (--baseline US in metrics/visualization scripts)
This DAG is the “truth” of how the repo works.
This repo’s core value is the benchmark logic, so zoom into two internals:
ASR stage internals (run_whisper.py)
Show:
• Audio loader/decoder → ffmpeg
• Whisper inference (model selection: tiny/base) → transcript text + metadata (language, timing)
• CSV writer
Metrics stage internals (calculate_metrics.py + classifier)
Show:
• Join step: transcripts ↔ ground_truth by filename
• CER computation (string distance) per sample → aggregate by accent_group
• Intent accuracy computation per accent_group
• Disparity index computation relative to baseline group
• Failure example selection (top-N worst / illustrative)
All modules communicate via files (CSV/JSON/PNG), not in-memory APIs
• That’s the architectural style: “pipeline with persisted checkpoints”.
Accent grouping is determined during ingestion and/or ground-truth
• The benchmark depends on consistent accent_group naming between organize_mozilla_cv.py and ground_truth.csv.
Runtime constraints are part of architecture
• Python 3.12.12 requirement (scripts/_python_version_check.py) and ffmpeg dependency should appear as environment prerequisites.
• Python 3.12.12 runtime (global)
• PyTorch (Whisper inference)
• OpenAI Whisper model (ASR node)
• ffmpeg (audio decoding dependency for Whisper)
• Transformers (HF) (if using zero-shot/BART; classifier node)
• pandas/numpy (data join + aggregation; metrics node)
• matplotlib/seaborn (visualization node)
• Input dataset: Mozilla Common Voice (external)
• Rectangles (blue): compute steps (scripts)
• Cloud (purple): external systems (Common Voice source, model hubs)
“As many components as possible” (but still coherent)
• Split “Intent Classification” into:
• Transcript normalization (before/after)
• Keyword classifier OR Zero-shot classifier (two subcomponents)
• Accuracy computation (overall + by accent)
• Split “Visualization” into:
• CER chart
• Intent error chart
• Disparity heatmap
• Dashboard composite
Slide 3: Metrics + disparity computation detail (joins, group-by, baseline)
4. Slide 4: Extension points (optional prepare_data.py, additional ASR models, new accent groups, noise simulation)
That set will be both accurate to the repo and maximally useful for future extension.