Speech & NLP
Vocaly AI: a pronunciation coach that hears every sound
Vocaly AI listens to you read a sentence and marks each sound that came out wrong, a "th" heard as "f" or a "v" heard as "w", then shows you how to fix it.
I built all of it: the scoring pipeline, the FastAPI backend and the React app, which runs in Docker on Hugging Face Spaces. On 500 recordings it never saw, its sound check agrees with trained human raters at 0.94 AUC.

- AUC for "was this sound wrong?" on 500 held-out recordings
- 0.94
- agreement with expert sentence scores, before and after
- 0.51 → 0.70
- agreement on fluency, after fixing one rule
- −0.08 → 0.63
- to score a four-second clip on a 4-core CPU
- ~1 s
Why Whisper alone was not enough
Speech recognisers are built to understand you, not to grade you. Whisper hears "tink" and writes "think", because that is the likely word, so the slip a learner most needs to hear about disappears.
The first version scored Whisper’s words against a pronunciation dictionary and nothing else. Measured against expert raters, it barely agreed with them: 0.51 on sentence scores, and slightly negative on fluency.
How it scores a sentence
Level the audio
The browser boosts quiet microphones and sends 16 kHz mono WAV, so the server rarely needs ffmpeg.
Find the words
Whisper large on Groq returns the words and their timings in a second or two, and local faster-whisper takes over if Groq is down. Voice activity detection drops the "Thank you." Whisper likes to invent over silence.
Hear the sounds
A wav2vec 2.0 phoneme model on ONNX Runtime gives the probability of every sound, every 20 ms. It has no language model, so it does not correct a wrong sound into the right word.
Judge each sound
Alignment-free goodness of pronunciation (Cao et al., Interspeech 2024) weighs each expected sound against every alternative. The strongest alternative becomes the diagnosis: /θ/ came out as /s/.
Score and explain
Words are aligned with a weighted edit distance, then the app gives four scores (pronunciation, fluency, clarity and completeness) and a coach card with one tip per slip.
Checking it against people
I measured the scorer on speechocean762: 5,000 English sentences read by Mandarin speakers and rated by trained annotators per sentence, word and sound. The weights were fitted on its training split. These figures come from 500 test recordings the fitting never saw, as Pearson’s r with the human rating.
| Test split, 500 recordings | Before | Now |
|---|---|---|
| Sentence accuracy | 0.514 | 0.651 |
| Sentence overall score | 0.507 | 0.697 |
| Sentence fluency | −0.084 | 0.627 |
| Word accuracy | 0.422 | 0.555 |
| "Was this sound wrong?" (AUC) | n/a | 0.939 |
Two changes did most of the work. The old fluency rule punished anyone over 180 words a minute, but the raters scored faster readers as more fluent, so I fitted the curve to them. And when Whisper reported a word as missing but its sounds were there, the word is now scored from the sounds instead of getting zero. That alone moved word accuracy from 0.398 to 0.555.
Where it still falls short
Only about 4% of the sounds in that data are rated wrong, which makes this a rare-event problem. At the threshold the app uses, about two flagged sounds in five are real slips (0.41 precision), and many slips go unflagged.
The phoneme model also leans toward the sound you meant to make. When a synthetic voice made twelve deliberate substitutions inside full sentences, half were reported. Spoken alone, "think" and "sink" separate cleanly; inside a familiar phrase, "berry" read as "very" came back clean. A model fine-tuned on non-native speech is the next step.
Making it fair for Indian speakers
The curve that turns sound evidence into "chance it is clean" was fitted on Mandarin speakers. On L2-ARCTIC, a corpus of non-native English with every sound marked by annotators, it flagged under 1% of a Hindi speaker’s sounds and caught 4% of the real slips.
So speakers of Hindi, Urdu, Bengali, Gujarati, Marathi, Punjabi, Tamil and Telugu get a trained sound model instead: logistic regression over the sound’s evidence, how long it lasted, the strongest competing sound and how clean its neighbours were. Every candidate also had to pass a native check set, 82 sentences read by four native voices, without flagging more than 2% of correct speech.
| Held-out Hindi speaker | Default curve | Sound model |
|---|---|---|
| "Was this sound wrong?" (AUC) | 0.602 | 0.776 |
| Real slips flagged | 4% | 13% |
| Flags that are real slips | 39% | 45% |
It catches three times as many of the slips the annotators heard, and its flags are right more often. The whole model is 16 KB of weights run with NumPy, so it adds no noticeable time.
A coach that only explains real mistakes
Each attempt ends with a coach card. An LLM (gpt-oss-120b on Groq) writes the wording, but only for the slips the scorer actually found, so it cannot invent problems. Its output is validated and cached, and a rule-based coach takes over when it is unavailable.
I benchmarked reasoning effort for it: medium answered in about 2 seconds against 18 for the slower setting, with no gain in quality.
Shipping it on a small CPU
- I exported the phoneme model from PyTorch to int8 ONNX (355 MB) and published it on the Hugging Face Hub. A four-second clip takes about a second on a 4-core CPU.
- FastAPI puts the heavy work behind a bounded queue, so a burst of requests waits its turn instead of failing.
- A multi-stage Docker build runs on Hugging Face Spaces, with PostgreSQL for history in production and SQLite locally.
- The frontend is React 19 with TypeScript and Vite, with a WebGL orb that follows the live audio.
More than a score
Around the scorer is a full practice app: mock interviews in eight formats that run hands-free, minimal-pair drills built from the sounds you miss most, a library of all 41 American English sounds, a spoken coach on Gemini Live, and progress tracking with before-and-after recordings.
Hiring for work like this?
I'm open to entry-level software engineering and AI/ML roles, in India or abroad, and I can join immediately. Email is the quickest way to reach me.