diff --git a/backend/routers/voice.py b/backend/routers/voice.py index 2ce0980..211de16 100644 --- a/backend/routers/voice.py +++ b/backend/routers/voice.py @@ -223,6 +223,7 @@ async def voice_chat(body: ChatIn) -> StreamingResponse: async def gen(): t0 = time.perf_counter() first = True + first_content = True try: async with httpx.AsyncClient(timeout=httpx.Timeout(None, connect=5.0)) as client: async with client.stream( @@ -233,9 +234,14 @@ async def voice_chat(body: ChatIn) -> StreamingResponse: yield f"data: {{\"error\": \"Hermes {r.status_code}: {detail}\"}}\n\n".encode() return async for chunk in r.aiter_raw(): - if first: # Time-To-First-Byte des Hermes-Streams (gefühlte Lucy-Latenz) + if first: # Time-To-First-Byte des Hermes-Streams (Verbindungs-Overhead) record_stage("chat_ttfb", (time.perf_counter() - t0) * 1000.0) first = False + # Erster CONTENT-Delta = echte Hirn-Latenz (Agent-Overhead + LLM-TTFT) — + # chat_ttfb misst nur den SSE-Start (~5 ms) und ist dafür blind. + if first_content and b'"content"' in chunk: + record_stage("chat_first_content", (time.perf_counter() - t0) * 1000.0) + first_content = False yield chunk except httpx.HTTPError as exc: yield f"data: {{\"error\": \"Verbindung zu Hermes fehlgeschlagen: {exc}\"}}\n\n".encode() diff --git a/deploy/llama-swap.config.yaml b/deploy/llama-swap.config.yaml index 67f3c93..d7ca508 100644 --- a/deploy/llama-swap.config.yaml +++ b/deploy/llama-swap.config.yaml @@ -5,7 +5,7 @@ globalTTL: 0 models: Qwen3.6-35B-A3B: cmd: | - llama-server -m /srv/models/Qwen3.6-35B-A3B-MTP-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_M.gguf --host 127.0.0.1 --port ${PORT} -c 65536 -ngl 999 -fa on --no-mmap --jinja --parallel 1 -cram 16384 --spec-type draft-mtp --spec-draft-n-max 3 + llama-server -m /srv/models/Qwen3.6-35B-A3B-MTP-GGUF/Qwen3.6-35B-A3B-UD-Q4_K_M.gguf --host 127.0.0.1 --port ${PORT} -c 65536 -ngl 999 -fa on --no-mmap --jinja --parallel 1 -cram 16384 -ctk q8_0 -ctv q8_0 --spec-type draft-mtp --spec-draft-n-max 3 ttl: 0 aliases: - hermes diff --git a/docs/REVIEW_2026-07-02.md b/docs/REVIEW_2026-07-02.md index 9dd84ba..d3f61fe 100644 --- a/docs/REVIEW_2026-07-02.md +++ b/docs/REVIEW_2026-07-02.md @@ -218,4 +218,30 @@ Quelle: `/api/voice/metrics` (live) + eigener TTFT-Test gegen llama-swap. --- +## 6. Nachtrag: P0/P1-Umsetzung (02.07.2026) + +**P0 komplett:** chat-Lane gefixt (fast-Alias), Hermes v0.18.0 (Postcheck grün), Config versioniert, Template-Drift behoben, Git aufgeräumt. B1 war Fehlalarm (s.o.). + +**P1-6 STT:** Parakeet-TDT 0.6B v3 (onnx-asr, int8, Box-CPU) als Default — **A/B gemessen: 0,45 s vs. 2,44 s** (whisper-medium) bei identischem Transkript. Live deployt, auch via :9001 verifiziert. + +**P1-7 VAD:** Silero v5 (vad-web 0.0.30) statt RMS — Endpointing 900→450 ms, WAV direkt (kein Opus-Umweg mehr). Build + Asset-Auslieferung verifiziert; Mikro-Test beim User. + +**P1-9 Brain-Bench-Matrix** (Qwen3.6-35B-A3B, separater Port, Vulkan, je ~100 Gen-Token): + +| Config | tg kurz | tg tief (15k) | Draft-Akzeptanz kurz | +|---|---|---|---| +| MTP n-max 3, KV f16 (live) | **78,6 t/s** | — (Probe-EOS) | 55 % | +| MTP n-max 4 | 63,7 | 100,9* | 39 % | +| ohne Spec | 62,4 | — (Probe-EOS) | — | +| **MTP n-max 3 + KV Q8_0** | **78,6** | 83,7 | 56 % | +| ohne Spec + KV Q8_0 | 62,1 | 57,0 | — | + +*\*repetitiver Test-Text → unrealistisch hohe Draft-Akzeptanz (95 %); die Kurz-Spalte ist maßgeblich.* + +**Bench-Verdikte:** (1) MTP n-max 3 bestätigt (+26 % vs. ohne Spec — die „MoE Speculative Trap" gilt auf diesem Vulkan/parallel-1-Setup NICHT; der Artikel testete ROCm + parallel 4). (2) n-max 4 lohnt nicht (Akzeptanz fällt auf 39 %). (3) **KV Q8_0 ist gratis** (identische t/s) und halbiert den KV-Speicher → für hermes in deploy/llama-swap.config.yaml übernommen; Live-Schaltung braucht User-Freigabe. Für coder/heavy vorher cache-reuse×KV-Quant-Verträglichkeit testen (Context-Shift mit quantisiertem KV ist in llama.cpp historisch heikel). + +**P1-10:** `chat_first_content`-Metrik in voice.py — misst die echte Hirn-Latenz (Agent-Overhead + LLM-TTFT bis zum ersten Inhalts-Token) statt nur des SSE-Starts. + +--- + *Erhoben am 02.07.2026 durch Claude Code (Live-SSH auf Box, lokale PC-Prüfung, 3 Codebase-Agents, 3 Web-Recherche-Runden). Messwerte: /api/voice/metrics (n=13 STT, n=18 chat_ttfb), TTFT-Direktmessung llama-swap :8080.*