Not all parameters are born equal: Attention is mostly what you need
Paper · 2021 · Nikolay Bogoychev
Summary
A Transformer can learn to translate even when large parts of it keep the random weights they started with. Bogoychev uses this observation to ask which parts of a neural translation system actually need to learn from data. The experiment starts with an ordinary machine translation system and blocks training updates to selected components. Those components still process signals as sentences pass through the network. Their weights stay fixed, so the trainable components have to learn to work with whatever transformations they provide.
The paper divides the network into attention, feed-forward layers and word embeddings. Attention lets positions in a sequence draw on information from other positions. Feed-forward layers transform the representation at each position, and embeddings connect vocabulary items to the vectors used inside the network. In the main Turkish–English experiment, the fully trainable Transformer-big reaches 24.3 BLEU on the development set. With two components frozen, trainable attention alone reaches 21.5 and trainable feed-forward layers alone reach 20.8. Trainable embeddings alone reach 4.4. Yet when attention can learn, allowing embeddings to learn alongside it helps. The embeddings appear to contribute something complementary, while attention and feed-forward layers can compensate for each other to a substantial degree.
That compensation depends on the architecture. Smaller translation networks tend to be more sensitive to freezing. Narrowing the feed-forward layers gives trainable attention the advantage in direct comparisons, while narrowing the attention projections reverses the ranking. The paper also compares two ways of fixing weights. Substituting diagonal matrices for random attention weights reduces Turkish–English development BLEU from 22.3 to 19.4. The corresponding feed-forward comparison is much closer, at 23.2 with random weights and 22.9 with diagonal weights. A frozen group can therefore still contribute through the transformation it performs, and the value of that transformation differs across groups.
The ranking also changes with the task. For English language modelling, which predicts text from its preceding context, freezing the embeddings raises development perplexity from 37.4 to 118.4. Lower perplexity is better. Freezing attention or the feed-forward layers produces much smaller changes. Across the experiments, parameter count describes the size of a component, while the freezing comparisons reveal how much the system depends on that component learning for a particular task and architecture.
Deep dive: Not all parameters are born equal: Attention is mostly what you need
Bogoychev freezes parts of a Transformer at random to find out what attention, feed-forward layers and embeddings need to learn for translation. · about 32 minutes to read
The problem and its context
What it means for a part of the network to matter
The Transformer already had a central place in neural translation when Bogoychev undertook this study. The architecture contains several kinds of operations, and end-to-end training lets them develop together. If the result translates well, the final score gives little direct guidance about where the system acquired its useful behaviour. An embedding table, an attention block and a feed-forward block all affect the computation. Their presence leaves open how much each one needs to change during training.
There are several ways to pose that question. A researcher might take a trained system and remove part of it, then see how much of its original performance survives. That measures a system's dependence on a component after the other components have already learned to work with it. Bogoychev starts the intervention earlier. The choice of which weights may change is made at random initialisation, and the remaining weights can adapt throughout training. The result measures what the network can acquire under the imposed restriction.
The distinction matters because different layers can compensate for each other. A component that appears indispensable in a network whose parts learned together might be less important when the rest of the network has time to adapt to a fixed counterpart. Conversely, a component might learn little that is unique and still supply a useful transformation when its weights are fixed. The paper explores both possibilities by changing which parts can learn and, in a separate comparison, by changing the fixed transformation itself.
The study also asks whether a parameter count is a guide to where learning matters. Counting the weights in a component is straightforward. Interpreting that count is harder. A large vocabulary table allocates separate entries to many items, while an attention or feed-forward block applies its weights repeatedly in processing a sequence. These are different ways of spending parameters. A large group might contribute useful capacity while being a poor place to put the only trainable weights. The experiments compare groups by what the complete system learns with them, as well as by the share of weights each group contains.
Freezing as a diagnostic
Freezing was already familiar from transfer learning. In the work Bogoychev discusses, a system trained for a new setting could inherit part of an existing system and keep those inherited weights fixed. An example is Transfer Learning for Low-Resource Neural Machine Translation. In that use of freezing, the weights carry information acquired in an earlier task or setting. Keeping them unchanged can preserve behaviour that would otherwise shift during adaptation.
Random freezing gives the same training decision a different purpose. A fixed random component has no prior exposure to the translation examples. It supplies a stable operation that the rest of the system can learn to accommodate. Good performance under this restriction shows that the component's own weights can remain at their initial values in that setup. Poor performance means that the other trainable components, with that architecture and procedure, had difficulty making up for the restriction.
The paper also places the study alongside earlier work on random neural networks and random sentence encoders. Those studies motivate the idea that fixed computations can still produce useful representations. A random transformation can change the form in which information reaches a trainable layer, even though the transformation itself never improves. Bogoychev asks how this principle plays out when whole groups of weights are frozen inside a Transformer and translation quality is the outcome.
The closest parallel discussed in the paper is the independent work of Garg and colleagues. Their encoder–decoder ablation made progressively more parts trainable and tracked the effect on English–French translation. Bogoychev extends the question to several Transformer configurations, compares attention and feed-forward layers directly, and tests a related prediction task with a different architecture. That wider set of comparisons makes it possible to ask whether the same component matters across changes in network size and task.
Why attention, feed-forward layers and embeddings are plausible substitutes
The components have distinct positions in the architecture. Attention routes information between positions, including from the encoded source into the decoder. Feed-forward layers act on representations that can already contain information from multiple positions. The embedding table is used where vocabulary items enter the network and where the decoder scores possible outputs. The paper groups these operations by the parameters they use and asks which ones must be adjustable for the overall system to perform well.
One possibility is that attention and feed-forward layers can supply some of the same useful information through different operations. The discussion connects this possibility to Transformer Feed-Forward Layers Are Key-Value Memories. That work gives the author a reason to expect feed-forward layers to contribute more than a generic transformation of an attention output. The freezing study tests the behavioural consequence of the idea. If either group can learn while the other stays fixed, and both settings support reasonably good translation, the result is consistent with overlapping contributions.
Other work examined the roles of attention through different interventions. Analyzing Multi-Head Self-Attention studied specialised heads and pruning. Heads are parallel parts of an attention operation, and pruning removes selected parts. Bogoychev also discusses work that assigned fixed attention patterns to most encoder heads. Synthesizer explored ways to supply attention patterns with alternative functions. Those comparisons motivate looking inside attention, where source-side, target-side and source-to-target operations have different jobs.
Embeddings raise a related question about representation and geometry. The paper refers to pretrained representations including ELMo, introduced in Deep Contextualized Word Representations, and to work on transferring translation components. Bogoychev distinguishes the information in a learned embedding from the width of the representation that the embedding supplies. Even when vocabulary vectors stay fixed, the space they occupy determines the inputs that the other layers must work with. The experiments vary both whether the vectors learn and how wide the network is around them.
The method, step by step
Follow a sentence through the network
The architecture has an encoder for the source sentence and a decoder that produces the target sentence. Before either part can process text, the text is represented as vocabulary tokens. A token can be a word piece. Each source token is associated with a vector in the embedding table, giving the encoder a numerical representation to process.
The encoder uses self-attention across the source sequence. A source position can draw on the entire input when building its representation. The decoder also uses self-attention, but it works with the target output available so far. Its mask restricts which positions it can use, preserving the order in which a translation is generated. A separate decoder operation, called context attention in the paper, receives the encoder's representation of the source. This gives the decoder a route to source information as it generates the target.
The feed-forward network, abbreviated FFN, transforms the representation at each position. It receives information that preceding operations have already combined. Residual connections provide a path around transformations, carrying a representation forward alongside their outputs. This path matters when interpreting the frozen feed-forward experiments. The network can still pass information from attention through the stack when the feed-forward weights are fixed.
The translation settings tie the source and target embeddings to the output weights. Tying means that the same weight table participates in representing tokens at the inputs and in scoring vocabulary items at the output. The paper follows the approach in Using the Output Embedding. Freezing the embedding group fixes that shared table in all its roles. Trainable internal layers can still change the vector presented to the output layer, so they can change the scores assigned to tokens even when the vocabulary table itself stays fixed.
Choose which weights may change
Bogoychev first trains a fully adjustable reference system for each main architecture. In the freezing runs, the selected component groups begin with random weights drawn using Glorot initialisation. A frozen group keeps its initial weights for the duration of the ordinary ablation run. All groups remain in the forward computation, where they continue to transform activations from their inputs. The trainable weights receive updates based on the training objective.
The core constraint can be written directly in terms of the weights.
Wꜰ(t) = Wꜰ(0)
Here W denotes the weights, the subscript ꜰ identifies the frozen group, t is a point during training, and 0 denotes initialisation. The parentheses indicate the point at which the weights are considered. The equality means that the group keeps the same values throughout the run. Its output can still vary from sentence to sentence because its input varies, and trainable layers earlier in the network can change what it receives.
The first set of variants freezes one group at a time. Freezing embeddings leaves both attention and feed-forward layers adjustable. Freezing attention leaves the embeddings and feed-forward layers adjustable. Freezing the feed-forward layers leaves the embeddings and attention adjustable. Each run asks how well the remaining pair can use the fixed computation supplied by the third group.
A second set freezes two groups at a time. Now the only adjustable group is attention, feed-forward layers or embeddings. These are deliberately restrictive settings. The trainable-attention run still uses feed-forward layers and the vocabulary table. The phrase “attention alone” refers to the sole source of adjustable weights. Likewise, when embeddings are the only trainable group, every translation still passes through the attention and feed-forward operations.
How the parameter-freezing experiments work
The steps in order.
The tables track how much of the network remains adjustable. Their parameter ratio is the trainable weight count as a share of the total.
r = Nₜ / Nₐ
Here r is the trainable parameter ratio, N is a count of parameters, the subscript ₜ selects trainable parameters, and the subscript ₐ selects all parameters in the network. The slash denotes division. The total includes the frozen weights because they still take part in computation. A small ratio describes a restriction on training within a particular architecture.
Build the translation comparisons
The main Turkish–English data come from the WMT 18 news translation task. The training set contains 1M parallel sentences, with 200K gold pairs and 800K back-translated pairs. Back-translation uses translated text to construct additional parallel training examples. Its purpose in this setup is to bring extra material into supervised translation training. The paper follows the method discussed in Improving Neural Machine Translation with Monolingual Data.
The author preprocesses and tokenises the data with Moses and uses a shared vocabulary of 36K byte-pair encoding tokens. Subword tokenization represents text using reusable pieces, so a vocabulary can cover words through combinations of entries. The approach is drawn from Neural Machine Translation of Rare Words with Subword Units. The shared vocabulary fits the decision to use tied source, target and output weights.
Training uses the Transformer implementation in Marian. The paper identifies the freeze_FFN branch of marian-dev as the code for the freezing experiments. The primary Transformer-big configuration has 213M parameters and 8 attention heads. The architecture provides a relatively wide starting point for testing whether the other components can accommodate random ones.
For the main machine translation experiments, the stopping procedure watches development scores. Training stops after 10 consecutive stalls in development perplexity or 50 consecutive stalls in development BLEU, whichever occurs first. A stall is a check that fails to improve the monitored score. The reported Turkish–English BLEU results come from the 2016 development set supplied by the shared-task organisers. Epoch counts record how long the training procedure ran in passes through the training data.
The first architecture change reduces the embedding dimension from 1024 to 128. Changing this dimension also changes the widths of operations that receive or produce vectors in that space. The resulting network contains 18M parameters. This is therefore a test of a narrower architecture built around a narrower representation. It also allows the same trainability choices to be compared in a setting where the fixed components supply less capacity.
Other variants target particular internal dimensions. The feed-forward reduction changes its dimension from 4096 to 1024, producing a network of 137M parameters. The narrow-attention setting reduces the second dimension of the key and query matrices 8-fold, for a total of 147M parameters. Queries and keys are the projections used to form attention comparisons. Narrowing them changes the room available for that computation. These architecture variants help determine whether a group's apparent importance changes with the capacity available to it and to the group that might compensate for it.
The Transformer-base comparison changes several dimensions together while keeping the number of heads the same. The embedding and feed-forward widths are halved, and attention becomes smaller as a consequence of its dependence on the representation width. This network has 62.6M parameters. It provides a second standard configuration on the Turkish–English data alongside the targeted variants.
Train a student and test another task
The Estonian–English student uses a different recipe. The paper builds an ensemble of four Transformer-big teachers trained with gold and synthetic material from WMT 18. An ensemble combines the teachers when producing translations. The author decodes 142M sentences with it and uses the resulting material to train the student. This is Sequence-Level Knowledge Distillation, in which a student learns from sequences produced by a teacher rather than relying solely on the original examples.
The student has 16.9M parameters. Its shared vocabulary contains 32K tokens, its embedding dimension is 256, and its feed-forward dimension is 1536. It has 6 encoder layers and 2 decoder layers. The source and target embeddings remain tied to the output weights. The freezing grid asks the same questions about trainability within this architecture, while the evaluation uses the Estonian–English development material from the WMT 18 news task.
The English language modelling experiment uses a Transformer-base configuration with 38M parameters and a vocabulary of 32K BPE tokens. It trains on 78M sentences from the 2017, 2018 and 2019 News Crawl collections. The development data use the first 1000 lines of each collection and are held apart from training. The outcome is perplexity, which reflects how much probability the system assigns to the observed continuation. Smaller values indicate better predictions.
Translation can also be understood as predicting a target sequence, with a source sentence as additional input. The English prediction task removes that source-side conditioning. Its Transformer has neither the translation encoder nor the context attention that reads the encoder output. Consequently, the language modelling comparison changes both the prediction problem and the set of routes through which attention can help solve it.
Change the fixed operation and the moment of freezing
One set of experiments asks whether the frozen transformations are useful in their own right. Instead of Glorot weights, the author assigns selected matrices a diagonal form and holds them fixed. The identity-style rule can be expressed for an entry of a matrix as follows.
Dᵢⱼ = 1 if i = j, and 0 otherwise
Here D is the fixed matrix, i indexes a row, and j indexes a column. Dᵢⱼ denotes the entry where that row and column meet. The condition i = j selects the main diagonal, where the entry is 1. All other entries are 0. For a rectangular matrix, positions outside the available diagonal remain zero. This construction keeps a limited coordinate-wise mapping and removes the general mixing supplied by random entries.
The diagonal attention experiment applies this construction to the projections in self-attention and context attention. The projections effectively copy coordinates, with a sparse pattern when divided among heads. For the rectangular feed-forward matrices, the corresponding construction leaves a diagonal portion and a zeroed remainder. The comparison keeps the same groups trainable as in the matched random run. It therefore tests a change in the frozen computation with the trainable parameter ratio held fixed.
Another experiment keeps the random initialisation and changes the time at which the restriction begins. It lets the entire Transformer-big learn for an initial period, then freezes either attention or the feed-forward layers and continues training the rest. The appendix compares freezing after 2, 4 or 7 epochs with freezing at initialisation. Each run ends up with the same kind of frozen group, but it reaches that point with different weights, and the remaining trainable groups have also spent time adapting before the freeze.
Experiments and results
How to read the comparisons
The translation tables pair development BLEU with the trainable parameter ratio and, for many runs, the number of training epochs. BLEU compares generated translations with reference translations through matching sequences of tokens. Higher values indicate better agreement under the metric. The paper cites BLEU: a Method for Automatic Evaluation for the measure. Epoch counts describe the training process, while the BLEU score describes the resulting translation output.
The relevant baseline for an ablation is typically the fully trainable version of its own architecture. The Transformer-big result also provides a common point of comparison across the Turkish–English width experiments. Those two comparisons answer different questions. The local baseline indicates what freezing costs within a given architecture. The common reference indicates where the whole variant sits relative to the original network, including the effect of changing widths.
Turkish–English Transformer-big
With the full 213M-parameter architecture, the baseline obtains 24.3 development BLEU. Freezing a single group yields a narrow range of scores. Frozen embeddings give 22.6, frozen attention gives 22.3, and frozen feed-forward layers give 23.2. The respective trainable ratios are .82, .64 and .52. The best single-freeze run therefore keeps the smallest share of those three configurations trainable.
The difference is clearer when only one group can learn. Attention-only training gives 21.5 development BLEU with a trainable ratio of .35. Feed-forward-only training gives 20.8 with .47 trainable. Embedding-only training gives 4.4 with .17 trainable. The paper treats the last result as a failure to learn useful translation and sets this configuration aside in the targeted Transformer-big width experiments.
Fully trainable and single-trainable-group Transformer-big on Turkish–English development BLEU
Attention and feed-forward layers each sustain much stronger translation than embeddings when they carry all the trainable weights.
The numbers
| System or setting | BLEU |
|---|---|
| Fully trainable Transformer-big (this paper) | 24.3 |
| Trainable attention only | 21.5 |
| Trainable feed-forward layers only | 20.8 |
| Trainable embeddings only | 4.4 |
The epoch counts put these scores in context. The paper gives 19 epochs for the full Transformer-big reference in its width comparisons. The single-freeze runs take 26 epochs with frozen embeddings, 23 with frozen attention and 26 with frozen feed-forward layers. When only attention is trainable, the run takes 36 epochs. The feed-forward-only run takes 37. The embedding-only run takes 25 and ends at its much lower BLEU score. A shorter run in this last comparison accompanies a much weaker outcome.
Freezing slightly raises the number of words processed per second in the main runs. The paper attributes the gain to less work during the backward pass, which computes the information used for updates. Yet the extra epochs absorb the throughput gain, and the paper reports that the frozen variants take longer in real time to converge. The trainable share, processing rate and time to the stopping point describe separate effects of the intervention.
Width changes on Turkish–English
The configuration with an embedding width of 128 scores 22.9 development BLEU when fully trainable. With embeddings frozen and both internal groups trainable, it reaches 18.9. The same score is recorded with feed-forward layers frozen and the embeddings and attention trainable. The run with attention frozen, leaving embeddings and feed-forward layers trainable, scores 16.2.
The single-trainable-group settings fare much worse in this narrow network. Attention alone reaches 5.1, and feed-forward layers alone reach 7.8. The fully trainable narrow configuration runs for 115 epochs. The single-freeze variants take 142 epochs with frozen embeddings, 274 with frozen attention and 132 with frozen feed-forward layers. The attention-only run takes 227, and the feed-forward-only run takes 307. The smaller network makes a substantial demand on training time measured in epochs, even when every group is trainable.
The configuration with narrowed feed-forward layers gives 23.2 development BLEU with all groups trainable. Freezing embeddings gives 22.0. Freezing attention gives 20.1, and freezing the narrow feed-forward layers gives 23.0. When only attention can learn, the result is 21.6. When only the narrow feed-forward group can learn, it is 18.0 with a trainable ratio of .18. This family thus retains much stronger translation with a single trainable group than the network narrowed through its embedding dimension.
The narrow-attention configuration gives 23.4 development BLEU with all weights trainable. Freezing embeddings gives 22.1, and freezing attention also gives 22.1. Freezing feed-forward layers gives 20.4. Feed-forward-only training produces 21.3, whereas attention-only training produces 17.0. The latter run has a trainable ratio of .06, and the paper highlights the result as retaining 72% of baseline BLEU with 6% of the parameters trainable. The other parameters still participate in computing the translation.
The epoch contrast is especially visible in that pair of runs. The narrow-attention network takes 13 epochs with everything trainable. With attention as the sole trainable group, it takes 196 epochs, while the feed-forward-only variant takes 33. The scores and epoch counts together show what is involved in adapting a very small trainable attention group to the fixed computations around it.
Attention subsets on Turkish–English
With the embeddings trainable and the feed-forward layers frozen, the full trainable attention group supports 23.2 development BLEU. Restricting training to decoder attention gives 19.8. Training context attention only gives 18.1, and training encoder attention only also gives 18.1. Training self-attention across the encoder and decoder gives 10.3. All of these are variants of the same Transformer-big network, with the rest of attention left at its random initial values.
Selected attention-training settings on Turkish–English development BLEU
Full trainable attention leads, and decoder attention gives the strongest result among the restricted settings.
The numbers
| System or setting | BLEU |
|---|---|
| Full attention (this paper) | 23.2 |
| Decoder attention only | 19.8 |
| Context attention only | 18.1 |
| Self-attention only | 10.3 |
The two settings with a trainable ratio of .41, self-attention only and decoder attention only, take 28 and 24 epochs respectively. Context-only and encoder-only training each use a ratio of .29 and take 40 and 41 epochs respectively. The similar scores in the latter pair arise from training distinct pathways. The self-attention and decoder comparison also gives a clear example of equal parameter shares supporting very different translation quality.
Standard base and distilled student
On the Turkish–English development set, the fully trainable 62.6M-parameter Transformer-base reaches 23.9 BLEU. The individual freezes produce 22.3 with frozen embeddings, 20.5 with frozen attention and 22.7 with frozen feed-forward layers. Trainable attention alone reaches 20.0, trainable feed-forward layers alone reach 17.5, and trainable embeddings alone reach 3.9.
The attention-only and embedding-only Transformer-base settings each have a trainable ratio of .30. Their figures illustrate the importance of where those weights sit. The attention-only run takes 148 epochs, while the embedding-only run takes 110 and produces little useful translation. With feed-forward layers alone trainable, the ratio is .40 and the run takes 76 epochs. The best score in this group goes to attention, which reaches it with the longest training run of the three.
The Estonian–English distilled student has a fully trainable development baseline of 24.2 BLEU. The freezing comparisons belong on that development set and within that training recipe. Freezing embeddings gives 20.3. Freezing attention gives 21.6, and freezing feed-forward layers gives 21.3. In the more restrictive settings, feed-forward-only training gives 15.2, attention-only training gives 12.5, and embedding-only training gives 3.3.
The student devotes a trainable ratio of .49 to the embedding-only condition. The attention-only condition uses .14, and the feed-forward-only condition uses .39. The largest trainable group, considered by itself, again produces the weakest translations. At the same time, both configurations that train embeddings alongside an internal group do better than the one that freezes them. Thus the student preserves the contrast between the weak standalone contribution of trainable embeddings and their value in combination.
English language prediction
The English News Crawl development results use perplexity. The fully trainable system reaches 37.4. Keeping the embeddings fixed gives 118.4 in spite of leaving both internal groups trainable. Freezing attention gives 47.5, and freezing feed-forward layers gives 50.3. This puts freezing embeddings last among the single-component freezes, a different pattern from the main translation experiment.
Full training and single-group freezing on English News Crawl development perplexity
Freezing the shared embedding group produces the poorest predictions among the single-group freezes.
The numbers
| System or setting | perplexity |
|---|---|
| Fully trainable Transformer (this paper) | 37.4 |
| Frozen attention | 47.5 |
| Frozen feed-forward layers | 50.3 |
| Frozen embeddings | 118.4 |
Among runs with only one trainable group, embeddings give the lowest development perplexity at 131.7. Feed-forward layers alone give 157.3, and attention alone gives 209.3. Each frozen configuration in the language modelling table has 6 recorded epochs. The score differences occur under the same reported training length. Even the best single-group result remains far above the perplexity obtained when all groups can learn.
What the ablations show
What attention and feed-forward layers can take over
The full-width Turkish–English comparison offers two ways to assess compensation. When just one group is frozen, either attention or feed-forward layers can learn alongside the embeddings and support a relatively strong result. When two groups are frozen, either internal group can still carry much of the translation performance through the same network. The embedding-only result separates this capability from the general ability to improve some set of weights.
The two comparisons have different implications. A strong result with trainable attention and embeddings could have meant that the embeddings supply a large part of what the fixed feed-forward layers would otherwise learn. The attention-only run shows how much translation can survive with the embedding table fixed as well. The feed-forward-only run makes the corresponding point from the other direction. At the original width, either kind of internal block provides a place for substantial adaptation.
The author interprets this as functional overlap. Feed-forward layers can process contextualised representations delivered by fixed attention. Trainable attention can reshape the signals it passes through fixed feed-forward blocks. The near scores establish a degree of substitution in the measured task. They leave open whether the configurations encode the same facts, apply the same sequence of computations, or make the same errors on individual examples.
The embeddings contribute in a different pattern. They do little by themselves for Turkish–English translation, but they can improve a configuration whose attention or feed-forward layers are already adjustable. With trainable embeddings and attention, the full-width system obtains 23.2 development BLEU. With trainable attention and feed-forward layers around fixed embeddings it obtains 22.6. Those configurations train different pairs and different parameter shares. Their order supports the idea that learning a vocabulary interface can add something to an effective internal computation, even when learning that interface alone accomplishes little.
The student makes the complementarity especially visible. Its training material is generated by an ensemble, and its architecture has a relatively small internal stack. In this setting, trainable embeddings paired with either internal group give the strongest single-freeze results. The large share of student parameters in the embedding group helps explain why this architecture is a useful test of raw counts. Almost half the weights can be adjustable while the system still lacks the kind of adaptation it needs for translation.
Which ranking survives a change in width
The targeted width reductions provide direct tests of the idea that one component compensates for another. With a narrower feed-forward group, training attention gives the better result both when the embeddings can learn and when the embeddings are fixed. With narrower attention, training feed-forward layers gives the better result in both comparisons. The comparison within each family holds the architecture fixed and changes the group that may adapt.
That reversal is stronger evidence about the conditions for compensation than an overall ranking averaged across architectures would be. A feed-forward group that can support translation on its own at the original width offers less support as the sole trainable group after its width is cut. The analogous change in attention capacity favours the feed-forward group. The component's role and its available width both matter to the result.
The reduced embedding-width experiment has a different interpretation because it changes the dimensions of several operations. With embeddings trainable, the attention setting gives 18.9 development BLEU in 132 epochs, while the feed-forward setting gives 16.2 in 274 epochs. When embeddings are frozen and there is only one adjustable group, the feed-forward run scores above the attention run, and both are weak. Whether embeddings can adapt changes the comparison as well as the architecture's width.
There is another comparison within the narrow embedding setting. Training attention together with the embeddings reaches the same 18.9 as training attention together with the feed-forward layers. The recorded trainable ratios are .31 and .75 respectively. The two arrangements use different trainable operations, which makes their matching scores informative. Giving attention a learnable vocabulary interface can support the same measured quality as giving it a much larger set of adjustable feed-forward weights in this experiment.
Transformer-base continues part of this pattern. Its attention-only score is farther from the feed-forward-only score than in Transformer-big, in favour of attention. Both scores also sit farther below the fully trainable result of their own architecture. Bogoychev describes this dependence on size as redundancy in the wider system. In experiment terms, redundancy means that the system retains more performance when constraints on the training of one part force other parts to adapt. The comparison links that robustness to the architecture, while changing several dimensions at once.
The distilled student adds an important qualification. Feed-forward-only training outperforms attention-only training there. The student also changes the language pair, the data generation procedure and the balance between encoder and decoder depth. Across the experiments, there is evidence for greater sensitivity in the smaller configurations. The order of the components depends on how the smaller configuration is built and trained.
Where it helps to train attention
The attention subset experiment keeps the feed-forward group fixed to reduce one source of compensation. The embeddings can learn in every run. Within that setup, the question is which attention weights can best adapt the internal computation to the task.
Self-attention covers information exchange within the source sequence and within the target prefix. The self-only setting holds context attention at its random initialisation. Its 10.3 BLEU shows how poorly those two trainable self-attention pathways substitute for the options available in the other restricted settings. Decoder-only training includes the decoder's access to the source through context attention as well as its access to preceding target tokens. Its 19.8 BLEU makes it the strongest of the restricted variants.
Context-only and encoder-only training both reach 18.1. In one case, the network adapts how the decoder reads the encoded source. In the other, it adapts how the source is represented before being read through fixed context attention. The latter case illustrates why freezing differs from removing an operation. A decoder with random context weights still receives a transformation of the encoded source. The trainable encoder can learn to supply representations that work with that transformation.
The full attention setting stays ahead of every restriction. The results therefore show both some adaptability across pathways and a benefit from training the whole attention group. They also help explain why the one-group freezes and this subset study should be read together. A system with all attention fixed and a trainable feed-forward group has a different way to compensate from a system with a partly trainable attention group and fixed feed-forward layers. A stronger score in the former setting reflects the redistribution of learning across the network.
The pruning and alternative-attention studies discussed by Bogoychev address related questions with different fixed structures. A chosen attention pattern, a generated pattern and a random weight matrix define different computations. The current experiment makes random weights the common starting point and tests which parts must adapt from it. Its attention ranking applies to that intervention and the fixed feed-forward setting used to expose the effect.
What the fixed transformations contribute
The diagonal comparison changes the contents of a frozen group while keeping its trainable status constant. The row for frozen attention with random weights gives 22.3 BLEU on the Turkish–English development set. With diagonal attention weights, the result is 19.4. Both runs have a trainable ratio of .64. They take 23 and 24 epochs respectively. The substantial score change occurs with the same amount of trainable capacity and similar reported run lengths.
The result supports a specific interpretation of random attention. The other groups learn around the fixed weights, and useful information appears to survive the random transformations. The coordinate-restricted version offers a different signal and supports a weaker final result. This is evidence that the transformations in the frozen attention group can matter even when their weights never receive updates.
The corresponding feed-forward comparison yields 23.2 BLEU with random weights and 22.9 with diagonal weights. Both use a trainable ratio of .52. The random setting takes 26 epochs and the diagonal setting takes 20. The table therefore places the diagonal result slightly below the random one. The accompanying prose describes a marginal improvement, so the direction of the small effect is reported here according to the table. The more stable observation is that the feed-forward scores are much closer together than the attention scores.
Residual connections provide the author's explanation for the feed-forward result. Attention outputs have a route forward around the feed-forward block. A restricted operation inside that block can therefore leave the network with a useful signal from attention, especially when attention itself is trainable. The experiment lends support to that interpretation through the final score. It leaves the detailed routing of information through individual layers open.
The embedding group is absent from this diagonal comparison for a reason specific to vocabulary tables. A typical shape mentioned in the paper is (32000,512). A diagonal structure with so many rows and a much narrower representation would assign an entirely zero vector to most vocabulary items. It would collapse distinctions between those items at the input and at the tied output interface. The author treats that as a different intervention from limiting the projections in attention or the feed-forward layers.
When a little learning before freezing helps
The delayed-freezing study tests whether initial training gives the selected group a better set of fixed weights. For attention frozen at initialisation, the reference result is 22.3 Turkish–English development BLEU after 23 total epochs. Freezing attention after 2 epochs gives 20.5 BLEU, and after 4 epochs it gives 20.6. Both runs take 71 total epochs. Freezing after 7 epochs reaches 22.2 BLEU in 34 total epochs, close to the reference score with a longer run.
With feed-forward layers, freezing at initialisation gives 23.2 development BLEU after 26 total epochs. Freezing after 2 epochs gives 22.6 in 37 total epochs, and freezing after 4 gives 22.7 in 38. Freezing after 7 epochs gives 22.6 in 21 total epochs. The last setting ends sooner and at a lower score. The score and the epoch count supply different views of how successful the schedule was.
The author observes that briefly training the eventually frozen group can give the system a stronger initial position, which the runs frozen from the beginning soon catch. After freezing, some delayed runs continue making small gains for many epochs. A plausible reading is that adaptation from the start gives the trainable groups a stable computation to work with. In the delayed condition, all groups initially adapt together, and the optimisation problem changes when one stops moving.
The result concerns short periods of joint training within the same experiment. The weights frozen at a later point have begun adapting to that run's data and partners. This comparison is useful for separating the effect of an initial head start from the quality at the end of training. In these schedules, the head start fails to improve final BLEU over the corresponding freeze at initialisation.
Why the task changes the answer
The English language modelling runs reverse the emphasis of the translation results. Trainable embeddings are most valuable in the single-freeze comparison. They are also the strongest standalone trainable group, as measured by lowest development perplexity among those settings. Training embeddings alongside either internal group makes a large further difference.
The architecture and the objective both matter to this observation. In translation, target predictions are informed by a separate source sentence, and context attention provides a path from its encoded representation into the decoder. In the English task, prediction draws on the text prefix and uses a different set of attention routes. The shared vocabulary weights can play a different role when the system relies on that kind of context. The freezing results establish a change in measured dependence, while the exact reason for the change remains open.
The language modelling results also qualify the training-time pattern. The translation runs often take more epochs when trainable capacity is restricted, with especially long runs in some of the narrower architectures. The English runs all have the same reported epoch count despite wide differences in perplexity. The paper's broader observation about slower convergence therefore describes a tendency in its translation experiments, with a clear exception in the separate task.
Limitations
Limits the author identifies
Bogoychev explicitly limits the main conclusions to the tasks studied. The relative dispensability of trainable embeddings in the main translation experiment carries over poorly to English language modelling. The paper's own comparison is enough to set a boundary on any general claim about which part of a Transformer must learn. The direction of the effect depends on what the system is trained to predict.
The author also emphasises that architecture size changes the picture. Wider translation networks can accommodate more frozen computation. Changes in the width of attention or feed-forward layers can reverse the ordering between them. The discussion accordingly treats redundancy as a property of particular configurations. The contrast between Transformer-big and the smaller student includes important changes in how the network is assembled, which the paper acknowledges when discussing the student's different behaviour.
The diagonal experiment comes with its own limits. The author confines it to attention and feed-forward weights because a diagonal vocabulary table would erase distinctions among most vocabulary items. The results also differ between internal groups. The random transformation appears more valuable for attention under this intervention than for the feed-forward layers. A claim about the usefulness of all random frozen weights would run beyond what the experiment shows.
Finally, the paper treats optimisation explanations as hypotheses. It suggests that reduced freedom to update weights might leave the optimiser facing more difficult parts of the training landscape, including saddle points. It also connects the slower runs to earlier work on smaller networks and sensitivity to initialisation. The measurements in this study are scores, epochs and training speed. Locating the points that caused a particular run to slow down would require evidence about the trajectory of training itself.
Limits of the comparisons
The scores establish how configurations rank on the stated development sets. The Turkish–English selection procedure uses development feedback, including BLEU, and that same split supplies the scores reported for the resulting configurations. The close comparisons are therefore rankings under the paper's training and development procedure. A separate test-set comparison would be needed to see how stable those close rankings are on fresh material.
The presented tables give a score for each setting without a distribution across random starts. Because the frozen weights are drawn at random, the strength of a particular fixed transformation could vary across draws. The large gap between useful translation and the embedding-only result is much easier to interpret than the order of closely spaced settings. The diagonal comparison also uses a single structured alternative. It demonstrates a consequence of that construction, while leaving open how other fixed transformations of comparable width would behave.
Functional overlap is inferred from the ability of alternative trainable components to support similar scores. That is a result about substitutability at the system level. It leaves open what either component has encoded and whether the outputs differ in systematic ways that the aggregate score conceals. The study's attention-subset experiment probes pathways more directly, but its result still concerns the effect of a training restriction on the complete network.
The parameter groups are broad and sometimes combine several roles. In particular, the embedding intervention simultaneously fixes the source and target representations and the output weights in the tied translation architecture. A score from that experiment measures dependence on training the shared table as a whole. It cannot identify which use of the table accounts for the observed benefit. A study that separated those roles would ask a more local question than the one Bogoychev reports.
Likewise, few comparisons isolate total size by itself. Reducing the embedding dimension changes compatible dimensions throughout the architecture. Transformer-base changes multiple widths. The distilled student changes architecture, training material and language pair. The study supports a relationship between the smaller configurations examined and their greater sensitivity to freezes. Assigning a precise share of that effect to parameter count, depth or data would require comparisons that vary those factors independently.
The contrast with language modelling establishes task dependence in the broad sense. The English experiment also changes the data, the metric and the paths by which attention can use context. BLEU and perplexity measure different outcomes, so their values cannot be combined into a common estimate of how much quality a freeze costs. The informative comparison is the ranking of frozen groups within each task. The reason that ranking changes could involve the objective, the architecture or their interaction.
There is also a distinction between the fraction of weights that learn and the cost of using the trained system. Random frozen weights still occupy their architectural positions and carry out computations at decoding time. The reported throughput gain concerns training and is small enough to be offset by longer runs in the main experiments. The results support an investigation of storage and implementation choices, but deployment savings would require a system that implements and measures those choices directly.
The delayed-freezing result has a similarly narrow scope. It tests short initial periods of training in the same system, then fixes attention or the feed-forward layers. Transfer learning can involve a component trained on other data or for a different objective, with a different relationship to the rest of the network. The appendix establishes the outcome of its own schedules. It leaves the value of those other forms of pretraining to the relevant transfer experiments.
What came after
There are no documented follow-up studies to trace for this paper. Its conclusion instead sets out a direction for subsequent work in efficient translation. The starting observation is that a fixed feed-forward group can account for up to 48% of a translation network's parameters and still leave the trained system with competitive development BLEU in the reported setting.
Bogoychev proposes generating some fixed random weights during decoding in place of storing them all on disk. The proposal follows from how those weights were obtained. A trained component must preserve the particular values it learned. A component left at random initialisation can in principle be generated again, provided the decoder reconstructs the fixed transformation that the rest of the network learned to use. This condition is central. The experiments hold that transformation steady throughout training, giving the adjustable components a consistent computation to adapt to.
The contemplated application is translation on devices with limited memory. The paper establishes that the full-width Turkish–English network can tolerate random frozen feed-forward weights while learning the task. It leaves the storage savings, generation cost and decoding performance of such an implementation to future work. The narrower translation networks and the English prediction experiment also give the proposal a concrete boundary. Which weights can sensibly be generated depends on the architecture, the available trainable capacity and the task that the resulting system must perform.
Cite
Cite as Nikolay Bogoychev. 2021. Not all parameters are born equal: Attention is mostly what you need. Proceedings of the Fourth BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP.
@inproceedings{nikolay2021not,
title = {{Not all parameters are born equal: Attention is mostly what you need}},
author = {Nikolay Bogoychev},
booktitle = {Proceedings of the Fourth BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP},
year = {2021},
doi = {10.18653/v1/2021.blackboxnlp-1.28},
url = {https://doi.org/10.18653/v1/2021.blackboxnlp-1.28}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/bogoychev-2021-not-all-parameters-are-born/