Implementing Speaker Identification with ECAPA-TDNN and FAISS

Imagine: an audio recording with multiple voices, and you need to accurately identify which one is your client. Standard diarization only separates speech by speaker but does not name them. Speaker identification solves this: using a voice fingerprint (embedding), we find the person in a database of

AI Development Areas

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1440
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1301
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    997
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1264
  • image_logo-advance_0.webp
    B2B Advance company logo design
    712
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1002

Imagine: an audio recording with multiple voices, and you need to accurately identify which one is your client. Standard diarization only separates speech by speaker but does not name them. Speaker identification solves this: using a voice fingerprint (embedding), we find the person in a database of known speakers. Over 5 years, we have implemented more than 20 speaker identification projects for banks, call centers, and security systems. We guarantee accuracy above 95% in production environments. We deploy such systems turnkey — from prototype to production with millions of voices.

Problems We Solve

  • Low accuracy in noisy environments — standard models fail on street recordings. Our pipeline includes VAD (Voice Activity Detection) and preprocessing: resampling to 16 kHz, volume normalization, silence removal. For example, in a call center project, we reduced EER from 4.2% to 1.1% solely through proper VAD.
  • Slow search in large databases — linear embedding search is inefficient for >10,000 voices. We use FAISS with IVF index, achieving search speed <5 ms per million vectors. For a 2 million voice database, we obtained p99 latency of 8 ms. This cut server hardware costs by 40%.
  • Sensitivity to recording duration — short phrases (<2 seconds) degrade quality. We offer adaptive thresholding and embedding accumulation from multiple segments. In one case, we achieved 91% accuracy on 1.5-second fragments.

If you face any of these issues — contact us, and we will propose a solution.

How Speaker Identification Works?

The system consists of three stages:

  1. Enrollment — for each speaker, collect 3-10 audio samples, extract embeddings via ECAPA-TDNN, and average them.
  2. Inference — compute the embedding from audio on the fly, compare with the database using cosine distance.
  3. Decision — if similarity > threshold (e.g., 0.75), return the name; otherwise 'UNKNOWN'.
Audio → VAD → Speaker Encoder → Embedding → Similarity Search → Identity (ECAPA-TDNN) (d-vector) (cosine / ANN) 

Why ECAPA-TDNN?

ECAPA-TDNN outperforms the previous x-vector standard by 30% in EER (Equal Error Rate) on VoxCeleb1 — EER 0.87% vs 1.2%. It is more robust to noise and varying durations. For simple scenarios (up to 1000 speakers), x-vector may suffice, but for state-of-the-art accuracy we choose ECAPA-TDNN.

Comparison of embedding extraction approaches:

Method EER (VoxCeleb1) Dimensionality Inference Time (GPU) Memory Requirements
i-vector 5.2% 400 200 MB
x-vector 1.2% 512 5 ms 50 MB
ECAPA-TDNN 0.87% 192 8 ms 20 MB

Extracting Speaker Embeddings

from speechbrain.pretrained import SpeakerRecognition import torchaudio import torch # ECAPA-TDNN — state-of-the-art architecture model = SpeakerRecognition.from_hparams( source="speechbrain/spkrec-ecapa-voxceleb", savedir="tmp_spkrec" ) def get_embedding(audio_path: str) -> torch.Tensor: signal, sr = torchaudio.load(audio_path) if sr != 16000: signal = torchaudio.functional.resample(signal, sr, 16000) embedding = model.encode_batch(signal) return embedding.squeeze() # Register a new speaker def register_speaker(name: str, audio_samples: list[str]): embeddings = [get_embedding(p) for p in audio_samples] mean_embedding = torch.stack(embeddings).mean(0) return mean_embedding # save to database 

Searching the Voice Database

import faiss import numpy as np # Index for fast search (millions of voices) index = faiss.IndexFlatIP(192) # cosine similarity via inner product speaker_names = [] def add_speaker(name: str, embedding: torch.Tensor): emb_np = embedding.numpy().reshape(1, -1) faiss.normalize_L2(emb_np) index.add(emb_np) speaker_names.append(name) def identify_speaker(audio_path: str, threshold: float = 0.75) -> str: embedding = get_embedding(audio_path).numpy().reshape(1, -1) faiss.normalize_L2(embedding) distances, indices = index.search(embedding, k=1) score = float(distances[0][0]) if score >= threshold: return speaker_names[indices[0][0]] return "UNKNOWN" 

Case Study: Call Center Authentication

A major bank wanted to implement voice authentication for customers calling into support. Key requirements: accuracy >95% on 3-5 second phrases and latency <200 ms. We deployed a pipeline based on ECAPA-TDNN + FAISS IVF100000. After collecting 10 voice samples per each of 5000 clients and calibrating the threshold on a held-out set, the target metrics were achieved: accuracy >95% with FAR 1.2%. The project was delivered in 3 weeks. Our many years of experience in speaker identification allowed us to minimize risks and ensure stable system operation.

How Does the Voice Database Scale?

EER of ECAPA-TDNN on VoxCeleb1: 0.87% — production level. With 10+ seconds of enrollment audio: accuracy >95% at threshold 0.8. For voice databases up to 10^6, we use FAISS with various indexes. Below is a comparison of FAISS indexes.

Index Recall@1 Accuracy Search Time (1M vectors) Memory (1M vectors)
FlatIP 100% 80 ms 768 MB
IVF100000 99.2% 5 ms 770 MB
HNSW64 99.5% 2 ms 810 MB

Threshold defines the precision/recall balance. For authentication (high security), use 0.85–0.9; for search (high recall), use 0.7–0.75. We recommend holding out 20% of data for validation.

How We Implement the System: Step by Step

  1. Audit and data collection — analyze use cases, collect voice samples (with consent).
  2. Architecture design — select model (ECAPA-TDNN / x-vector), configure FAISS index, set threshold.
  3. Implementation — build pipeline, integrate with your API/application (REST, gRPC).
  4. Testing — validate on real recordings, measure precision/recall, perform load testing.
  5. Deployment and support — deploy on server/cloud, monitor latency, train your team.

What’s Included

  • Source code for the identification pipeline (Python, PyTorch)
  • FAST API server for identification and enrollment
  • Deployment and configuration documentation
  • Integration with your application (1-2 endpoints)
  • Team training (2 hours online)
  • 1-month post-deployment support

Timelines

Basic identification system: from 1 week. With FAISS index and voice database management: from 2 weeks. Full cycle with integration and testing: 2-4 weeks.

Contact us for a consultation and project estimate — we will select the optimal solution for your task. Get a free estimate within 1 business day. Submit a request — we will demo the system on your data.