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

Abierto
#1,180 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
swift

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Swift
Estrellas
3k
Forks
451
Merge medio
1 d 19 h
PR fusionados (30 d)
87

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de FluidInference/FluidAudio

Todos los issues de FluidInference/FluidAudio

Issues similares

Más issues de Swift

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.