silero: VAD.update_options(activation_threshold=...) keeps the old deactivation_threshold, so it disagrees with VAD.load
Bug Description
silero.VAD.load(activation_threshold=x) sets deactivation_threshold to max(x - 0.15, 0.01) when the caller does not pass one:
https://github.com/livekit/agents/blob/e684c2379e1c385afe8edcd1f02ea422051b035f/livekit-plugins/livekit-plugins-silero/livekit/plugins/silero/vad.py#L131-L141
VAD.update_options(activation_threshold=x) only replaces activation_threshold. It keeps the deactivation_threshold that was derived from the old activation threshold:
https://github.com/livekit/agents/blob/e684c2379e1c385afe8edcd1f02ea422051b035f/livekit-plugins/livekit-plugins-silero/livekit/plugins/silero/vad.py#L209-L212
VADStream.update_options does the same for open streams (L274-L277 in the same file).
So the same options give two different VADs, depending on whether they were passed to load or to update_options. With the defaults (activation_threshold=0.5, so deactivation_threshold=0.35):
update_options(activation_threshold=0.7)gives a deactivation threshold of 0.35.load(activation_threshold=0.7)gives 0.55. Speech ends later than configured, because a speaking frame stays speech whilep > 0.35(L518-L519).update_options(activation_threshold=0.2)gives a deactivation threshold of 0.35, which is above the activation threshold. The exit threshold then has no effect.
The bundled livekit.agents.inference.VAD copied the same update_options, so it has the same bug:
https://github.com/livekit/agents/blob/e684c2379e1c385afe8edcd1f02ea422051b035f/livekit-agents/livekit/agents/inference/vad.py#L84-L86 (constructor) and
https://github.com/livekit/agents/blob/e684c2379e1c385afe8edcd1f02ea422051b035f/livekit-agents/livekit/agents/inference/vad.py#L126-L129 (update_options).
The update_options docstring does not document deactivation_threshold or say that it is not re-derived.
Expected Behavior
VAD.load(activation_threshold=0.7) and VAD.load() followed by update_options(activation_threshold=0.7) give the same deactivation_threshold (0.55). A deactivation_threshold that the caller set explicitly stays as set.
Reproduction Steps
1. Save the script below as repro.py.
2. uv run --no-project --with 'livekit-plugins-silero==1.8.4' python repro.py
3. Compare the deactivation threshold after load and after update_options.
# repro.py
import asyncio
from importlib.metadata import version
from livekit.agents import inference
from livekit.plugins import silero
def thresholds(vad):
return vad._opts.activation_threshold, vad._opts.deactivation_threshold
print("livekit-plugins-silero", version("livekit-plugins-silero"), "livekit-agents", version("livekit-agents"))
direct = silero.VAD.load(activation_threshold=0.7)
updated = silero.VAD.load()
updated.update_options(activation_threshold=0.7)
print("silero.VAD.load(activation_threshold=0.7) ->", thresholds(direct))
print("silero.VAD.load() + update_options(act=0.7) ->", thresholds(updated))
low = silero.VAD.load()
low.update_options(activation_threshold=0.2)
print("silero.VAD.load() + update_options(act=0.2) ->", thresholds(low), "deactivation above activation")
async def open_stream_then_update():
vad = silero.VAD.load()
stream = vad.stream()
vad.update_options(activation_threshold=0.7)
value = stream._opts.deactivation_threshold
await stream.aclose()
return value
print("open stream, then update_options(act=0.7) -> deactivation", asyncio.run(open_stream_then_update()))
i_direct = inference.VAD(model="silero", activation_threshold=0.7)
i_updated = inference.VAD(model="silero")
i_updated.update_options(activation_threshold=0.7)
print("inference.VAD(activation_threshold=0.7) ->", thresholds(i_direct))
print("inference.VAD() + update_options(act=0.7) ->", thresholds(i_updated))
for name, a, b in (("silero.VAD", direct, updated), ("inference.VAD", i_direct, i_updated)):
ok = thresholds(a) == thresholds(b)
print("PASS" if ok else "FAIL", f"{name}: same options, deactivation_threshold {thresholds(a)[1]} at construction vs {thresholds(b)[1]} after update_options")
# Output on livekit-plugins-silero 1.8.4 / livekit-agents 1.8.4:
livekit-plugins-silero 1.8.4 livekit-agents 1.8.4
silero.VAD.load(activation_threshold=0.7) -> (0.7, 0.5499999999999999)
silero.VAD.load() + update_options(act=0.7) -> (0.7, 0.35)
silero.VAD.load() + update_options(act=0.2) -> (0.2, 0.35) deactivation above activation
open stream, then update_options(act=0.7) -> deactivation 0.35
inference.VAD(activation_threshold=0.7) -> (0.7, 0.5499999999999999)
inference.VAD() + update_options(act=0.7) -> (0.7, 0.35)
FAIL silero.VAD: same options, deactivation_threshold 0.5499999999999999 at construction vs 0.35 after update_options
FAIL inference.VAD: same options, deactivation_threshold 0.5499999999999999 at construction vs 0.35 after update_options
Operating System
macOS 26.5.1 (Apple M4 Max). The code path is platform-independent; our production worker runs on Linux.
Models Used
Silero VAD (bundled model), OpenAI STT/TTS
Package Versions
livekit-agents==1.8.4
livekit-plugins-silero==1.8.4
livekit-local-inference==0.2.7
onnxruntime==1.30.0
Python 3.14.3
Session/Room/Call IDs
N/A (reproduces without a room).
Proposed Solution
# Remember whether the caller set deactivation_threshold, and re-derive it
# in update_options only when they did not. Same change in VADStream.update_options
# and in livekit.agents.inference.VAD.
if is_given(activation_threshold):
self._opts.activation_threshold = activation_threshold
if not is_given(deactivation_threshold) and not self._deactivation_explicit:
self._opts.deactivation_threshold = max(activation_threshold - 0.15, 0.01)
if is_given(deactivation_threshold):
self._opts.deactivation_threshold = deactivation_threshold
self._deactivation_explicit = True
Additional Context
Proposed solution note: A shared helper for the max(x - 0.15, 0.01) default would keep load, the inference.VAD constructor and both update_options methods from drifting again.
Reproduction note: I could not run the script against main from git, because the git install carries the Git LFS pointer instead of silero_vad.onnx and VAD.load fails with INVALID_PROTOBUF. silero/vad.py and inference/vad.py on main (96341b0db2d0224403a36612cb04a1e38d60d405) are byte-identical to the [email protected] tag, so the bug is on main too.
We build per-session VADs with custom thresholds on top of one shared VAD. Because of this bug, every update_options(activation_threshold=...) call also passes deactivation_threshold=max(x - 0.15, 0.01), a copy of the formula from VAD.load. A test compares the result with VAD.load, so we notice if the formula changes upstream.
I used an AI assistant to trace this and draft the report; I verified the reproduction myself.
Screenshots and Recordings
N/A
Hi, I'm Himanshu, exploring a small first testing contribution. I see #7607, #7611, and #7735 already address this, so I won't open another competing fix. Would a comparison of load vs update_options behavior, especially explicitly supplied deactivation thresholds and already-open streams, help validate the chosen PR? Which remaining case would be useful?
Following up on my earlier offer with a run. Five open PRs now touch this issue (#7607, #7611, #7735, #8155 and #8161). I ran the same 8 update_options cases against main and against each PR's source files. Silero vad.py on main is unchanged from c2b2f5cbd through today's 853fbf243.

| case | main | #7607 | #7611 | #7735 | #8155 | #8161 |
|---|---|---|---|---|---|---|
1 load(act=0.8) (reference) |
0.65 | 0.65 | 0.65 | 0.65 | 0.65 | 0.65 |
2 load(); update(act=0.8) |
0.35 | 0.65 | 0.65 | 0.65 | 0.65 | 0.35 |
3 load(act=0.8); update(act=0.5) |
0.65 | 0.35 | 0.35 | 0.35 | 0.35 | 0.65 |
4 load(deact=0.2); update(act=0.8) |
0.2 | 0.2 | 0.2 | 0.65 | 0.2 | 0.2 |
5 load(); update(act=0.8, deact=0.3) |
0.3 | 0.3 | 0.3 | 0.3 | 0.3 | 0.3 |
6 load(); update(act=0.1) |
0.35 | 0.01 | 0.01 | 0.01 | 0.01 | 0.35 |
7 stream open, then update(act=0.8) (VAD / stream) |
0.35 / 0.35 | 0.65 / 0.65 | 0.65 / 0.65 | 0.65 / 0.65 | 0.65 / 0.65 | 0.35 / 0.35 |
8 load(); update(deact=0.3); update(act=0.8) |
0.3 | 0.3 | 0.3 | 0.65 | 0.3 | 0.3 |
Values are deactivation_threshold after the calls.
What the run shows:
- Main still has the bug as reported. Raising activation to 0.8 keeps 0.35. Lowering activation to 0.1 leaves deactivation at 0.35, above activation (case 6).
- #7607, #7611 and #8155 give the same result on all 8 cases. They derive the pair like
loaddoes, keep an explicitly chosen deactivation threshold, and reach an already-open stream. - #7735 also fixes cases 2, 3, 6 and 7. In cases 4 and 8 it replaces a deactivation threshold the caller set earlier (0.2 from
load, 0.3 from a previousupdate_options) with the derived 0.65. Its description says "explicit values always win". In this run that holds only when both thresholds are passed in the same call (case 5). - #8161 leaves
update_optionsas on main. It addswith_options(), a different API aimed at #7602, so it does not fix this issue on its own. I did not testwith_options().
Not covered:
livekit.agents.inference.VAD, which #7611, #7735 and #8155 also change.- Speech segmentation on real audio: this compares option values only.
- The PRs' own test suites.
- For #7611, #7735, #8155 and #8161, I copied each PR's non-test files onto main, because #7611 no longer applies cleanly. #7607 also gives the same results with its diff applied normally.
Reproduce (about 10 s)
git clone https://github.com/livekit/agents && cd agents && git checkout 853fbf243
uv sync --all-extras --dev
export SILERO_ONNX=/path/to/silero_vad.onnx # the real file, not the git-lfs pointer
uv run python compare_7597.py main
for n in 7607 7611 7735 8155 8161; do
git fetch -q origin pull/$n/head:pr/$n
gh pr view $n -R livekit/agents --json files --jq '.files[].path|select(test("^tests/")|not)' |
while read -r f; do git show "pr/$n:$f" > "$f"; done
uv run python compare_7597.py "#$n"; git checkout -q -- .
done
Scripts: compare_7597.py, demo-7597.sh, table.py