# Connectionist temporal classification

Connectionist temporal classification (CTC) is a loss function and output representation for training neural networks on sequence-labeling tasks where input and output are not time-aligned, introduced in 2006. It is widely used in speech recognition and handwriting recognition.

Connectionist temporal classification (CTC) is a loss function and output representation used to train neural networks on sequence-labelling tasks where the input and output are not aligned in time. It was introduced in 2006 and is independent of the underlying neural network structure, meaning it can be applied to various architectures. CTC is commonly used for tasks such as on-line handwriting recognition and speech recognition, where the input sequence (e.g., audio frames or pen strokes) is much longer than the output label sequence (e.g., phonemes or characters).

The core challenge CTC addresses is the unknown alignment between input observations and target labels. For example, in speech audio, multiple time slices may correspond to a single phoneme, and the exact boundaries are not known during training. CTC solves this by predicting a probability distribution over labels at each time step, including a special blank output. It does not attempt to learn boundaries or timings; instead, label sequences are considered equivalent if they differ only in alignment, ignoring blanks. This equivalence leads to many possible alignments for a given label sequence, making scoring non-trivial, but an efficient forward-backward algorithm exists to compute the total probability.

## Training and Scoring

CTC scores are computed as the sum of probabilities over all possible alignments that map to a target label sequence. This score is differentiable, allowing it to be used with the back-propagation algorithm to update neural network weights. The network typically has a continuous output, such as a softmax layer, which is fitted through training to model the probability of each label at each time step. The forward-backward algorithm, analogous to that used in hidden Markov models (HMMs), enables efficient computation of the loss and its gradients. Alternative approaches to a CTC-fitted neural network include using an HMM, which explicitly models state transitions and durations.

## Applications and Milestones

CTC has been successfully applied in several notable systems. In 2009, a CTC-trained long short-term memory (LSTM) network was the first recurrent neural network (RNN) to win pattern recognition contests, achieving victories in several connected handwriting recognition competitions. In 2014, the Chinese company Baidu used a bidirectional RNN (not an LSTM) trained on the CTC loss function to break the 2S09 Switchboard Hub5'00 speech recognition dataset benchmark without using any traditional speech processing methods. In 2015, CTC was used in Google voice search and dictation on Android devices, demonstrating its practical utility in consumer products.

## Limitations and Extensions

CTC is limited to monotonic alignment, meaning that the order of output labels must correspond to the order of input observations. This is not a problem for voice recognition, where phonemes and words occur in a fixed order. However, it may be problematic for language translation, as later words in one language may correspond to earlier words in another due to different word orderings. This limitation has motivated the development of alternative sequence-to-sequence models, such as those based on attention mechanisms, which can handle non-monotonic alignments. Despite this, CTC remains a foundational technique in sequence labeling and is often used in hybrid systems or as a component in more complex architectures.

## Relationship to Other Techniques

CTC is closely related to other sequence modeling approaches. It is often compared to hidden Markov models (HMMs), which also handle sequence alignment but use a different probabilistic framework. In deep learning, CTC is frequently used with recurrent neural networks, particularly LSTMs and bidirectional RNNs, but it can also be applied to other architectures like transformers. The loss function is a type of loss-functions used in supervised learning, and it is often combined with techniques such as beam-search for decoding during inference. CTC's focus on alignment-free training has influenced later developments in sequence-to-sequence learning, though it remains distinct from attention-based methods.

## See Also

- [sequence-to-sequence](https://www.wikiprompt.org/wiki/sequence-to-sequence)
- [loss-functions](https://www.wikiprompt.org/wiki/loss-functions)
- [beam-search](https://www.wikiprompt.org/wiki/beam-search)
- [neural-network](https://www.wikiprompt.org/wiki/neural-network)
- [deep-learning](https://www.wikiprompt.org/wiki/deep-learning)

## External links

- [Wikipedia: Connectionist temporal classification](https://en.wikipedia.org/wiki/Connectionist_temporal_classification)

---
Source: https://www.wikiprompt.org/wiki/connectionist-temporal-classification
License: CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
Last updated: 2026-09-14T04:26:53.143238+00:00
