A decision hook for TDT v3 batch decoding: favoring a user's terms at decode time

Aperta
#1,180 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
swift

Direzione di ricerca

Read the TDT v3 batch decode loops and the batch v3 decode sites reachable from the [Float] call, then compare their handling of language filters, top-K logits, and blank labels with the fork commit and tests described here. Done means an optional decision-bias hook reaches each listed decode path, preserves behavior when absent, and has tests for token replacement and confidence; coordinate with the work in #1168.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

We use FluidAudio's Parakeet TDT v3 batch path, on CPU, in an on-device dictation app, with a Ukrainian fine-tune of parakeet-tdt-0.6b-v3. Users want the decoder to get their own terms right: team jargon, tool names, people's names.

Today's options don't reach these words on that path. The CTC-spotter rescoring has no non-ASCII pieces, as discussed in #967. NemotronVocabularyBias serves only the streaming Nemotron models. Fixing the text after recognition can't recover a word the decoder never emitted.

We added a small, language-neutral hook to TDT v3 batch decoding in a fork, and would like to offer it upstream if it's useful:

public protocol TdtDecisionBias: AnyObject {
    func adjust(label: Int, topKIds: [Int], topKLogits: [Float], blankId: Int) -> Int
    func didEmit(_ token: Int)
}
// transcribe(_ samples: [Float], decoderState:, language:, decisionBias: (@Sendable () -> any TdtDecisionBias)? = nil)
  • Where it's called: in both decode loops, after the existing language filter and English blocklist. It's skipped for a blank label (a token there would inherit the blank step's duration), when the top-K is missing, and while the last chunk is flushed. A returned label outside the top-K is ignored.
  • What it sees: didEmit reports every decoded non-blank token, suppressed ones included, so a bias can follow the decoder state.
  • Where the factory goes: it travels with language to every batch v3 decode site reachable from the [Float] call: the single window, each parallel window, seam-gap repair probes, empty-decode recovery retries, and dual-decode arbitration. Each decoder call makes its own instance.
  • Confidence of a replaced token: exp(z_i − z_max) · p_argmax, taken from the raw token probability rather than the filtered top-K softmax.
  • With no factory: nothing changes. Outputs and confidences were byte-identical to v0.18.3 on 130 inputs, including long ones up to 71 s.

The matcher itself, which knows the terms, lives in our app and stays out of FluidAudio. It's a case-sensitive adaptation of NemotronVocabularyBias's piece-text matching, with a small start bonus, given only to a word-start piece of two letters or more as upstream does, and a larger continuation bonus. A candidate without a bonus never replaces the label.

Measurements. Read speech from one speaker, two sets: a pilot that picked the setting and a held-out set that confirmed it. Each set has term, lookalike, neutral and silence clips. Recall counts term forms; changed clips are compared with no bias.

set term recall, case-insensitive exact lookalike clips changed neutral clips changed words on silence
pilot 30 → 37 / 56 26 → 33 0 / 15 0 / 42 0
held-out 31 → 40 / 55 24 → 35 0 / 20 0 / 40 0

The results are identical with the language set to Ukrainian, so the alphabet filter still holds wherever no term applies, and with 300 extra generated terms in the list.

Fork: https://github.com/vladislawfox/FluidAudio/tree/chrrp-1, one commit on v0.18.3: https://github.com/vladislawfox/FluidAudio/commit/346ac139a0c3744a352a47c3d4f94a6aa323f461. It includes static-step tests in the style of EnglishBlocklistTests, and the full suite passes offline.

We know #1168 touches the same top-K code; we'd rebase onto it. If you're interested, we'll open a PR. If not, no worries: the fork works for us.

Lingua principale
Swift
Stelle
3k
Fork
451
Merge medio
1g 19h
PR unite (30g)
87

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di FluidInference/FluidAudio

Tutte le issue di FluidInference/FluidAudio

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.