pyctcdecode
CTC beam search decoder for speech recognition.
What it is and what it does
pyctcdecode is a Python-based CTC beam search decoder for converting raw logits from speech recognition models into text. It implements shallow fusion with n-gram language models (via kenlm), allowing you to improve transcription accuracy by integrating domain-specific language constraints during decoding rather than retraining the model. The package handles both standard character-based and byte-pair-encoded (BPE) vocabularies automatically, and supports features like hotword boosting (promoting specific phrases during inference) and real-time stateful decoding for streaming applications.
The decoder is designed as a middle ground between C++ performance and Python flexibility. It includes batch processing via multiprocessing, returns detailed beam search results with frame-level timing information, and integrates with pretrained models from Nvidia NeMo and Hugging Face Wav2Vec2. Runtime is comparable to C++ implementations at beam widths of 10 or greater. However, the package is no longer maintained—the last release was in January 2023 and the repository shows no commits since July 2023.
Use it for:
- Improve accuracy of Conformer-CTC or Wav2Vec2 models by integrating a domain-specific language model during inference without retraining.
- Boost recognition of important domain terms (product names, technical jargon) by adding hotwords during decoding.
- Extract word-level timing and confidence scores from CTC models natively through the decoding process.
- Process speech recognition logits in batch with multiprocessing for production inference pipelines.
- Decode byte-pair-encoded vocabularies automatically without manual token merging logic.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Decodes CTC (Connectionist Temporal Classification) logits from speech recognition models using beam search with optional n-gram language model support, handling both standard and byte-pair-encoded vocabularies.
Yes, if you have an existing CTC-based speech model and need to integrate a language model or extract frame-level timing. The low install friction and permissive license make it straightforward to add. However, be aware the package is abandoned—no updates since early 2023—so use it only in stable production contexts where you can maintain it yourself if needed. For new projects, verify whether active alternatives exist.
Install
pyctcdecode on PyPI
pip
pip install pyctcdecodeuv
uv add pyctcdecodepoetry
poetry add pyctcdecodeInstalling pyctcdecode
Before you install
Low install friction with a pure-Python wheel and minimal runtime dependencies. However, the package is abandoned—last release was 2023-01-20 and the last commit 2023-07-13—so expect no bug fixes or maintenance going forward.
License in practice
Apache License 2.0 (permissive) allows commercial and derivative use with attribution and liability disclaimers. No restrictions on modification or redistribution.
Quickstart
pip install pyctcdecode
from pyctcdecode import build_ctcdecoder
labels = [" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
decoder = build_ctcdecoder(labels, kenlm_model_path="model.arpa", alpha=0.5, beta=1.0)
text = decoder.decode(logits)
Requires a kenlm language model file (.arpa or .bin) for best results; decoding works without one but will be less accurate. Hyperparameters (alpha, beta, beam width) strongly influence error rate and runtime and require tuning on your data.
Verify before relying
- Whether kenlm is an optional or required dependency (not listed in runtime deps but featured prominently in examples)
- Performance comparison details with C++ decoders at different beam widths mentioned in description
- Compatibility with models beyond Conformer-CTC and Wav2Vec2 (tutorials mention these but generality is unclear)
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — numpy, pygtrie, hypothesis, importlib-metadata |
| Maintenance | abandoned — 1,302 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 143,734/month — #11,168 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyctcdecode-0.5.0-py2.py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
speechbrainSpeechBrain is a PyTorch-based toolkit for…
permissive · top 5,000 on PyPI
nemo-toolkitnemo-toolkit provides a PyTorch framework for…
permissive · top 5,000 on PyPI
cut-cross-entropyComputes cross-entropy loss for…
unclear · top 15,000 on PyPI
nemo-text-processingConverts text to normalized form and back…
permissive · top 15,000 on PyPI
torchcrepePyTorch implementation of the CREPE pitch…
permissive · top 15,000 on PyPI
faster-whisperTranscribes audio to text using OpenAI's…
permissive · top 5,000 on PyPI
s3tokenizerConverts audio into discrete semantic speech…
permissive · top 15,000 on PyPI
sherpa-onnx-coresherpa-onnx-core provides pre-built ONNX…
permissive · top 15,000 on PyPI
whisper-timestampedAdds word-level timestamps and confidence…
copyleft · top 15,000 on PyPI
voskVosk provides offline speech recognition for…
permissive · top 15,000 on PyPI