Skip to content

About

Speak a question, hear the answer: Whisper ASR → SQLCoder-7B text-to-SQL → SQLite → TTS, evaluated on noisy SpokenSpider (clean to 0 dB SNR).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Voice-to-SQL Pipeline

Whisper SQLCoder TTS Python

A spoken natural-language question is converted end-to-end into a SQL query, executed against a real database, and answered back as speech.

🎤 Voice → ASR (Whisper) → Intent Check → Text-to-SQL (SQLCoder-7B)
        → SQL Validation + SQLite Execution → Response Generation → TTS → 🔊

Dataset: SpokenSpider — 100 Spider-benchmark questions × 4 conditions (clean, 20dB, 10dB, 0dB SNR), synthesized with gTTS.

WER and execution accuracy vs. noise level

What's included

This submission ships code, notebooks, and results — not the raw audio dataset or Spider databases (840MB+), which are regenerable. data/metadata.csv contains the full evaluation results (400 rows: transcripts, generated SQL, execution results, latencies) backing every figure and table in notebooks/analysis.ipynb. The notebooks already contain their executed outputs, so all results, figures, and tables can be viewed without re-running anything.

Re-running the pipeline from scratch

  1. Install dependencies

    pip install -r requirements.txt
    
  2. Download Spider benchmark (questions, SQL, and SQLite databases)

    python data/download_spider.py
    

    If automatic database download fails (Google Drive often rate-limits), download the Spider zip manually from the Spider website or Kaggle, then run:

    python data/download_spider.py --from-zip path/to/spider.zip
    
  3. Generate the SpokenSpider audio dataset (100 questions × 4 SNR conditions)

    python src/dataset_gen.py --max-samples 100
    

    This populates data/spoken_spider/{clean,noisy_0db,noisy_10db,noisy_20db}/ and writes the base rows of data/metadata.csv.

  4. Run the full pipeline batch evaluation

    python src/pipeline.py --batch --snr-filter clean 0db 10db 20db --no-speak
    

    This fills in the pipeline result columns (p_transcript, p_generated_sql, p_exec_*, latencies, etc.) in data/metadata.csv.

  5. Open the notebooks

    jupyter notebook notebooks/analysis.ipynb   # full evaluation results & figures
    jupyter notebook notebooks/demo.ipynb       # live single-query walkthrough + TTS comparison
    

    In Jupyter: Kernel → Restart & Run All.

Project structure

src/            Pipeline modules (ASR, Text-to-SQL, DB execution, response gen, TTS)
evaluation/     Metrics (WER/EXA/VQA/SLA) and research-question experiments
demo/           Live microphone demo script
notebooks/      analysis.ipynb (full results) and demo.ipynb (live walkthrough)
data/           metadata.csv (evaluation results) + download/generation scripts
outputs/        Saved figures, LaTeX results table, demo audio samples

Key findings

  • ASR (Whisper) is robust up to 20 dB SNR (WER ≈ 0.017) but degrades sharply at 0 dB (WER ≈ 0.169).
  • SQLCoder partially absorbs ASR noise — SQL execution accuracy drops only ~7pp from clean to 0dB despite a 10× WER increase.
  • simple_select queries are most noise-sensitive; aggregation queries are the most robust.
  • SQLCoder dominates end-to-end latency (~96% of total, ~16s/query) — the bottleneck for real-time deployment.
  • VITS (neural TTS) beats gTTS on both synthesis latency and naturalness, and runs fully offline.
  • Noise mainly hurts through a rising "no-answer" rate (8% → 13% at 0dB) rather than wrong answers — the safer failure mode for a call-center deployment.

About

Speak a question, hear the answer: Whisper ASR → SQLCoder-7B text-to-SQL → SQLite → TTS, evaluated on noisy SpokenSpider (clean to 0 dB SNR).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages