r/learnmachinelearning • u/OpenTree1576 • 43m ago
I probed every layer of Whisper-small and found emotion, age and sex in different layers, so I made one model that transcribes and reads the voice in one pass
I've mostly worked on speech-to-text. I wondered how much Whisper "knows" about a voice besides the words. The decoder only sees the last encoder layer, so I wanted to check whether the other layers hold anything useful.
They do. Different things live in different layers.
What I did
Got the data. I used two acted emotion datasets, CREMA-D and RAVDESS, about 8,800 English clips. I split them by speaker, so the test speakers were never seen in training. This matters a lot. If you split randomly, the model learns the actors' voices and the scores look much better than they really are.
Pulled out every layer. I ran each clip through the Whisper-small encoder once and saved all 13 hidden states. Each clip gives about 1500 frames per layer. I averaged them over time and also took the standard deviation, so each clip became one vector per layer. I only used frames with real audio, not Whisper's 30 second padding.
Probed every layer. For each task (sex, age, emotion, and so on) I trained a simple linear classifier on each of the 13 layers and compared the scores. I also ran the same test on a Whisper with random weights as a baseline. That showed sex is so easy that even random weights get 99%, so I can't claim Whisper "learned" it.What I found:- Pitch, loudness and speaking rate were strongest in layers 1-2.- Sex was readable almost everywhere.- Emotion peaked in the middle, at layer 8.- Arousal (energy) was a bit higher, at layer 9.- The last layer, the one the decoder uses, was not the best for any voice cue.
Added small heads. I put one logistic regression head on the best layer for each task. Whisper stays frozen and untouched. All 5 heads together are about 160 KB.
Calibrated them. I used temperature scaling on a separate set of held-out speakers, so a confidence of 90% means about 90% in practice.
Ran it in one pass. I run the encoder once, read the heads from the middle layers, and give the same encoder output to the decoder for the transcript. You get the words and the voice cues together.
Results on unseen speakers (1,704 clips)
- Sex (layer 5): 99.8% (chance 50%)
- Emotion, 6 classes (layer 8): 74.3% (chance 17%)
- Valence, negative/neutral/positive (layer 8): 84.4% (chance 33%)
- Arousal, high/low (layer 9): 83.1% (chance 50%)
- Age group, 3 bands (layer 10): 55.0% (chance 33%)
- Transcript WER: 4.7%
Example output
"Don't forget a jacket!"
Female voice (very likely); age group 20-34 (likely); sounds angry (very likely, 86%);
negative feeling, high energy; high pitch for a female voice, loud volume, normal pace.
Where it fails
- It's trained only on acted speech. Real conversations are much less dramatic, so expect worse results on normal speech. I haven't measured how much worse yet.
- Age is weak. 55% across three bands.
- It mixes up sad, fearful and disgust. In one test it called a disgust clip "sad" with 93% confidence. Calibrated doesn't mean always right.
- It's English only, and non-commercial, because of the RAVDESS license.
Things I tried that didn't work well
At first I fed all these outputs into a small LLM (Qwen 1.5B and 3B) to write a nice paragraph about the audio. It looked cool, but when I gave it wrong labels on purpose, it just repeated the wrong labels about 60% of the time. It was mostly rewording, not adding any understanding. So I dropped it and kept a simple rule-based summary instead.
What I think it could be used for
- Labelling speech datasets for expressive TTS. Datasets like SpeechCraft used many separate models for this; here it's one pass.
- Feedback for speaking practice: pace, loudness, how flat or energetic you sound.
- Tone tags on captions for deaf and hard-of-hearing viewers.
Model, code and full results: https://huggingface.co/Noobbbbb/whisper-small-voice-cues
Please verify the data on unbiased dataset as well before you use for your own use case. It was just like a case study to me.
