Conformer

Also known as: convolution-augmented transformer

On this page 7

The Conformer is a neural network encoder architecture that combines Transformer self-attention with convolution inside each block, so that it models both global context across an utterance and fine local acoustic patterns. In Speech & language AI, it is one of the most widely used encoders for automatic speech recognition, and it also appears in speaker, language identification and speech translation systems.

The name is a contraction of convolution-augmented transformer. Introduced in 2020, the design addressed a known weakness of pure Transformers on audio: attention captures long-range dependencies well but handles short, position-sensitive features such as formant transitions less efficiently than convolution does.

How a Conformer block processes speech

A Conformer block processes a sequence of acoustic frames through four modules in a fixed order, each wrapped in a residual connection. The input is usually a Mel spectrogram with 80 filter banks, downsampled by a convolutional front end so that each encoder frame covers about 40 milliseconds of audio.

The block follows a macaron-style layout: a feed-forward module at the start and another at the end, each contributing only half of its output to the residual path. Between them sit the attention module and the convolution module, and a final layer normalization closes the block.

The table below lists the modules in processing order and the role each plays.

ModuleMain operationRole in speech modeling
First feed-forwardTwo linear layers with Swish, half-step residualNonlinear feature mixing
Multi-head self-attentionAttention with relative positional encodingLong-range context across the utterance
Convolution modulePointwise conv, GLU, depthwise conv, batch normLocal patterns over neighboring frames
Second feed-forwardTwo linear layers, half-step residualRefines combined features
Layer normalizationNormalizes the block outputStabilizes deep stacks
Modules inside one Conformer block

The depthwise convolution typically uses a kernel of 15 to 31 frames, which spans roughly half a second to one second of speech. That window covers phonemes and syllable transitions, while attention links distant words that share context.

Model sizes and key hyperparameters

Conformer models are usually described by depth, model dimension, attention heads and convolution kernel size. Published configurations range from small encoders suited to on-device recognition to large encoders trained on tens of thousands of hours of audio.

The following table gives representative ranges rather than exact reference values, because implementations vary.

Size classEncoder layersModel dimensionApproximate parameters
Small12 to 16144 to 25610 to 30 million
Medium16 to 18256 to 51230 to 120 million
Large17 to 24512 to 1,024120 to 600 million
Very large24 or more1,024 or moreAbove 600 million
Representative Conformer configurations

Changing the kernel size affects the local receptive field, while the number of attention heads affects how many distinct context patterns each layer can track. In practice, depth and dimension influence word error rate more than either of those settings.

The Conformer sits between pure attention models and pure convolutional or recurrent models, borrowing the strength of each. Its main advantage is better accuracy per parameter on speech, at the cost of slightly higher implementation complexity.

EncoderContext modelingTypical trade-off
ConformerGlobal attention plus local convolutionHigh accuracy, quadratic attention cost
Transformer encoderGlobal attention onlyWeaker on fine local acoustics
LSTM encoderSequential recurrenceSlow training, limited parallelism
Pure CNN encoderStacked local convolutionsEfficient, needs depth for long context
Zipformer and SqueezeformerConformer variants with downsamplingLower compute at similar accuracy
Conformer and alternative speech encoders

The Conformer is an encoder, not a full recognizer. It is paired with a decoding objective such as Connectionist temporal classification, an RNN-Transducer or an attention-based decoder, and that choice determines streaming ability and latency as much as the encoder does.

Training and deployment considerations

Training a Conformer well depends on strong data augmentation and careful scheduling. SpecAugment, which masks blocks of time and frequency in the spectrogram, is standard, and a learning rate warm-up of several thousand steps is common because deep attention stacks are unstable early in training.

Deployment decisions mostly concern latency. The table below maps common requirements to configuration choices.

RequirementRecommended choiceReason
Streaming recognitionChunked or limited-context attention, causal convolutionAvoids waiting for future audio
Offline transcriptionFull-context attentionHighest accuracy on whole files
On-device useSmall model with quantizationFits memory and power limits
Long recordingsSegmenting with voice activity detectionControls quadratic attention cost
Deployment requirements and matching choices
  • Causal convolution is required for streaming, because a centered kernel would look into future frames.
  • Batch normalization in the convolution module can behave poorly with very small batches; layer normalization is a common substitute.
  • Long-form audio above roughly 30 seconds often needs chunking, since memory grows with the square of sequence length.

Limitations and common misconceptions

The Conformer does not remove the quadratic cost of self-attention, so very long inputs remain expensive. It also does not fix weaknesses in training data: accents, noise conditions and domains missing from the corpus still raise word error rate sharply.

A frequent misconception is that the Conformer is a complete speech model with its own vocabulary. It only produces encoded frame representations; the tokenizer, decoder, language model fusion and text normalization determine much of the final output quality.

Another misconception is that convolution makes positional encoding unnecessary. The convolution module does supply some local ordering information, but most implementations still use relative positional encoding in the attention module, and removing it usually degrades accuracy on longer utterances.

Finally, reported benchmark gains should be read with care. Results on read audiobook speech, such as the widely cited LibriSpeech test sets, often reach word error rates below 3 percent, while the same model on conversational telephone audio or noisy field recordings can perform several times worse. Evaluation on in-domain data remains essential before deployment.

In simple terms

Understanding speech needs two kinds of listening. You must hear tiny sound details, such as the difference between “b” and “p”. You must also follow the meaning of the whole sentence.

A Conformer does both at once. One part looks closely at short stretches of sound. Another part looks across the entire recording. Combining them makes speech recognition more accurate than using either part alone.

A practical example

A hospital group wants to transcribe doctors’ dictated notes on a private server, because patient data cannot leave its network. Earlier recognition software struggled with drug names and with fast speakers.

The engineering team trains a medium Conformer encoder with an RNN-Transducer decoder on about 3,000 hours of general English speech, then fine-tunes it on 200 hours of anonymized medical dictation. They enable limited-context attention with 640-millisecond chunks so that text appears while the doctor is still talking.

On the hospital’s held-out test set, word error rate drops from about 14 percent to about 7 percent, with the largest gains on medication names. Doctors see draft text with under one second of delay, and transcriptionists now correct drafts instead of typing notes from scratch.