# k2-fsa/k2

FSA/FST algorithms, differentiable, with PyTorch compatibility.

Repository: https://github.com/k2-fsa/k2
Canonical: https://ross.abutalabs.com/products/k2
Homepage: https://k2-fsa.github.io/k2
Language: Cuda
License: Apache-2.0
License Family: permissive
Last push: 2026-07-11T22:46:12+00:00

## Health v2 (maintenance only)
Score: 64/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 92, release rhythm 8, longevity 100
- inputs: {"age_days": 2329, "days_push": 53, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1352, forks 237 (observed 2026-08-28T04:04:28.353632+00:00)

## What it is
k2 is a C++/CUDA library with Python bindings that implements differentiable Finite State Automaton (FSA) and Finite State Transducer (FST) algorithms integrated with autograd-based toolkits like PyTorch. It supports batched FST processing on CPU and CUDA, and is primarily used for automatic speech recognition tasks such as CTC loss, LF-MMI loss, and decoding with lattice rescoring.

## Use cases
- compute CTC loss with FST-based decoding graphs
- train ASR models with LF-MMI objective in PyTorch
- perform fast pruned composition of dense FSA from neural network log-probs
- rescore lattices during multi-pass speech recognition decoding
- run differentiable FSA/FST algorithms on GPU with autograd support
- process batches of FSAs/FSTs in parallel on CUDA

## When to choose
- you need differentiable FSA/FST operations inside PyTorch training loops
- you are building ASR systems with CTC or LF-MMI training objectives
- you need GPU-accelerated, batched FST decoding or lattice rescoring
- you want an extensible alternative to Kaldi's FST tooling

## When to avoid
- you only need classical, non-differentiable FST tools like OpenFst for offline text processing
- your project uses TensorFlow (support not yet available)
- you need a pure-CPU solution without CUDA and lack pre-compiled wheel support for your platform
- you are not working with speech recognition or graph-based decoding

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, deep-learning, speech-recognition, math, gpu-computing
- domain: speech-processing, machine-learning, gpu-computing
- platform: python, cpp, windows
- tags: fsa, fst, autograd, pytorch, asr, ctc, lf-mmi, ragged-tensor, decoding, lattice-rescoring, natural-language-processing, cuda, linux, macos

## Member repositories
- k2-fsa/k2 (main) score 64

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:28.353632+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:42:09.979085+00:00, confidence not recorded.
  - readme: https://github.com/k2-fsa/k2 (fetched 2026-08-28T04:04:28.353632+00:00, sha 5c2505e15ba6)
  - homepage: https://k2-fsa.github.io/k2 (fetched 2026-08-29T12:00:39.527548+00:00, sha c77198cf5c92)
- Data as of 2026-08-30T08:39:29.467469+00:00.
