Gram-CTC: Automatic Unit Selection and Target Decomposition for Sequence Labelling

Hairong Liu, Zhenyao Zhu, Xiangang Li, Sanjeev Satheesh

Introduction

Gram-CTC extends the popular Connectionist Temporal Classification (CTC) loss function to automatically discover the optimal basic units ("grams") and sequence decompositions for sequence labelling tasks like Automatic Speech Recognition (ASR). By allowing the model to output variable-length chunks of characters at each time step, Gram-CTC captures longer-term dependencies and enables larger temporal strides. This significantly speeds up training while achieving state-of-the-art accuracy.

The "Goldilocks" Problem of Unit Selection

Standard sequence labelling models (like standard CTC or seq2seq) force practitioners to choose a fixed set of basic units—such as characters, words, phonemes, or word-pieces—and a fixed way to decompose target sequences into these units.

This creates a persistent "Goldilocks" problem:

  • Words lead to massive vocabularies and out-of-vocabulary (OOV) issues.
  • Characters require very long context windows and force the model to learn complex, irregular spelling-to-sound rules (e.g., the "oh" sound in though vs. toe).
  • Phonemes require complex, error-prone dictionaries to map sounds back to text.

The authors propose a model that learns the best cohesive units (like "tion" or "the") directly from the data, rather than relying on hand-crafted rules or fixed word-piece algorithms.

The Gram-CTC Approach

Gram-CTC is introduced as a strictly more general version of the CTC loss function. It tackles the unit selection problem through several key mechanisms:

1. Target Decomposition and Modified Forward-Backward Algorithm

While vanilla CTC marginalizes over all possible alignments of a fixed character sequence, Gram-CTC marginalizes over all possible alignments and all possible decompositions of the target sequence into "grams" (n-grams of characters).

To achieve this, the dynamic programming algorithm used to calculate CTC loss is expanded. The state space now handles variable-length grams up to a maximum length $\tau$.

Gram-CTC Forward-Backward Lattice

While this increases the number of valid paths quadratically (as the model can "jump" across multiple characters in a single step), the authors note it results in only a trivial increase in overall neural network training time.

2. Iterative Gram Selection

To avoid an exponentially exploding vocabulary of all possible n-grams, the authors use a clever filtering step. They first train a model with all uni-grams and bi-grams, decode a large corpus to find the most frequently used grams, and then restrict the final vocabulary to these top grams plus all uni-grams.

3. Joint Training Architecture

Because Gram-CTC has to learn both alignment and decomposition simultaneously, training from scratch can be unstable. To fix this, the authors jointly train the network using both the Gram-CTC loss and the vanilla CTC loss. This dual-objective approach guides the model to a better optimum.

Joint Training Architecture

Key Insights and Performance

The authors evaluated Gram-CTC across several datasets, including the Wall Street Journal (WSJ, ~80 hours), Fisher-Switchboard (~2300 hours), and a massive 10,000-hour internal Baidu dataset containing noisy, far-field, and accented speech.

Data-driven Phonetics: Gram-CTC naturally discovers intuitive, phonetically meaningful chunks (like "the", "ng", "are", "tion") without any phonetic dictionary. It learns a natural granularity that sits perfectly between characters and words, resembling phonetic decomposition but in a more robust, end-to-end manner.

Larger Strides for Faster Training: Vanilla CTC needs a high time resolution (small stride) to ensure there are enough frames to output every single character. Because Gram-CTC predicts chunks of characters per frame, the neural network can operate at a lower time resolution (larger stride). On the WSJ dataset, increasing the model stride from 2 to 4 cut training time per epoch almost in half (from 35 to 18 minutes). Gram-CTC maintained a strong Word Error Rate (WER) of 18.87 at stride 4, whereas vanilla uni-gram CTC degraded heavily to 23.76.

State-of-the-Art Accuracy: * WSJ: Achieved a WER of 6.75 (with a language model), outperforming the vanilla CTC baseline (7.11). * Fisher-Switchboard: Reached a WER of 7.3 on the Switchboard subset and 14.7 on CallHome, significantly outperforming the vanilla CTC baseline (9.0 and 17.7, respectively). * 10K Dataset: Reduced WER from 29.1% (vanilla CTC) to 25.59% (Gram-CTC + vanilla CTC joint training) without a language model, proving it scales exceptionally well to massive, noisy, real-world datasets.

Limitations and Future Work

Gram-CTC is inherently harder to train than vanilla CTC because it solves a more complex joint problem, currently relying on joint training with vanilla CTC to stabilize the learning curve. Additionally, on very small datasets, learning larger grams suffers from data sparsity, limiting the maximum effective gram size. Future work will investigate better optimization techniques specifically for the Gram-CTC loss to remove the reliance on joint training, as well as applying Gram-CTC to other sequence labelling tasks like machine translation.

Summary updated

BibTeX
@inproceedings{liu2017gram,
  author = {Hairong Liu and Zhenyao Zhu and Xiangang Li and Sanjeev Satheesh},
  title = {{Gram-CTC: Automatic Unit Selection and Target Decomposition for Sequence Labelling}},
  booktitle = {International Conference on Machine Learning},
  year = {2017},
  url = {https://openreview.net/forum?id=ryb6UnWd-H},
}
Figure