Files
rag-technical-docs-assistant/docs/evaluation/local-s2s/responsive-candidate-20261017.md
T
amirhosein mazaheri 628aec8def feat(voice): implement local S2S responsiveness candidate and direct TTS routing
Add local S2S responsiveness candidate pinning ASR options and sentence-at-a-time generation. Route speech synthesis directly to OpenAI API for fluent Persian phonetics with gpt-4o-mini-tts-2025-12-15. Add responsiveness, budget carry, and browser watch unit tests along with acceptance benchmarks and evaluation evidence.
2026-10-17 13:02:41 +03:30

5.9 KiB

Isolated responsiveness candidate ? 2026-10-17

Status: implemented and live for human comparison; ASR/latency improvement not accepted. User requested fixes after two real short-utterance transcription errors and server speech-start-to-audio delays5.6?10.5s. This candidate does not claim those errors are resolved without new real audio.

Changes

LOCAL_S2S_RESPONSIVE=true opts into a separate frozen local profile; defaultfalse preserves old profiles. The LLM emits each complete sentence instead of waiting for3. Actual initialized handler attestation checks the applied value, and the profile digest/patch revision rag-local-s2s-responsive-v1 distinguish old reservations. No old execution profile is rewritten.

ASR uses temperature0 and a generic conversational Persian transcription hint; neither known test utterance is embedded and returned transcripts are not rewritten. Native setup applies settings before warmup. The gateway preserves exact WAV bytes while translating multipart into documented JSON input_audio and provider.options.groq.prompt; fa stays explicit. OpenRouter documents plain multipart prompt as accepted but ignored and documents provider-specific options here: STT contract. The hint applies only when Groq serves the request; other routes still receive explicit language and temperature. No unsupported latency routing preference is claimed.

The gateway records numeric component header/first-body times without text, audio or keys, to separate provider delay from pipeline delay. Existing HTTP PCM streaming is retained; openai_tts_stream remainsfalse because its upstream flag is not a general HTTP-streaming switch. PCM format, audio speed, playback/queue capacity, silence/padding settings, models/voices and retained-answer policy remain unchanged. Smaller sentence requests may increase TTS call counts; budget caps still apply.

Validation

-157 focused unit tests passed in8.51s: wire bytes/options, applied policy/attestation, profile mismatch, cancellation/history, budget/supervisor and baseline behavior. -3 PostgreSQL profile/replay/revocation tests passed in6.72s, zero skips, --require-postgres on a fresh dedicated tmpfs PostgreSQL. Owned container removed; operational and browser DB unchanged. Responsive and baseline reservations both pin original profiles on replay. -COPY-only image sha256:ddbb90366f19f8077b1cb40a77e529393459485fb8ae0cb9d074ffea641c265f, verified parent 66aceba8e58a; no dependencies downloaded/changed and private inputs excluded from context. -Actual pinned native engine with real assets, networknone and fixture provider I/O passed. Final stricter18.272s run supplies only one complete sentence and holds generation open; audio arrives before completion, active cancellation/retained drafts/next generation and stale-output exclusion pass. Client error null; cleanup/pending zero, paid calls0. Controlled duration is not a Persian latency benchmark. -Actual candidate startup24.639s; STT/LLM/TTS probes all200. Authenticated proxied session_ready and closed/user_requested pass; connection check did not increase inference count. This proves setup/probe compatibility, not human accuracy or quality. -Initial local test runs exposed a Windows BOM decoding issue in the edited engine file and a missing RuntimeSettings argument in the new test; both corrected before the passing runs. No assertion weakened.

Live handoff and budget

Browser http://127.0.0.2:4201/login, same private account/password and ?????? ?????. API and engine use the new image and responsive flag in the isolated stack. Memory prevention remains OFF per user; Docker3GiB/no-swap, deadlines and30minute expiry remain. Nominal expiry (Tehran): 2026-10-17T11:01:18.153111+03:30.

New exclusive directory .local-s2s-build/windows-responsive-paid-01 carries both previous local ledgers and exact-ID receipts in order. All prior$0.710884452 exposure remains accounted. Current reserve $0.769884452, maximum $0.981884452, below the original$1 total. Limits:4 STT,4 LLM,5 TTS attempts including startup. Extra TTS allowance covers sentence splitting; no unrestricted OpenAI. Failed/unknown attempts keep reserves, partial or discontinuous billing chains fail closed, old ledgers remain unchanged. No automatic restart.

Human next: repeat the same short Persian utterances, listen to response onset and interrupt/request the same answer. Exact acoustic timing needs browser/capture measurements; server timing alone excludes the final audible-output path. Same-answer compliance and factual RAG remain pending. Sanitized actual results.

Human retest: latency still high, evaluation quota failure

User reports high latency persists and supplied browser error LIVE_PROVIDER_UNAVAILABLE for session e67dea1c-74bc-427e-8143-8187546e7cd3. Exact evaluation ledger denial: speech attempt_limit,5 admitted. Sentence splitting increased TTS calls; the sixth speech call was refused before provider I/O.13 admitted requests all returned200 (4STT,4LLM,5TTS); reserved exposure$0.981884452 held pending billing. This is an evaluation quota failure, not proof of provider outage or a successful repair. Engine stopped; UI/API remain available. No new inference during diagnosis.

Measured user-request component first-body delays: STT2046/1553/2058ms; LLM765/768/767ms; TTS2491/1578/2036/3741ms. These server timings exclude user speech and final browser audible onset. Sentence-at-a-time alone has not established acceptable end-to-end latency. Do not repeat this capped handoff or claim the latency fix accepted. Next funded evaluation must account for per-answer sentence/TTS calls before admitting generation, or use a deliberately bounded small scenario after exact bill reconciliation. Budget stays$1; memory prevention staysoff.

User explicitly asks to minimize coding quota consumption: keep follow-up investigation/changes narrowly targeted, avoid broad test/build/document churn.