Skip to main content
QUICK REVIEW

[Paper Review] The Devil is in the Detail: Simple Tricks Improve Systematic Generalization of Transformers

Róbert Csordás, Kazuki Irie|arXiv (Cornell University)|Aug 26, 2021
Advanced Neural Network ApplicationsComputer Science46 references5 citations
TL;DR

This paper demonstrates that simple architectural and training configuration adjustments—such as embedding scaling, early stopping, relative positional embeddings, and Universal Transformer variants—drastically improve systematic generalization in Transformers across five benchmark datasets. The approach boosts accuracy from 35% to 81% on COGS and from 50% to 85% on PCFG’s productivity split, achieving 100% on SCAN’s length split with relative positional encoding, despite no performance gap on IID splits.

ABSTRACT

Recently, many datasets have been proposed to test the systematic generalization ability of neural networks. The companion baseline Transformers, typically trained with default hyper-parameters from standard tasks, are shown to fail dramatically. Here we demonstrate that by revisiting model configurations as basic as scaling of embeddings, early stopping, relative positional embedding, and Universal Transformer variants, we can drastically improve the performance of Transformers on systematic generalization. We report improvements on five popular datasets: SCAN, CFQ, PCFG, COGS, and Mathematics dataset. Our models improve accuracy from 50% to 85% on the PCFG productivity split, and from 35% to 81% on COGS. On SCAN, relative positional embedding largely mitigates the EOS decision problem (Newman et al., 2020), yielding 100% accuracy on the length split with a cutoff at 26. Importantly, performance differences between these models are typically invisible on the IID data split. This calls for proper generalization validation sets for developing neural networks that generalize systematically. We publicly release the code to reproduce our results.

Motivation & Objective

  • Address the persistent failure of standard Transformer models in systematic generalization tasks despite strong performance on standard benchmarks.
  • Investigate whether suboptimal baseline configurations—such as default hyperparameters and absolute positional embeddings—undermine fair evaluation of systematic generalization.
  • Demonstrate that minor architectural and training adjustments can yield substantial gains in systematic generalization without introducing complex inductive biases.
  • Highlight the critical need for dedicated generalization validation sets, as performance gaps are invisible on IID splits.
  • Establish stronger, reproducible baselines for future research on systematic generalization in neural networks.

Proposed method

  • Apply token embedding upscaling (TEU) by initializing word embeddings with Glorot uniform distribution and scaling them by √d_model to balance with positional embeddings.
  • Implement position embedding downscaling (PED) by initializing word embeddings with Kaiming normal distribution (σ = 1/√d_model) and reducing positional embedding magnitude by 1/√d_model.
  • Introduce relative positional embeddings using the decomposed attention mechanism from Dai et al. (2019), which explicitly models relative position via learned vectors u and v and relative position embeddings P_i-j.
  • Use early stopping based on validation loss to prevent overfitting on IID splits while maintaining generalization performance.
  • Train Universal Transformer variants with shared parameters across layers to improve sequence modeling and generalization capacity.
  • Avoid combining absolute and relative positional embeddings; use relative positional attention in all layers except encoder-decoder interfaces.

Experimental results

Research questions

  • RQ1To what extent do standard Transformer hyperparameters and configurations limit systematic generalization performance on benchmark datasets?
  • RQ2Can simple architectural modifications—such as embedding scaling and relative positional encoding—significantly improve systematic generalization without adding symbolic components?
  • RQ3Why do performance gaps between models remain undetected on IID validation sets, and what does this imply for evaluating generalization?
  • RQ4How do relative positional embeddings mitigate the end-of-sentence (EOS) decision problem in sequence-to-sequence tasks?
  • RQ5Can a single set of configuration improvements generalize across diverse systematic generalization benchmarks like SCAN, COGS, PCFG, and Mathematics?

Key findings

  • On the PCFG productivity split, the model improves accuracy from 50% to 85% using embedding scaling and relative positional encoding.
  • On the COGS dataset, performance increases from 35% to 81% with the same configuration improvements, demonstrating strong generalization gains.
  • On SCAN’s length split (cutoff at 26), relative positional embedding enables 100% accuracy, effectively solving the EOS decision problem.
  • On the PCFG systematicity split, the model achieves 96% accuracy, up from 72% in the baseline, showing improved compositional reasoning.
  • Despite dramatic performance differences on generalization splits, all models perform identically on IID validation sets, underscoring the need for dedicated generalization benchmarks.
  • The code and trained models are publicly released to ensure reproducibility and enable future benchmarking of systematic generalization methods.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.