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

オープン
#1,180 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
swift

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Swift
スター
3k
フォーク
451
平均マージ
1日 19時間
マージ済み PR(30日)
87

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

FluidInference/FluidAudio のほかの issue

FluidInference/FluidAudio の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。