Lessons learned
One entry per pitfall met while building the voice assistant: what it looked like, why it happened, how it was found, what fixed it, and what now guards against a repeat.
Wake word: the server's features are not the training features
- Symptom: offline scores of a custom openWakeWord model disagreed with the server for the same clip, from 0.004 to 0.96. Model selection and threshold estimates based on them were wrong in both directions.
- Root cause: openWakeWord's
melspectrogrammodel ends with aReduceMaxover its whole input tensor and clamps the log-mel at max - 80 dB. The server (wyoming-openwakeword2.x, pyopen-wakeword) calls it on one 1760-sample chunk at a time, so the floor is set per 80 ms. Batch extraction (AudioFeatures.embed_clips, used for training and typical offline evaluation) sets the floor from the loudest sample of the whole batch. - How detected: clip-by-clip comparison of the batched path against pyopen-wakeword streaming
showed agreement for some voices and large gaps for others. A per-chunk TFLite run matched the
server exactly, and the ONNX graph showed the
ReduceMax. - Fix:
scripts/voice-assistant/wakeword/stream_mel.pymakes the max per batch row.fast_eval.py embed --stream-onnxthen feeds the server's 1760-sample chunks with its frame and window bookkeeping. This matches streaming to 0.032 in the embeddings and 0.002 in the score. - Guard:
scripts/voice-assistant/wakeword/test_server_exact_features.pychecks streaming against batched (tolerance 0.05) and that plain batch features differ.fast_report.pyrefuses embeddings not taggedserver-exact. Details: kivi wake word, Pitfalls.
Wake word: default augmentation buries a short word
- Symptom: with the official openWakeWord recipe (
train.py,auto_train), every "kivi" model collapsed to 2-9 % recall, even on its own training positives. - Root cause:
augment_clipsmixes background at -10 to +15 dB SNR computed over the whole 2 s padded window. For a 0.45 s word, many positives end up at or below 0 dB on the word.auto_trainthen raises the negative weight to 1500x or more, which pushes every output down. - How detected: ablations on cached features. A plain classifier on clean positives reached 98 % held-out recall at about 1 false window per hour, on noisy positives 43 %, and with the near-word negatives 15 %. The word-to-background amplitude ratio of augmented positives was 1.0 to 2.4.
- Fix: augment with the SNR measured against the word (5 to 30 dB). Train the same DNN head
with a fixed small negative weight and mined hard negatives (
augment_set.py --mode simple,train_simple.py,fast_eval.py mine). - Guard: the training history logs validation recall at fixed false accepts. kivi wake word, Training records the choice.
Wake word: digital silence in the evaluation clips decides which model wins
- Symptom: models trained on server-exact features (the "cheapest next step" of v1) scored far below v1 on v1's held-out clips (clean recall 0.1 to 23 % against 67 % at the same false accepts on MLS dev), whatever the negatives were. One of them reached 99.5 % on the same clips once they had a noise floor.
- Root cause: v1's evaluation clips (and v1's long-audio pads) contain exact zeros around the word. The server clamps the log-mel per 80 ms chunk at max - 80 dB, so an all-zero chunk gives features that no real microphone produces (the satellites' quietest 80 ms frames are -75 to -50 dBFS after the front-end). A model that never saw digital silence misfires on it; v1 was trained with batch features, where zeros are clamped against the loud part of the batch, and happens to cope. The test measured the padding, not the word.
- How detected: the same candidate scored 35/1 800 on the zero-padded clips and 1 791/1 800
on the same clips with a -62 to -48 dBFS white floor through the front-end
(
v2_augment.py eval). - Fix: every v2 training and evaluation clip carries a mic floor calibrated on real satellite audio and goes through the satellite front-end; v1 and v2 are compared on those features. v1's zero-padded set is still reported, labelled as such.
- Guard:
v2_augment.pyadds the floor by default; its docstring explains why.
Wake word: the server-exact training window cut the end of the word
- Symptom: part of the same v2 shortfall; positives were labelled on a window that did not contain the whole word.
- Root cause:
augment_set.py --stream-onnxplaces the word end 0-200 ms before the end of a 40 960-sample window, but the last of the 16 server embeddings only sees audio up to sample 39 360 (31 whole 1 280-sample chunks, the last embedding ending 4 mel frames before the chunk end). About half of the positives lost up to 100 ms of the final vowel. - How detected: a 10 ms noise burst moved along the window changes the last embedding only
up to sample 39 360 (
v2diagnosticdiag_rf.py). - Fix:
v2_augment.py trainuses a 40 160-sample window and puts the word end 0-200 ms before sample 39 280. - Guard: the constants
TOTALandLAST_AUDIOinv2_augment.py, with the measurement in their comment.
Whisper: --debug logs the whole argument namespace, including the Home Assistant token
- Symptom: none yet. Found while designing how to log transcripts for the usage study.
- Root cause:
wyoming-faster-whisperprints its parsed argument namespace at DEBUG, and--debugturns DEBUG on for every library. With--hass-tokenread fromWYO_WHISPER_HASS_TOKEN_FILE, the namespace carries the Home Assistant token (an administrator token: Home Assistant tokens have no scopes), and it would reach the pod log and Loki. - How detected: reading the server source and the first canary design, which suggested
--debugto see the composed prompt and transcripts. - Fix: never run the production pod with
--debug. The transcript logger is lowered to DEBUG on its own, fromapps/home-assistant/config/whisper-logging/sitecustomize.py(loaded throughPYTHONPATH): root logger at INFO, onlywyoming_faster_whisper.dispatch_handlerat DEBUG. - Guard: the per-logger
sitecustomize.pyis the only way DEBUG is enabled; its header says why. whisper-image-build.md and the log policy forbid pasting--debugoutput.
Whisper: wyoming-faster-whisper 3.8.1 renamed the transcript logger, which silently broke the Vector drop regex
- Symptom: none visible. The Vector rule that drops voice transcripts before Loki stopped
matching after the 3.8.1 image: a regex written for
INFO:wyoming_faster_whisper.handler:no longer matched the new line, so the filter would have let transcripts through without any error. - Root cause: 3.8.1 logs the transcript from
dispatch_handler.pyasDEBUG:wyoming_faster_whisper.dispatch_handler:<text>(2.x:INFO:...handler:<text>). The filter matched onlyhandler. - How detected: reading the 3.8.1 source while preparing the image, before the cutover.
- Fix: the
drop_voice_transcriptscondition insystem/loki/vector-agent.yamlis now^(INFO|DEBUG):wyoming_faster_whisper\.(dispatch_)?handler:. - Guard: the Vector unit tests in the same file
(
whisper_transcript_line_is_dropped,whisper_debug_transcript_line_is_dropped,whisper_dispatch_handler_transcript_line_is_dropped) cover the three line shapes with synthetic text. Runvector testafter any Whisper version change. A logger rename is a privacy change.
STT: GTX 1060 (sm_61) offers only float32, int8 and int8_float32 in CTranslate2
- Symptom:
large-v3-turbodoes not fit or does not run fast with the usual precisions. - Root cause: on Pascal
sm_61CTranslate2 lists onlyfloat32,int8andint8_float32as supported compute types (no usablefloat16). float32large-v3-turbodoes not fit in the card's 3 GB next to the display and other users (about 1.1 GiB is used by the int8 model). - How detected:
ctranslate2.get_supported_compute_types("cuda")on the target card and the documented CTranslate2 quantisation table; VRAM read from the GPU exporter. - Fix: run
--compute-type int8(executed asint8_float32). The same limit makes small fp16 models slow on this card; the decision-model study ran fp32. - Guard: the canary step in whisper-image-build.md prints the supported compute types and fails on CUDA kernel errors before the real STT is touched, and the registry records the precision of every model.
Home Assistant: assist_pipeline: debug_recording_dir records continuous room audio with no cap or expiry
- Symptom: none yet; found while enabling request audio for Whisper fine-tuning and front-end work.
- Root cause: with a server-side wake word every pipeline run starts at the wake word stage, so the debug recording writes every chunk the satellites stream, continuously (about 115 MB per listening hour per satellite), not just the speech after a wake. Home Assistant has no size limit or expiry for that directory.
- How detected: reading the
assist_pipelinedebug recording code and the run layout (00_wake-*.wav,01_stt-*.wav). - Fix: a dedicated 500 GiB volume outside
/configand/media, enabled only on the owner's approval, with a daily cleanup. - Guard: the CronJob
home-assistant-voice-recordings-cleanup(90 days from the last write, oldest runs first above 90 % use) and rows 5 and 6 of the data register, which state what is recorded and who may read it.
Home Assistant: .storage/homeassistant.exposed_entities shows only manual overrides
- Symptom: reading the file suggested 0 entities were exposed to Assist, when 113 were.
- Root cause: the file stores only manual exposure overrides; entities exposed by default are not listed.
- How detected: the count differed from the websocket answer.
- Fix: use the websocket command
homeassistant/expose_entity/list, as Whisper's name list and the analysis scripts do (it needs an administrator token). - Guard: STT hint list names the websocket call as the source
of exposed entities; never infer exposure from
.storage.
Whisper logs: most DEBUG lines are "Sent info" replies, not voice traffic
- Symptom: about 90 % of the Whisper DEBUG lines looked like activity, so request counts from line counts were far too high.
- Root cause: Home Assistant polls the server with a Wyoming
describerequest regularly, and each reply logs "Sent info". - How detected: counting line kinds in the pod log (counts only, no text read).
- Fix: count requests with the "Audio stopped" line, one per utterance.
- Guard: the analysis scripts count "Audio stopped", and the data register describes the stream's contents so counts are not taken from raw line totals.
Forgejo: building and pushing the Whisper image
- Symptom: four separate failures in the first runs of the image workflow in
agil/wyoming-whisper. - Root cause and fix:
- Repository secret names cannot start with
FORGEJO_(reserved prefix), so the plannedFORGEJO_PACKAGES_PATwas rejected. Use another prefix. - The automatic Actions token cannot push packages. A dedicated personal access token with only
write:packageis needed; it is created and set by the owner and kept inpass. - The 1.64 GB layer push timed out. The push step needs a retry loop.
- The package cleanup rule (keep the last 3 versions) can only be set in the web UI, not by API.
- How detected: failed workflow runs and the registry responses.
- Guard: the workflow in the image repository carries the retry loop, the owner's checklist in
whisper-image-build.md lists the token and the UI-only rule, and the
image is pinned by digest in
apps/home-assistant/values.yaml.
Workstation: load stalls evaluations and a broad pkill killed other sessions' workers
- Symptom: evaluation runs slowed to a crawl and timed out, and a cleanup killed Python workers that belonged to other sessions.
- Root cause: the workstation is shared by several sessions. Under load (average 100 to 200)
CPU-heavy evaluations stall, and a
pkillwith a generic pattern matches every Python worker, not just the caller's. - How detected: load average and the other sessions' runs failing at the same moment.
- Fix: cap the worker count of every evaluation, and stop jobs by PID or process group only.
- Guard: rule for all sessions: never use a generic
pkill/killallpattern. Start long jobs in their own process group and record the PID, so cleanup targets only that group.
Whisper: the GTX 1060 cannot host a second Whisper instance
- Symptom: during a Whisper settings benchmark (2026-11-05, 18:45-18:53 UTC), live STT requests failed with CUDA out of memory and then "invalid device ordinal"; 67 of about 190 live requests took more than 5 s (up to 47 s) instead of about 0.9 s. A live AEC experiment on a TV was running at the same time and its transcript-based results were contaminated.
- Root cause: the benchmark assumed the live Whisper was idle and that a second large-v3-turbo int8 instance (peak about 1.8 GiB) fits next to the live one (about 1.1 GiB) on the 3 GiB card. The card reached 2967 of 3072 MiB, and the live service was not idle.
- How detected: the live Whisper log showed the CUDA errors; request latencies were split by
overlap with the benchmark using log timestamps only (
whisper_bench/live_overlap.py). - Fix: the benchmark pod was deleted; the live service recovered without a restart.
- Guard: never run a second GPU model on the 1060 while the live service runs. Benchmark on the workstation GPU for accuracy, or schedule a short announced outage (live Whisper scaled to 0) for 1060 latency numbers, and check that no live experiment is using voice at the time.
Wake word: fetching a licence-restricted model with an ad-hoc token and bot user
- Symptom: the first kivi deployment (2026-11-05) fetched
kivi.tflitefrom the private repository withcurlin an init container. It needed a dedicated Forgejo bot user, aread:repositorytoken, a Vault entry, an ExternalSecret and a PVC cache so that restarts did not depend on Forgejo. The owner called it a workaround; the bot and the Vault entry were removed the same evening. - Root cause: the model was treated as a file to download, not as an artifact to ship. The
cluster already pulls private images from
git.grigri.cloudwith the nodes' containerd credential (metal/roles/k3s/templates/host.toml.j2), so an image needs no new credential at all. - Second pitfall found on the way: a Forgejo package takes the visibility of its owner, not
of its repository. While the user
agilwas public,git.grigri.cloud/agil/<name>images could be pulled anonymously even when the repository was private (checked: an anonymous pull ofagil/wyoming-whisperresolved). The owner setagilto "limited" on 2026-11-05; since then anonymous pulls of its packages are refused. A detour through a private organisation is not needed. - How detected: owner review of the first design; the anonymous pull test before publishing the model image.
- Fix: the model is published as a private image
git.grigri.cloud/agil/kivi-models:<version>, linked to the repository and built by its workflow on a version tag, pinned by tag and digest in GitOps; an init container copies it into anemptyDir. No token, Vault entry, bot or PVC. - Guard: prefer a private image pulled with the existing node credential for any
licence-restricted file the cluster needs. Keep the owner
agillimited (or private) and check an anonymous pull is refused after every release (theagil/kivi-modelsREADME says so).
Wake word: indexing an .npz inside a loop re-reads the whole array and ran out of memory
- Symptom: the first Kivi v3 feature job was killed about 30 s after it started, with no
Python error in its log. The user journal showed
The kernel OOM killer killed some processes in this unitfor thesystemd-runscope (20 GB cap, 20 GB peak). - Root cause:
np.load("takes.npz")returns anNpzFile, and eachT["audio"][i]decompresses the whole 27 MB array again. The slice is a view, so every one of the 16 600 augmentation items kept its own full copy alive. - How detected:
journalctl --userfor the scope (Failed with result 'oom-kill'), then the oneT["audio"][i]per item in the list comprehension. - Fix: load the arrays once (
{k: v.copy() for k, v in np.load(...).items()}) and copy each take out. - Guard: the comment on that line in
v3_real.py feats. Jobs run underMemoryMax, so a repeat stops the job, not the shared workstation.