Skip to content

Studio Transcribe: optional speaker accent hint - #17460

Merged
danielhanchen merged 7 commits into
unslothai:mainfrom
debojyoti-dev:feat/transcribe-speaker-accent-17440
Nov 14, 2026
Merged

danielhanchen merged 7 commits into
unslothai:mainfrom
debojyoti-dev:feat/transcribe-speaker-accent-17440

Conversation

@debojyoti-dev

@debojyoti-dev debojyoti-dev commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #17440

What this changes

The Transcribe page gets an optional Speaker accent field under Language, for a description such as "Chinese-accented English". Language still sets the spoken language, so the transcript stays in that language; the accent only goes in as a text hint.

The hint reaches only models that can take one:

Engine / model How the hint is used
Qwen3-ASR on llama.cpp Qwen3-ASR's context, sent as the system turn
Connections (not Whisper, not *-diarize) the OpenAI-compatible prompt field
Whisper (Transformers, whisper.cpp, whisper-1 connections), gpt-4o-transcribe-diarize, audio.cpp models (MOSS, VibeVoice, Parakeet, Qwen3-ASR audio.cpp, ...) and mlx-audio checkpoints not supported

For a model that can't take it, the field turns read-only and says the hint isn't sent and which models can use one. Nothing is dropped silently: /audio/stt/capabilities now reports accent_hint, and /audio/transcribe/source answers 422 if a hint comes in for such a model. The field defaults to empty and nothing is inferred.

The text sent is Speaker accent: <hint>., with whitespace tidied and capped at 200 characters.

Screenshots

Whisper (hint supported), and MOSS-Transcribe-Diarize (hint not supported):

A real run with the hint set (whisper-small on GPU). The transcript stays in English:

Testing

Windows 11, RTX 3050 Laptop 4 GB.

End to end

  • I ran a real Studio backend (run.py --api-only) with vite and headless Chromium. I uploaded a recorded English clip in the Transcribe UI, typed an accent, and pressed Transcribe. The request carried speaker_accent, openai/whisper-small transcribed on the GPU, and the English transcript came back unchanged.
  • Over the API on the same server, accent_hint was true for whisper-small and false for MOSS-Transcribe-Diarize. A MOSS request with a hint got the 422.
  • I added a connection pointing at a local OpenAI-style stub. It received prompt: "Speaker accent: Japanese-accented English." when a hint was set, and no prompt without one.
  • With whisper-small on CUDA, I called transcribe_window directly with and without the prompt, on both the plain path and the timestamped path. The text was identical in all four runs. Before the timestamp fix, the timestamped path printed the prompt into the transcript.

Tests

  • New tests cover the capability per engine, including mlx-audio. They also cover the route forwarding the hint for Transformers, whisper.cpp and llama.cpp, plus the 422, the 200-character limit, and the connection prompt. On the payload side they cover whisper.cpp's form field and the Qwen3-ASR system turn. The frontend tests cover the switches, the store, and the connection behavior.
  • Backend: I ran every STT, transcription and OpenAI audio suite (test_stt_*, test_transcribe_source_route, test_openai_audio_*, test_audio_inputs, test_mcp_tools_audio, test_custom_provider_api_type, ...). All pass except 5 that fail the same way on clean main on this Windows machine: 4 ROCm test_slim_guard_* tests in test_stt_ggml_sidecar.py, and test_stt_sidecar.py::test_corrupt_or_escaping_revision_record_is_ignored.
  • Frontend: the full npm test run gave 15663 tests and 1 failure, the persisted-store test that needed the new field; that file now passes. The audio and transcribe tests then gave 698 pass, 0 fail. tsc --noEmit is clean. eslint on the touched files shows the same findings as on main.
  • ruff check is clean on the backend files.

Not tested here: there's no whisper-server or llama-server binary on this machine, so the whisper.cpp and Qwen3-ASR (llama.cpp) paths are covered by request/payload tests rather than a live model. There's also no Mac, so the mlx-audio case is covered by a unit test.

Update: Whisper takes no hint (measured)

Whisper's prompt conditions the transcript's style (it is meant to hold earlier transcript text), not the speaker's accent. Real runs on EdAcc accented English (54 clips; Chinese, Spanish, Indian, Scottish, Eastern European and US speakers), WER without vs with the hint:

Engine No hint With hint Paired bootstrap 95% CI of the change
whisper-small, whisper.cpp v1.9.1 whisper-server (L4) 18.3% 21.4% +1.1 to +5.3 pp
whisper-small, whisper.cpp, second run 19.4% 20.3% -0.9 to +3.0 pp
whisper-small, Transformers (L4, fp16) 19.2% 19.8% -0.3 to +1.6 pp
Qwen3-ASR 0.6B Q8_0, llama.cpp llama-server (b12340 prebuilt, CPU) 13.3% 12.5% -1.8 to +0.2 pp

So the hint now goes only to Qwen3-ASR on llama.cpp and to connections whose model is neither Whisper nor gpt-4o-transcribe-diarize (OpenAI documents that model as not taking prompt). Whisper shows the field read-only with the usual note, and the route answers 422 for a hint it cannot use. No transcript contained the hint text in any run.

Before / after (Transcribe rail)

Base (left) has no accent field. Head (right): editable for Qwen3-ASR 0.6B on llama.cpp; read-only with the note for whisper-small. /audio/stt/capabilities reports accent_hint true for qwen3-asr-0.6b, false for openai/whisper-small and MOSS-Transcribe-Diarize (absent on base).

Adds an optional "Speaker accent" field under Language on the Transcribe
page. The text goes to models that take a text hint and nowhere else:

- Whisper on Transformers: Whisper's prompt (prompt_ids), kept out of the
  returned text on the timestamped path too
- Whisper on whisper.cpp: the server's prompt field
- Qwen3-ASR on llama.cpp: Qwen3-ASR's context, as the system turn
- Connections: the OpenAI-compatible transcription prompt

audio.cpp and mlx-audio models take no hint. /audio/stt/capabilities now
reports accent_hint, the field turns read-only with a note saying the hint
is not sent, and /audio/transcribe/source answers 422 rather than dropping
a hint for such a model. The hint never changes the selected language, so
the transcript stays in the spoken language.
@danielhanchen

Copy link
Copy Markdown
Member

Frontend build + bundle sanity fails on this PR at the test typecheck, not in the long-chat gate:

tests/transcribe-capabilities.test.ts(77,33): error TS2741: Property 'speakerAccent' is missing in type '{ timestamps: false; speakers: true; }' but required in type '{ timestamps: boolean; speakers: boolean; speakerAccent: string; }'.

The capability shape now requires speakerAccent, but the object literal at line 77 of the test still has only timestamps and speakers. Adding speakerAccent there, or making the field optional if older capability payloads can omit it, should clear it. You can check locally with node scripts/typecheck.mjs --tests in studio/frontend.

The Long-chat gate (Firefox) red is not from this PR; main has it too.

danielhanchen added a commit that referenced this pull request Nov 11, 2026
…17466)

## Summary

Reduce motion is on by default since #17377, and its blanket rule in
`index.css` gives every element `transition-duration: 0.01ms`.
`transition-property` defaults to `all`, so that one line turns on
transitions for every property of every element, including the many no
rule ever meant to animate.

Chromium makes this expensive. `* { scrollbar-color }` sets a scrollbar
colour on every element, and Chromium starts a scrollbar-color
transition on each of them whenever they are restyled, even when the
value does not change (the from and to keyframes are identical). With
any non-`auto` colour, a body-level restyle in a 40 turn Liquid Glass
chat started about 2,000 of these transitions, and more as the chat
grows. This is behind the Chromium long-chat gate cells that keep
failing on recent PRs (`area thread_scroll (liquid-3d)` and `area stream
(liquid-3d)` growing 2.5x to 2.8x from 40 to 200 turns, e.g. #17453 and
#17460).

## Change

- Both Reduce motion blocks (`html.force-reduced-motion`, on by default,
and the OS `prefers-reduced-motion` block) now give the `*` blanket
`transition-duration: 0s`. A transition that lasts 0.01ms and one that
does not run look the same, so nothing on screen changes and Reduce
motion stays on.
- A second rule in each block keeps 0.01ms for elements that still need
their `transitionend`:
- elements that declare a transition through a Tailwind class
(`[class*="transition"]`), which covers the reasoning and sidebar
collapsibles that unmount on `transitionend`;
- the overlays `native-view.ts` follows by their transition events
(`CLICKABLE_SELECTOR`: toasts, the find bar, native clickables and the
rail), so the Desktop browser view keeps its hole in place while they
appear.
- The annotation layer's zoom only had a transition because of the
blanket. Its comment now says what happens without one: the existing
`[zoom]` effect redraws it.

## Guard

New `studio/frontend/tests/reduced-motion-implicit-transitions.test.ts`:

- fails if either Reduce motion `*` blanket sets a nonzero
`transition-duration`, with its own cases for the checker;
- requires the 0.01ms exemption in both blocks, and that it lists every
part of `native-view.ts`'s `CLICKABLE_SELECTOR`, so the two cannot drift
apart.

`reasoning-grid-collapse.test.ts` now checks that the collapse is
reached through the class exemption instead of counting the old blanket
lines.

Against main's `index.css` the new test and the updated collapse test
fail (3 failures); with this change all 20 tests in the four related
files pass.

## Measurements

Chromium (the long-chat gate's headless build and harness, this host),
Liquid Glass 3D, main-thread CPU per area at 200 turns, three
interleaved runs each:

| Area | main | this PR |
|---|---|---|
| `thread_scroll` | 1,166 / 679 / 628 ms | 186 / 209 / 166 ms |
| `stream` | 3,072 / 3,242 / 3,244 ms | 1,450 / 1,241 / 1,175 ms |
| `command_palette` | 1,370 / 1,058 / 1,172 ms | 326 / 236 / 346 ms |

Scrollbar-color transitions started by one body-level restyle at 40
turns: 2,550 on main, 0 with this change.

## Long-chat gate: Settings ceiling

With the blanket transitions gone, the gate's 40 turn reading of opening
Settings in the default appearance drops from about 6,100 elements
restyled to about 2,400, while the 200 turn reading stays near 7,900.
That made `area settings (default)` read 3.3x against the 2.0x
element-growth limit.

The growth itself is on main already. Measured on fresh pages with the
gate's harness, default appearance:

| | 40 turns | 200 turns | growth |
|---|---|---|---|
| main | 1,975 elements, 290 ms CPU | 9,721 elements, 816 ms CPU | 4.9x
|
| this PR | 1,663 elements, 217 ms CPU | 7,760 elements, 461 ms CPU |
4.7x |

The gate only passed on main because the transitions inflated its 40
turn reading. `KNOWN_DEFAULT` in `tests/studio/_area_matrix.py` now
records it as `length:settings=5`, so Settings keeps a ceiling instead
of being skipped. This changes only the element and layout count check
for that one area; its CPU and paint growth checks are unchanged.
Finding what restyles the thread when Settings opens is a separate fix.

## Not covered

The Firefox long-chat gate failure that also started with #17377 is a
different cost: forcing every transition to 0s does not change the
Firefox numbers, so this PR does not address it.
@danielhanchen danielhanchen self-assigned this Nov 13, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 13, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T10:15:37.477020Z 998d909 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0830042422

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

model: string,
): TranscribeSwitches {
const untimed = OPENAI_UNTIMED_MODEL.test(model);
const { accent, speakerAccent } = accentFor(true, prefs.speakerAccent ?? "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disable accent hints for the diarizing connection model

When a connection offers gpt-4o-transcribe-diarize (which connectionTranscribeModels accepts), this hard-coded true enables the accent field and includes the hint in the request. _external_source_transcript then forwards it as prompt, but OpenAI's diarizing transcription model does not support that parameter, so adding an accent makes an otherwise valid short transcription fail upstream. Gate accent support by model instead of enabling it for every connection.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d8e89f0: diarize connection models disable the accent field and the route answers 422 instead of forwarding prompt, since the OpenAI API docs say prompt is not supported for gpt-4o-transcribe-diarize.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: d8e89f0652

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…tions

A Whisper prompt conditions transcript style, not accent: on EdAcc accented
English, whisper-small with the hint as its prompt scored worse than without
(whisper.cpp 18.3% -> 21.4% WER, 95% CI +1.1 to +5.3 pp, 54 clips), while
Qwen3-ASR's context held or improved (13.3% -> 12.5%).

[skip ci]
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 998d909825

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 14, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 14, 2026
@danielhanchen
danielhanchen merged commit 9103ef0 into unslothai:main Nov 14, 2026
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.

[Feature] Add an optional speaker accent hint to transcription

2 participants