DeepHorus is an innovative tech media and intelligence platform focused on AI, blockchain, startups, and emerging technologies.
Published on

Show HN: Optimized CUDA forced alignment kernels. 10x – 1000x faster

Authors
  • avatar
    Name
    DeepHorus
    Twitter

A new open-source package, fast_forced_aligner, adds optimized CUDA kernels to forced alignment with claimed speedups from 10x to 1,000x. It converts CTC frame scores and a known transcript into batched GPU alignments. The tool returns a token label and score for every audio frame, targeting frame-level timing.

Forced alignment locates words and phonemes in audio, but conventional dynamic programming can bottleneck long or numerous recordings. The package batches recordings of different lengths without padding and keeps results on the GPU. Acoustic inference remains the caller’s job; examples use stock Hugging Face Transformers models to produce emissions.

On a ten-workload benchmark suite with prevalidated inputs, optimized alignment was 11.50x faster than corrected ctc-forced-aligner CPU8 and 208.18x faster than k2 CUDA. The project says optimized alignments matched conventional dynamic programming on all 3,482 distinct benchmark inputs, though adversarial near-tie cases can differ. Both optimized and conventional modes use the same Python API.

The package requires Python 3.11 or newer, a compatible NVIDIA driver, and the CUDA 12.8 development toolkit. It is not yet on PyPI, so installation comes directly from GitHub. CUDA source compiles on first use, requiring nvcc and a C++ compiler.

Inputs must be contiguous CUDA FP32 emissions and CUDA int64 target IDs on one device. The API accepts a blank ID and returns paths that preserve blanks and repeated labels. A mode flag selects conventional full-record dynamic programming through the same interface.

A Docker example uses facebook/wav2vec2-base-960h and LibriSpeech samples to report alignment rows per second. The reported 208.18x advantage over k2 CUDA suggests strong gains for high-throughput workloads. The project cautions that near-tie cases can differ from conventional DP.

It remains GitHub-only and depends on CUDA. If performance holds across diverse audio, it could simplify large-scale transcription timing workflows. Its conventional mode offers a reference for validation.