Source-linked AI summary

Scaling Laws for Neural Machine Translation

Behrooz Ghorbani, Orhan Firat, Markus Freitag, Ankur Bapna, Maxim Krikun, Xavier Garcia, Ciprian Chelba, Colin Cherry

arXiv:2109.07740v1cs.LGcs.AIcs.CL

TL;DR

Neural machine translation scaling has lacked systematic study, despite scaling being used to improve model performance. This paper studies encoder-decoder Transformer scaling with a separate encoder/decoder loss law and examines how data composition shapes loss and translation quality; scaling outcomes differ across evaluation-set composition.

  • Problem

    Scaling behavior in NMT had not been systematically studied, and it was unclear whether total parameter count could describe model fit as it does for some other tasks.

    Source: §1 · pp. 1–2
  • Method

    The authors empirically study encoder-decoder Transformer scaling and model cross-entropy as a bivariate function of encoder and decoder parameter counts.

    Source: §1 · p. 2
  • Results

    The bivariate law fits two language pairs; target-original evaluation benefits from scale, while source-original reducible error quickly saturates and cross-entropy/generation correlation breaks down.

    Source: §5 · pp. 10–11
  • Takeaways & Limitations

    NMT scaling descriptions must distinguish encoder from decoder capacity, and findings about loss and generation quality depend on evaluation-data composition.

    Source: §5 · pp. 10–11

    The findings raise concerns about synthetic data's effects on scaling and evaluation, and the possible effect of machine-generated web text on future model quality.

    Source: §5 · p. 12

Abstract

from arXiv · show

We present an empirical study of scaling properties of encoder-decoder Transformer models used in neural machine translation (NMT). We show that cross-entropy loss as a function of model size follows a certain scaling law. Specifically (i) We propose a formula which describes the scaling behavior of cross-entropy loss as a bivariate function of encoder and decoder size, and show that it gives accurate predictions under a variety of scaling approaches and languages; we show that the total number of parameters alone is not sufficient for such purposes. (ii) We observe different power law exponents when scaling the decoder vs scaling the encoder, and provide recommendations for optimal allocation of encoder/decoder capacity based on this observation. (iii) We also report that the scaling behavior of the model is acutely influenced by composition bias of the train/test sets, which we define as any deviation from naturally generated text (either via machine generated or human translated text). We observe that natural text on the target side enjoys scaling, which manifests as successful reduction of the cross-entropy loss. (iv) Finally, we investigate the relationship between the cross-entropy loss and the quality of the generated translations. We find two different behaviors, depending on the nature of the test data. For test sets which were originally translated from target language to source language, both loss and BLEU score improve as model size increases. In contrast, for test sets originally translated from source language to target language, the loss improves, but the BLEU score stops improving after a certain threshold. We release generated text from all models used in this study.

1 Introduction

This section introduces a systematic study of scaling laws for encoder-decoder Transformers in neural machine translation. It examines how encoder and decoder capacity, data composition, and evaluation-set naturalness relate to cross-entropy and translation quality.

  • NMT scaling is harder to characterize than decoder-only language modeling because it is conditional, uses separate components, and permits multiple valid translations.The paper links differing test-set difficulty to translation direction and contrasts translated target text with natural target text.Source: §1 · p. 2
  • A bivariate law using encoder and decoder parameter counts describes NMT scaling, whereas total parameter count alone is insufficient.The study identifies total capacity and its allocation between the encoder and decoder as relevant to scaling behavior.Source: §1 · p. 2
  • Target-natural evaluation continues to benefit from capacity scaling, while cross-entropy improvement on source-natural evaluation saturates even for moderately sized models.Source: §1 · p. 2
  • The study investigates whether cross-entropy improvements track generation quality across encoder-versus-decoder scaling and source-natural-versus-target-natural evaluation.Source: §1 · p. 2
  • Model scaling predictably improves validation cross-entropy across multiple language pairs and training/test data compositions.Source: §1 · p. 2

2 Effect of Scaling on Cross-Entropy

NMT cross-entropy scaling depends separately on encoder and decoder capacity, and the fitted law predicts symmetric scaling from encoder- and decoder-scaling data. Across test sets, decoder scaling has a larger exponent than encoder scaling.

2.1 Experimental setting

  • Experiments vary Transformer depth while holding width and other internal settings fixed, testing encoder-only, decoder-only, and symmetric scaling.Encoder-only and decoder-only runs vary one side while holding the other at six layers; symmetric runs increase both together.Source: §2.1 · p. 3

2.2 Results

  • A power law using only total parameters misses NMT scaling differences; the proposed law models loss as a function of separate encoder and decoder parameter counts.Its exponents are test-set-specific, with separate terms for encoder and decoder size.Source: §2.2 · p. 4
  • The proposed law captures both encoder- and decoder-scaling behavior, explaining more than 99% of the variation in English→German log-perplexity.The law was jointly fitted to empirical losses from both scaling experiments.Source: §2.2 · p. 4, Figure 2 · p. 5
  • The law fitted on encoder- and decoder-scaling data predicts symmetric-scaling test loss with 99.8% of its variation captured out of sample.The reported out-of-sample comparison uses English→German models.Source: §2.2 · p. 4, Figure 3 · p. 5
  • For German→English as well as English→German, the proposed functional form closely captures observed scaling behavior.The reported German→English fit is for the Web-Domain test set.Source: §2.2 · p. 5, Figure 4 · p. 6

2.3 Analysis

  • Across all considered test sets, the decoder exponent exceeds the encoder exponent, making decoder growth more effective for reducing test loss.The paper notes that this contrasts with the common practice of using deep encoders and shallow decoders.Source: §2.3 · pp. 5–6
  • Proportional encoder-decoder scaling achieves the optimal scaling exponent when the parameter ratio stays fixed, while symmetric scaling is nearly optimal and heavily lopsided allocations perform worse.The symmetric allocation is reported as N_d/N ≈ 0.55.Source: §2.3 · pp. 6–7

3 Effect of Dataset Composition Bias on Scaling Behavior

Dataset composition affects how cross-entropy loss scales in NMT: source-original and target-original test sets show markedly different scaling behavior. Training on back-translated data also shows a test-loss threshold near 400M parameters, while the source-original training experiment reports very low loss and apparent overfitting.

  • The paper defines composition bias as deviation from naturally generated text in source-target data, arising when the paired text is human-translated or machine-translated.The authors note that machine-generated content can also appear in web-harvested corpora and data-augmentation pipelines.Source: §3 · pp. 7–8
  • Source- and target-original test sets have drastically different fitted scaling powers, unlike the scaling-penalty pattern reported for language-model evaluations.Source: §3 · p. 7
  • On target-original test sets, reducible loss falls more slowly than on source-original sets: scaling the baseline 6L-6L model by 11× is estimated to bring it below 0.05, versus 2.5× for source-original sets.The comparison uses fitted scaling laws and symmetric encoder/decoder scaling.Source: §3 · p. 8, Figure 7 · p. 8
  • The test-set composition changes the practical value of model size: moderate scaling can nearly eliminate reducible loss on source-original sets, while target-original sets need larger models.Source: §3 · p. 8
  • For models trained on target-original back-translated data, test loss stops improving and deteriorates beyond roughly 400M parameters, despite continued training-loss reduction; the authors hypothesize this threshold reflects the back-translation model’s capacity.They leave that capacity hypothesis for future verification.Source: §3 · pp. 8–9, Figure 8 · p. 9
  • In the source-original training experiment, even the smallest models reach roughly 0.16 loss, with an apparent overfitting pattern on a target side described as composition-biased.The experiment compares target-original and source-original training datasets generated from web documents and translated with a hybrid model.Source: §3 · pp. 8–9

4 Evolution of Generation Quality

The paper examines how translation quality changes with model scaling and cross-entropy loss. Target-original test sets show improving BLEU alongside lower loss, whereas source-original test sets show BLEU deterioration beyond a threshold despite continued loss improvement.

  • The analysis uses beam search with the baseline model’s decoding configuration rather than tuning its hyperparameters for each model.Source: §4 · p. 9
  • On target-original test sets, lower cross-entropy loss accompanies consistent BLEU increases; on source-original sets, loss improves while BLEU deteriorates beyond a threshold.Figure 10 plots BLEU against cross-entropy loss across models and training checkpoints.Source: §4 · pp. 9–10, Figure 10 · p. 10
  • A simple power law captures the BLEU–cross-entropy relationship for high-quality models, with reported deviations for smaller models and early checkpoints.Source: §4 · p. 9
  • BLEURT scores closely mirror BLEU’s scaling behavior, supporting the same contrast across test-set constructions.Source: §4 · p. 10
  • At similar test-loss values, encoder-scaled models yield better generation quality than decoder-scaled models; the cause remains unresolved.The authors leave insufficient search versus different architectural priors as alternatives for future work.Source: §4 · p. 10

5 Conclusion and Limitation

The study finds that encoder-decoder NMT scaling is better described by separate encoder and decoder capacities than by total parameter count alone. Scaling effects also depend on data composition, and the relationship between cross-entropy and generation quality differs across evaluation sets.

5 Conclusion and Limitation

  • A bivariate law using encoder and decoder parameter counts describes NMT scaling across strategies, language pairs, and evaluation sets, unlike a univariate law based only on total parameters.Whether this behavior is intrinsic to encoder-decoder architecture or to the NMT task requires further study.Source: §5 · p. 10
  • Target-original evaluation sets continue benefiting from scaling, while reducible error on source-original sets quickly saturates to zero.The authors suggest this may reflect lower diversity in translated text, but present that explanation as a possibility.Source: §5 · pp. 10–11
  • When training on target-original back-translated text, quality improves with scale before saturating near the capacity of the model used for back-translation.The authors say the synthetic-text generator’s capacity may play a role, but requires further investigation.Source: §5 · p. 11
  • On target-original evaluation, lower cross-entropy is associated with improved BLEU and BLEURT, but on source-original data that relationship breaks down.At the same cross-entropy, encoder-scaled models perform better on BLEU/BLEURT than decoder-scaled models; the explanation requires further investigation.Source: §5 · p. 11, Figure 11 · p. 11
  • The study’s scaling findings are empirical, and whether their formulation generalizes beyond the studied architecture or task remains unresolved.Source: §5 · pp. 10–11
  • The authors raise concerns that machine-generated text may affect scaling and evaluation, including in future models trained on web text.They note that machine-translated text already makes up a significant portion of web text in low-resource languages.Source: §5 · pp. 11–12

A Architecture and Hyper-Parameter Details

The appendix records the shared Transformer configuration, regularization and optimizer settings, and the parameter-decomposition tables for the scaling models.

A Architecture and Hyper-Parameter Details

  • All models use a 1024-dimensional model, 8192-dimensional feed-forward layers, 16 attention heads, 1024 attention hidden dimensions, and a 32,000-piece vocabulary.Source: A Architecture and Hyper-Parameter… · p. 15
  • Training uses dropout and label smoothing of 0.1, logit clipping of 10, and Adafactor with 40,000 linear warm-up steps and an inverse-square-root learning-rate schedule.Adafactor uses momentum of 0.9 and a factored second moment to save memory.Source: A Architecture and Hyper-Parameter… · p. 15
  • Tables 1–3 report parameter decompositions for encoder-scaling, decoder-scaling, and symmetric-scaling models, respectively.The symmetric-scaling table covers models trained for English→German.Source: Table 1 · p. 15, Table 2 · p. 16, Table 3 · p. 16

B Scaling Laws for Other Test Sets

The appendix tests the fitted scaling law on additional test sets and domains, including out-of-sample predictions for symmetric models. The reported fits closely track empirical losses across the examined settings.

B Scaling Laws for Other Test Sets

C Quantifying the Random Variations in the Results

The appendix quantifies variability in final test loss by retraining selected symmetric models with four seeds and reporting the resulting spread.

C Quantifying the Random Variations in the Results

D.1 Proof of proposition 1

The proof transforms the optimal encoder/decoder sizing objective into a convex problem, then uses KKT conditions and substitutions to derive the optimal sizes and resulting scaling law.

D.1 Proof of proposition 1

  • Taking the logarithm of the objective and changing variables converts the sizing problem into a convex optimization problem.The transformed problem is then solved in the changed variables.Source: §D.1 · p. 24
  • The proof uses the convexity of the transformed problem to apply KKT conditions and form a Lagrangian.Source: §D.1 · p. 24
  • First-order conditions, the binding constraint, and successive substitutions yield optimal encoder/decoder sizes and their substitution into the scaling law.Source: §D.1 · p. 24

E Curve Fitting Details

The appendix specifies the curve-fitting implementation, including its bivariate inputs, robust loss, and fitting-scale choices.

E Curve Fitting Details

  • Curve fitting uses scipy.optimize.least_squares with the soft_l1 loss to provide robustness to outliers.Source: E Curve Fitting Details · p. 25
  • The fitting function takes encoder and decoder parameter counts as inputs and fits four parameters to log perplexity.The parameter array corresponds to α, p_e, p_d, and c.Source: E Curve Fitting Details · p. 25
  • The fitting routine rejects inputs containing NaNs or mismatched observation and feature shapes.Source: E Curve Fitting Details · p. 25
  • The four fitting parameters are initialized to 0.2, 0.4, 0.6, and 1.0 before optimization.Source: E Curve Fitting Details · p. 25
  • The fitting-scale parameter is selected from 25 geometrically spaced values between 0.001 and 0.025.At 0.025 the fit effectively becomes least squares; smaller values increase robustness to outliers.Source: E Curve Fitting Details · p. 25

F Analysis of the Generation Quality

Generation-quality scaling depends on test-set composition: target-original data shows BLEU gains alongside cross-entropy improvements, while source-original data eventually diverges. Encoder-scaled models show stronger BLEU scaling trends, with deviations for shallow decoders and early checkpoints.

F Analysis of the Generation Quality

Loading 2109.07740v1…