---
title: "How Much Attention Do You Need? A Granular Analysis of"
description: "A component-by-component study of neural machine translation shows where self-attention matters and which Transformer features help…"
canonical: "https://research.elamur.ai/free/en/papers/domhan-2018-how-much-attention-do-you/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Shryfti](https://md.shryfti.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/domhan-2018-how-much-attention-do-you/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2018](https://md.research.elamur.ai/free/en/papers/2018/) / How Much Attention Do You Need? A Granular Analysis of Neural Machine Translation Architectures

# How Much Attention Do You Need? A Granular Analysis of Neural Machine Translation Architectures

Paper · 2018 · Tobias Domhan

**Authors:** Domhan, Tobias · **Year:** 2018 · **Venue:** Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[**74** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2798761464) · [Cited by **19** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/domhan-2018-how-much-attention-do-you/cited-by/) · [Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)](https://aclanthology.org/volumes/P18-1/) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/P18-1167/)
- [PDF](https://aclanthology.org/P18-1167.pdf)
- [DOI 10.18653/v1/p18-1167](https://doi.org/10.18653/v1/p18-1167)
- [OpenAlex](https://openalex.org/W2798761464)

Citations: OpenAlex, 2026-10-14.

## Summary

When a new translation architecture works better, the improvement may come from several changes introduced together. The [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/) made self-attention the main way for positions within a sentence to exchange information. It also changed how often the decoder consults the source, how attention scores are computed, and what each block does with the information it receives. Tobias Domhan asks which of these changes account for the Transformer’s advantage in neural [machine translation](https://md.research.elamur.ai/free/en/topics/machine-translation/), and whether the answer differs between reading a source sentence and writing its translation.

The paper introduces an Architecture Definition Language that describes a translation system as a pair of chains built from reusable layers. It allows the author to add Transformer features to recurrent and convolutional systems in stages, and to replace self-attention on either side of a Transformer while keeping its other components. Across experiments on IWSLT’16 English→German and WMT’17 English→German and Latvian→English, two changes stand out. Recurrent decoders benefit from consulting the source at several depths, and both recurrent and convolutional systems benefit from residual feed-forward layers, which transform the representation at each position while retaining a direct connection around the transformation. On WMT’17 English→German, the final recurrent and ReLU convolutional variants reach mean [BLEU scores](https://md.research.elamur.ai/free/en/concepts/bleu/) of 26.7 and 26.9, respectively, against 27.6 for the Transformer.

The replacement experiments locate the strongest case for self-attention on the source side. On WMT’17 English→German, a Transformer encoder paired with a convolutional decoder reaches 27.6 mean BLEU, the same reported mean as the fully self-attentive system. Replacing encoder self-attention with convolution while leaving the decoder self-attentive yields 26.6. IWSLT English→German is an important exception to the source-side pattern. On that dataset, the recurrent and convolutional encoders paired with a self-attentive decoder both score above the fully self-attentive reference on mean BLEU. The paper also compares ways to connect decoder blocks to encoder outputs. Giving each block access to the top encoder representation is at least as effective on the reported means as routing different encoder depths to different decoder blocks.

A more severe test removes the decoder layer that exchanges information across target positions. Every decoder block can still consult the encoded source, and the decoder still receives the preceding target token and its positional information. This version reaches 25.3 mean BLEU on WMT’17 English→German, with a larger loss on METEOR than the decoder substitutions incur. The paper thus identifies two distinct roles for attention. Repeated attention to the source contributes strongly to the improved architectures, while the preferred way to combine information across positions on the target side depends on the dataset and metric.

## Deep dive: How Much Attention Do You Need? A Granular Analysis of Neural Machine Translation Architectures

A component-by-component study of neural machine translation shows where self-attention matters and which Transformer features help other architectures. · about 39 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### An architectural improvement can have several causes

A translation system has to solve two related problems. It must build a representation of a completed sentence in one language, and it must use that representation to generate a sentence in another language. The first job belongs to the encoder. The second belongs to the decoder, which produces the output in order and has access to the part it has already generated. The encoder can use the whole input at every stage of processing. The decoder must respect the boundary between the target text already available and the text it is about to predict.

Attention provides a connection between those two jobs. A decoder can express what it needs at its current position as a query and use that query to weight information from the source. It can therefore retrieve a different mixture of source information for different target positions. The paper traces the rise of this approach through early sequence-to-sequence translation and the introduction of attention to that setting. It cites the sequence-to-sequence work of Sutskever and colleagues and the attention work of Bahdanau and colleagues and Luong and colleagues. Luong’s study is especially relevant because it examined several attention mechanisms for recurrent translation and included dot-product attention, a scoring approach that the Transformer also uses. [Sequence to Sequence Learning with Neural Networks](https://md.research.elamur.ai/free/en/papers/sutskever-2014-sequence-sequence-learning-neural-networks/) · [Effective Approaches to Attention-based Neural Machine Translation](https://md.research.elamur.ai/free/en/papers/luong-2015-effective-approaches-attention-based-neural/)

In the recurrent architectures the paper discusses, a layer carries a state forward through the sentence. Processing a position involves the input at that position and a state produced at an earlier one. This arrangement gives the network a way to retain information over time, but the computations within a recurrent layer depend on sequence order. Architectures based on convolution and self-attention remove the requirement to finish the previous source position before starting the next one within the same layer. The paper describes these developments as improving training speed and translation quality and presents them as the immediate background for its comparisons. [Convolutional Sequence to Sequence Learning](https://md.research.elamur.ai/free/en/papers/gehring-2017-convolutional-sequence-sequence-learning/) · [Attention Is All You Need](https://md.research.elamur.ai/free/en/papers/vaswani-2017-attention-all-need/)

Convolution and self-attention make different choices about where each position gets information. A convolution applies a learned transformation to a local window. Repeating the operation at greater depth lets information travel beyond the first window. Self-attention allows a position to draw on other eligible positions directly by assigning them weights. On the source side, those positions can span the sentence. On the target side, eligibility is restricted by generation order. Both mechanisms can process positions in parallel during training when their inputs at a layer are available, but they reach context in different ways.

The shift to a different way of combining positions is only part of what distinguishes the Transformer. Its decoder consults the encoded source repeatedly. An attention operation can use several heads, meaning separate learned views of the inputs that yield separate mixtures of information. The architecture also uses normalization and position-wise feed-forward transformations inside a residual structure. A residual connection carries the incoming representation around a transformation and adds the transformed result to it. Each of these changes affects a different part of computation, and a comparison between complete architectures bundles their effects.

This makes the title’s question more specific than it first appears. The amount of attention can refer to how many times the decoder looks at the source, how many heads participate in a particular lookup, or whether the system uses attention to connect positions within the source or within the target. Those are different design choices. For instance, the decoder can use recurrent layers for target history and still consult the source through multi-head attention. That system changes one use of attention while preserving another.

#### What earlier comparisons left open

The paper situates its investigation alongside work that had already varied recurrent architectures. Britz and colleagues had explored attention choices, recurrent cell types, and network depth. That study showed the relevance of examining architecture decisions within a family. Domhan’s investigation extends the comparison across recurrent, convolutional, and self-attentive families by describing their higher-level components in a common language. [Massive Exploration of Neural Machine Translation Architectures](https://md.research.elamur.ai/free/en/papers/britz-2017-massive-exploration-neural-machine-translation/)

There was also a precedent for expressing architectures in a language. The paper discusses Schrimpf and colleagues’ approach to defining the internal structure of a recurrent cell for automatic search. It mentions related architecture-search efforts in image classification. Domhan uses a language at the level of encoder and decoder layers. The experiments follow specified substitutions and additions, so the resulting configurations answer questions about particular paths through the design space. [Neural Architecture Search with Reinforcement Learning](https://md.research.elamur.ai/free/en/papers/zoph-2016-neural-architecture-search-reinforcement-learning/)

A common description helps with comparisons that look simple in prose. Replacing self-attention with recurrence can mean rebuilding the decoder in the style of an older recurrent system, with one source lookup near the top. It can also mean preserving the Transformer’s repeated source lookup and replacing only the sublayer that mixes target positions. The first comparison changes how the decoder gets source information along with how it handles target history. The second isolates the choice more closely. The paper uses both kinds of evidence for different purposes. It traces what happens when familiar baselines acquire features from the Transformer, then asks what happens when those features are held in place and the sequence-processing layer is changed on a particular side.

The design also separates the place where source attention occurs from the source representation it reads. Installing a source-attention layer at every decoder depth provides more points at which the decoder can consult the source. Each of those layers could read the final encoder output, or they could read encoder outputs from different levels. The first decision governs the number and placement of source lookups. The second governs what representation is offered to each lookup. Treating them as separate variables lets the paper ask whether more opportunities to consult the source require a corresponding spread across encoder depths.

### The method, step by step

#### From the source sentence to a target prediction

The input sentence enters the encoder as a sequence of token embeddings. An embedding is a learned vector associated with a vocabulary entry. The encoder transforms the sequence of vectors through successive layers and keeps a representation at each source position. The decoder begins from target embeddings, which during training are supplied from the reference translation at the positions where that text is already available. Its layers can combine target-side information and retrieve information from the source. The final decoder representation gives the next-token distribution.

How the encoder and decoder produce a translation The steps in order.

The paper writes the source and target sequences as follows.

```
X = (x₁, …, xₙ)
```

Here `X` is the input sentence, `x₁` through `xₙ` are its tokens in order, and `n` is the source length. The ellipsis denotes the intervening positions.

```
Y = (y₁, …, yₘ)
```

Here `Y` is the target sentence, `y₁` through `yₘ` are its tokens in order, and `m` is the target length. Again, the ellipsis stands for the intervening positions.

```
p(yₜ | Y₁:ₜ₋₁, X; θ) = softmax(Wₒ zᴸ + bₒ)
```

The left side gives the probability `p` of target token `yₜ` at step `t`, conditional on the earlier target tokens `Y₁:ₜ₋₁` and input sentence `X`, with learned parameters `θ`. On the right, `zᴸ` is the final decoder vector used at that step, and `L` is the last decoder layer. The projection matrix `Wₒ` and bias vector `bₒ` turn that vector into scores indexed by the target vocabulary. The subscript `o` identifies the output transformation. `softmax` turns its scores into a probability distribution over the vocabulary.

The training objective is cross-entropy, which penalizes the system for assigning low probability to the reference token. The target prefix in the equation usually comes from the reference sentence during training. This procedure is called teacher forcing. At generation time, the preceding tokens come from the system’s own predictions. This distinction matters for architecture design. With the reference prefix available during training, a decoder layer can compute at several positions in parallel if its operations respect which inputs each position is allowed to see. The generated sentence itself still emerges in order.

The embedding lookup on the source side has the following form.

```
u⁰ₜ = Eₛᵣ꜀ xₜ
```

Here `u⁰ₜ` is the source embedding at position `t`, and the superscript `0` designates the representation before the encoder’s processing layers. `Eₛᵣ꜀` is the source embedding matrix, with one column for each entry of the source vocabulary and a row for each of the `e` embedding dimensions. In this expression `xₜ` denotes the one-hot vector for source token `xₜ`. It selects the associated column. The target side initializes its representations by the same kind of lookup using the target embedding matrix.

#### How the language composes layers

The Architecture Definition Language, or ADL, represents the encoder and decoder as separate chains. A layer in a chain receives the representation produced by the previous layer. It can have named arguments, such as a kernel size, or positional arguments whose meaning comes from their order. A layer can also contain a chain of its own. This is how the same notation describes a simple projection and a residual block containing normalization, attention, and dropout.

```
Hⁱ ∈ ℝᵀˣᵈⁱ
```

`Hⁱ` is the collection of hidden states at layer index `i`. The symbol `∈` means it belongs to the indicated set of real-valued matrices, written `ℝ`. `T` is the sequence length and `dⁱ` is the vector width at that layer, so the matrix has one row per position and one column per feature. The paper generally holds the width constant across successive layers and calls it the architecture’s dimensionality. Some operations expand a vector internally and then restore that width.

```
l₁ → l₂ → … → l_L = l_L(… l₂(l₁(H⁰)))
```

Here `l₁`, `l₂`, and `l_L` are layers in a chain of length `L`. The arrows say to apply the layers in order, starting with the input states `H⁰`. The nested calls on the right express the same order, with the ellipsis standing for intermediate layers. The equivalence describes ordinary chaining. A decoder source-attention layer also needs the selected encoder states, a second input supplied alongside the ordinary activation flowing down the decoder.

```
repeat(n, l) = l₁ → l₂ → … → lₙ
```

The function `repeat` makes `n` successive instances of the layer or chain `l`. The instances `l₁` through `lₙ` have the same structure and separate learned parameters. The arrows indicate execution order. Thus a repeated source-attention block can learn a different lookup at each depth even when all of those lookups read the same encoder states.

The paper uses `U` for source states and `Z` for target states, with a superscript denoting depth. The encoder states available to source attention range from the source embeddings through the top encoder output. The decoder’s ordinary chain begins at the target embeddings and ends at the representation used in the probability equation. An ADL definition specifies both chains and the connection from each source-attention operation to the encoder representation it reads. Changing that connection can give a decoder layer a different input without changing the order of its sublayers.

#### Operations at a position

The simplest layer returns its input. It becomes useful when the architecture branches and one branch needs to preserve the original representation.

```
id(hₜ) = hₜ
```

`id` is the identity operation, `hₜ` is the hidden vector at position `t`, and the equality says the output is that same vector.

```
concat(hₜ, l₁, …, lₚ) = [l₁(hₜ); …; lₚ(hₜ)]
```

Here `concat` applies the `p` branches `l₁` through `lₚ` to the input at `t`. Square brackets and the separators inside them indicate that the resulting vectors are joined along their feature dimensions. The ellipses stand for the intermediate branches. In the recurrent baseline, this operation joins a decoder state to a source-attention context so that both are present in the input to the following transformation.

```
linear(hₜ, dₒ) = Whₜ + b
```

`linear` produces an output of width `dₒ` from input vector `hₜ`. The learned matrix `W` has one row per output feature and one column per input feature. The learned bias `b` has the output width and is added to the projected vector.

```
ff(hₜ, dₒ) = dropout(max(0, linear(hₜ, dₒ)))
```

`ff` is the feed-forward layer. It applies the linear transformation to the vector `hₜ` at position `t`, using output width `dₒ`. The coordinate-wise maximum with `0` is the rectified linear unit, or ReLU. It leaves positive coordinates in place and clips negative ones to zero. `dropout` regularizes the resulting activations during training. The ADL also allows dropout as a layer in its own right. [Dropout](https://md.research.elamur.ai/free/en/papers/srivastava-2014-dropout-simple-way-prevent/)

```
ffl(hₜ) = ff(4dᵢₙ) → linear(dᵢₙ)
```

The operation `ffl` starts from `hₜ`, whose width is `dᵢₙ`. The first operation in the chain uses `ff` to expand that width to `4dᵢₙ`. The next operation projects back to `dᵢₙ`. The chain passes its input implicitly to `ff` and the expanded result implicitly to `linear`. Returning to the original width makes it possible to add the output to the original vector in a residual block.

The feed-forward layers act at individual positions. They can reshape the information that has already arrived through recurrence, convolution, or attention. On their own they do not carry a feature from one position to another. This is central to the experiments. Adding an expanding feed-forward layer changes how thoroughly the representation can be processed after information is combined, while the operation that transfers information across positions can be kept fixed.

Position information enters some of the architectures through fixed embeddings. The ADL scales the token vector, adds a vector determined by its position, and applies dropout.

```
pos(hₜ) = dropout(√d · hₜ + pₜ)
```

`pos` is the positional-embedding layer. `hₜ` is the input at position `t`, `d` is its width, and `√d` is the square root used to scale that input. `pₜ` is the fixed vector for position `t`. The dot indicates scalar multiplication. `dropout` is applied after the scaled embedding and the position vector have been added.

```
pₜ,₂ⱼ = sin(t / 10000^(2j/d))
```

`pₜ,₂ⱼ` is the coordinate in an even slot indexed by `2j` of the position vector `pₜ`. The position is `t`, `j` indexes coordinate pairs, and `d` is the width. The fixed base `10000` is raised to `2j/d`, which determines the scale of the argument to `sin`, the sine function.

```
pₜ,₂ⱼ₊₁ = cos(t / 10000^(2j/d))
```

`pₜ,₂ⱼ₊₁` is the odd slot paired with the preceding even slot. `cos` is the cosine function. The position `t`, pair index `j`, width `d`, and base `10000` enter the argument in the same way. Using the coordinate pair gives the architecture a fixed representation of order before any recurrent, convolutional, or attention layer operates.

#### Recurrence and convolution

A recurrent layer processes an input at each position together with a state carried from the previous position. The ADL describes the visible layer output and the updated internal state separately.

```
rnn(hₜ) = fᵣₙₙ,ₒ(hₜ, sₜ₋₁)
```

`rnn(hₜ)` is the recurrent layer’s output at position `t`. The function `fᵣₙₙ,ₒ` computes it from the current input `hₜ` and previous internal state `sₜ₋₁`. The subscript `o` identifies the output function.

```
sₜ = fᵣₙₙ,ₕ(hₜ, sₜ₋₁)
```

Here `sₜ` is the updated state passed along the sequence. The function `fᵣₙₙ,ₕ` describes the state update from `hₜ` and `sₜ₋₁`. The subscript `h` distinguishes this update from the visible output. The layer definition accommodates a gated recurrent unit, or GRU, and a long short-term memory cell, or LSTM. The experiments use LSTMs. A bidirectional layer, called `birnn` in the ADL, runs recurrence over the source in both directions and joins the outputs. [Learning Phrase Representations using RNN Encoder–Decoder](https://md.research.elamur.ai/free/en/papers/cho-2014-learning-phrase-representations-rnn-encoder/)

A convolutional layer applies a shared learned transformation to a window of input positions. The paper’s encoder expression uses a window centered on the current position. The decoder uses a window ending at that position.

```
cnn(H, v, k) at i = v(W[hᵢ₋⌊ₖ⧸₂⌋; …; hᵢ₊⌊ₖ⧸₂⌋] + b)
```

`cnn` is the convolution, `H` is the input sequence of hidden vectors, `v` is the activation function, and `k` is the kernel size. The output shown is the one at source position `i`. The brackets join the input vectors `h` from the positions in the window, and the ellipsis includes all intervening positions. The notation `⌊k/2⌋` gives the integer obtained by rounding the half-width down. The learned matrix `W` projects that joined input and `b` is the bias. Padding extends the input at sentence boundaries so the output has the same number of positions as the input.

```
cnn(H, v, k) at t = v(W[hₜ₋ₖ₊₁; …; hₜ] + b)
```

Here `t` is the decoder position, `H` is the sequence of decoder inputs to the layer, `v` is the activation, and `k` is again the kernel size. The window contains vectors from `t−k+1` through `t`, with the bounds chosen so that the layer never reads a later decoder position. `W` and `b` are the learned projection and bias. The padding vectors on the left supply the missing inputs at the start of the sequence. This lets the same operation apply there as elsewhere.

The convolution can use ReLU or a gated linear unit, abbreviated GLU. A GLU splits the projected input into two parts. It uses one part to decide how much of each coordinate in the other part passes through.

```
glu([hᴬ; hᴮ]) = hᴬ ⊗ σ(hᴮ)
```

The brackets denote the joined input made from the equal-width vectors `hᴬ` and `hᴮ`. The superscripts `A` and `B` identify its two halves. `σ` is the sigmoid function applied separately to each coordinate. The operator `⊗` multiplies corresponding coordinates, so the sigmoid of `hᴮ` gates the output from `hᴬ`. The projection feeding the gate supplies both halves. [Language Modeling with Gated Convolutional Networks](https://md.research.elamur.ai/free/en/papers/dauphin-2016-language-modeling-gated-convolutional-networks/)

#### The different uses of attention

Attention starts with queries, keys, and values. A query describes the input for which the layer needs a context. Keys supply the vectors against which that query is scored. Values supply the content to be combined according to the scores. In source attention, the query is built from a decoder state, and the keys and values come from the encoder. In self-attention, all three are obtained from the same sequence of hidden states, with learned projections able to give them different roles.

```
dot_att(Q, K, V, s) = softmax(QKᵀ / √s) V
```

`dot_att` is scaled dot-product attention. `Q` is the matrix of queries, `K` the matrix of keys, and `V` the matrix of values, each arranged with vectors as rows. The transpose `Kᵀ` allows `QKᵀ` to produce a score for every query and key pair. `s` is the scale parameter, ordinarily the vector width `d` where the definition does not specify another value. Dividing by `√s` rescales the scores. `softmax` converts each row of scores into weights over the keys. Multiplication by `V` computes the weighted mixture of values for each query.

```
proj_dot_att(Q, K, V, dₚ, s) = dot_att(QW_Q, KW_K, VW_V, s)
```

`proj_dot_att` is projected dot-product attention. It starts with query matrix `Q`, key matrix `K`, and value matrix `V`. The learned matrices `W_Q`, `W_K`, and `W_V` map their respective inputs to width `dₚ`, the projected dimensionality. The function `dot_att` then operates on these projected inputs with scale `s`. This lets the architecture learn which features matter for comparing positions and which features to pass onward.

```
Cᵢ = proj_dot_att(Q, K, V, d/h, s)
```

`Cᵢ` is the output for head index `i`, using its own projections in `proj_dot_att`. `Q`, `K`, and `V` are again the inputs in their query, key, and value roles. `d` is the overall attention width, `h` is the number of heads, and `d/h` is the projected width of a head. The argument `s` sets the scaling used within the head.

```
mh_dot_att(Q, K, V, h, s) = [Cᵢ for each head i]
```

`mh_dot_att` denotes multi-head dot-product attention on inputs `Q`, `K`, and `V`, with head count `h` and scale parameter `s`. The bracketed expression means that the outputs `Cᵢ` from the individual heads are concatenated along the feature dimension. With `h = 1`, the operation is the projected dot-product attention described above.

The ADL also defines attention that scores the query and key through a small neural network, referred to as multilayer perceptron or MLP attention. This is the scoring approach used for the conventional recurrent baseline.

```
Sᵢⱼ = wₒᵀ tanh(W_q qᵢ + W_k kⱼ)
```

`Sᵢⱼ` is the score for query index `i` and key index `j`. The vectors `qᵢ` and `kⱼ` come from the query and key sequences. The learned matrices `W_q` and `W_k` transform them into the same feature space so their results can be added. The function `tanh` applies the hyperbolic tangent to the resulting coordinates. The transpose of the learned vector `wₒ` reduces that result to a single score.

```
mlp_att(Q, K, V) = softmax(S) V
```

`mlp_att` is MLP attention. Its inputs `Q`, `K`, and `V` are the query, key, and value matrices. The score matrix `S` contains the pairwise scores just defined. The row-wise `softmax` produces the weights with which `V` is combined. The mechanism therefore returns a context for each query, as dot-product attention does, while learning the scores through a different computation.

The source-attention definitions specify which hidden states fill the inputs of these operations.

```
mh_dot_src_att(H, U, h, s) = mh_dot_att(H, U, U, h, s)
```

`mh_dot_src_att` is multi-head attention from decoder to encoder. The decoder states `H` serve as queries, and the source states `U` at the selected depth supply both keys and values. The function `mh_dot_att` uses `h` heads and scale `s`.

```
dot_src_att(H, U, s) = mh_dot_att(H, U, U, 1, s)
```

`dot_src_att` is the single-head form. The inputs have the same roles, with decoder states `H` querying encoder states `U`. The argument `1` specifies a single head, and `s` remains the scale. In the convolutional architecture inspired by ConvS2S, the setting `s = 1` makes the score unscaled because the denominator is then unity.

```
mlp_src_att(H, U) = mlp_att(H, U, U)
```

`mlp_src_att` is the source-attention form that uses the MLP scoring function. `H` supplies the decoder queries, and `U` supplies the encoder keys and values. The inner operation `mlp_att` calculates the context with the score network and the weighted sum defined above.

```
mh_dot_self_att(H, s) = mh_dot_att(H, H, H, s)
```

`mh_dot_self_att` is multi-head self-attention, with the head setting understood in the call. `H` is the hidden-state matrix of the sequence being processed. It fills the query, key, and value roles. The function `mh_dot_att` computes attention with scaling parameter `s`. On the decoder side a mask excludes future positions from the weights. This lets the layer use the current available input and earlier inputs while respecting the target prefix in the prediction equation.

The repeated use of `H` in that last formula identifies the source of the inputs. The learned projections can turn the same hidden vector into different query, key, and value vectors. Likewise, a single encoder representation may be used for keys and values at several decoder layers without forcing those layers to learn the same projections. Attention type, head count, choice of source depth, and placement in the chain are therefore distinct choices in the language.

#### Normalization and residual paths

Layer normalization operates on the features of the vector at a position. It subtracts that vector’s mean, divides by its standard deviation, and then applies learned coordinate-wise scaling and shifting. [Layer Normalization](https://md.research.elamur.ai/free/en/papers/ba-2016-layer-normalization/)

```
μₜ = (1/d) ∑ⱼ hₜ,ⱼ
```

`μₜ` is the feature mean at position `t`. The sum `∑ⱼ` ranges over the `d` feature coordinates, and `hₜ,ⱼ` denotes feature `j` of that vector. The factor `1/d` makes the sum a mean.

```
σₜ = √((1/d) ∑ⱼ (hₜ,ⱼ − μₜ)²)
```

`σₜ` is the feature standard deviation at position `t`. Each feature `hₜ,ⱼ` is compared with the same position’s mean `μₜ`. The sum ranges over the `d` coordinates, the differences are squared, and the square root is taken after averaging those squared differences.

```
norm(hₜ) = g ⊗ ((hₜ − μₜ) / σₜ) + b
```

`norm` is layer normalization, and `hₜ` is the vector at position `t`. Its mean `μₜ` is subtracted from each coordinate and its standard deviation `σₜ` divides each centered coordinate. The vectors `g` and `b` provide learned scales and shifts. The operator `⊗` indicates coordinate-wise multiplication.

```
res(hₜ, l) = hₜ + l(hₜ)
```

`res` is a residual layer and `l` is the transformation inside it, possibly a chain of layers. The original vector `hₜ` at position `t` follows the direct path. The result `l(hₜ)` follows the transformed path. Their addition requires the same output width on both paths.

```
res_d(hₜ, l) = hₜ + dropout(l(hₜ))
```

`res_d` is the residual form with dropout. It applies the inner transformation `l` to `hₜ`, passes its output through `dropout`, and adds the result to the original vector.

```
res_nd(hₜ, l) = hₜ + dropout(l(norm(hₜ)))
```

`res_nd` is the residual form with both normalization and dropout. The inner transformation `l` operates on `norm(hₜ)`, and its result goes through `dropout` before being added to `hₜ`. In the Transformer implementation used in the paper, normalization thus acts at the entrance to the transformed branch. The encoder and decoder chains also end in normalization.

#### Building the translation architectures

The conventional recurrent architecture in the paper starts its encoder with dropout and a bidirectional layer. It then uses a stack of unidirectional recurrent layers with residual paths around them. The decoder runs a recurrent stack, uses a single source-attention layer with MLP scoring, and joins the resulting source context with the decoder state before a feed-forward transformation.

```
Uᴸˢ = dropout → birnn → repeat(n − 1, res_d(rnn))
```

`Uᴸˢ` denotes the top encoder states, with `Lₛ` the encoder depth. The expression on the right is a chain applied to the source embeddings. `dropout` regularizes those inputs, `birnn` processes the sequence in both directions, and `repeat` instantiates `n − 1` unidirectional `rnn` layers inside residual blocks with dropout, written `res_d`. The symbol `n` is the number of encoder layers for this definition.

```
Zᴸ = dropout → repeat(n, res_d(rnn)) → concat(id, mlp_src_att) → ff
```

`Zᴸ` denotes the final decoder states at depth `L`. The target embeddings pass through `dropout` and then through `n` repeated residual recurrent layers. The operation `concat` joins the recurrent output from its identity branch `id` with the context produced by `mlp_src_att`, which also reads the encoder states. Finally, `ff` transforms this joined representation for the output predictor.

The paper also tests a version with input feeding. This gives the bottom of the decoder information from the top of the preceding step, adding a path by which previous decoder computation can influence the current step.

```
z⁰ₜ = [zᴸₜ₋₁; Eₜᵍₜ yₜ]
```

`z⁰ₜ` is the decoder input representation at position `t`, and `zᴸₜ₋₁` is the top decoder state at the preceding position. `Eₜᵍₜ` is the target embedding matrix, and `yₜ` here is the token supplied as the decoder input at that position, represented for embedding lookup. The brackets concatenate the top state and the embedding. The output prediction uses the available target inputs with the autoregressive shift. This connection requires the previous top state to be ready before the decoder can form its current input. A recurrent decoder already has sequential dependencies, which is why the paper singles out this constraint as a concern when applying input feeding to other kinds of decoder.

For convolution, the paper first describes a ConvS2S-style architecture. Its encoder adds positional information and repeats residual gated convolutions with dropout. Its decoder uses convolution together with unscaled, single-head source attention inside the residual structure. The implementation’s description specifies simpler treatment of the query and value inputs than in the cited ConvS2S design. The experiments then use a simpler convolutional baseline that puts the convolution and source attention into their own residual blocks. [Convolutional Sequence to Sequence Learning](https://md.research.elamur.ai/free/en/papers/gehring-2017-convolutional-sequence-sequence-learning/)

```
Uᴸˢ = pos → repeat(6, res_d(cnn))
```

Here `Uᴸˢ` is the final source representation at encoder depth `Lₛ` in that experimental convolutional baseline. The position layer `pos` acts on the source embeddings. The function `repeat` then builds `6` instances of the dropout residual form `res_d` around a convolutional layer `cnn`.

```
Zᴸ = pos → repeat(6, res_d(cnn) → res_d(dot_src_att))
```

`Zᴸ` is the final decoder representation at depth `L`. The function `pos` adds positional information to the target embeddings. Each of the `6` repeated blocks first applies a residual `cnn` operation with dropout, then a residual single-head `dot_src_att` operation with dropout. The second operation uses the current decoder states to query the encoder output. The convolution uses the window that ends at the current decoder input position.

The Transformer uses comparable blocks on both sides, with an additional source-attention operation on the decoder side.

```
tₑₙ꜀ = res_nd(mh_dot_self_att) → res_nd(ffl)
```

`tₑₙ꜀` names a Transformer encoder block. Its first residual layer, `res_nd`, contains multi-head self-attention, written `mh_dot_self_att`. Its second contains the expanding feed-forward transformation `ffl`. The arrow orders these operations, and each transformed branch starts with normalization and ends with dropout before its residual addition.

```
t𝒹ₑ꜀ = res_nd(mh_dot_self_att) → res_nd(mh_dot_src_att) → res_nd(ffl)
```

`t𝒹ₑ꜀` names a Transformer decoder block. Masked `mh_dot_self_att` first processes the permitted target positions. The resulting states then query the encoder through `mh_dot_src_att`. The last operation is `ffl`. Each of the three operations is wrapped in its own normalized dropout residual layer.

```
Uᴸˢ = pos → repeat(n, tₑₙ꜀) → norm
```

`Uᴸˢ` is the final encoder representation at depth `Lₛ`. The source embeddings receive positional information through `pos`, `repeat` applies `n` separately parameterized instances of the encoder block `tₑₙ꜀`, and `norm` normalizes the final states.

```
Zᴸ = pos → repeat(n, t𝒹ₑ꜀) → norm
```

`Zᴸ` is the final decoder representation at depth `L`. The `pos` layer operates on the target embeddings. The `n` instances of `t𝒹ₑ꜀` each include a source lookup, and the final `norm` acts before the output projection. This structure uses the normalization placement adopted from tensor2tensor in the paper’s implementation.

The replacement experiment treats the first operation of each Transformer block as a choice. On the encoder side, the sequence-processing layer can be self-attention, recurrence, or convolution, followed by the same expanding feed-forward layer. On the decoder side, the corresponding choice comes before the unchanged source-attention and feed-forward layers. A special decoder configuration also removes that operation and its residual wrapper. The remaining block is compact enough to show directly.

```
t𝒹ₑ꜀ = res_nd(mh_dot_src_att) → res_nd(ffl)
```

In this reduced block, `t𝒹ₑ꜀` is the decoder chain element, `res_nd` is the residual form with normalization and dropout, `mh_dot_src_att` reads the encoder, and `ffl` transforms features at the current target position. There is no operation in this block that reads another target position. The preceding generated token reaches the decoder through its input embedding, and its own position remains available through the positional layer. The source lookup can still use the full encoded sentence.

#### Preparing and training the comparisons

The paper implements the ADL in an adapted version of Sockeye. The implementation reads architecture definitions, allowing the same training system to run the recurrent, convolutional, and Transformer variants. The paper makes the implementation and configurations available. Its additional WMT’14 comparison uses data distributed in preprocessed form through tensor2tensor.

For the main experiments, the source and reference are first segmented by the Moses tokenizer. Byte Pair Encoding then represents the tokenized text in units that can include parts of words. The same setting of 32,000 merge operations is used for WMT’17 and IWSLT’16. This gives the experiments a shared approach to vocabulary construction while the translation architecture changes. [Tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/) · [Subword tokenization](https://md.research.elamur.ai/free/en/concepts/subword-tokenization/) · [Neural Machine Translation of Rare Words with Subword Units](https://md.research.elamur.ai/free/en/papers/sennrich-2016-neural-machine-translation-rare-words/)

The experiments use a hidden width of 512 for IWSLT and 256 for WMT. Every architecture is trained with six blocks in its encoder and six in its decoder, with each full Transformer block counted once. The ordinary convolutional configuration uses a kernel size of 3 and ReLU, with GLU used in the comparisons that name it. The recurrent layers use LSTM cells. These choices specify the configurations being compared. A Transformer block and a recurrent block can have different operations and parameter counts even at the same hidden width.

Adam is the training optimizer, and its learning rate is set to zero.0002. Validation perplexity tracks the system’s predictive fit on held-out data during training. When it fails to improve for 8 consecutive checkpoints, the learning rate is multiplied by 0.7. Checkpoints are taken every 4,000 updates on WMT and every 1,000 updates on IWSLT. Label smoothing is used with a setting of 0.1. It softens the training target distribution used in the cross-entropy calculation. [Adam](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/)

### Experiments and results

#### Datasets, splits, and scoring

The main experiments cover corpora of different sizes. WMT’17 has roughly 5.9 million training sentences for English→German and 4.5 million for Latvian→English. The paper uses newstest2016 for validation and reports evaluation on newstest2017. IWSLT’16 English→German has approximately 200 thousand training sentences. Its validation set is TED.tst2013, and its reported evaluation set is TED.tst2014. That separation gives the learning-rate schedule its own held-out signal while reserving the named evaluation sets for the reported comparisons.

The main scores are BLEU and METEOR on tokenized translations, calculated with MultEval. Both compare generated translations with references. BLEU summarizes the overlap of token sequences with the references, while METEOR evaluates matches through its own alignment and scoring procedure. The results can therefore agree on the general direction of a change and still differ in how they rank particular systems. The IWSLT tables report BLEU. The WMT’17 architecture tables report both measures. Unless the paper specifies otherwise, each comparison uses three random seeds, and the reported spread is the standard deviation across runs.

A separate WMT’14 English→German experiment checks the Transformer implementation against the earlier report. The training data for this experiment comes from WMT’16 in the preprocessed form distributed through tensor2tensor, with 32,000 BPE merge operations. The evaluation uses tokenized and compound-split newstest2014 and runs the multi-bleu.perl scorer to match the earlier evaluation procedure. The paper reports 27.5 BLEU for its Transformer implementation, alongside 27.3 for the earlier system. This check belongs to its own data and scoring setup. The within-paper architecture comparisons use the WMT’17 and IWSLT results, which have their own evaluation conditions.

#### Adding Transformer components to recurrent and convolutional systems

The recurrent experiment begins with RNMT, a conventional recurrent architecture with a single MLP source-attention operation, and includes a version with input feeding disabled. It then introduces a recurrent baseline labeled RNN. This baseline wraps the first bidirectional encoder layer in a residual connection and changes the decoder to use a residual single-head dot-product source lookup followed by a residual expanding feed-forward element. It uses no input feeding. The subsequent steps vary attention heads, positional embeddings, normalization, repeated source lookups, and the placement of additional expanding feed-forward layers. The final variant has a Transformer-style block layout with recurrence occupying the sequence-processing slots.

The convolutional experiment starts closer to that layout. The CNN baseline already uses position embeddings, residual convolutional layers, and a source-attention operation in every decoder block. It has separate runs with GLU and ReLU activations. The paper adds normalization at the residual inputs, multi-head source attention, and expanding residual feed-forward layers. In the completed configuration, convolutions occupy the places where the Transformer uses self-attention. The source lookups and feed-forward operations remain in the Transformer-style positions.

Recurrent and convolutional variants on WMT’17 English→German newstest2017, mean BLEU The completed recurrent and convolutional variants approach the Transformer and improve on their family baselines.

**The numbers**

| System or setting | BLEU |
| --- | --- |
| RNMT with input feeding | 25.5 |
| RNN baseline | 23.8 |
| RNN with repeated multi-head source attention | 25.5 |
| Final recurrent variant | 26.7 |
| CNN GLU baseline | 25.0 |
| CNN ReLU baseline | 23.9 |
| Final convolutional GLU variant | 26.8 |
| Final convolutional ReLU variant | 26.9 |
| Transformer (this paper) | 27.6 |

On WMT’17 English→German, the Transformer’s 27.6 mean BLEU comes with a standard deviation of 0.0 as reported, and its METEOR is 47.2 ± 0.1. The final recurrent variant gives 26.7 ± 0.1 BLEU and 46.4 ± 0.2 METEOR. The final ReLU convolutional variant gives 26.9 ± 0.1 BLEU and 46.1 ± 0.0 METEOR. The recurrent and convolutional endpoints are close on the two metrics, with the ReLU convolutional variant ahead on BLEU and the recurrent variant ahead on METEOR.

On the IWSLT English→German evaluation split, the recurrent series starts at 23.2 ± 0.2 BLEU for RNMT with input feeding and 23.1 ± 0.2 when input feeding is removed. The final recurrent variant reaches 25.1 ± 0.1. The convolutional GLU baseline has 24.3 ± 0.4, and the ReLU baseline has 23.6 ± 0.3. After the Transformer-style additions, the GLU and ReLU versions both report a mean of 25.3, with standard deviations of 0.1 and 0.3, respectively. The Transformer reference in these component-building comparisons is 25.4 ± 0.1. The convolutional endpoints are close to it at the reported precision.

WMT’17 Latvian→English distinguishes the alternatives more clearly. In the architecture-building comparisons, the Transformer reports 18.5 ± 0.0 BLEU and 51.3 ± 0.1 METEOR. The final recurrent variant reaches 17.8 ± 0.1 BLEU and 50.5 ± 0.1 METEOR. The final ReLU convolutional variant gives 16.4 ± 0.2 BLEU and 47.9 ± 0.1 METEOR, and the final GLU variant reports 16.4 ± 0.2 BLEU and 47.9 ± 0.2 METEOR. The convolutional variants improve over their baselines while leaving a more visible gap to the Transformer on this direction than they do on IWSLT.

#### Keeping the Transformer blocks and changing their sequence layers

A separate experiment starts with the Transformer block structure and varies the sequence-processing layer directly on the encoder, decoder, or both. Its fully self-attentive reference for WMT’17 English→German is again 27.6 ± 0.0 BLEU and 47.2 ± 0.1 METEOR. Keeping the self-attentive encoder and using a recurrent decoder yields 27.4 ± 0.1 BLEU and 47.0 ± 0.1 METEOR. With a convolutional decoder, the scores are 27.6 ± 0.2 BLEU and 46.7 ± 0.1 METEOR. A decoder that alternates among the three sequence operations across blocks reaches 27.6 ± 0.2 BLEU and 47.2 ± 0.2 METEOR.

Changing the encoder instead yields 27.2 ± 0.1 BLEU and 46.7 ± 0.1 METEOR for recurrence, and 26.6 ± 0.3 BLEU and 46.3 ± 0.1 METEOR for convolution, in both cases with a self-attentive decoder. The endpoint that removes target-position mixing altogether still reaches 25.3 ± 0.2 BLEU, with METEOR of 43.1 ± 0.1. These runs distinguish a decoder that uses an alternative history mechanism from one that has no layer for combining target positions.

Encoder and decoder substitutions on WMT’17 Latvian→English newstest2017, mean BLEU The recurrent decoder is competitive with the all-self-attentive reference, while encoder substitutions and removal of target mixing score lower.

**The numbers**

| System or setting | BLEU |
| --- | --- |
| Self-attentive encoder and decoder | 18.3 |
| Self-attentive encoder, recurrent decoder (this paper) | 18.4 |
| Self-attentive encoder, convolutional decoder | 18.0 |
| Recurrent encoder, self-attentive decoder | 17.8 |
| Convolutional encoder, self-attentive decoder | 16.8 |
| Self-attentive encoder, mixed decoder | 18.3 |
| Self-attentive encoder, no target-position mixing | 15.9 |

The Latvian→English self-attention comparison reports its own fully self-attentive reference, 18.3 ± 0.0 BLEU and 51.1 ± 0.1 METEOR. Against that reference, the recurrent decoder with self-attentive encoder reaches 18.4 ± 0.2 BLEU and 51.1 ± 0.1 METEOR. The convolutional decoder in the same arrangement gives 18.0 ± 0.3 BLEU and 50.3 ± 0.3 METEOR. The mixed decoder gives 18.3 ± 0.1 BLEU and 51.1 ± 0.1 METEOR. With target-position mixing removed, the scores are 15.9 ± 0.1 BLEU and 45.1 ± 0.2 METEOR. The paper’s other Latvian→English comparison tables give the Transformer result of 18.5 ± 0.0 BLEU, so each set of substitutions is best read against the reference reported with it.

On IWSLT, the fully self-attentive entry in the replacement experiment is 25.4 ± 0.2 BLEU. With decoder recurrence it is 25.1 ± 0.1, and with decoder convolution it is 25.4 ± 0.4. The mixed decoder gives 25.1 ± 0.2. Removing the target sequence layer yields 23.7 ± 0.2. On this dataset, putting recurrence only in the encoder gives 25.8 ± 0.1, and putting convolution only in the encoder gives 25.7 ± 0.1. Both keep the self-attentive decoder. Those results distinguish the smaller-corpus experiment from the pattern on WMT’17.

### What the ablations show

#### Repeated source lookups can read the same encoder layer

The Transformer offers a source lookup at each decoder depth, so the paper asks whether those lookups should read different source representations. The standard choice is to make the top encoder output available to every decoder block. An increasing schedule instead matches each decoder block with the encoder block at the same depth. A decreasing schedule starts with the top encoder block and moves down as decoder depth increases. The latter tests a progression from the most processed encoder states toward earlier ones.

Encoder states used for source attention on WMT’17 English→German newstest2017, mean BLEU Giving every decoder block the top encoder states yields the highest reported mean.

**The numbers**

| System or setting | BLEU |
| --- | --- |
| Top encoder block at every decoder block (this paper) | 27.6 |
| Encoder and decoder blocks matched by depth | 27.3 |
| Encoder depth decreases across decoder blocks | 27.1 |

On WMT’17 English→German, the top-only schedule scores 27.6 ± 0.0, followed by the same-depth schedule at 27.3 ± 0.1 and the decreasing schedule at 27.1 ± 0.1. On IWSLT English→German, the corresponding scores are 25.4 ± 0.2, 25.4 ± 0.1, and 25.3 ± 0.2. Using the top encoder representation is as good as or better than the alternatives at the level of reported mean BLEU. The experiment keeps the repeated lookups in place. Its result bears on which representation those lookups read, while the recurrent sequence of additions tests the value of making more lookups available in the first place.

Even when the source representation is held constant, successive decoder lookups start from different query states. Each block can ask a different question of the same encoded sentence, because its input comes from a different stage of target processing and its attention has separately learned weights. The test therefore separates diversity of encoder inputs from diversity of decoder computations. The latter is already present in the standard repetition of source attention.

#### The head count matters in the architecture around it

In the recurrent progression, removing input feeding reduces WMT’17 English→German BLEU from 25.5 ± 0.2 to 24.6 ± 0.1 and METEOR from 45.1 ± 0.1 to 43.8 ± 0.2. The paper’s next recurrent baseline changes other components as well. Its 23.8 ± 0.1 BLEU and 43.3 ± 0.1 METEOR provide the starting point for the staged additions. Switching its single source-attention operation to multiple heads yields 24.4 ± 0.1 BLEU and 43.9 ± 0.1 METEOR. The IWSLT comparison also improves, from 22.8 ± 0.2 BLEU to 23.7 ± 0.4.

The source-attention placement changes the interpretation of head count. In the WMT’17 English→German recurrent progression, the setting before repeated source attention reports 24.0 ± 0.2 BLEU. Repeating the attention with one head in each block reaches 25.2 ± 0.1, and using multiple heads in those blocks reaches 25.5 ± 0.0. On IWSLT, the corresponding repeated single-head and multi-head settings give 24.5 ± 0.0 and 24.4 ± 0.3. Splitting one source lookup into several heads helps the recurrent baseline, while providing distinct source lookups at different depths produces a clearer gain in the tested progression. The added gain from multiple heads is smaller when distinct lookups are already present, and its direction varies across those settings.

The convolutional progression starts with repeated source attention, so it tests head count in that context. In the WMT’17 English→German ReLU series, the normalized single-head version has 24.3 ± 0.2 BLEU and 43.6 ± 0.1 METEOR. The next version with multi-head attention has 24.9 ± 0.1 BLEU and 44.4 ± 0.1 METEOR. On IWSLT, the corresponding mean BLEU values are 24.3 and 24.2. This helps locate the paper’s claim about multi-head attention. It is an effective addition in the reported WMT convolutional comparisons, with weaker evidence on IWSLT and a dependence on how source lookups are distributed through the decoder.

#### The largest late gains come from feed-forward layers

The recurrent experiment’s final addition installs expanding feed-forward residual layers throughout the architecture. A feed-forward transformation already exists near the top of the simple RNN decoder baseline. The late change gives such processing a regular place in the encoder and decoder blocks, including after the decoder’s source lookups. In the WMT’17 English→German recurrent series, the preceding multi-head setting reports 25.5 ± 0.0 BLEU and 45.3 ± 0.0 METEOR. The version with the added feed-forward layers reaches 26.7 ± 0.1 and 46.4 ± 0.2. On IWSLT, the same comparison is 24.4 ± 0.3 against 25.1 ± 0.1 BLEU.

The expanding residual layers also give the clearest late gains in the convolutional series. On WMT’17 English→German, the ReLU sequence goes from 24.9 ± 0.1 BLEU before the addition to 26.9 ± 0.1 after it. METEOR goes from 44.4 ± 0.1 to 46.1 ± 0.0. The GLU branch moves from 25.4 ± 0.1 BLEU and 44.8 ± 0.1 METEOR to 26.8 ± 0.1 BLEU and 46.0 ± 0.1 METEOR. In the convolutional WMT’17 Latvian→English sequence, the addition moves the ReLU setting from 16.1 ± 0.1 BLEU to 16.4 ± 0.2, with METEOR going from 47.5 ± 0.2 to 47.9 ± 0.1. How much improvement is measured depends on the setting used for evaluation.

These changes yield a specific architectural inference. The benefits associated with Transformer blocks extend to the transformations performed after context has been gathered. A recurrent layer can supply target or source context to a feed-forward layer, as can a convolution or self-attention operation. The consistent gains in the paper’s final additions identify the value of that feed-forward placement within the tested blocks. The comparison changes the layers that perform the processing and the capacity available to perform it together.

#### Position, normalization, and gates behave differently across families

Fixed positional embeddings bring mixed results to the recurrent series. A recurrent layer already encounters the sequence in order. On WMT’17 English→German, the addition follows a setting with 24.4 ± 0.1 BLEU and 43.9 ± 0.1 METEOR and yields 24.1 ± 0.1 BLEU and 43.5 ± 0.2 METEOR. On IWSLT, the move is from 23.7 ± 0.4 to 23.9 ± 0.2 BLEU. The results give little basis for crediting the larger recurrent improvements to the position vectors. The recurrent configurations tested later include them as part of the Transformer-style layout.

Pre-normalization also depends on the family and activation. In the recurrent progression on WMT’17 English→German, adding normalization leads from 24.1 ± 0.1 to 24.0 ± 0.2 BLEU and from 43.5 ± 0.2 to 43.2 ± 0.1 METEOR. The corresponding change in the IWSLT recurrent series is from 23.9 ± 0.2 to 23.7 ± 0.1 BLEU. The ReLU convolutional progression on IWSLT, by comparison, goes from 23.6 ± 0.3 to 24.3 ± 0.1 BLEU. On WMT’17 Latvian→English its normalized version reaches 16.0 ± 0.2 BLEU compared with 15.4 ± 0.1 for the ReLU baseline. The IWSLT GLU branch goes from 24.3 ± 0.4 to 24.1 ± 0.1. These observations support the paper’s account of normalization as helpful in the convolutional progression while showing where the individual effect depends on activation and data.

The GLU baseline starts ahead of ReLU on the reported translation evaluations. After the full set of additions, the two branches arrive at very similar scores. In IWSLT they arrive at the same mean BLEU of 25.3, and in WMT’17 English→German their means are 26.8 for GLU and 26.9 for ReLU. This comparison shows how a choice that distinguishes baseline convolutional systems can become less consequential once the surrounding blocks change. It also keeps the role of the activation separate from the later experiment on where a convolution can replace self-attention, which uses ReLU.

#### Source and target sequence mixing have different effects

The substitution experiment is the clearest test of which side benefits more from self-attention. In its WMT’17 English→German comparison, the mean BLEU for the self-attentive encoder with a convolutional decoder is 27.6, whereas the convolutional encoder with a self-attentive decoder gives 26.6. The recurrent pair shows a smaller contrast, with 27.4 when recurrence is in the decoder and 27.2 when it is in the encoder. On Latvian→English, the convolutional pair gives 18.0 and 16.8 respectively, and the recurrent pair gives 18.4 and 17.8. Each pair preserves the source-attention and feed-forward layout and moves the substitution to the other side.

One architectural reason this comparison is informative is that a decoder has two ways to get context. Its sequence-processing layer can combine the target history, and its source-attention layers can make fresh use of the encoded source at each depth. Replacing target self-attention keeps that second route. Replacing encoder self-attention changes the states read through that route at every decoder depth. The experiments establish the difference in score under those substitutions. Which source properties are better preserved by self-attention remains an interpretation of the structural difference.

Replacing both sides gives the WMT convolutional and recurrent endpoints reported in the component-building experiments. The hybrid results explain how those endpoints can improve substantially over their baselines while still leaving room for a different source-processing operation. On IWSLT, the direction changes. The recurrent encoder with a self-attentive decoder reaches 25.8 ± 0.1 BLEU and the convolutional encoder with that decoder reaches 25.7 ± 0.1, against 25.4 ± 0.2 for the fully self-attentive comparison. The paper identifies IWSLT as the exception to its WMT encoder pattern.

The mixed decoder offers another test of how much target self-attention is needed. It uses self-attention in the first and fourth blocks, recurrence in the second and fifth, and convolution in the third and sixth. With the self-attentive encoder, it matches the full Transformer’s reported mean BLEU and METEOR on both WMT directions in this comparison. On IWSLT it gives 25.1 ± 0.2 BLEU against 25.4 ± 0.2. This is evidence for one specific arrangement of the three operations. It shows that the decoder can distribute sequence processing across different layer types and remain competitive in these runs.

#### Removing target history tests a stronger dependence

A recurrent or convolutional decoder still connects target positions. The version called `none` in the experiment removes the residual sublayer that makes those connections. It preserves source attention, the feed-forward sublayer, and the target input embedding with positional information. At a generation step, the most recently generated token supplies the available target token to that position. Earlier output can have an indirect effect through the identity of that token, while the decoder has no separate path to inspect the earlier target states. The encoder itself still uses self-attention in this test.

The result shows how much the remaining architecture can do. On WMT’17 English→German, this version reaches 25.3 ± 0.2 BLEU, with the self-attentive decoder reference at 27.6 ± 0.0. Its METEOR is 43.1 ± 0.1, compared with 47.2 ± 0.1 in the reference. On WMT’17 Latvian→English, the corresponding comparison is 15.9 ± 0.1 against 18.3 ± 0.0 BLEU, and 45.1 ± 0.2 against 51.1 ± 0.1 METEOR. The IWSLT BLEU values are 23.7 ± 0.2 and 25.4 ± 0.2. The retained translation ability and the score losses answer different parts of the question. The decoder can derive substantial output from the source and the immediately available target token. Giving it a mechanism for broader target context improves the scores across the evaluated settings.

### Limitations

#### Limits identified by the author

The author scopes the main conclusion to the datasets evaluated. The evidence that recurrent or convolutional decoders can compete with a self-attentive decoder comes from the tested combinations of language direction, corpus, and architecture. The paper explicitly identifies IWSLT as an exception to the WMT pattern when changing the encoder. It also distinguishes BLEU from METEOR when describing convolutional decoder performance. Matching the Transformer on mean BLEU for WMT’17 English→German coexists with a lower reported METEOR for that setting.

The author points out limitations of the sequence mechanisms themselves. Convolution has a local window whose reach grows through depth. Recurrence carries a state through time, with uncertain effectiveness for very long dependencies and a sequential computation within the layer. Self-attention gives positions a direct route to each other, while relative position is less directly represented than in a convolutional window. These are structural properties discussed in the paper. Its aggregate translation scores show the performance of the resulting configurations, while leaving the effects of individual dependency lengths and positional relationships unmeasured.

The conclusion about the decoder with no target sequence layer is also bounded by its design. The author describes the loss of access to the generated history and the ability that remains with the previous token and current position. The configuration still relies on repeated source lookups. Its translation scores characterize a source-conditioned decoder with reduced target context. They supply no separate assessment of long-range target dependencies or of which errors account for its lower scores.

#### Limits visible in the experimental setup

The common block count and hidden width make comparisons easier to interpret, but different operators at a given width can have different parameter and computation requirements. The reported architecture results compare translation scores at the specified settings. They provide no matched budget study of parameter count, training time, or decoding latency. This distinction matters because the paper discusses parallelism as a property of the architectures. A recurrent decoder substitution can be competitive on a quality metric while changing the way training computation is scheduled. The reported quality comparisons leave the practical speed tradeoff open.

The staged experiments measure additions in a particular order. A gain observed after installing a residual feed-forward layer is conditional on the attention, normalization, and sequence layers already present at that step. The reported progression gives evidence for the effect of the addition within that configuration. An exhaustive comparison across all combinations would be required to attribute the same magnitude to the component independently of the others. Some interactions are visible in the experiments themselves, especially the different effect of extra heads with one source lookup and with repeated lookups.

The source-depth investigation is similarly specific. It compares all-top routing with two schedules that assign a single encoder level to a decoder block. This supports retaining the top-layer connection in the tested Transformer. Possible architectures that combine representations from several encoder levels are outside that comparison. The same scope applies to the mixed decoder. The tested schedule shows that this arrangement can work, while the contribution of any particular ordering is unresolved.

Random seeds and standard deviations help characterize run-to-run variation. For example, an IWSLT convolutional decoder with the self-attentive encoder and the fully self-attentive reference both have a reported mean of 25.4 BLEU, with standard deviations of 0.4 and 0.2, respectively. The paper gives those summaries of its runs and uses them to describe comparable performance. The architectural conclusions are strongest when the same pattern appears across settings or across both metrics. Small rankings based on the displayed means carry evidence at the precision and variation of the reported runs.

Corpus size is one difference between the IWSLT and WMT setups. The evaluation sets and network widths differ as well, and the recurrent or convolutional encoder’s standing changes across them. The comparison therefore documents a contrast between setups without isolating corpus size as its cause. The paper’s English→German and Latvian→English results also differ in how well the convolutional replacements close the gap. These direction-specific results give the study a broader basis than a single benchmark while leaving generalization to other translation directions open.

Finally, BLEU and METEOR summarize reference agreement across evaluation sets. They let the paper compare many configurations under a shared protocol. The experiments do not break those scores down by sentence length, kinds of source relationships, rare vocabulary, or specific target errors. The evidence can locate a useful component in this architecture and reveal a source–target asymmetry across the tested comparisons. Explaining that asymmetry by a particular class of linguistic errors would require observations beyond the aggregate scores.

### What came after

The later study [Learning Deep Transformer Systems for Machine Translation](https://md.research.elamur.ai/free/en/papers/wang-2019-learning-deep-transformer-models-machine/) cites Domhan’s analysis and takes depth as its subject within Transformer translation. The connection is at the level of architectural questions. Domhan fixes the block count in the main comparisons and examines what operations to put inside those blocks and how to connect them across the encoder and decoder. The later study focuses on learning deep Transformer architectures for the same task.

The citation establishes a link between the two investigations. It leaves open whether the later study used the ADL, adopted any of the recurrent or convolutional substitutions, or retested the encoder–decoder asymmetry. The two questions can be read together without assigning the later paper a replication claim. Domhan’s experiments distinguish what a block does from where it sits in the translation system. The later work’s focus on depth concerns how those blocks are stacked.

## Cite

Cite as Tobias Domhan. 2018. How Much Attention Do You Need? A Granular Analysis of Neural Machine Translation Architectures. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/p18-1167](https://doi.org/10.18653/v1/p18-1167)

```bibtex
@inproceedings{tobias2018how,
  title = {{How Much Attention Do You Need? A Granular Analysis of Neural Machine Translation Architectures}},
  author = {Tobias Domhan},
  booktitle = {Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2018},
  doi = {10.18653/v1/p18-1167},
  url = {https://doi.org/10.18653/v1/p18-1167}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
