Skip to content

Unsloth Desktop: voice mode speaks a thinking filler, judges turn ends with small local models, and shows what it hears (part C) - #14084

Open
LeoBorcherding wants to merge 385 commits into
unslothai:mainfrom
LeoBorcherding:voice/pr-b-thinking-filler
Open

LeoBorcherding wants to merge 385 commits into
unslothai:mainfrom
LeoBorcherding:voice/pr-b-thinking-filler

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Merge order

order PR what depends on
1 #12384 (part A) hands-free voice mode in chat main
2 #14084 (part C, this PR) thinking filler, turn judge, orb #12384
2 #16976 the mic sends audio straight to the model main
3 #17069 voice mode hears and speaks through any audio-input model #14084, #16976
any #12385 (part B) voice latency benchmark nothing, lands in any order

#16955 (read aloud in sentences) copies this PR's voice/speech-text.ts and voice/tts-chunk-plan.ts so it can merge on its own, with a few splitter fixes. Whichever of the two lands second drops its duplicate copy and keeps those fixes.

Stacked on #12384 (part A): the diff includes that PR's commits until it merges, and everything here needs its voice loop. Nothing in it is required for part A or the latency benchmark in #12385 (part B) to work. This is part C.

Small local models for the loop (trained for this, served from Hugging Face, ONNX int8 on CPU, 1 to 3 ms each):

  • a turn judge that says whether a transcript is a finished turn, so a pause mid-sentence holds the fragment instead of sending it
  • a thinking filler that picks a short spoken phrase ("let me look at that") while the model thinks, and an echo check so the reply never repeats the filler
  • an interject judge for speech that lands while the model is thinking: restart, hold for after the reply, or ignore a backchannel (ignore only for three words or fewer)

Orb: the edge is a live spectrum of the mic or the reply, state colours match the app palette, the ring arcs show the judge, filler and interrupt decisions, and a ripple plus caption show every VAD and transcript verdict (kept or dropped, and why).

Voice picker: a built-in speaker dropdown for voices that list several, read from the model's status once loaded. OmniVoice is labelled as picking a new speaker per sentence until a saved voice is chosen (a fixed seed and a voice description were both measured not to hold it).

Fixes found by using it: turns said while the voice loads are parked and sent as one prompt, a held fragment no longer doubles, a barge-in during thinking no longer leaves the reply paused, queued questions collect instead of overwriting each other, the last word is no longer cut by the mic re-arm, the voice is checked to be serving before a turn is sent, a stop button while the reply is still being spoken, and the mic reopens on its own when the device changes or an earbud comes out.

Tracing: with UNSLOTH_VAD_DEBUG_DIR set the loop writes a JSONL trace of every decision beside the VAD clips, which is how each of the fixes above was found.

Tested on this Mac (M-series, Unsloth Desktop build from the branch, gemma-4-12b-it GGUF as the chat model, PocketTTS and OmniVoice as voices, Parakeet STT, PulseVAD). The models' training data and reports are in the Hugging Face repos.

LeoBorcherding and others added 29 commits October 17, 2026 20:34
…e orb

Stroke 5 to 6.5, radius 106 to 110; the box is derived from them.
… sends

The interrupt model's hold waited for playback to end on its own, and a barge-in
cuts playback without that firing, so held speech sat for minutes and then went
as a stale prompt of its own. The next utterance that commits now carries the
held ones with it, a repeat of a held line counts as insisting and restarts the
request, and the same line is never held twice.
…read

Cancelling a run that had not produced a token left it in "cancelling" for good:
the engine dropped the task, the event stream never closed, and the first-token
wait kept renewing the lease every 30 s, so the sweeper never settled it and every
later turn on the thread was refused with "already has an active generation".
The producer now stops draining a few seconds after the cancel and settles the run
as cancelled, polling the cancel on a half-second tick instead of the renew
interval. The voice loop also asks the server whether the old run is gone before
starting the coalesced one, instead of trusting the local running flag.
…rries its confidence

The detector was asked after 250 ms of loudness but needed 300 ms of voice in
the probe, so the first check failed every time and the reply only stopped on
the second or third try. The barge probe now needs 200 ms. The bar over the
reply's bleed drops from 3x to 2x; the detector already rejects bleed. The
filler route's confidence now reaches the decision readout.
…s slide and the icon cross-fades

The spectrum contour was a fresh clip-path on every animation frame. It now
writes at most 30 a second on a will-change layer, with the smoothing buffers
and the unit circle allocated once and an attack/release on each band so the
edge glides instead of jittering.

The decision ring moves its fill along the track with a stroke-dashoffset
transition instead of jumping, the value label cross-fades, and the filler arc
shows the model's confidence now that the decision carries one.

State changes cross-fade the glyph in one grid cell and ease the glow and
body colour in 250 ms.
Transcribing or thinking can be over in under 100 ms, and the raw derived
state flashed the icon and colour for a frame. A small timer-injected
scheduler (orb-dwell.ts) now sits between deriveOrbState and the store: a
displayed state keeps the screen for ORB_DWELL_MS before the newest raw state
replaces it, only the newest is ever pending, and hearing, speaking and the
loop stopping still land at once. Unit tests cover the ordering.
The overlay was seen in listening with Voice unticked in the + menu. The orb
state now drops to null at the dwell whenever the loop is off, the overlay also
checks the store's mode, and every displayed state change is traced.
Three scripted tweens over the pulsing amber body dropped frames in the desktop
webview; a compositor-driven translate does not.
… while the answer is written

The classifier choosing silence left an eleven-second gap on a slow question
with nothing said; after 2.5 s with nothing playing a short bridge now goes
out. "Almost there" was a thinking phrase, said while twenty seconds of
thinking remained; it now goes out once reply text is arriving and the first
sentence has not played, which is the gap where it is true, and lands ahead
of that sentence.
Every barge-in trades the two, and the 250 ms glow, the 180 ms scaled icon
fade and the 220 ms caption (exit then enter) added up to half a second of
swap that read as lag. Glow 100 ms, icon a 90 ms fade with no scale, caption
90 ms each way, and the gradient no longer carries a transition it could not
animate anyway.
…s wait for the rest

"Can you hear me?" asked three times over its own reply being thought out
restarted the run each time and threw the thinking away, so the answer came
after the third try. An utterance that shares most words with the pending
prompt now keeps the run and says a still-on-it line; a real restart waits
1.8 s instead of 650 ms so what follows stacks into one run; and the quiet
bridge is said once per stretch of restarts, not once per restart.
… answer

An aside joined the sentence queue and was synthesized in turn, so it came
out seconds after the moment it was for, often as "almost there" followed at
once by the answer. Asides now play from a cache the moment they are decided,
only when nothing is on the timeline and no reply sentence is being
synthesized; a first-time phrase that is ready after the reply caught up is
dropped. The fixed phrases are synthesized into the cache while the loop is
idle, once the voice has loaded.
…its models; the Voice menu item unloads them
danielhanchen and others added 28 commits November 14, 2026 20:34
# Conflicts:
#	studio/frontend/src/features/chat/adapters/studio-voice-loop-adapter.ts
#	studio/frontend/tests/voice-loop-guards.test.ts

[skip ci]
# Conflicts:
#	studio/frontend/src/features/chat/voice/voice-engine.tsx
#	studio/frontend/tests/voice-loop-guards.test.ts

[skip ci]
# Conflicts:
#	studio/frontend/tests/voice-loop-guards.test.ts

[skip ci]
# Conflicts:
#	studio/frontend/src/features/chat/adapters/studio-voice-loop-adapter.ts
#	studio/frontend/tests/voice-loop-guards.test.ts
# Conflicts:
#	studio/frontend/src/components/assistant-ui/voice-orb.tsx

[skip ci]
…tinuation holds the reply; speech waits for the current pick's slot
# Conflicts:
#	studio/frontend/src/features/chat/adapters/studio-voice-loop-adapter.ts
#	studio/frontend/src/features/chat/chat-page.tsx
#	studio/frontend/tests/voice-detector-release.test.ts

[skip ci]
…the CPU, one voice load per reply

- The dictation mic was wrapped in a div, so the 22rem composer rule that shrinks
  '.aui-composer-action-wrapper > button' no longer reached it. Render it conditionally instead.
- Start PulseVAD on the CPU: nothing frees the detector for training or chat, so on the GPU it
  held memory until Studio exited.
- A failing voice load was retried and toasted once per sentence; once per reply now.
- Turning Voice off while the mic was starting showed a false microphone error.

[skip ci]
… a speech request

A voice ejected from Loaded models kept voiceSlotLoaded set, so the next reply named an unloaded
voice; with switch model by request on and multi-model off, that loaded it as the chat model.

[skip ci]
…r reply

A voice ejected while queued clips played was still named by the reply's later sentences.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants