Latency budget + benchmark plan
Browse files- docs/LATENCY.md +64 -0
docs/LATENCY.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LATENCY β benchmarking methods & budget tables
|
| 2 |
+
|
| 3 |
+
## Budget (from the concept package, to be measured β not yet achieved)
|
| 4 |
+
|
| 5 |
+
These are the *targets* the MVP slice is designed against. Nothing in this
|
| 6 |
+
repo has been benchmarked yet; the harness below is how every number gets
|
| 7 |
+
produced and re-produced.
|
| 8 |
+
|
| 9 |
+
| Stage | Local CPU-only | Local + GPU/ANE | Pika (published) |
|
| 10 |
+
|---|---|---|---|
|
| 11 |
+
| ASR finalize | 400β700ms | 150β250ms | β |
|
| 12 |
+
| Agent first token | 300β900ms | 150β400ms | β |
|
| 13 |
+
| TTS first chunk | 200β400ms | 80β150ms | β |
|
| 14 |
+
| Avatar render | 500β900ms | 200β350ms | β |
|
| 15 |
+
| **Perceived turn** | **~2.5β4.5s** | **~1.2β2.0s** | **~1.5s** |
|
| 16 |
+
|
| 17 |
+
## The mitigations that make 2.5s feel like 1.5s
|
| 18 |
+
|
| 19 |
+
1. **Speculative dispatch at ~600ms of silence** β partial ASR transcripts
|
| 20 |
+
go to the agent before the utterance finalizes; resumed speech cancels
|
| 21 |
+
the generation. Saves 200β600ms.
|
| 22 |
+
2. **Sentence-level pre-roll** β the agent's first sentence starts TTS
|
| 23 |
+
while later sentences are still generating. Saves one TTS round-trip.
|
| 24 |
+
3. **Lead-out motion** β avatar mouth motion starts ~150ms before audio
|
| 25 |
+
playout, perceptually erasing the render handshake.
|
| 26 |
+
4. **Cached identity** β avatar/voice assets are loaded and warmed at
|
| 27 |
+
session start, never per turn.
|
| 28 |
+
|
| 29 |
+
## Fidelity ladder rungs & FPS targets
|
| 30 |
+
|
| 31 |
+
| Rung | Name | Target FPS | Host |
|
| 32 |
+
|---|---|---|---|
|
| 33 |
+
| 4 | FULL_PORTRAIT | 20β24 | GPU / Apple ANE |
|
| 34 |
+
| 3 | VISEME_STILL | β₯15 (MVP) | CPU |
|
| 35 |
+
| 2 | AUDIO_REACTIVE_WAVE | β₯10 | CPU (weak) |
|
| 36 |
+
| 1 | STATIC_CARD | n/a | anything |
|
| 37 |
+
|
| 38 |
+
Rung selection is `select_rung()` at join time; runtime degradation
|
| 39 |
+
triggers when measured FPS < target for 5 consecutive seconds (event:
|
| 40 |
+
`persona.rung_change`).
|
| 41 |
+
|
| 42 |
+
## Benchmark harness (MVP acceptance)
|
| 43 |
+
|
| 44 |
+
`python benchmarks/turn_latency.py` (lands with the MVP slice) measures,
|
| 45 |
+
per turn over β₯50 synthetic Q&A turns:
|
| 46 |
+
|
| 47 |
+
- `t_asr_final`: speech-end β final transcript
|
| 48 |
+
- `t_first_token`: transcript β agent first sentence
|
| 49 |
+
- `t_tts_chunk`: sentence β first audio chunk
|
| 50 |
+
- `t_avatar_frame`: audio chunk β first frame on the virtual camera
|
| 51 |
+
- `t_perceived`: speech-end β first audible+visible output
|
| 52 |
+
|
| 53 |
+
Win condition from the concept: **agent joins, answers within 4s with a
|
| 54 |
+
moving mouth, leaves, and produces a valid replay log** β i.e.
|
| 55 |
+
`t_perceived` p50 < 4.0s on CPU at rung 3, and
|
| 56 |
+
`EventLog(...).verify() == (True, None)`.
|
| 57 |
+
|
| 58 |
+
## Reporting rules
|
| 59 |
+
|
| 60 |
+
- Report p50/p95, machine, and library versions with every number.
|
| 61 |
+
- Faster-whisper int8, Piper medium voices; note thread counts.
|
| 62 |
+
- If FULL_PORTRAIT can't hold 20 FPS on Apple Silicon, video becomes a
|
| 63 |
+
cloud-burst feature and rung 3 becomes the local ceiling β that is a
|
| 64 |
+
finding to report, not a failure to hide.
|