openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Evaluate and harden anti-hallucination improvements for voice transcription

Open Al629176 opened this issue 7 months ago • 5 comments

Summary

Review external proposal to reduce voice transcription hallucinations and decide on safe integration approach.

Scope

  • Evaluate technical impact on transcription quality.
  • Perform dependency/security risk review for third-party components.
  • Decide: adopt, adapt, or reject with rationale.

Acceptance Criteria

  • Written recommendation with risk/benefit analysis.
  • Security concerns documented for any external dependency.
  • If approved, implementation plan and test strategy included.

Al629176 avatar Apr 13 '26 08:04 Al629176

voice transcription hallucinations are the worst failure mode because they produce confident-sounding garbage that downstream systems treat as real input. the biggest source in our experience is silence and background noise at the start/end of recordings. whisper in particular loves to hallucinate repeated phrases or common sentences (like 'thank you for watching') when it gets low-signal audio. the most effective mitigation we found was a VAD (voice activity detection) pre-filter that trims silence before sending audio to the model, combined with a confidence threshold on the output. if the average log probability per token drops below a threshold (we use -1.0), we reject the entire transcription instead of passing garbage downstream. also worth checking if any third-party components introduce their own audio preprocessing that might amplify the problem.

m13v avatar Apr 13 '26 17:04 m13v

our transcription service with VAD pre-filtering, confidence thresholds, and the hallucination rejection logic: https://github.com/m13v/fazm/blob/main/Desktop/Sources/TranscriptionService.swift

fazm is an open source macOS AI agent that uses voice as the primary input, so transcription accuracy is critical for the entire interaction chain.

m13v avatar Apr 13 '26 17:04 m13v

nice try fucking bot

senamakel avatar Apr 13 '26 21:04 senamakel

Evaluation & Recommendation

Investigated the external proposal (m13v/fazm TranscriptionService.swift) and our current anti-hallucination stack. Verdict: no new dependencies or techniques needed — our existing defenses plus PR #556 cover everything the proposal suggests and more.

External proposal analysis

The linked fazm TranscriptionService uses DeepGram's cloud API with built-in VAD (vad_events: true, endpointing: 300). It does not implement local VAD or post-transcription hallucination filtering — it delegates entirely to DeepGram. This is not applicable to our local Whisper pipeline.

The two concrete suggestions from the comments were:

  1. "Add VAD gate before Whisper" — we already have real-time silence gating (SilenceGate in audio_capture.rs, RMS threshold + 500ms gate) on the desktop dictation path, and the chat voice path uses browser MediaRecorder which is human-gated (user presses start/stop)
  2. "Set no_speech_threshold to 0.6 and temperature to 0.0" — we already do both in whisper_engine.rs

What we already have (defense-in-depth)

Layer Location Technique
Real-time silence gate audio_capture.rs RMS-based, 500ms threshold, 100ms look-ahead
Peak RMS pre-check server.rs Rejects fully-silent recordings before Whisper
Whisper built-in whisper_engine.rs no_speech_thold=0.6, entropy_thold=2.4, logprob_thold=-1.0, temperature=0.0, suppress_nst, suppress_blank, single_segment
Per-segment confidence whisper_engine.rs SEGMENT_LOGPROB_REJECT=-0.7 — stricter than whisper.cpp default
Post-transcription filter hallucination.rs (PR #556) Pattern matching, punctuation-aware repetition, dominant-word ratio

What PR #556 added

  • Shared hallucination.rs module with improved detector (catches "it... it... it..." and ratio-based patterns)
  • Applied filter to the chat voice path (ops.rs) which previously had zero hallucination filtering
  • 14 unit tests

VAD for chat voice path — not recommended

Adding a separate VAD layer to the chat voice path would mean decoding compressed audio (webm/opus → PCM) just to compute energy, adding latency for marginal gain. The browser's MediaRecorder is already human-gated, and the Whisper-level + post-transcription defenses handle the rest.

Security review

No new external dependencies introduced. All filtering is pure Rust string processing in the existing crate.

Conclusion

Closing as resolved by #556. If hallucination reports persist after that PR ships, the minimal next step would be a total-energy check on raw audio bytes before Whisper (not full VAD) — but we don't expect to need it.

oxoxDev avatar Apr 14 '26 09:04 oxoxDev

Resolved by #556 — see evaluation above.

oxoxDev avatar Apr 14 '26 09:04 oxoxDev