Are we able to modify transcription confidence thr...
# ask-ai
m
Are we able to modify transcription confidence thresholds for acceptable transcriptions from the STT node?
t
Thanks for reaching out, Alex. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding about whether you can modify transcription confidence thresholds for acceptable transcriptions from the STT node. Short answer: Yes — you can tune how the STT node decides turns and end-of-utterance behavior for several STT providers supported by LiveKit, but the exact parameters and what you can control depend on which provider you’re using. Some providers expose end-of-turn / VAD / silence thresholds you can adjust; direct word-level confidence filtering is not always provided by the node itself and may require post-processing. To give concrete guidance I need to know which STT provider you’re using (for example: Deepgram, AssemblyAI, Speechmatics). Here’s what can be adjusted per provider: • Deepgram ◦ You can set parameters such as
eager_eot_threshold
(0.3–0.9) and
eot_threshold
(0.5–0.9) to control when an eager end-of-turn fires and when a final turn is finished. These influence when the STT node considers a transcription complete. • AssemblyAI (with LiveKit Inference) ◦ You can pass
extra_kwargs
to send provider-specific options like VAD-related thresholds (for example
vad_threshold
) that affect voice-activity and turn detection behavior. • Speechmatics ◦ You can adjust
end_of_utterance_silence_trigger
(silence duration that triggers end-of-utterance), which indirectly affects when a transcription is considered complete. If your goal is specifically to: • Filter out low-confidence words in the transcript: That capability is not guaranteed to be built into every STT node. You can check whether your chosen provider returns per-word confidence scores and then apply post-processing on the transcript to drop or flag words below your desired confidence threshold. • Change when the node emits a final transcript versus interim results: Use the provider-specific end-of-turn / VAD / silence thresholds noted above. Which STT provider are you using, and do you want help with: 1) adjusting end-of-turn / VAD thresholds for more/less aggressive turn completion, or 2) filtering words by confidence after transcription (post-processing)? Tell me your provider and which of the two goals above matches your need and I’ll give exact parameter names and a short example for configuring it. Sources: Deepgram STT | LiveKit Documentation | AssemblyAI STT | LiveKit Documentation | Speechmatics STT plugin guide | LiveKit Documentation
m
i’m not interested in end of turn capabilities. I’m trying to understand if I can get the STT node to pass on transcriptions that were low confidence.
t
Thanks — I’m responding to your clarified question about whether the STT node can be configured to pass on (or filter out) low‑confidence transcriptions. Short answer: The STT node generally passes through the transcriptions the provider returns, including low‑confidence results. Confidence-related settings exposed by the STT node are primarily for turn/end‑of‑utterance and VAD behavior, not for filtering individual low‑confidence words or entire transcripts. If you need to accept or reject transcripts based on confidence, you’ll need to do that after the STT node (post‑processing), or rely on provider features if the provider exposes per‑word confidence that you can act on. What you can do next: • Check if your STT provider returns per‑word or per‑segment confidence scores. If it does, implement a small post‑processing step that: a. Inspects confidence values on words/segments. b. Drops or flags words below your threshold, or discards the entire segment if average confidence is too low. • If your provider exposes any confidence-related options (some vendors allow extra flags), you can use those to influence the returned results — but those options are provider‑specific and usually don’t automatically filter results inside the STT node. • If you tell me which STT provider you use (e.g., Deepgram, AssemblyAI, Speechmatics), I can: ◦ Confirm whether that provider returns per‑word confidence scores, and ◦ Give a short example of how to implement simple post‑processing to filter by confidence. Which provider are you using and do you want examples for dropping low‑confidence words or discarding whole segments?
m
Soniox. interested in dropping low confidence words.
t
Thanks — I’m responding to your request about dropping low‑confidence words from Soniox transcriptions. Short answer: Yes. Soniox returns per‑word confidence scores and you can drop low‑confidence words by overriding the STT node in your agent, inspecting the word-level confidences on each transcription event, and emitting a modified transcript with low‑confidence words removed. What to do (high-level) • Override your agent’s
stt_node
hook so you intercept transcription events as they stream from Soniox. • For each transcription event (interim or final), read the words/tokens and their confidence values. • Build a filtered transcript by excluding words below your chosen threshold (for example 0.5). • Replace the event’s text/alternatives with the filtered text before yielding the event so downstream components only see the cleaned transcript. Example concept (Python-style pseudocode) • The snippet below demonstrates the pattern: call the base implementation to get events, filter words by
word.confidence
, update the
event.alternatives[0].text
, then yield the event.
Copy code
async def stt_node(self, audio: AsyncIterable[rtc.AudioFrame], model_settings: ModelSettings):
    # Stream transcription events from the default STT processing
    async for event in super().stt_node(audio, model_settings):
        # Only process transcript events that include word-level data
        if event.type in (stt.SpeechEventType.FINAL_TRANSCRIPT, stt.SpeechEventType.INTERIM_TRANSCRIPT):
            alt = event.alternatives[0] if event.alternatives else None
            if alt and hasattr(alt, "words"):
                threshold = 0.5  # set your confidence threshold here
                filtered_words = [
                    w.text for w in alt.words
                    if getattr(w, "confidence", 1.0) >= threshold
                ]
                # Join remaining words; you can preserve spacing/punctuation as needed
                alt.text = " ".join(filtered_words)
        yield event
Notes and tips • Choose your threshold based on testing. 0.5 is a common starting point but you may prefer higher for cleaner transcripts. • If Soniox sometimes omits per‑word confidence for certain tokens, guard with a default confidence (as shown) or treat missing values as low confidence. • Decide whether to apply filtering to interim results, final results, or both. Filtering interim results may make streaming feel choppy; many choose to filter only final transcripts. • If you want to discard entire segments instead of removing words, compute an average or minimum confidence across the segment and skip yielding the event when it’s below your cutoff. • Keep downstream consumers in mind: removing words can change timestamps or semantics. If you rely on precise timing, you may prefer flagging low‑confidence words rather than removing them. If you’d like, I can: • Provide a more concrete code example in the exact language/framework you’re using. • Show an example that flags low‑confidence words (e.g., wraps them in markers) instead of dropping them. • Suggest a simple test plan to pick an appropriate threshold. Which would you prefer? Sources: Soniox STT plugin guide | LiveKit Documentation | Pipeline nodes and hooks | LiveKit Documentation