Skip to content

Conversation

@toubatbrian
Copy link
Contributor

Fixes two bugs in the Silero VAD ONNX model wrapper that caused the RNN state to never be updated between inference calls:

  1. Wrong output key: The ONNX model outputs the state as stateN, not state. The state was being read from the wrong key and never stored.

  2. Wrong context slice: Audio context was taken from the beginning of the input buffer instead of the end, breaking audio continuity between chunks.

Before

  • RNN state remained at initial zeros forever
  • Each inference ran without temporal context
  • VAD accuracy degraded, especially for speech boundary detection

After

  • RNN state properly persists across inference calls
  • Model maintains temporal memory for accurate speech detection

Mirrors fix from Python SDK: livekit/agents#4437

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2026

🦋 Changeset detected

Latest commit: 85009db

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-rime Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-xai Patch
@livekit/agents-plugins-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@toubatbrian toubatbrian requested a review from theomonnom January 6, 2026 08:51
@toubatbrian toubatbrian changed the title fix(silero): persist RNN state between VAD inference calls fix(silero): Persist RNN state between VAD inference calls Jan 6, 2026
@toubatbrian toubatbrian merged commit d51c5c6 into main Jan 7, 2026
8 checks passed
@toubatbrian toubatbrian deleted the brian/fix-silero-vad-state branch January 7, 2026 07:30
@github-actions github-actions bot mentioned this pull request Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants