Elamur Research

Pruning Neural Machine Translation for Speed Using Group Lasso

Paper · 2021 · Maximiliana Behnke and Kenneth Heafield

Summary

A translation network can have many weights set to zero and still take just as long to translate a sentence. If those zeros are scattered through matrices, the software may keep doing the same work unless it has a faster way to handle that particular pattern. Maximiliana Behnke and Kenneth Heafield take a different approach to machine translation. They train a network so that complete rows, columns or attention heads can be removed. The remaining weights form smaller dense matrices, which the translation software can multiply with its usual routines. The paper asks whether that change improves the tradeoff between translation quality and speed when the starting systems are already fast.

The training method uses group lasso, a penalty that shrinks sets of related weights together. The authors let the system learn normally at first, then apply the penalty, then physically remove the structures it has made dispensable. Training continues on the reduced network with the penalty switched off. The procedure can retain different widths in different layers, even when those layers began with identical dimensions. The authors test this schedule on compact students trained by knowledge distillation, in which a larger teacher supplies translations for a smaller system to learn from.

For English→German, a student with a 6-6 encoder–decoder architecture reaches 38.3 BLEU against 38.5 for its unpruned baseline, while single-core throughput rises from 1225 to 1639 words per second. The paper describes this as a 34% speed-up at a cost of 0.2 BLEU, with 69% feedforward sparsity. For a student with a tied decoder, pruning just the encoder can make translation 14% faster with quality close to the baseline. The strongest English→German speed–quality choices come from a 12-1 architecture. Pruning its encoder feedforward units and attention heads gives a 51% speed-up at a cost of 0.3 BLEU. The paper’s WMT21 shared-task results also report gains from combining pruning with quantisation. Relative to systems with neither optimisation, the combined variants are reported as 1.9–2.7× faster, with losses of 0.9–1.7 BLEU.

The authors also examine what survives pruning and whether the same smaller architecture would work as well if trained from scratch. Later decoder layers tend to retain more capacity, while encoder profiles vary between an overall rise and a dip followed by recovery. Training through pruning consistently beats fresh training for the matched English→German architectures in the reported comparisons. Spanish→English shows much closer results, suggesting that in some settings the procedure’s main contribution is to find a useful allocation of capacity. The findings connect inference speed to the amount of computation the software actually avoids, and translation quality to both the location of the surviving capacity and the way it was trained.

Deep dive: Pruning Neural Machine Translation for Speed Using Group Lasso

Behnke and Heafield use group lasso to shrink neural translation networks and measure how much faster they run for a given loss in quality. · about 34 minutes to read

The problem and its context

Why zero weights may leave translation just as slow

A Transformer translates with an encoder that builds a representation of the source sentence and a decoder that uses that representation to generate the target sentence. Much of the computation involves multiplying arrays of activations by weight matrices. A weight indicates how strongly an input contributes to some output of that operation. Setting it to zero removes the contribution mathematically. Whether it removes any work from the translation program depends on how the rest of the matrix is stored and processed.

This distinction matters for deployment. A smaller file saves storage, while a faster decoding pass lets a system translate more text in a given time. Pruning can achieve the former by storing the positions and values of only the surviving weights. To achieve the latter with a scattered pattern of zeros, a sparse multiplication routine must identify and skip missing entries cheaply enough to make up for the extra work of managing an irregular matrix. The paper frames inference speed as an outcome to measure directly, alongside storage and translation quality.

The authors distinguish unstructured pruning, which can select individual weights anywhere in a matrix, from structured pruning, which removes recognizable groups. Their review gives examples of neural translation networks reduced substantially through unstructured sparsity without a demonstrated speed gain. Brix and colleagues, for example, report 70 to 90% sparsity with losses of 0.6 to 3.3 BLEU. The sparse representation helped with compression. The review also describes a result from Yao and colleagues in which an 87.5% sparse system took 1.6× as long with cuSPARSE. The paper notes that the implementation of sparse multiplication matters to such comparisons. It discusses both work on improving sparse GPU routines and efforts to balance the amount of work assigned to different parts of a processor. Sparse GPU Kernels for Deep Learning

Structured pruning can make the remaining work more regular. Prior studies discussed in the paper remove blocks of weights, whole attention heads or complete layers. Blocks inside a matrix still require a routine that understands which blocks are present. A full row or column, in contrast, can be taken out of the matrix altogether once the corresponding change is made to the computation that feeds or consumes it. That is the particular form of structure the authors exploit. An attention head offers another possible unit of removal because the computations belonging to it occupy identifiable parts of several projections. Previous work had already studied which heads could be discarded. Analyzing Multi-Head Self-Attention

The review also considers approaches that look for redundancy after training and approaches that reduce the network during training. A search over a fully trained network can discover dispensable units, but the cost of running that search is part of the overall procedure. Other work prunes at initialisation or uses information collected as training progresses. The method in this paper occupies a position between those timings. It learns an initial set of weights, applies a penalty during subsequent updates, and lets the translation objective finish training the architecture that emerges.

Group lasso predates this study. It was introduced for regression problems with grouped variables, then adapted to encourage structured sparsity in neural networks. The authors describe applications with goals different from theirs. For instance, pruning the changes made during domain adaptation can make those changes cheaper to store while still requiring the full underlying translation network at inference. A prior translation efficiency submission by Murray and colleagues is closer to the present work. It used group lasso for feedforward pruning. Behnke and Heafield differ in the range of structures they remove, the optimiser they use and the decision to switch off the penalty during training. Learning Structured Sparsity in Deep Neural Networks

What counts as a better efficiency result

The comparison matters as much as the removal procedure. A large translation system and a smaller compressed version can show how much quality is lost as speed increases. A translation engineer deciding between systems also has other choices. The engineer could use a shallower decoder, train with narrower layers from the start, transfer behaviour from a teacher to a smaller student, or lower the numerical precision of the weights. The authors argue that pruning should be judged alongside the tradeoffs available from those alternatives. They also note that the techniques can be used together, which makes an already optimised student a more informative starting point.

The paper expresses this criterion with the Pareto frontier. Imagine plotting a point for each student, using translation quality on one axis and translation time on the other. A system is dominated if an alternative is at least as good on both quantities and better on one. The frontier contains the choices that survive this comparison. Its shape matters because an application may care enough about quality to accept slower translation, while another may choose the fastest system that meets a quality requirement. A technique can add a useful choice without producing the highest quality or the shortest time across the entire set.

The encoder–decoder split gives this comparison particular force. The decoder works as the target sequence is produced. Reducing its depth can therefore change the amount of work repeatedly performed during generation. The paper discusses earlier research that moved layers from the decoder to the encoder while preserving translation quality. That makes depth allocation an alternative to pruning as well as something pruning can build on. A comparison within a fixed architecture tells the reader what the penalty and removal procedure achieved there. A comparison across architectures addresses whether that same configuration makes sense when decoder depth is also a choice.

The authors also distinguish the number of parameters from their location. A uniform reduction sets a common feedforward width across layers, giving a clear, simple baseline. A penalty applied to individual groups can leave some layers much wider than others. The question is whether those unequal widths reflect a useful allocation of capacity. Answering it requires comparison both with uniformly narrow networks and with networks that start from the unequal dimensions discovered by pruning. The first comparison tests a simpler way to choose widths. The second tests how much of the result can be attributed to the resulting architecture.

Finally, earlier efficiency studies vary in what they report. The paper criticises studies that claim size or speed advantages without timing the resulting system, and studies whose BLEU reporting leaves the scoring convention unclear. Those are separate issues. Actual timing is needed to verify the computational claim, and a reproducible scoring procedure is needed to locate that timing result on a quality–speed plot. A fast system can occupy very different positions on the plot depending on the evaluation conditions and the quality metric used. A Call for Clarity in Reporting BLEU Scores

The method, step by step

Choosing what can disappear

The procedure begins by identifying parts of the computation that can be removed cleanly. In a feedforward sublayer, an intermediate unit is produced by a projection and used by a later projection. Its input weights determine what signal it receives. Its output weights determine where that signal goes. Removing the unit changes the intermediate dimension of both projections. The layer can still receive and return vectors of the same outer dimensions, an important property when different layers are assigned different internal widths.

Think of the intermediate units as a list of signals prepared for the next operation. Once an operation stops using one signal everywhere that matters, there is no reason to keep computing it. Its incoming weights can be removed from the preceding matrix, together with the weights that would have consumed its value. Similarly, if a signal is constant, its downstream contribution can be absorbed into the bias, the fixed offset added by a projection. These adjustments explain why the paper groups whole rows and columns and includes bias parameters in a group when appropriate. It is trying to eliminate the computation and preserve the contribution of any constant that remains.

The authors initially experimented with 8x8 blocks. They observed that the training process could leave complete rows and columns inactive. Once a whole dimension can be eliminated, matrix multiplication can proceed on the smaller array in the usual dense format. The final procedure exploits this property directly. The new dimensions may differ from layer to layer, so the implementation must accommodate different widths. It can continue to use dense arithmetic for the surviving parameters.

An attention head is a coarser unit. Each head carries out part of the attention calculation, which selects and combines information from relevant positions. Encoder self-attention looks within the source representation. Decoder context attention uses the encoder representation to inform generation. The students in this paper replace decoder self-attention with a faster recurrent unit called SSRU, short for Simpler Simple Recurrent Unit. This distinction matters when reading the pruning profiles. The attention components under discussion are source-side self-attention and the decoder’s access to the source.

The paper experiments with grouping attention weights in different ways. In one version, it regularises individual rows or columns in the attention projections. It then uses their surviving values to decide whether to remove a complete head. The 12-1 experiment describes removing a head when at least half its connections are inactive, using the same 1e−5 cutoff mentioned for rows and columns. The archive of experiments also includes a variant that puts the corresponding weights of an entire head under a single group penalty. This version encourages the head to diminish as a unit. When a layer is left with no attention heads, the implementation can skip that attention computation.

The placement of pruning is another choice. The same penalty can be used for feedforward layers in the encoder alone or in the encoder and decoder together. For the English→German student with the deepest encoder and shallowest decoder, the authors focus the removal on the encoder, where much of the architecture’s work has been allocated. The Estonian→English comparison lets pruning reach the feedforward and attention components on both sides. These decisions determine which structures get the opportunity to shrink. Within that scope, training determines the groups that reach the removal criterion.

How group lasso changes the training objective

Group lasso adds a cost for keeping groups of weights large. For each group it takes the Euclidean length of its weight vector. It then adds those lengths over the groups in a matrix. The unit presented to the penalty is the whole vector. A group can escape the penalty entirely when its weights collectively reach zero. At the same time, training still rewards weights that help the network fit the target translations. The tradeoff is made during learning, rather than by selecting an architecture’s widths before the network has seen any translation data.

R(w) = ∑(g=1…G) γ ‖w_g‖₂ = ∑(g=1…G) γ √(∑(j=1…|G_g|) (w_g^j)²)

Here w is a weight matrix and R(w) is its group lasso penalty. The matrix is divided into G non-overlapping groups, and g indexes those groups. G_g denotes the set of weights in group g, and |G_g| is its size. w_g is the vector made from those weights, with w_g^j denoting its component at position j. The symbol ‖·‖₂ is the Euclidean norm. The square root of the sum of squared components expands that norm. Each ∑ sums over the index and range shown next to it. The factor γ scales the contribution of a group according to its size. The paper describes using the square root of d_g, where d_g is the number of weights in the group. The scale is shared when the groups have equal sizes, as with a matrix partitioned into equal rows or equal columns.

The inner norm measures how far a group’s weights collectively are from zero. It also treats positive and negative weights alike, since each weight is squared before its contribution is added. Large weights of opposite signs therefore do not cancel in the penalty. The outer sum adds one norm per group, corresponding to an L₁ penalty over the group magnitudes. This pairing of an L₂ norm within groups and an L₁ form across them is what gives group lasso its preference for group-level sparsity. In the authors’ mixed experiments, a feedforward connection group and a whole attention head can contain different numbers of weights. The size scaling matters precisely because those choices change what a group represents.

The ordinary prediction loss is cross-entropy. For a target token, it penalises the network for assigning low probability to the token it is meant to predict. Training continues to use this loss while regularisation is active, with the group penalties added as shown in the paper’s batch objective.

(1/|B|) ∑(x ∈ B) [CE(x) + λ ∑(w ∈ W) R(w)]

B is the batch of words used for this objective, |B| is the number of words in it, and x denotes a word in the batch. CE(x) is its cross-entropy loss. W denotes the weight matrices whose group penalties are included, w is one of those matrices, and R(w) is the penalty defined above. λ is the coefficient controlling the regulariser’s overall strength. The outer ∑ adds the bracketed expression over the batch words, and 1/|B| averages it. The inner ∑ adds the regularisation terms for the relevant matrices.

The two scaling factors play different roles. The group-size factor is part of the penalty for a particular group. The coefficient λ sets the importance of the combined penalty relative to the prediction objective. A sweep over λ can therefore trace different quality and speed tradeoffs within a pruning setup. The same value may behave differently when the grouping or the set of eligible layers changes. The authors use Adam for weight updates. The regulariser makes groups small during those updates. A later operation uses the cutoff to turn small groups into dimensions that are physically absent.

Training, removing groups and finishing the student

Training and pruning a distilled translation student

The steps in order.

Training and pruning a distilled translation studentStep 1: Prepare translation targets with a teacher1. Prepare translation targets with a teacherStep 2: Train the student without the pruning penalty2. Train the student without the pruning penaltyStep 3: Add group lasso to the training objective3. Add group lasso to the training objectiveStep 4: Identify inactive dimensions and removable attention heads4. Identify inactive dimensions and removable attention headsStep 5: Collapse the affected matrices into smaller dense shapes5. Collapse the affected matrices into smaller dense shapesStep 6: Finish training without group lasso6. Finish training without group lassoStep 7: Select the checkpoint with the highest validation BLEU7. Select the checkpoint with the highest validation BLEU

In the main training recipe, the authors first give the student 25k batches without the pruning penalty. They describe a period early in Transformer training when translation scores can improve very quickly and the system is sensitive to training settings. Their chosen point for introducing regularisation is after the improvement between checkpoints has slowed to less than 1 BLEU point. The initial phase is still part of the same student’s learning history. It gives the later pruning procedure weights that have already started to organise around the translation task.

The regularised phase lasts 250k batches in the main recipe. The authors arrived at that duration after trying to keep the penalty active until convergence. Their training trace for a tied English→German student at λ = 0.5 shows that the bulk of the feedforward reduction had already occurred well before the end of that run. They use 250k as the point at which to move from encouraging sparsity to fitting the translation task in the reduced architecture. They report that switching off the penalty gives back some of the quality lost under continued regularisation.

At the transition, the paper describes identifying rows or columns whose sum is below 1e−5, followed by collapsing the network. The removal also has to take account of the neighbouring projection and any constant contribution associated with a deleted dimension. For a head, the relevant removal rule depends on the variant. After this operation the remaining units are the only ones the last training phase can use. Disabling the penalty lets their weights adjust without further pressure to shrink whole groups. The group lasso phase therefore helps choose the architecture, while the final phase trains within that choice.

Across training phases the authors carry forward the latest checkpoint and restart the training round. The reset refers to training settings such as learning-rate scheduling and optimiser state, while the retained weights supply continuity. The authors checked whether refreshing those settings alone improved the baselines and found no additional advantage. They describe the pruning schedule as a training pass because selecting a reduced architecture and finishing it are parts of one progression from the original initialisation. The matrix collapse is an explicit operation within that progression.

Training stops after validation BLEU has failed to improve for 20 consecutive validations. The authors use the checkpoint with the highest validation BLEU. The shared-task experiments preserve the broad sequence while changing the durations. They start with 50k updates before regularisation and use 150k with the penalty before slicing and the final convergence phase. Their shared-task comparison uses λ = 0.5 for both ways of grouping attention parameters.

Preparing the students and their training data

The authors use sequence-level knowledge distillation for all the translation directions studied. A teacher provides a translation as a target sequence for the student. The student learns a mapping from source sentences to translations while using a smaller architecture suited to inference. For English→German, the teacher is Microsoft’s WMT 2019 news translation submission. The ensemble has four members. Each uses 12 encoder and decoder layers, an embedding size of 1024, a feedforward size of 4096 and 8 attention heads. Spanish→English and Estonian→English use Bergamot teachers, each an ensemble of two similar networks with 6 layers. Microsoft Translator at WMT 2019

The students use an embedding dimension of 256 and start with a feedforward dimension of 1536. An embedding is the vector representation the system associates with a vocabulary item. The feedforward dimension is the size of the intermediate transformation where the pruning procedure can remove units. Attention normally has 8 heads per layer in these students, with SSRU taking the place of decoder self-attention. The experiments compare 6-2tied, 6-6, 12-1 and 6-2 architectures. In these labels the first part gives encoder depth and the second gives decoder depth. The tied variant shares the decoder-layer parameters across its decoder applications. It therefore has a single set of decoder-layer weights to regularise.

The authors generate a shared vocabulary of 32,000 units with SentencePiece. This is subword tokenization, which permits a word to be represented by smaller recurring pieces. During translation the students use shortlists of the top 50 words, a setting the paper reports alongside the other efficiency choices. Their general training settings follow the Marian Transformer base configuration. On all four GPUs, a 10 GB workspace is filled by dynamic batching. The resulting batches contain about 71,000 words for the 6-2tied student and about 46,000 for the 6-6 student. This gives context to the batch counts in the schedule, since a batch can represent different amounts of text depending on the architecture. The authors omit dropout and label smoothing in their distilled training setup. SentencePiece · Marian

English→German follows the WNGT2020 efficiency setup under the WMT 2019 data condition. Its training data consist of 13M parallel sentences, and development uses the concatenated WMT test sets from 2016–2018. Spanish→English training uses 242M sentences, including about 15M forward- or back-translations, and uses a WMT13 test set for development. For Estonian→English the corresponding training collection has 132M sentences, about 30M of them forward- or back-translations, and development uses WMT18/dev. Forward- and back-translation here describe synthetic data produced by translating in the target direction or translating target-language material back into the source language. Marian is used for both training and decoding, while inference timings in the main comparison are measured on a CPU core. Findings of the 2019 Conference on Machine Translation

Experiments and results

How to read the comparisons

The paper reports translation quality with BLEU, chrF and COMET. BLEU uses overlap between sequences of words in candidate translations and reference translations. chrF uses overlap between short sequences of characters, so it can register partial matches within words as well as matches that span them. COMET supplies a learned quality score. The authors use SacreBLEU for BLEU and chrF and the wmt20-comet-da configuration for COMET. The scores give complementary views of the same translations. The paper selects checkpoints with validation BLEU, then reports the additional metrics to show where a quality judgement depends on the measure.

Inference results are reported as elapsed translation time or words per second, sometimes with a speed-up relative to the unpruned system. The size column measures storage in MB. Feedforward and attention sparsities describe the portion removed from those components. They should be read as component measurements even when presented next to total file size. Embeddings and other unchanged weights still occupy space in the student. Likewise, the effects on throughput depend on which of the removed computations was taking time, as well as how much of it the authors eliminated.

There are several kinds of baseline. The simplest is the unpruned version of the architecture whose penalty is being varied. The reinitialised comparison uses the shape discovered by pruning but trains freshly initialised weights in that shape. This holds the final architecture fixed while changing its training history. Uniformly narrower students provide a separate alternative for choosing a small architecture. The English→German frontier comparison brings these choices together across decoder depths. The shared-task table starts from unpruned, unquantised variants and follows each pruning approach through quantisation and subsequent fine-tuning.

English→German with a tied decoder

The tied-decoder experiments begin from a student already designed for fast translation. The unpruned version records 37.2 BLEU, 63.3 chrF and 49.7 COMET. It occupies 61 MB and translates at 2404 words per second on the CPU core. The authors vary λ through 0.3, 0.4, 0.5, 0.7 and 1.0. In one sweep both encoder and decoder feedforward layers can shrink. In the other the penalty applies only to the encoder. Because the decoder shares its parameters across applications, the set potentially removed from the decoder is already compact.

For pruning on both sides at λ = 0.3, the evaluation gives 37.8 BLEU, 63.8 chrF and 51.1 COMET. The row also shows 45% feedforward sparsity, 51 MB and 2613 words per second. The score gains in all the reported quality measures make this a useful example of a small penalty, although they are point estimates. The layer dimensions show how little of the shared decoder changes at this setting. Its width is 1534 against the original 1536, while the encoder layers have already lost substantial capacity. Allowing both sides to be pruned gives the training procedure the option to remove decoder units, and the low-penalty setting exercises that option sparingly.

At λ = 0.4, both-side pruning reaches 63% feedforward sparsity, a size of 47 MB and throughput of 2748 words per second. The quality scores are 37.4 BLEU, 63.4 chrF and 50.4 COMET. Stronger pressure can take the same architecture much further along the speed axis. The λ = 1.0 entry reaches 92% feedforward sparsity, 41 MB and 3420 words per second, with 36.1 BLEU, 62.5 chrF and 46.0 COMET. The penalty sweep thus reveals where increasing sparsity starts exacting a more substantial quality cost.

With pruning restricted to the encoder, λ = 0.3 reaches 48% feedforward sparsity, 2748 words per second and 50 MB. It records 37.6 BLEU, 63.4 chrF and 50.4 COMET. This is the encoder-only result behind the authors’ description of a 14% speed improvement with overall quality close to the baseline. The λ = 0.4 encoder-only entry reaches 2916 words per second and 37.3 BLEU. As the penalty grows stronger, the fastest entries come from giving the decoder the opportunity to shrink as well. Restricting pruning to the encoder and including the decoder give different sets of choices, even when the original network and the penalty coefficient are the same.

English→German and Spanish→English with deeper decoders

The 6-6 English→German system has an unpruned quality score of 38.5 BLEU and translates at 1225 words per second. With more decoder layers than the tied student, it starts at a different point in the quality–speed comparison. The authors apply feedforward pruning on both sides, testing weaker coefficients than in the tied sweep as well as more aggressive settings. At λ = 0.1, the result is 38.7 BLEU, 64.5 chrF and 55.7 COMET, with 31% feedforward sparsity and 1377 words per second. Increasing λ to 0.15 yields 38.6 BLEU and 1543 words per second, with 55% sparsity. Its 54.7 COMET score is close to the unpruned 54.8.

The paper highlights the λ = 0.2 configuration. In the English→German 6-6 evaluation it records 38.3 BLEU, 64.1 chrF and 53.8 COMET, against the unpruned system’s 38.5 BLEU, 64.2 chrF and 54.8 COMET. Its size is 58 MB against 83 MB for the baseline, and it translates at 1639 words per second. At 69% feedforward sparsity, this is the point the paper describes as removing roughly two-thirds of the feedforward parameters for a 34% speed-up and a 0.2 BLEU loss. The remaining network still varies sharply in width across layers. Its final decoder layer retains the original width, a sign that the global sparsity percentage conceals an uneven distribution.

At λ = 1.0, feedforward sparsity rises to 98% and the system reaches 1976 words per second, with quality at 36.8 BLEU, 63.1 chrF and 49.6 COMET. These are useful measurements even though such a severe cut is less attractive on the combined English→German comparison. A shallower decoder can offer a better speed–quality choice than a deeply pruned 6-6 student. Looking only at the sweep within 6-6 would demonstrate that the penalty can accelerate that architecture, while leaving the more practical question of the best available design unresolved.

Spanish→English uses the same architecture and coefficient sweep. Its test results are averaged over WMT12–13. The unpruned student records 37.3 BLEU, 62.6 chrF and 58.1 COMET, with throughput of 1407 words per second. At λ = 0.15, the figures are 36.8 BLEU, 62.3 chrF and 56.8 COMET, with 67% feedforward sparsity and 1811 words per second. This puts it near the feedforward sparsity of the English→German setting highlighted above, with its own quality and throughput consequences. The experiment illustrates why the same pruning rate cannot stand in for accuracy across translation directions.

Single-core throughput for Spanish→English 6-6 students on WMT12–13

Stronger feedforward pruning raises throughput across the reported settings.

Single-core throughput for Spanish→English 6-6 students on WMT12–13Unpruned student: 1407Unpruned student1407Pruned with λ = 0.1: 1655Pruned with λ = 0.11655Pruned with λ = 0.15: 1811Pruned with λ = 0.151811Pruned with λ = 0.2: 1891Pruned with λ = 0.21891Pruned with λ = 0.4: 2071Pruned with λ = 0.42071Pruned with λ = 1.0 (this paper): 2204Pruned with λ = 1.0 (this paper)2204
The numbers
System or settingwords per second
Unpruned student1407
Pruned with λ = 0.11655
Pruned with λ = 0.151811
Pruned with λ = 0.21891
Pruned with λ = 0.42071
Pruned with λ = 1.0 (this paper)2204

The star identifies the fastest displayed setting. Its WMT12–13 quality scores are 35.9 BLEU, 61.8 chrF and 54.3 COMET, at 98% feedforward sparsity. The weaker λ = 0.1 setting gives 36.9 BLEU, 62.4 chrF and 57.3 COMET at 48% sparsity. The speed trend in the chart is clearer than any claim that stronger pruning is generally preferable. The relevant operating point depends on how much quality loss can be accepted, and the metrics give a reader several ways to see the cost of moving along the curve.

English→German with a shallow decoder

The 12-1 experiment changes both the distribution of layers and the scope of pruning. The authors keep the small decoder intact and allow feedforward units and attention heads to be removed from the deeper encoder. The starting student records 38.2 BLEU, 63.9 chrF and 49.5 COMET. It occupies 85 MB and translates at 1930 words per second. Here the attention penalty acts on individual rows or columns first, and the removal procedure uses their inactivity to decide which heads to discard.

At λ = 0.2, this system reaches 2918 words per second with an overall size of 54 MB. It has 48% attention sparsity and 63% feedforward sparsity. Its English→German quality scores are 37.9 BLEU, 63.6 chrF and 49.6 COMET. The paper reports this as a 51% speed-up with a 0.3 BLEU loss relative to the corresponding unpruned baseline. The additional quality measurements matter. chrF declines, while COMET is close to its starting value. The data establish the reported BLEU tradeoff and show that quality change has a different profile under each metric.

At λ = 0.4, the authors report 3430 words per second, a size of 45 MB, 58% attention sparsity and 81% feedforward sparsity. The quality scores fall to 37.0 BLEU, 62.9 chrF and 46.5 COMET. At λ = 0.7, throughput increases to 3485 words per second and BLEU falls to 36.6. Comparing the latter settings shows how a further reduction in surviving weights may offer less practical benefit once inference has already been substantially accelerated. The speed differences are measured for the complete translation system. The table does not isolate how much time each matrix or each component saves.

The paper compares these pruned architectures with unpruned students, reinitialised versions of discovered architectures, and simpler alternatives whose feedforward widths are set uniformly to 768, 384, 192 or 96. For the 12-1 alternative it also tests 4 heads per layer to approximate the scale of attention pruning. In the plot of average English→German quality and translation time, the pruned 12-1 variants lead the frontier among the tested systems. The 6-6 family still helps define the high-quality region. The plot’s practical result is that reducing decoder depth and pruning the remaining network can be complementary choices. Severe pruning within a deep-decoder family does not automatically reproduce that advantage.

Estonian→English and the choice of attention group

On the WMT18 test set, the unpruned Estonian→English 6-2 student records 31.5 BLEU, 58.4 chrF and 54.8 COMET. At λ = 0.3, the authors compare pruning rows or columns throughout the eligible projections with applying the penalty to complete attention heads while still pruning feedforward units by rows or columns. Both procedures produce faster students. Grouping by head delivers the greater throughput improvement and the larger quality loss in this experiment.

Single-core throughput for Estonian→English 6-2 students on the WMT18 test set

Applying the penalty to complete attention heads gives the highest throughput in this comparison.

Single-core throughput for Estonian→English 6-2 students on the WMT18 test setUnpruned student: 1414Unpruned student1414Row and column penalties for feedforward and attention: 1614Row and column penalties for feedforwardand attention1614Row and column penalties for feedforward, whole-head penalties for attention (this paper): 2012Row and column penalties forfeedforward, whole-head penalties forattention (this paper)2012
The numbers
System or settingwords per second
Unpruned student1414
Row and column penalties for feedforward and attention1614
Row and column penalties for feedforward, whole-head penalties for attention (this paper)2012

The row-and-column variant records 30.4 BLEU, 57.6 chrF and 53.0 COMET. The whole-head variant records 29.8 BLEU, 57.0 chrF and 49.9 COMET. The layer counts show the computational distinction behind these rows. The whole-head version leaves some encoder layers with zero attention heads, permitting the corresponding attention computations to be skipped. The row-and-column version preserves at least one head in each encoder layer shown in the comparison. Both procedures produce variable widths. Only the first of these pruning outcomes also eliminates those entire attention sublayers in the reported configuration.

Pruning and quantisation in the shared task

The WMT2021 efficiency submission tests 12-1.tiny and 12-1.micro variants. Each is pruned in the encoder using either a penalty on entire heads or a penalty on rows or columns that informs the removal of heads. Both procedures also prune feedforward dimensions. The authors then apply 8bit quantisation, which reduces the numerical precision used to represent weights, and test an additional fine-tuning stage at that precision. The shared-task timing table reports seconds on a single CPU core with a mini-batch of 32. The quality columns give separate scores for WMT20 and WMT21.

WMT2021 Efficiency Shared Task single-core translation time for English→German 12-1.tiny variants

Combining row and column based pruning with quantisation gives the shortest measured time in the tiny family.

WMT2021 Efficiency Shared Task single-core translation time for English→German 12-1.tiny variantsUnpruned and unquantised: 19.2Unpruned and unquantised19.2Whole-head penalty pruning: 14.5Whole-head penalty pruning14.5Whole-head penalty pruning and quantisation: 9.3Whole-head penalty pruning andquantisation9.3Row and column penalty pruning: 11.6Row and column penalty pruning11.6Row and column penalty pruning and quantisation (this paper): 6.9Row and column penalty pruning andquantisation (this paper)6.9Row and column penalty pruning, quantisation and fine-tuning: 7.1Row and column penalty pruning,quantisation and fine-tuning7.1
The numbers
System or settingseconds
Unpruned and unquantised19.2
Whole-head penalty pruning14.5
Whole-head penalty pruning and quantisation9.3
Row and column penalty pruning11.6
Row and column penalty pruning and quantisation (this paper)6.9
Row and column penalty pruning, quantisation and fine-tuning7.1

The WMT21 BLEU figures show the tradeoff behind the timings. The unpruned 12-1.tiny scores 27.6. After pruning with whole-head penalties it scores 27.0, and the row-and-column variant scores 26.3. Quantisation brings the corresponding scores to 26.2 and 25.6. Fine-tuning after quantisation raises them to 26.7 and 26.0. COMET also recovers after fine-tuning for the quantised row-and-column variant, from 28.7 to 31.3 on WMT21, compared with 41.9 for the baseline. The WMT20 columns show some differences in how the metrics respond. For instance, the same row-and-column 12-1.tiny variant has WMT20 BLEU of 32.9 both before and after quantised fine-tuning, with COMET rising from 33.7 to 35.7.

The 12-1.micro results give a check within a more compact starting family. Its unpruned, unquantised timing is 17.1 seconds, with 27.6 BLEU on WMT21. The row-and-column version after quantisation and fine-tuning records 7.5 seconds and 25.9 BLEU on that test set. The corresponding whole-head penalty variant records 9.2 seconds and 26.5 BLEU. In the paper’s aggregate description of the WMT21 tests, pruning alone gives 1.2–1.7× speed-ups for losses of 0.6–1.3 BLEU. The combined pruning and quantisation results are reported as 1.9–2.7× faster at a cost of 0.9–1.7 BLEU relative to the baselines with neither optimisation. The shared-task evidence shows how the method performs as part of an efficiency pipeline, alongside the earlier experiments that focus on structural reduction.

What the ablations show

Training history matters differently across language pairs

The comparison with fresh training asks whether the architecture discovered by pruning is sufficient to explain the final result. The authors take the surviving dimensions and attention structure, initialise the corresponding network with fresh weights and train it from the start. The comparison holds the dimensions fixed, so any difference in quality cannot come simply from how many feedforward units or heads the final system contains. It can reflect the initial wider stage, the regularised learning period, the preservation of learned weights or other differences between the training paths.

The English→German 6-2tied comparison favours keeping the pruning trajectory. At λ = 0.3, the student pruned on both sides achieves 37.8 BLEU, 63.8 chrF and 51.1 COMET. Training the discovered architecture from scratch gives 37.1 BLEU, 63.2 chrF and 48.8 COMET. At the most aggressive reported setting, λ = 1.0, the pruned system scores 36.1 BLEU and 46.0 COMET, while the freshly trained counterpart records 35.3 BLEU and 42.7 COMET. Every coefficient in this English→German tied comparison favours pruning through training on all the reported quality metrics.

The result extends to the reported English→German 6-6 pairs. At λ = 0.2 the scores after training through pruning are 38.3 BLEU, 64.1 chrF and 53.8 COMET. Starting from the discovered architecture gives 37.6 BLEU, 63.7 chrF and 52.3 COMET. At λ = 0.1, the pruned system’s 38.7 BLEU compares with 38.1 for the new training run. The comparison supports preserving the learning history under these settings. Starting wide and ending narrow can reach a quality level that the matched narrow architecture trained directly fails to reach in the reported experiment.

Spanish→English behaves differently. Over WMT12–13, the λ = 0.1 pruned 6-6 system gives 36.9 BLEU while the freshly trained counterpart gives 37.0. Both record 57.3 COMET. At λ = 0.3 the two runs give 36.3 BLEU, 62.0 chrF and 55.1 COMET. Elsewhere there are small differences and a few clearer gaps, such as 54.3 COMET for pruning and 53.0 for fresh training at λ = 1.0. The close matches establish that an architecture found by pruning can sometimes retain much of its value when transferred to a new training run. The English→German results show that this interpretation depends on the setting.

The Estonian→English results again show why the choice of metric matters. The row-and-column student gives 30.4 BLEU on WMT18 after pruning and 30.3 when trained from scratch. Its COMET scores are 53.0 and 50.7 respectively. The whole-head variant gives 29.8 BLEU after pruning and 28.5 after reinitialisation, with COMET at 49.9 and 46.8. BLEU alone makes the row-and-column pair look nearly interchangeable on this test set. COMET shows a more appreciable quality cost associated with fresh training of the same architecture. The whole-head variant shows a clearer separation in the reported BLEU scores as well.

What changes when the authors alter the schedule or the groups

The authors’ timing choice for the regulariser comes from a training trace and a schedule comparison. In the tied English→German example with λ = 0.5, most of the reduction occurs during the earlier part of training. Keeping the penalty until convergence continues to press the surviving groups to shrink, even once the main reduction has taken place. The authors report that ending the penalty, collapsing the matrices and finishing with the ordinary loss allows partial recovery. This evidence explains their chosen schedule as a compromise between creating removable structures and leaving room for the retained weights to adapt. Their separate reset check addresses the possibility that a fresh optimiser schedule, by itself, accounts for the improvement.

Comparing encoder-only and encoder-plus-decoder pruning in the tied system exposes the role of the eligible layers. At λ = 0.4 both variants occupy 47 MB. The encoder-only result translates at 2916 words per second, and the variant that permits pruning on both sides translates at 2748. At λ = 1.0, the both-side run reaches 3420 words per second while pruning only the encoder reaches 3096. The speeds and quality scores show a change in the available tradeoffs as the penalty grows stronger. The shared decoder retains almost all its width under the weakest both-side setting, then loses more under stronger pressure. Storage at a given setting is an incomplete guide to the speed comparison because the actual workload depends on where dimensions survive.

The attention experiments show an interaction between grouping and architecture. In Estonian→English, whole-head penalties can leave encoder attention sublayers with no heads. The authors link that aggressiveness to the scaling of the penalty with group size. In the English→German efficiency submission, the whole-head penalty leaves nearly all attention weights in place. Both 12-1.tiny and 12-1.micro show 3% attention sparsity in the whole-head variants, alongside feedforward sparsities of 75% and 72% respectively. The row-and-column variants show attention sparsities of 68% and 60%, alongside feedforward sparsities of 73% and 59%. The same group label describes a real difference in the objective, while the outcome depends on how that objective interacts with the student and the training recipe. The shared-task runs use one coefficient for both groupings, so the observed balance applies to those runs.

The Spanish→English corpus comparison addresses another possible explanation. The full corpus has 242M training sentences, described as 19× the scale of the English→German corpus. The authors sample 13M sentences from it and repeat the Spanish→English experiments. They report similar conclusions. This weakens the idea that the Spanish→English behaviour is simply a consequence of training on a much larger collection. It leaves room for effects of the language direction, the data itself and differences in how translation quality responds to pruning. The repeated experiment is a control on the amount of data within Spanish→English.

How the surviving capacity is distributed

The layer-by-layer counts show that group lasso does more than reduce the average feedforward width. In the English→German 6-6 setup at λ = 0.2, the first encoder feedforward layer has 259 surviving dimensions, while the last has 610. The decoder’s first feedforward layer has 121 and its last has 1536. All began with a width of 1536. The middle layers have their own allocations, so the pattern is a broad increase toward the output instead of a strict increase from every layer to the next. The late decoder’s retained width is especially striking given the overall 69% feedforward sparsity in this student.

The English→German 12-1 student gives a different encoder profile. With λ = 0.2, the first encoder feedforward layer retains 728 dimensions, the eighth retains 297, and the last retains 635. The encoder therefore has substantial width near both ends and less in part of the middle. Its last context attention layer keeps all 8 heads, as it does across the reported sweep. The pruning scope for this experiment protects the decoder, which is essential context for interpreting those unchanged values. Encoder self-attention, meanwhile, varies across layers along with the feedforward widths.

The paper looks more closely at Spanish→English by regularising connections in both feedforward and attention projections at λ = 0.1, 0.2, 0.3 and 0.4. The resulting encoder profiles show a dip in the earlier middle layers, with the second and third layers especially affected in the analysis. Encoder self-attention and feedforward widths broadly follow that shape together. Decoder feedforward and context attention retain more capacity towards the later layers. The Estonian→English students with whole-head pruning show a roughly similar allocation, in spite of differences in which attention layers survive and how pruning is applied.

The authors relate these profiles to their earlier results on pruning attention heads. They propose that the decoder may do more work on its own evolving target-side representation earlier and draw more strongly on source context in later layers. Layer survival is evidence of which computations were harder to discard under these procedures. It gives indirect support for this interpretation, while leaving the exact linguistic or computational role of a surviving head open. Losing Heads in the Lottery

Taken together, the comparisons explain why the paper treats structured pruning as a form of architecture search. A penalty sweep discovers distributions that a uniform-width baseline would never generate. In cases like Spanish→English, close scores after reinitialisation show that the distribution can be useful in its own right. In other cases, notably English→German, the higher quality of the retained weights shows that the search and the training path contribute jointly. The paper’s actual speed gains come when those discoveries are translated into smaller matrix operations or skipped attention computations.

Limitations

Limits the authors state

The authors describe the shared-task pruning settings as lightly explored. The scale of that task prevented them from searching over pruning hyper-parameters in detail, so they used λ = 0.5 for both grouping methods. Consequently, the shared-task comparison shows what those methods produced under a common coefficient and schedule. It leaves open what each would produce after independent tuning. The Estonian→English comparison likewise uses λ = 0.3 without a sweep. The contrasting head survival across experiments makes the range of explored settings important to the strength of any general claim about grouping.

The authors also report that more compact systems can suffer larger quality losses after quantisation. Fine-tuning partly recovers the losses in the shared-task results. That makes the final tradeoff a property of the entire sequence of pruning, lower-precision conversion and further training. The timing of the best combined system cannot establish that pruning alone provides the same gain. The intermediate pruning rows give the direct evidence for the contribution of structural removal before quantisation.

The discussion leaves the improvement of pruning larger structures to future work. Entire attention sublayers can disappear in particular runs, which suggests additional opportunities for architecture search. The paper mainly studies feedforward dimensions and complete heads, with only some experiments reaching the point of skipping a sublayer. Its analysis supports further investigation of larger groups and different levels of grouping. It supplies less evidence for a general rule about which full layers to remove.

The authors also recognise a practical limit to making an existing architecture progressively narrower. Past a certain quality loss, a different allocation of depth can offer a better point on the speed–quality frontier. This shows up for heavily pruned English→German students with deep decoders. The method can refine a reasonable starting design, while the choice of encoder and decoder depths remains consequential. The reported frontier includes that choice because a pruning coefficient cannot substitute for it.

Limits implied by the experimental setup

The timing evidence is specific to the tested decoding conditions. The main comparisons use Marian and a single CPU core. The shared-task timing uses a mini-batch of 32 on a single core. The reason smaller dense matrices can save work is clear from the architecture, while elapsed time depends on how a particular runtime executes the remaining operations. The measurements give concrete results for the tested configuration. They leave throughput on other hardware, performance under other batch sizes and response time for other serving patterns to be measured separately. The training setup used GPUs, which is a different condition from the single-core inference evaluation.

The data also define the scope of the language claims. The experiments concern distilled students in English→German, Spanish→English and Estonian→English. Directions, teachers and training collections vary, and some corpora include substantial amounts of synthetic material. The smaller-corpus Spanish experiment controls data volume within that language direction. It does not hold the teachers, source and target languages, data composition and all architecture choices constant across the whole paper. Similar layer profiles across the reported systems suggest a recurring pattern under these conditions. The evidence is narrower than a claim that any translation network would organise itself this way.

The strong initial students make the comparisons more informative for efficient deployment, while also making it difficult to infer how pruning would interact with other kinds of starting system. These students already combine distillation, compact dimensions, shortlists and a fast replacement for decoder self-attention. The supervised target data and the decoding architecture are thus part of the setting in which the reported structures emerge. A student with ordinary decoder self-attention, or one trained with a different teacher, could expose a different balance between encoder computations and decoder computations. The paper does not perform that comparison.

The reported translation scores are aggregate automatic metrics. They show how the variants compare on test collections and, in several cases, whether the answer depends on the scoring method. They give little direct evidence about which sentences suffer first as capacity is removed. For example, the paper’s layer counts do not reveal how a particular loss of attention capacity changes difficult long-distance reordering or the treatment of rare words. Those questions would require an analysis organised around specific translation behaviours. Small gains and losses in the tables are also point estimates. In the absence of reported uncertainty for those comparisons, a small improvement is best read as a result of that run.

Reinitialisation is a useful control for the final architecture, but it changes several aspects of learning together. A freshly trained small student has no period of training at the original width, no group lasso phase that selects among competing units, and no inherited weights at the point of collapse. The authors test whether resetting optimisation settings helps the baseline, which addresses one possible source of advantage. The rest of the comparison establishes the effect of a training path as a whole. It cannot identify which part of that path accounts for the English→German quality gap.

The regularisation trace provides evidence for switching off the penalty in the chosen schedule. The paper gives less evidence for a broadly optimal cutoff or phase length. A group that is small during one stage of training might have developed differently if the penalty were introduced earlier, kept longer or scaled differently. The pruning definition is operational. It uses small weights and rules for matrix dimensions or heads to decide what can be removed, and the subsequent quality and timing tests judge the resulting network. Similar results for the stated criteria would need to be demonstrated before carrying the same schedule unchanged into a different training regime.

Finally, the Pareto frontier is relative to the systems evaluated. Including distilled baselines, alternate decoder depths, uniformly narrow students and freshly trained versions of discovered architectures makes it a stronger comparison than testing only an unoptimised starting point. The resulting frontier identifies the available choices within that study. A different set of baselines or a different timing workload could change which choice lies furthest along the quality–speed tradeoff. Similarly, integrating pruning into the original training trajectory avoids a separate full cycle of training just to recover a pruned student. The paper’s main measurements concern inference, and the evidence for that advantage is distinct from a comprehensive comparison of total training time or training cost.

What came after

Treviso and colleagues’ Efficient Methods for Natural Language Processing: A Survey cites the paper. The later work is a survey of efficiency methods, so the citation places Behnke and Heafield’s translation experiments within a broader study of efficiency in language processing. It documents uptake through review. A specific extension of the group lasso objective, a replication of the translation timings or a new experiment based on the pruned architectures is unverified.

Cite

Cite as Maximiliana Behnke and Kenneth Heafield. 2021. Pruning Neural Machine Translation for Speed Using Group Lasso. Proceedings of the Sixth Conference on Machine Translation.

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{behnke2021pruning,
  title = {{Pruning Neural Machine Translation for Speed Using Group Lasso}},
  author = {Maximiliana Behnke and Kenneth Heafield},
  booktitle = {Proceedings of the Sixth Conference on Machine Translation},
  year = {2021},
  url = {https://aclanthology.org/2021.wmt-1.116/}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/behnke-2021-pruning-neural-machine-translation-speed/