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

Đang mở
#1,180 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
swift

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Swift
Star
3k
Fork
451
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
87

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của FluidInference/FluidAudio

Tất cả issue của FluidInference/FluidAudio

Issue tương tự

Thêm issue về Swift

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.