John Huang← Back to projects

Case study

Speech-Based Idiom Classifier

End-to-end speech NLP pipeline classifying phrases as literal or idiomatic from raw audio.

  • Python
  • BERT
  • Whisper
  • librosa
  • Gradio
  • 80.0%end-to-end accuracy on 459 audio recordings
  • 0.92weighted F1 for the fine-tuned BERT classifier
  • +14 ptsover a TF-IDF + logistic-regression baseline
  • 39,924MAGPIE training examples

Overview

This project takes raw speech audio through transcription and language modeling to produce a literal-or-idiomatic classification in one system.

The full pipeline achieved 80.0% end-to-end accuracy on 459 custom audio recordings.

Written idiom classification assumes clean text, but a speech-based system must absorb transcription errors, acoustic variation, and ambiguity before it can reason about phrase meaning.

My contribution

I built the complete audio-to-label pipeline, fine-tuned the language model, established a classical baseline, recorded the evaluation set, and performed per-class error analysis on the combined system.

Implementation

OpenAI Whisper transcribes the audio before a fine-tuned BERT classifier predicts whether the target phrase is literal or idiomatic. Audio processing uses librosa, and Gradio provides an interactive interface.

I fine-tuned BERT on 39,924 examples from the MAGPIE dataset, reaching a weighted F1 of 0.92 and outperforming a TF-IDF plus logistic-regression baseline by 14 percentage points.

Challenges

The largest gap appeared between clean-text classifier performance and end-to-end audio performance. Error analysis identified Whisper transcription noise as the dominant failure mode rather than the downstream classifier.

What I learned

The project demonstrated why component metrics are not enough for multi-stage ML systems. End-to-end evaluation and error attribution are necessary to identify which stage actually limits user-facing performance.