Search

Search papers and lessons

Conformer: Convolution-augmented Transformer for Speech Recognition

Anmol Gulati, James Qin, Chung-Cheng Chiu et al. · 2020

Conformer is a speech encoder that puts a convolution module inside each transformer block, so one network models both nearby sound patterns and whole-utterance context.

On this page

  • Colour = topic mix
  • Discrete math
  • Architectures
  • Calculus
  • Neural network basics
  • Linear algebra
  • Probability
  • ReadReady to readNot yet

TL;DR

Conformer is a neural encoder for speech recognition. Each of its blocks combines a self-attention layer, which lets every audio frame look at the whole utterance, with a convolution layer, which looks closely at neighbouring frames. Two half-weight feed-forward layers sit on either side. On the LibriSpeech benchmark the largest model, with 118.8 million parameters, reached word error rates of 2.1 percent on the clean test set and 4.3 percent on the harder test set without a language model, the best published numbers at the time.

Builds on: Transformer, Depthwise Separable Convolution, Gated Linear Unit (GLU), Automatic Speech Recognition · Leads to: speech systems that use the Conformer encoder as their acoustic model

Why it mattered

Conformer set a new accuracy mark on LibriSpeech, the standard English speech benchmark. Its main claim is about parameters: a 30.7 million parameter Conformer already beat the 139 million parameter Transformer transducer, on both test sets without a language model.

The paper is also a clean study of one design question that many fields faced: how to combine attention with convolution. Its ablation tables show which pieces matter, so later work can reuse the parts that helped and skip the rest.

As of late 2026 the paper had about 5,300 citations on OpenAlex.

The problem

Speech recognition maps a long audio signal, typically one feature vector every 10 milliseconds, to a sequence of words. Two kinds of pattern must be captured. Local patterns are short sounds: a stop consonant lasts a few tens of milliseconds, and its identity depends on the frames right next to it. Global patterns span seconds: the correct spelling of a word may depend on what was said at the start of the sentence.

Before 2020, the two main encoders each covered one kind well. Recurrent networks (Recurrent Neural Network) carried context forward through time, but they were slow to train because each step waited for the one before. Transformers (Transformer) let every position attend to every other in one step, which captures global context and trains in parallel, but a transformer is weaker at fine local detail. Convolutional networks (Convolutional Neural Network) are good at local detail, but a local window only sees a few frames per layer, so reaching global context takes many layers or many parameters.

The question the paper asks is how to get both in one parameter-efficient block.

How it works

The encoder first shortens the input with a convolution subsampling layer, then runs a stack of Conformer blocks (16 or 17 of them, depending on the model size). Each block passes its input through four modules in order. Trace one frame through one block:

flowchart TB
  X["Input frame x"] --> F1["Half-step FFN: x + 1/2 FFN(x)"]
  F1 --> A["Multi-head self-attention, residual add"]
  A --> C["Convolution module, residual add"]
  C --> F2["Half-step FFN: x + 1/2 FFN(x)"]
  F2 --> N["Layer normalization"]
  N --> Y["Output to next block"]
  1. Start with the frame vector. Suppose the block receives a vector x for one frame. It is the output of the previous block, or of the subsampling layer for the first block.
  2. First half-step feed-forward module. A feed-forward module (Feedforward Neural Network) computes a new vector from x. Its output is multiplied by one half and added back to x. The half weight is the Macaron trick described below. Check: the vector changes a little, not a lot, because only half the update is added.
  3. Multi-head self-attention. The updated vector goes into multi-head self-attention (Multi-Head Attention), which mixes information from all frames of the utterance. The paper uses relative positional information (Positional Encoding) so the attention knows how far apart two frames are, not only their absolute index. The attention output is added back to its input, a residual connection (Residual Connection). Check: a frame can now carry a summary of what the rest of the utterance says.
  4. Convolution module. The result enters the convolution module, which looks at a window of neighbouring frames. It runs in five small stages, traced below. Its output is again added back to its input. Check: after this step each frame has absorbed information from its neighbours.
  5. Second half-step feed-forward module, then layer normalization. A second feed-forward module, again weighted by one half and added back, is followed by a layer normalization (Layer Normalization). The normalized vector is the block's output and becomes the input of the next block. Check: the output has the same length as the input, so blocks can be stacked.

The convolution module has five stages, applied to each frame's vector:

  1. A layer normalization, then a pointwise convolution (Pointwise (1x1) Convolution) that doubles the number of channels from d to 2d. This is a learned mix of the channels at each frame, with no neighbours involved.
  2. A gated linear unit (Gated Linear Unit (GLU)). It splits the 2d channels into two halves of d each. One half is multiplied by a sigmoid of the other, so it works as a gate. Output: d channels.
  3. A depthwise convolution (Depthwise Separable Convolution) with kernel length 32 over time. Each channel gets its own filter that slides across neighbouring frames. Output: still d channels, now with local context.
  4. Batch normalization (Batch Normalization) across the batch, which helps deep stacks train.
  5. A swish activation (Activation Function), which is a smooth bend that behaves like a ReLU for large positive inputs and lets small negative values through.

The paper's Figure 2 describes this chain. The module's output must have the model width so that it can be added to the block input.

The sandwich of two half-weight feed-forward modules is the design's signature. Feed-forward layers are weighted by one half in both places so that together they contribute about as much as one full-weight feed-forward layer, but the work is split on either side of attention and convolution.

The math

Definition: Conformer block

A Conformer block maps an input sequence of vectors xix_i to an output sequence yiy_i of the same shape. It is built from four modules: a feed-forward module FFN\mathrm{FFN}, multi-head self-attention MHSA\mathrm{MHSA}, a convolution module Conv\mathrm{Conv}, and a second feed-forward module, followed by a layer normalization LayerNorm\mathrm{LayerNorm}. Each module is wrapped in a residual connection.

The symbols: xix_i is the input to block ii, and x~i\tilde{x}_i, xi′x^{\prime}_i, xi′′x^{\prime\prime}_i are the intermediate vectors after each stage. Each stage adds one module's output to its input.

Step 2 in symbols: the first half-step feed-forward

x~i=xi+12 FFN(xi)\tilde{x}_i = x_i + \frac{1}{2}\,\mathrm{FFN}(x_i)

Step 3 in symbols: attention with a residual

xi′=x~i+MHSA(x~i)x^{\prime}_i = \tilde{x}_i + \mathrm{MHSA}(\tilde{x}_i)

Step 4 in symbols: convolution with a residual

xi′′=xi′+Conv(xi′)x^{\prime\prime}_i = x^{\prime}_i + \mathrm{Conv}(x^{\prime}_i)

Step 5 in symbols: the closing half-step and layer normalization

yi=LayerNorm ⁣(xi′′+12 FFN(xi′′))y_i = \mathrm{LayerNorm}\!\left(x^{\prime\prime}_i + \frac{1}{2}\,\mathrm{FFN}(x^{\prime\prime}_i)\right)

The feed-forward module itself is two linear maps with a swish activation between them. Writing σ(z)=1/(1+e−z)\sigma(z) = 1/(1 + e^{-z}) for the sigmoid and swish(z)=z σ(z)\mathrm{swish}(z) = z\,\sigma(z), the module computes FFN(x)=W2 dropout(swish(W1x))\mathrm{FFN}(x) = W_2\,\mathrm{dropout}(\mathrm{swish}(W_1 x)), where W1W_1 expands the width by a factor of 4 and W2W_2 projects it back.

The gate in the convolution module

Split a vector zz with 2d2d entries into halves aa and bb of length dd. The gated linear unit is

GLU(z)=a⊙σ(b)\mathrm{GLU}(z) = a \odot \sigma(b)

where ⊙\odot is the entrywise product. Each entry of bb decides, between 0 and 1, how much of the matching entry of aa passes through.

The depthwise convolution

For channel cc and kernel length K=32K = 32, the depthwise convolution computes

yt,c=∑j=0K−1wj,c ut+j−⌊K/2⌋, cy_{t,c} = \sum_{j=0}^{K-1} w_{j,c}\, u_{t+j-\lfloor K/2 \rfloor,\,c}

Each channel has its own KK weights wj,cw_{j,c} and never mixes with another channel. The parameter count is d⋅Kd \cdot K. A standard convolution that mixes channels needs d⋅d⋅Kd \cdot d \cdot K. The ratio is 1/d1/d, which is why the depthwise form is cheap.

Worked examples

Example
One gate on one channel

Take the vector z=(2,1)z = (2, 1), so d=1d = 1, a=2a = 2 and b=1b = 1.

  1. Split the vector. The first half is a=2a = 2 and the second half is b=1b = 1.
  2. Compute the gate. σ(1)=1/(1+e−1)≈0.731\sigma(1) = 1/(1 + e^{-1}) \approx 0.731.
  3. Multiply. GLU(z)=2×0.731=1.46\mathrm{GLU}(z) = 2 \times 0.731 = 1.46.

Interpretation: the gate let about 73 percent of the value 22 through. A larger bb would let more through, and a very negative bb would block it almost entirely.

Example
One block on a single number

Use scalar values, skip the final layer normalization (on a single number it only rescales), and pick a starting value xi=4x_i = 4. Pretend the feed-forward module returns 2 for 44, attention returns 1, and the convolution returns 0.5.

  1. First half-step. x~i=4+12×2=5\tilde{x}_i = 4 + \tfrac{1}{2} \times 2 = 5.
  2. Attention. xi′=5+1=6x^{\prime}_i = 5 + 1 = 6.
  3. Convolution. xi′′=6+0.5=6.5x^{\prime\prime}_i = 6 + 0.5 = 6.5.
  4. Second half-step. The feed-forward module applied to 6.56.5 returns 1 in this example, so 6.5+12×1=7.06.5 + \tfrac{1}{2} \times 1 = 7.0.

Interpretation: the block raised the value from 4 to 7. Each module added its own correction and nothing overwrote the input, which is what a residual connection guarantees. The half weights kept the two feed-forward corrections smaller than a full one would have been.

Example
Why depthwise convolution is cheap, at Conformer-M size

The medium model has width d=256d = 256 (Table 1 of the paper) and kernel length K=32K = 32.

  1. A standard convolution from 256 channels to 256 channels with kernel 32 has 256×256×32=2,097,152256 \times 256 \times 32 = 2{,}097{,}152 weights.
  2. A depthwise convolution with 256 channels and kernel 32 has 256×32=8,192256 \times 32 = 8{,}192 weights.
  3. The ratio is 8,192/2,097,152=1/2568{,}192 / 2{,}097{,}152 = 1/256, which matches 1/d1/d.
  4. So the depthwise filter spans 32 frames at a cost of about 0.4 percent of a full channel-mixing convolution. Channel mixing is left to the pointwise layers.

Try it: the large model has d=512d = 512 and K=32K = 32. Compute its depthwise weights and its standard-convolution weights, then find the ratio. Answer: depthwise 512×32=16,384512 \times 32 = 16{,}384; standard 512×512×32=8,388,608512 \times 512 \times 32 = 8{,}388{,}608; ratio 16,384/8,388,608=1/51216{,}384 / 8{,}388{,}608 = 1/512.

Results

The three models were chosen by sweeping depth, width and attention heads, keeping the best one under each parameter budget (Table 1 of the paper).

ModelParametersEncoder layersWidthHeads
Conformer S10.3 M161444
Conformer M30.7 M162564
Conformer L118.8 M175128

Word error rates on LibriSpeech (test-clean / test-other, lower is better):

ModelParametersWithout LMWith LM
Transformer transducer139 M2.4 / 5.62.0 / 4.6
ContextNet (L)112.7 M2.1 / 4.61.9 / 4.1
Conformer S10.3 M2.7 / 6.32.1 / 5.0
Conformer M30.7 M2.3 / 5.02.0 / 4.3
Conformer L118.8 M2.1 / 4.31.9 / 3.9

What these numbers mean: the medium model beats a model more than four times its size. The large model gives the best numbers in the table. With an external language model the gap to the Transformer transducer on the hard test set is about 15 percent relative (3.9 against 4.6), the improvement the paper highlights. The paper's limits: all results are on one benchmark, LibriSpeech, and the language-model comparisons depend on the particular language model the authors trained.

The ablation tables (test-other word error rate, no language model) show which parts carry the gain:

  • Full Conformer L: 4.3.
  • Replace the convolution module with nothing: 4.9.
  • Replace the relative positional encoding with ordinary positional encoding: 5.6. This is the largest drop in the table.
  • Replace the two half-step feed-forward modules with one full feed-forward module (Table 5): 4.5.
  • Swap swish for ReLU (Activation Function): 4.5.

Placement also matters. Putting the convolution before attention, or running attention and convolution in parallel, was worse than the chosen order. Kernel length 32 was best or tied for best among the values tried (3, 7, 17, 32, 65). For attention heads, eight (the setting used for Conformer L) gave the best test-other score, 4.3, while four, sixteen and thirty-two heads gave 4.5, 4.4 and 4.5.

Reading guide

The paper is short. Read it in this order, with the lessons each part needs:

Check yourself

QuestionIn one sentence, what does the convolution module add to a Conformer block that the self-attention module does not provide?Show answer

Local detail: the convolution looks at a short window of neighbouring frames with its own learned filters, which captures fine short-range patterns efficiently. Self-attention already mixes information across the whole utterance, but it is weaker at fine local patterns, so the two together cover both scales.

QuestionA gated linear unit receives the vector (3, 0). Compute its output.Show answer

Split into a=3a = 3 and b=0b = 0. Then σ(0)=0.5\sigma(0) = 0.5, so the output is 3×0.5=1.53 \times 0.5 = 1.5. A zero gate input lets half of the value through.

QuestionEach Conformer block uses two feed-forward modules with weight one half instead of one full feed-forward module. Why might the half weights help, and what did the paper find when it used full-step residuals instead?Show answer

Each half-step correction is smaller, so the two together add about as much change as one full layer, but the update is split around the attention and convolution modules. This is the Macaron-style design the paper borrows from Macaron-Net. In the paper's ablation, full-step residuals were slightly worse on test-other (4.5 against 4.3), so the half weight is a measured choice, not decoration.

QuestionA product team has a memory budget of about 12 million parameters for an on-device recogniser. Which Conformer size from the paper fits, and what is its no-language-model word error rate on test-other?Show answer

Conformer S, with 10.3 million parameters, is the only model in the paper under 12 million. Its test-other error without a language model is 6.3 percent. Conformer M, at 30.7 million, is too large for the budget.

Sources

Read the full paper

Anmol Gulati, James Qin, Chung-Cheng Chiu et al., 2020. arXiv:2005.08100