All models

torchaudio.models.Conformer

Attention and a depthwise convolution between two half-step feed-forward layers; the speech encoder of the 2020s.

Audio and speech · 259 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (19 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
361K
Operations
259
Framework
PyTorch
Recurrent
No
Published
Interspeech 2020
Cited by
3,128 (as of 18 October 2026)
Authors
Anmol Gulati, James Qin, Chung-Cheng Chiu and others
License
BSD-2-Clause
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m10575
Graph hash
5dda03d68f2cf6e0de6a4b1999ef0a0e06cb41bbe7ea59366128bed50a35751b
Skeleton hash
ccdf369046042e3b4b7edcee3fb6c5bbed07324f1cfbfd1a85bd265bd2813e62
Architecture hash
91b0473d974e0a755eb5f374054612356d2575ca99e76227621ba70a0993f706
Diagram SHA-256
4dc295a09e4775335a6773d8b5baa04668cfb27b9617ddbd44d2dc2f58369125
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

About this model's family

Conformer is a convolution-augmented Transformer for speech recognition, built to get the best of both worlds from attention and convolution. The premise is that Transformer models are good at capturing content-based global interactions, while CNNs exploit local features effectively. The paper studies how to combine the two to model both local and global dependencies of an audio sequence in a parameter-efficient way.

A Conformer block stacks four modules: a feed-forward module, a self-attention module, a convolution module, and a second feed-forward module at the end. The two feed-forward modules sandwich attention and convolution, a structure inspired by Macaron-Net with its two half-step feed-forward layers. Self-attention is multi-headed and borrows the relative sinusoidal positional encoding scheme from Transformer-XL. The authors found that two Macaron-style feed-forward layers give a significant improvement over a single feed-forward module.

On LibriSpeech, Conformer reaches word error rates of 2.1%/4.3% without a language model and 1.9%/3.9% with an external language model on test/testother. A small model of only 10M parameters still reaches 2.7%/6.3%. Three sizes, small, medium and large, were chosen at 10M, 30M and 118M parameters by sweeping depth, model dimension and attention heads. One of the saved implementations is SpeechBrain's ConformerEncoder. Its convolution module replaces the BatchNorm of the original Conformer with a LayerNorm.

Key idea. Sandwiching multi-headed self-attention and a convolution module between two half-step feed-forward modules, so one block models both local and global dependencies of an audio sequence.

  • Conformer
  • Convolution-augmented Transformer
  • ConformerEncoder
  • speech recognition
  • ASR
  • LibriSpeech
  • SpeechBrain Conformer
  • torchaudio Conformer
  • Macaron-Net

AI-written summary, checked automatically against its sources; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{gulati2020conformerconvolutionaugmentedtransformerspeech,
      title={Conformer: Convolution-augmented Transformer for Speech Recognition}, 
      author={Anmol Gulati and James Qin and Chung-Cheng Chiu and Niki Parmar and Yu Zhang and Jiahui Yu and Wei Han and Shibo Wang and Zhengdong Zhang and Yonghui Wu and Ruoming Pang},
      year={2020},
      eprint={2005.08100},
      archivePrefix={arXiv},
      primaryClass={eess.AS},
      url={https://arxiv.org/abs/2005.08100}, 
}