FDE Times dataFDE jobs open 932▼14 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 62Companies hiring 202Remote-friendly 24%Median US pay $201kTop hirer Databricks 92
中文VI

The newspaper of the Forward Deployed Engineer

Guides

In Vietnamese call-center transcription, the model is the easy part

PhoWhisper transcribes and WhisperX separates speakers, but the real errors come from 8kHz files, people talking over each other and the code that joins the two.

ShareLinkedInFacebookX

In brief

  • For Vietnamese, start with PhoWhisper: VinAI fine-tuned Whisper on 844 hours of data covering many regional accents.
  • Call-center recordings are usually 8kHz, while PhoWhisper needs 16kHz input, so resampling is mandatory.
  • A summary is only as good as the speaker attribution in the transcript, and accuracy has to be measured on the client's own data.
Five-step process diagram. Audio is normalised to 16kHz, then splits into two streams: PhoWhisper transcribes the speech and WhisperX separates the speakers. The streams meet at the dialogue-merge step, highlighted in orange and annotated to say that wrongly assigned speaker labels will swap the agent and customer roles. The final step is the summary.
One stream yields each word with its timestamp; the other yields time spans with speaker labels. Aligning the two streams in time is the step you must test and verify yourself: assign a single role wrongly and the whole summary is inverted.

A call center can record thousands of calls a day and have almost nobody listen to them again. When a client asks an FDE to “do something with all these recordings”, the model is rarely the hard part. The trouble lies in low-quality 8kHz files, two people talking over each other, and regional accents the demo set never contained.

AWS describes speech-to-text as software that listens to audio and returns a verbatim, editable transcript. It also lists call analytics, the extraction of insight from customer conversations, among the technology’s applications. This guide builds a small version of that problem on your own laptop.

You will end up with a transcript, speaker labels and a summary, along with a quality score you calculated yourself.

What are you building, and what do you need?

The pipeline has five stages: normalize the audio, transcribe it, add timestamps and separate the speakers, assemble a labeled conversation, then summarize. The final step is to measure where the whole chain goes wrong.

You need Python, the Hugging Face transformers library and a few recorded calls. If you have no real data yet, role-play an agent and a customer with a friend and record it on a phone. A GPU helps but is not required for the small models.

Whisper comes in six model sizes that trade speed against accuracy, so the client’s GPU budget will decide which one you use.

Step 1: why must call-center files be raised to 16kHz?

Call-center recordings are typically stored at 8kHz, while PhoWhisper needs input audio sampled at 16kHz. This is an input requirement of the model, so do not skip it even if the file seems to play normally. The first step is to resample every file to 16kHz and name it clearly, for example call_001_16k.wav.

The code below is a condensed version that assumes librosa and soundfile are installed; torchaudio or ffmpeg work just as well, as long as the output is 16kHz:

# Condensed: resample one recording to 16kHz, mono
import librosa
import soundfile as sf

audio, sr = librosa.load("call_001.wav", sr=16000, mono=True)
sf.write("call_001_16k.wav", audio, 16000)
print(sr)  # must print 16000

Check: open a few converted files and listen to them, and print the sample rate to confirm it is 16000. A common mistake is resampling only part of a folder, so results are good on one file and poor on another, and the model gets the blame.

Step 2: original Whisper or PhoWhisper?

OpenAI’s repository presents Whisper as a general-purpose speech recognition model: multilingual transcription, speech translation and language identification. The same repository states plainly that Whisper’s quality varies widely by language. For Vietnamese, that is the reason to try a dedicated fine-tuned model.

VinAI’s PhoWhisper is multilingual Whisper fine-tuned on 844 hours of Vietnamese data, including many regional accents, and it comes in five versions. You call it through the transformers ASR pipeline:

from transformers import pipeline

transcriber = pipeline("automatic-speech-recognition", model="vinai/PhoWhisper-small")
# Condensed: take the text part of the result
output = transcriber("call_001_16k.wav")["text"]
print(output)

If you want to compare against the original Whisper, there is one trap: the turbo model was not trained for translation. For Vietnamese call recordings, use it to transcribe, and do not ask it to translate into English.

Check: read the transcript while listening to the audio. Pay attention to proper names, order numbers and phone numbers, because these are what clients care about most and where errors are most likely.

Step 3: who is speaking, and when?

A solid block of text is not yet a call record. To produce a summary such as “the customer complained about a late delivery, the agent promised a refund”, you need to know who said each sentence. The original Whisper gives only sentence-level timestamps, which are not fine-grained enough to cut cleanly where two people talk over each other.

WhisperX fills this gap in three ways. It aligns with wav2vec2 to get accurate timestamps for each word, and it uses pyannote-audio to tell speakers apart, returning speaker ID labels.

It also runs VAD (voice activity detection) as a preprocessing step to reduce hallucination, and performs batched inference without raising WER, reaching about 70 times real time with large-v2.

One point needs to be clear: these features belong to WhisperX, and nothing guarantees that PhoWhisper’s transcript will feed straight into WhisperX’s wav2vec2 alignment step. Treat combining the two tools as a design you have to test and verify yourself.

The idea is that one stream produces each word with its timing, another produces time spans with speaker labels, and your job is to merge them by time.

Take the exact commands and parameters for alignment and diarization directly from the README of the m-bain/whisperX repository, matching the version you have installed.

The merging code you can write yourself, and it is the part most worth practicing. The code below is a condensed version built on data structures you define, not the WhisperX API: each word is assigned to the speaker whose time span overlaps it the most.

# Condensed: words and turns are data you convert into this shape yourself
# words = [{"word": "hello", "start": 0.4, "end": 0.7}, ...]
# turns = [{"speaker": "SPEAKER_00", "start": 0.0, "end": 3.2}, ...]

def overlap(a_start, a_end, b_start, b_end):
    return max(0.0, min(a_end, b_end) - max(a_start, b_start))

def assign_speakers(words, turns):
    for w in words:
        best = max(turns, key=lambda t: overlap(w["start"], w["end"], t["start"], t["end"]))
        w["speaker"] = best["speaker"]
    return words

Check: diarization only gives you SPEAKER_00 and SPEAKER_01; it does not know who the agent is. You have to set your own relabeling rule, for instance that whoever says the scripted opening greeting is the agent. Test that rule on every call, because a single call in which the customer speaks first flips the roles in the entire summary.

Step 4: what should the summary contain for users to need it?

Once you have a labeled conversation, pass it to a language model to summarize. Do not ask something generic like “summarize this call”. Ask for exactly the fields a call-center manager needs to read. The template below is only an illustration; replace it with the fields the client actually uses:

# Illustrative summary template
- Reason for the call:
- Was the customer satisfied at the end of the call:
- What the agent committed to (with deadline, if any):
- Next actions:

Splitting the summary into fields lets you compare thousands of calls instead of reading thousands of free-form paragraphs. It also exposes errors from earlier stages: if the “What the agent committed to” field contains the customer’s words, step 3 has almost certainly assigned the wrong speaker.

Step 5: measure on the client’s own data

Because Whisper’s quality swings sharply by language, nobody’s published figures can replace your own measurement on the client’s Vietnamese calls.

The usual metric is WER, the word error rate. Take a reference sentence of 20 words in which the model gets 3 words wrong and drops 1. WER is then 4 divided by 20, or 20%.

Do this calculation for each call rather than only taking the average, because one regional-accent call with a high WER can be hidden by ten calls in a standard accent.

A further warning about borrowing published numbers: an arXiv paper on a pipeline for evaluating Vietnamese service quality from speech was withdrawn by its own authors because its results contained significant errors. Before putting anyone’s figure on a slide for a client, check that the source still stands.

Failure mode Symptom First fix
Forgot to resample some files Unusual quality gaps between files Check for a 16000 sample rate across all files
Hallucination in silent stretches Sentences nobody said appear during hold time Turn on VAD before transcribing
Agent and customer roles flipped Summary says the customer “promised a refund” Review the speaker relabeling rule

How does this skill show up with clients?

As an FDE on a project like this, spend the first days measuring before choosing a model. Ask for 20 to 30 calls representative of regions, times of day and complaint types, sit with a shift supervisor to type reference transcripts, then run the pipeline and present a WER table broken down by group.

That table will help decide which model size to use, whether a GPU is needed and which calls must go to a human reviewer.

When reading FDE or solutions engineer job descriptions, look for phrases such as “call analytics”, “speech”, “contact center” or “ASR”. On a CV, do not just write “used Whisper”. Say that you measured WER on Vietnamese data, found errors caused by 8kHz audio or flipped speaker roles, and explain how you fixed them.

Choosing a model takes one line of code. Knowing which calls the pipeline gets wrong, and why, is what the client pays for.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
5 sources
Read next on the roadmap · Stage 3: Applied AILlama 3.1's model card lists Thai, but not VietnameseOne evening of reading model cards and running your own tests is enough to compare the licenses and language claims of Qwen, Llama, Gemma and Mistral.