Microsoft Drops WavLM Base+ SV to Verify Speakers With 0.60% Error Rate
Microsoft's WavLM Base+ fine-tuned for speaker verification is available on Hugging Face, giving builders a drop-in encoder for voice identity tasks.
Takeaways
- Microsoft published WavLM Base+ SV on Hugging Face for speaker verification.
- Built on WavLM Base+ pretrained on 94k hours of speech, fine-tuned on VoxCeleb1.
- Uses an X-Vector head with Additive Margin Softmax loss to produce speaker embeddings.
- Outperforms ECAPA-TDNN on VoxCeleb1 trials despite being a Base-size model.
- Plugs into Transformers via
WavLMForXVector; expects 16 kHz mono audio. - Paper: arxiv.org/abs/2110.13900; code at microsoft/unilm.
Microsoft has released WavLM Base+ SV on Hugging Face, giving developers a roughly 95-million-parameter model for deciding whether two audio clips contain the same speaker. The checkpoint produces fixed-length speaker embeddings and integrates with Transformers through WavLMForXVector.
By packaging the pretrained encoder, X-Vector head, and feature extractor together, the release removes the need to assemble a speaker-verification model from separate components. A production system still requires audio preprocessing, threshold calibration, enrollment storage, spoof detection, and controls for biometric data.
One checkpoint, one embedding
Speaker verification compares a candidate utterance with a reference utterance from an enrolled speaker. WavLM Base+ SV maps each clip to a 512-dimensional vector, and cosine similarity measures the distance between the two vectors. Higher scores indicate a closer match.
| Task | One-to-one speaker verification |
|---|---|
| Backbone | 12 Transformer layers with a 768-dimensional hidden representation |
| Model size | Approximately 95 million parameters |
| Input | Mono speech sampled at 16 kHz |
| Output | One 512-dimensional embedding per utterance |
| Fine-tuning data | VoxCeleb1 |
| Interface | Wav2Vec2FeatureExtractor and WavLMForXVector |
| License | MIT |
A one-to-many identification service can compare the candidate embedding with a gallery of enrolled vectors, although retrieval, indexing, score normalization, and identity-level thresholds remain application responsibilities. Diarization systems can also cluster embeddings from pre-segmented speech, but this checkpoint does not locate speech boundaries or speaker changes.
Noise-aware pretraining preserves identity
WavLM extends the HuBERT self-supervised learning framework, which learns speech representations by predicting discrete targets for masked audio frames. The WavLM paper adds utterance mixing, a training method that overlays speech or noise so the encoder must recover information about the underlying speaker and content.
Microsoft pretrained Base+ on about 94,000 hours of unlabeled 16 kHz speech: 60,000 hours from Libri-Light, 10,000 from GigaSpeech, and 24,000 from VoxPopuli. Its Transformer also uses gated relative position bias, allowing attention layers to incorporate the distance between audio frames.
The speaker-verification checkpoint adds an X-Vector head and fine-tunes the network on VoxCeleb1 with Additive Margin Softmax loss. This objective pulls recordings from the same training identity closer together while separating recordings from different identities.
A 0.60% EER under the paper’s protocol
The WavLM paper reports a 0.60% equal error rate for Base+ on the VoxCeleb1-O verification benchmark, compared with 0.87% for its ECAPA-TDNN baseline. WavLM Large reached 0.38%, while using about three times as many parameters as Base+.
Equal error rate is the operating point where false accepts and false rejects occur at the same rate; lower values indicate better performance under that evaluation protocol. These results depend on the paper’s training data, trial pairs, scoring method, and audio conditions, so they do not predict error rates for a different language, microphone, noise profile, or enrollment process.
A minimal pairwise check
The following example embeds two mono 16 kHz waveforms in separate forward passes, normalizes their vectors, and calculates cosine similarity. Separate passes prevent padding from influencing the pooled representation when clips have different durations.
import torch
import torch.nn.functional as F
from transformers import Wav2Vec2FeatureExtractor, WavLMForXVector
CHECKPOINT = "microsoft/wavlm-base-plus-sv"
extractor = Wav2Vec2FeatureExtractor.from_pretrained(CHECKPOINT)
model = WavLMForXVector.from_pretrained(CHECKPOINT)
model.eval()
def embed(waveform):
inputs = extractor(
waveform,
sampling_rate=16000,
return_tensors="pt",
)
with torch.inference_mode():
embedding = model(**inputs).embeddings
return F.normalize(embedding, dim=-1)
# Each variable is a one-dimensional mono waveform sampled at 16 kHz.
reference = embed(audio_reference)
candidate = embed(audio_candidate)
score = F.cosine_similarity(reference, candidate).item()
same_speaker = score >= 0.86
Each waveform must be decoded, mixed to mono, and resampled to 16 kHz before inference. Long recordings increase memory and latency, so applications commonly select voiced segments or divide recordings into consistent windows before aggregating scores.
Calibrate the 0.86 cutoff
The model card suggests a cosine-similarity threshold of 0.86 for its example, but that value should serve only as an initial test setting. A deployment threshold must reflect the relative cost of false accepts and false rejects in the target environment.
- Build same-speaker and different-speaker trial pairs from representative microphones, languages, noise levels, and clip durations.
- Measure false-accept and false-reject rates across candidate thresholds.
- Select an operating point based on the application’s risk requirements rather than equal error rate alone.
- Repeat the evaluation for demographic groups and recording conditions that may produce different score distributions.
- Recalibrate after changing preprocessing, enrollment audio, model weights, or deployment hardware.
The surrounding system still matters
- Transcription: The checkpoint has no tokenizer or language-model head and produces no text. Speech recognition requires an ASR model.
- Diarization: The embeddings can support clustering after voice activity detection and speaker-change segmentation. Those stages are not included.
- Replay and synthetic speech: A high similarity score does not establish liveness or authenticity. Voice login requires separate replay, synthesis, and presentation-attack detection.
- Bandwidth: A 16 kHz input contains frequencies only up to 8 kHz. Resampling wider-band audio cannot preserve speaker cues above that limit.
- Domain shift: Fine-tuning on VoxCeleb1 reflects interview-style recordings and its speaker population. Telephone audio, far-field microphones, children’s voices, accented speech, and other domains need local testing.
- Clip duration: Very short or low-speech clips provide less identity information. Minimum-duration rules should come from measured performance on the intended data.
- Biometric data: Embeddings and enrollment recordings require access controls, encryption, retention limits, deletion procedures, and any consent required by the deployment jurisdiction.
Microsoft’s source repository contains the original implementation, training resources, and additional WavLM checkpoints for teams that need domain-specific fine-tuning or the larger backbone.