Audio Classification
ONNX
English
end-of-turn-detection
turn-taking
voice-agents
speech
from-scratch
Eval Results (legacy)
Nikhil-09 commited on
Commit
8094ec7
Β·
verified Β·
1 Parent(s): cbefd6b

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +138 -0
README.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_name: mixed-per-model
4
+ license_link: LICENSE
5
+ library_name: onnx
6
+ pipeline_tag: audio-classification
7
+ language:
8
+ - en
9
+ tags:
10
+ - end-of-turn-detection
11
+ - turn-taking
12
+ - voice-agents
13
+ - speech
14
+ - onnx
15
+ - from-scratch
16
+ datasets:
17
+ - pipecat-ai/smart-turn-data-v3.2-train
18
+ - Scicom-intl/semantic-vad-eot
19
+ - li2017dailydialog/daily_dialog
20
+ metrics:
21
+ - roc_auc
22
+ - average_precision
23
+ model-index:
24
+ - name: TurnWave
25
+ results:
26
+ - task:
27
+ type: audio-classification
28
+ name: End-of-turn detection
29
+ dataset:
30
+ type: livekit/eot-bench-data
31
+ name: eot-bench (English)
32
+ split: validation
33
+ metrics:
34
+ - type: roc_auc
35
+ value: 0.77
36
+ name: AUC
37
+ - type: average_precision
38
+ value: 0.602
39
+ name: Average precision
40
+ - type: false_cutoff_rate
41
+ value: 42.1
42
+ name: False cutoffs @300ms latency budget (%)
43
+ - type: false_cutoff_rate
44
+ value: 17.2
45
+ name: False cutoffs @600ms latency budget (%)
46
+ ---
47
+
48
+ # TurnWave β€” end-of-turn detection for voice agents
49
+
50
+ Decides whether a caller has **finished speaking** or is only pausing, so a voice
51
+ agent neither interrupts them nor leaves an awkward silence. It replaces the fixed
52
+ 300–700 ms silence timeout most pipelines still use.
53
+
54
+ **Trained from scratch β€” no pretrained weights anywhere.** A causal transformer
55
+ (RoPE, RMSNorm, SwiGLU) over the transcript tail, and a CNN over log-mel
56
+ spectrograms for prosody. Even the log-mel front end is hand-built on `torch.stft`,
57
+ so there is no torchaudio or librosa dependency.
58
+
59
+ ## Benchmark
60
+
61
+ Scored by [LiveKit's eot-bench](https://github.com/livekit/eot-bench) harness on
62
+ real human-to-agent conversation, using their code and published baselines. Lower
63
+ is better; **bold marks the best per column.**
64
+
65
+ | model | false cutoffs @300 ms ↓ | @600 ms ↓ | latency @5% cutoff ↓ |
66
+ |---|---|---|---|
67
+ | VAD baseline | 55.6% | 21.7% | 1600 ms |
68
+ | **TurnWave audio branch (this model)** | 42.1% | 17.2% | 1195 ms |
69
+ | SmartTurn v3.2 | 35.2% | 14.8% | 1051 ms |
70
+ | LiveKit Turn Detector v1 | **9.9%** | **4.5%** | **543 ms** |
71
+
72
+ TurnWave beats the VAD baseline on every metric the harness reports.
73
+
74
+ ## Models in this repo
75
+
76
+ | file | licence | training data |
77
+ |---|---|---|
78
+ | `audio_eot_v2.onnx` | apache-2.0 | trained on smart-turn conversational clips |
79
+ | `audio_eot.onnx` | cc-by-4.0 | Phase 4; trained on semantic-vad-eot (CC BY 4.0) |
80
+ | `text_eot.int8.onnx` | cc-by-nc-sa-4.0 | trained on DailyDialog (CC BY-NC-SA 4.0) β€” non-commercial |
81
+ | `fusion_eot.onnx` | cc-by-nc-sa-4.0 | contains the text branch, so it inherits the same terms |
82
+
83
+ Each model's licence follows its training data, so they differ. `audio_eot_v2` is
84
+ the one the benchmark above measures and the one to use.
85
+
86
+ ## Usage
87
+
88
+ ```python
89
+ from huggingface_hub import hf_hub_download
90
+ from turnwave.infer import TurnDetector # pip install git+https://github.com/Nikhils-G/turnwave
91
+
92
+ detector = TurnDetector(hf_hub_download("Nikhil-09/turnwave", "audio_eot_v2.onnx"))
93
+ if detector.predict(audio=wav_16k) > 0.5:
94
+ respond()
95
+ ```
96
+
97
+ 16 kHz mono. The model reads the last 2 seconds ending at the decision point, which
98
+ sits 0.2 s into the pause β€” where a live agent decides, and where eot-bench scores.
99
+
100
+ | model | variant | CPU latency | size |
101
+ |---|---|---|---|
102
+ | audio_eot_v2 | fp32 | 4.81 ms | 14.0 MB |
103
+ | audio_eot | fp32 | 4.52 ms | 14.0 MB |
104
+ | text_eot | int8 | 5.02 ms | 7.2 MB |
105
+ | fusion_eot | fp32 | 9.35 ms | 42.4 MB |
106
+
107
+ INT8 is not applied blindly: dynamic quantization rewrites MatMul, so it speeds up
108
+ the transformer and *slows down* the conv-heavy branches. Each model ships whichever
109
+ variant measured faster.
110
+
111
+ ## What this project found
112
+
113
+ The first version of this model scored **AP 0.945** on its own held-out test set and
114
+ **AUC 0.563** on eot-bench β€” barely above random. The policy sweep chose thresholds
115
+ of 0.0 and 1.0, meaning *ignore the model entirely*.
116
+
117
+ The cause was the training corpus, not the architecture. It derived from a dataset
118
+ whose own card declares `task_categories: [text-to-speech]` β€” read speech, whose
119
+ pauses are reading hesitations rather than conversational turn-yields. The model had
120
+ learned *"has this sentence finished being read aloud."*
121
+
122
+ Retraining on conversational data, changing nothing else, lifted AUC to **0.770**.
123
+ The in-domain score could never have revealed this; only a benchmark on data we did
124
+ not build could.
125
+
126
+ ## Limitations
127
+
128
+ - **English only.** Other languages are in the training data but untested here.
129
+ - **Behind the production models**, and not a fair comparison: SmartTurn starts from
130
+ a pretrained Whisper encoder, LiveKit's is a fine-tuned 0.5B LLM distilled from a
131
+ 7B teacher. This is 3.49M parameters from random initialisation.
132
+ - **The fusion model is stale.** It was trained on the read-speech corpus, which the
133
+ benchmark showed to be the wrong task. The conversational corpus has no
134
+ transcripts, so retraining fusion needs ASR first.
135
+ - **Non-commercial models included.** The text and fusion models derive from
136
+ DailyDialog (CC BY-NC-SA 4.0). Only the audio branches are permissively licensed.
137
+
138
+ Code, training scripts, and the full write-up: **https://github.com/Nikhils-G/turnwave**