smart-turn-uz-v1: end-of-turn detection for Uzbek phone calls

The caller has paused. Did they finish, or will they go on? This model listens to the last 8 seconds of the caller's audio and returns the probability that the turn is over. It is for live voice agents on the phone.

It is a further fine-tune of gurinbaev/smart-turn-uz on a larger private set of Uzbek phone calls. The architecture, size and speed are unchanged.

Lineage

Step Model What it added
1 pipecat-ai/smart-turn-v3 (v3.2) Whisper tiny encoder plus a classifier, 8M parameters, multilingual
2 gurinbaev/smart-turn-uz Fine-tuned on Uzbek and Russian phone calls
3 this model Fine-tuned further on more Uzbek phone calls, with automatic labels

All credit for the model design goes to the Smart Turn team, and for the Uzbek adaptation and the published PyTorch weights to the author of smart-turn-uz.

Results

On our own held-out phone calls, never used for training or for choosing the checkpoint, this model reaches AUC 0.900 (0.5 is a coin flip, 1.0 is perfect).

How this was measured. Read it before comparing with any other number:

  • Most of our calls, in training and in the test, are mono recordings with both speakers in one channel. For these, the other speakers' speech is replaced by line noise, using annotated segment times, to imitate one side of a phone line. Only a smaller part is true two-channel recordings. On those alone the AUC is 0.902.
  • Decision points come from both sides of the call, operator and customer, not only from the caller.
  • The labels are automatic (see Training).

This model is not shown to be better than smart-turn-uz. An earlier version of this card compared the two on our test only. That was not a fair comparison and it has been removed. On the base model's own test set, an independent measurement gives this model 0.800 against 0.822 for smart-turn-uz. So this model fits calls like ours, and the base model fits calls like its own. Test both on your calls before choosing.

How many real ends of turn are found while a fixed share of unfinished turns is wrongly called finished, on our test:

Unfinished turns called finished Ends of turn found Threshold
5 % 50 % 0.84
10 % 66 % 0.74

The thresholds differ from the base model's: do not reuse 0.7 without checking it on your own calls.

One request takes about 65 ms on one CPU thread in PyTorch, the same as the base model.

Files

File What it is
smart-turn-uz-v1.pt PyTorch state_dict for SmartTurn in smart_turn.py, the same format as smart-turn-uz.pt. Outputs a logit
smart-turn-uz-v1.onnx The same model in ONNX. Input input_features, float32 [batch, 80, 800] (Whisper log-mel features of 8 s). Output logits, [batch]. The features are computed outside the graph, unlike the raw-audio graph of smart-turn-uz
smart_turn.py The model definition and feature extraction, unchanged from smart-turn-uz
smart-turn-uz-v1-mix50.pt Experimental. The weights are an average: 50 % smart-turn-uz, 50 % this model. Same format as smart-turn-uz-v1.pt
smart-turn-uz-v1-mix25.pt Experimental. 75 % smart-turn-uz, 25 % this model

The two mixes stay closer to the base model, so they may keep more of its quality on calls like its own. This is not measured yet: they have not been scored on the base model's test set. On our two-channel test calls they reach AUC 0.895 (mix50) and 0.870 (mix25), against 0.902 for this model.

Usage

Feed only the caller's channel: the last 8 seconds up to about 0.2 s after their speech stopped, mono, 16 kHz, float32 in [-1, 1]. Shorter audio is padded with zeros on the left. Phone audio at 8 kHz should be resampled to 16 kHz; wideband audio should be low-passed to the telephone band first.

PyTorch:

import torch
from smart_turn import SmartTurn, features, to_features

model = SmartTurn()
model.load_state_dict(torch.load("smart-turn-uz-v1.pt", map_location="cpu"))
model.eval()
extractor = features()

def end_of_turn(audio) -> float:
    with torch.no_grad():
        return torch.sigmoid(model(torch.from_numpy(to_features(extractor, [audio])))).item()

ONNX:

import numpy as np
import onnxruntime
from smart_turn import features, to_features

session = onnxruntime.InferenceSession("smart-turn-uz-v1.onnx", providers=["CPUExecutionProvider"])
extractor = features()

def end_of_turn(audio: np.ndarray) -> float:
    logit = session.run(None, {"input_features": to_features(extractor, [audio])})[0][0]
    return float(1 / (1 + np.exp(-logit)))

The ONNX file matches PyTorch to within 5e-7 in probability.

Training

Starting point: the published smart-turn-uz.pt. Nothing in the architecture was changed.

Labels. No one labelled turns by hand. A decision point is a pause of 0.2 s in a speaker's speech, the moment a live agent would ask the model. The label is what happened next:

  • end: another speaker talks first.
  • continue: the same speaker goes on shortly after.

Unclear cases, such as overlapping speech and short backchannels, are left out.

Audio. Most training calls are mono recordings. For each speaker, the other speakers' speech is replaced by line noise, so the clip sounds like one side of a phone line. The rest are true two-channel recordings. Both the operator's and the customer's pauses are used.

Setting Value
Epochs 3
Batch size 64
Optimizer AdamW, weight decay 0.01
Learning rate 5e-5, warm-up, then cosine decay
Precision mixed (fp16)
Published weights running average of the training weights (EMA, 0.999)

Augmentation of the log-mel features: a small time shift, frequency masking and time masking. The last 0.6 s is never masked, because the end of the phrase is the signal the model has to learn.

The checkpoint was chosen on separate validation calls. The test calls played no part in it.

Limitations

  • Trained and tested on telephone calls only, mostly Uzbek with Russian words mixed in. Fully Russian speech was not scored separately.
  • An "end" here means that another speaker took the floor in a human conversation. This is close to, but not the same as, the moment a voice agent should answer.
  • The labels are automatic, so they are noisy.
  • Most of the training and test audio is mono with the other speaker replaced by noise. This only imitates the caller's channel that a live agent hears.
  • On the base model's own test set this model scores lower than the base model (0.800 against 0.822).
  • Backchannels are left out of training, as in the base model. The model answers only "finished or not".
  • The training and test data are private and are not shared.

License

BSD 2-Clause, like both base models. See LICENSE.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for risqaliyevds/smart-turn-uz-v1

Quantized
(1)
this model