Final: speculative dispatch 2.94s win, zero-throttling contention verdict
Browse files- docs/LATENCY.md +32 -25
docs/LATENCY.md
CHANGED
|
@@ -2,19 +2,20 @@
|
|
| 2 |
|
| 3 |
## MEASURED — MVP slice, 2026-10-04, cpu-upgrade (8 vCPU cgroup quota, CPU-only)
|
| 4 |
|
| 5 |
-
End-to-end run `ml-intern-freestream-e2e-
|
| 6 |
-
two turns, ASR tiny.en @1 thread, clause-level chunking):
|
| 7 |
livekit-server v1.13.7 dev mode in-container, bot joined via the real CLI,
|
| 8 |
test client asked spoken questions, timings measured at the receiving client.
|
| 9 |
|
| 10 |
| Metric | Measured | Target | Verdict |
|
| 11 |
|---|---|---|---|
|
| 12 |
-
| **t_perceived, turn 1** (cached disclosure) | **
|
| 13 |
-
| t_perceived, turn 2 (dynamic reply) | 5.
|
| 14 |
-
| t_ready (CLI join → bot ready, incl. warmup) | 12.
|
| 15 |
-
| ASR finalize (tiny.en int8, 1 thread) | 1.
|
| 16 |
-
| First-chunk synth, turn 2 |
|
| 17 |
-
| bot→client transport gap | 0.
|
|
|
|
| 18 |
| Mouth movement | 13/13 checks incl. both turns | >0 | PASS |
|
| 19 |
| Replay logs | both hash chains verify | valid | PASS |
|
| 20 |
|
|
@@ -27,27 +28,33 @@ Findings from the profiling campaign:
|
|
| 27 |
2. **The fixed consent disclosure is pre-synthesizable** (CONSENT.md #2):
|
| 28 |
caching it at session start removes Piper entirely from the first turn's
|
| 29 |
audio path.
|
| 30 |
-
3. **bot→client transport is nearly free (0.
|
| 31 |
-
absolute cross-process timestamps.
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
5. **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
first sentence cost 7.47s of synthesis. Clause-level chunking (cap ~60
|
| 39 |
-
chars at comma boundaries) cut it to
|
| 40 |
-
|
| 41 |
-
|
| 42 |
voice (63.2 → 18.7 MB) made TTS **3–4× slower** (RTF 2.50–2.98 vs 0.79–0.86
|
| 43 |
fp32): dequant overhead dominates the conv-heavy VITS graph on this CPU
|
| 44 |
(no VNNI). Rejected here; artifact + verdict archived at
|
| 45 |
-
[LoveLogicAI/piper-en_US-amy-medium-int8](https://huggingface.co/LoveLogicAI/piper-en_US-amy-medium-int8)
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
"Streamy" correctly; tiny.en hears "Streami"
|
| 50 |
-
|
| 51 |
|
| 52 |
Remaining levers, in order of expected yield: (a) the ~0.9s of unexplained
|
| 53 |
utterance-finalization lag beyond the 600ms hangover; (b) in-context ASR/synth
|
|
|
|
| 2 |
|
| 3 |
## MEASURED — MVP slice, 2026-10-04, cpu-upgrade (8 vCPU cgroup quota, CPU-only)
|
| 4 |
|
| 5 |
+
End-to-end run `ml-intern-freestream-e2e-speculative` (final: job `6ac2e756404719ba37651973`,
|
| 6 |
+
two turns, speculative dispatch ON, ASR tiny.en @1 thread, clause-level chunking):
|
| 7 |
livekit-server v1.13.7 dev mode in-container, bot joined via the real CLI,
|
| 8 |
test client asked spoken questions, timings measured at the receiving client.
|
| 9 |
|
| 10 |
| Metric | Measured | Target | Verdict |
|
| 11 |
|---|---|---|---|
|
| 12 |
+
| **t_perceived, turn 1** (speculative + cached disclosure) | **2.94s** | ≤ 4.0s (win condition) | **PASS** 🔥 |
|
| 13 |
+
| t_perceived, turn 2 (speculative, dynamic reply) | 5.79s | — | both turns via speculative path |
|
| 14 |
+
| t_ready (CLI join → bot ready, incl. warmup) | 12.5s | — | — |
|
| 15 |
+
| ASR finalize (tiny.en int8, 1 thread) | 1.25–1.46s | 400–700ms | over; standalone RTF 0.25 |
|
| 16 |
+
| First-chunk synth, turn 2 | 4.09s | 200–400ms | clause-capped (was 7.47s) |
|
| 17 |
+
| bot→client transport gap | 0.04s (t1) / 0.45s (t2) | — | negligible |
|
| 18 |
+
| cgroup CPU throttling during turns | **0 periods, 0ms** | — | contention myth settled |
|
| 19 |
| Mouth movement | 13/13 checks incl. both turns | >0 | PASS |
|
| 20 |
| Replay logs | both hash chains verify | valid | PASS |
|
| 21 |
|
|
|
|
| 28 |
2. **The fixed consent disclosure is pre-synthesizable** (CONSENT.md #2):
|
| 29 |
caching it at session start removes Piper entirely from the first turn's
|
| 30 |
audio path.
|
| 31 |
+
3. **bot→client transport is nearly free (0.04–0.5s)** — measured with
|
| 32 |
+
absolute cross-process timestamps.
|
| 33 |
+
4. **Speculative dispatch works** (concept mitigation #1): dispatching ASR +
|
| 34 |
+
agent + first-chunk synth at ~300ms of silence (with cancellation on
|
| 35 |
+
speech resume and dedup against the final event) took turn 1 from 3.12s
|
| 36 |
+
to **2.94s**. Both measured turns completed via the speculative path; the
|
| 37 |
+
cancellation path is exercised by the segmenter's "resumed" event.
|
| 38 |
+
5. **The contention question is settled: zero cgroup throttling**
|
| 39 |
+
(cpu.stat deltas across turns: 0 periods, 0ms). The in-context vs
|
| 40 |
+
standalone RTF gap is not quota starvation — it is cold-start effects
|
| 41 |
+
(page cache, allocator warmup) and benign thread scheduling. The ORT
|
| 42 |
+
thread-cap countermeasure was not needed (knob FREESTREAM_ORT_THREADS
|
| 43 |
+
remains for other hosts).
|
| 44 |
+
6. **First-chunk synth length was the real turn-2+ bottleneck**: a 99-char
|
| 45 |
first sentence cost 7.47s of synthesis. Clause-level chunking (cap ~60
|
| 46 |
+
chars at comma boundaries) cut it to ~4s. Later chunks pipeline behind
|
| 47 |
+
playback.
|
| 48 |
+
7. **Quantization verdict — asymmetric**: int8-dynamic-quantizing the Piper
|
| 49 |
voice (63.2 → 18.7 MB) made TTS **3–4× slower** (RTF 2.50–2.98 vs 0.79–0.86
|
| 50 |
fp32): dequant overhead dominates the conv-heavy VITS graph on this CPU
|
| 51 |
(no VNNI). Rejected here; artifact + verdict archived at
|
| 52 |
+
[LoveLogicAI/piper-en_US-amy-medium-int8](https://huggingface.co/LoveLogicAI/piper-en_US-amy-medium-int8).
|
| 53 |
+
ASR was already int8 (CTranslate2) and got faster via English-only tiny.en
|
| 54 |
+
@1 thread.
|
| 55 |
+
8. **whisper tiny.en vs base accuracy**: base transcribed the bot name
|
| 56 |
+
"Streamy" correctly; tiny.en hears "Streami". The latency profile uses
|
| 57 |
+
tiny.en; base (+~2s ASR) is the accuracy upgrade path.
|
| 58 |
|
| 59 |
Remaining levers, in order of expected yield: (a) the ~0.9s of unexplained
|
| 60 |
utterance-finalization lag beyond the 600ms hangover; (b) in-context ASR/synth
|