Profiling campaign results: transport gap, pause-render verdict, clause chunking, remaining levers
Browse files- docs/LATENCY.md +45 -36
docs/LATENCY.md
CHANGED
|
@@ -2,58 +2,67 @@
|
|
| 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 |
-
|
| 7 |
livekit-server v1.13.7 dev mode in-container, bot joined via the real CLI,
|
| 8 |
-
test client asked
|
| 9 |
|
| 10 |
| Metric | Measured | Target | Verdict |
|
| 11 |
|---|---|---|---|
|
| 12 |
-
| **t_perceived** (
|
| 13 |
-
|
|
| 14 |
-
|
|
| 15 |
-
|
|
| 16 |
-
|
|
| 17 |
-
|
|
| 18 |
-
|
|
| 19 |
-
| Mouth movement during speech | 234 video frames, median luma diff 0.70 | >0 | PASS |
|
| 20 |
| Replay logs | both hash chains verify | valid | PASS |
|
| 21 |
|
| 22 |
-
Findings from the
|
| 23 |
|
| 24 |
1. **cgroup oversubscription is the #1 CPU pitfall**: the container reports
|
| 25 |
`os.cpu_count()=64` under an 8-core quota. Whisper tiny at 8 threads
|
| 26 |
-
measured **39.5s** vs **1.16s** at 1 thread (same transcript).
|
| 27 |
-
low
|
| 28 |
-
2. **The fixed consent disclosure is pre-synthesizable** (CONSENT.md #2):
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
3. **
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
5.
|
|
|
|
| 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
|
| 45 |
[LoveLogicAI/piper-en_US-amy-medium-int8](https://huggingface.co/LoveLogicAI/piper-en_US-amy-medium-int8)
|
| 46 |
-
for re-testing on VNNI-capable hosts. ASR
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
The tables below are the original design targets, kept for reference.
|
| 51 |
|
| 52 |
-
## Budget (from the concept package
|
| 53 |
|
| 54 |
-
These are the *targets* the MVP slice
|
| 55 |
-
|
| 56 |
-
produced and re-produced.
|
| 57 |
|
| 58 |
| Stage | Local CPU-only | Local + GPU/ANE | Pika (published) |
|
| 59 |
|---|---|---|---|
|
|
|
|
| 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-clausechunks` (final: job `6ac2e57d404719ba376518ab`,
|
| 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) | **3.12s** | β€ 4.0s (win condition) | **PASS** |
|
| 13 |
+
| t_perceived, turn 2 (dynamic reply) | 5.73s | β | was 9.32s before clause chunking |
|
| 14 |
+
| t_ready (CLI join β bot ready, incl. warmup) | 12.7s | β | β |
|
| 15 |
+
| ASR finalize (tiny.en int8, 1 thread) | 1.21β1.31s | 400β700ms | over; standalone RTF 0.25 |
|
| 16 |
+
| First-chunk synth, turn 2 | 3.66s (was 7.47s) | 200β400ms | clause-capped |
|
| 17 |
+
| botβclient transport gap | 0.14s (t1) / 0.48s (t2) | β | negligible |
|
| 18 |
+
| Mouth movement | 13/13 checks incl. both turns | >0 | PASS |
|
|
|
|
| 19 |
| Replay logs | both hash chains verify | valid | PASS |
|
| 20 |
|
| 21 |
+
Findings from the profiling campaign:
|
| 22 |
|
| 23 |
1. **cgroup oversubscription is the #1 CPU pitfall**: the container reports
|
| 24 |
`os.cpu_count()=64` under an 8-core quota. Whisper tiny at 8 threads
|
| 25 |
+
measured **39.5s** vs **1.16s** at 1 thread (same transcript). Thread
|
| 26 |
+
counts are pinned low (FREESTREAM_WHISPER_THREADS).
|
| 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.1β0.5s)** β measured with
|
| 31 |
+
absolute cross-process timestamps. Earlier estimates of a ~1.6s gap were
|
| 32 |
+
measurement artifacts, not transport cost.
|
| 33 |
+
4. **Pausing the render loop during ASR does not help** (1.66s vs 1.33s
|
| 34 |
+
unpainted baseline, noise-level difference). The in-context slowdown vs
|
| 35 |
+
standalone RTF is not the render loop; the knob
|
| 36 |
+
(FREESTREAM_PAUSE_RENDER) remains for future profiling.
|
| 37 |
+
5. **First-chunk synth length was the real turn-2+ bottleneck**: a 99-char
|
| 38 |
+
first sentence cost 7.47s of synthesis. Clause-level chunking (cap ~60
|
| 39 |
+
chars at comma boundaries) cut it to 3.66s and turn-2 t_perceived to
|
| 40 |
+
5.73s. Later chunks pipeline behind playback.
|
| 41 |
+
6. **Quantization verdict β asymmetric**: int8-dynamic-quantizing the Piper
|
| 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 |
+
for re-testing on VNNI-capable hosts. ASR was already int8 (CTranslate2)
|
| 47 |
+
and got faster via English-only tiny.en @1 thread.
|
| 48 |
+
7. **whisper tiny.en vs base accuracy**: base transcribed the bot name
|
| 49 |
+
"Streamy" correctly; tiny.en hears "Streami"/"streaming". The latency
|
| 50 |
+
profile uses tiny.en; base (+~2s ASR) is the accuracy upgrade path.
|
| 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
|
| 54 |
+
contention (standalone RTF 0.25/0.79 vs in-context ~0.5/~1.2) β the render
|
| 55 |
+
loop is exonerated, so the suspect is WebRTC encode + thread interference;
|
| 56 |
+
(c) the concept's speculative dispatch at ~600ms silence (overlaps agent
|
| 57 |
+
response with utterance tail) β the largest structural win for turn-2+,
|
| 58 |
+
but a bigger build.
|
| 59 |
|
| 60 |
The tables below are the original design targets, kept for reference.
|
| 61 |
|
| 62 |
+
## Budget (from the concept package; measured results above)
|
| 63 |
|
| 64 |
+
These are the *targets* the MVP slice was designed against; the MEASURED
|
| 65 |
+
section above is the current scorecard against them.
|
|
|
|
| 66 |
|
| 67 |
| Stage | Local CPU-only | Local + GPU/ANE | Pika (published) |
|
| 68 |
|---|---|---|---|
|