Gradient Vaccine: Investigating and Improving Multi-task Optimization in Massively Multilingual Models

Zirui Wang, Yulia Tsvetkov, Orhan Firat, Yuan Cao

TL;DR

Massively multilingual models struggle with optimizing performance across many languages simultaneously. This paper introduces "Gradient Vaccine," a novel optimization technique that leverages language similarity to align model updates, leading to significant improvements in machine translation and other multilingual tasks.

What Problem Does This Paper Address?

Training a single model to handle dozens or even hundreds of languages (massively multilingual models) is incredibly challenging. While researchers often use a single, language-agnostic objective function, the underlying optimization process is complex and poorly understood. This can lead to "negative interference," where learning one language hinders performance on another, especially when languages are dissimilar. Existing methods for improving multi-task optimization often fail to account for the nuanced relationships between languages, leading to suboptimal performance. The authors aim to understand the "black box" of multilingual optimization by analyzing the geometry of the loss function and propose a method to improve it.

Methods

The core of this paper is the introduction of Gradient Vaccine (GradVac), a new optimization strategy. GradVac builds upon the observation that the similarity of gradients (the direction of steepest ascent for the loss function) between different language tasks correlates with both linguistic proximity and overall model performance.

Here's how it works:

  • Loss Geometry Analysis: The authors first analyze the cosine similarity of gradients for different language pairs during training. They observe that typologically similar languages tend to have more similar gradients.
  • Identifying Limitations: They identify a limitation in existing methods like PCGrad, which aim to deconflict gradients but assume a universal target similarity (often zero). This is problematic because similar languages should have similar gradients.
  • Gradient Vaccine: GradVac addresses this by setting adaptive gradient similarity objectives. Instead of forcing all gradients to be orthogonal, it encourages gradients of similar languages to be more aligned. It achieves this by modifying the gradient of one task to match a desired cosine similarity with the gradient of another task, using a formulation derived from geometric principles.
  • EMA for Adaptation: To make these objectives dynamic, GradVac uses an Exponential Moving Average (EMA) to track gradient similarities over time, allowing it to adapt to changing task relationships.

Datasets

  • Custom Multilingual NMT Dataset: A large-scale dataset containing over 25 billion sentence pairs across 25 languages, spanning 10 diverse language families and varying data sizes. This dataset is described as "heavily unbalanced and noisy."
  • WMT Datasets: Publicly available WMT datasets were used for smaller-scale experiments and ablation studies.
  • XTREME Benchmark: Used for evaluating the proposed method on multilingual language models (specifically, multilingual BERT) for tasks like Named Entity Recognition (NER) and Part-of-Speech (POS) tagging.

Key Insights and Ideas

  • Gradient Similarity as a Signal: The similarity of gradients during training is a powerful indicator of language proximity and model performance. Similar languages naturally exhibit similar gradient trajectories.
  • Language Proximity Matters for Optimization: Typologically similar languages benefit from more aligned gradients, leading to better cross-lingual transfer and overall model quality.
  • Limitations of Existing Methods: Methods like PCGrad, which enforce orthogonality between conflicting gradients, are too simplistic for multilingual settings where positive gradient similarity is desirable for related tasks.
  • Adaptive Objectives are Crucial: A one-size-fits-all approach to gradient alignment is insufficient. GradVac's ability to set adaptive similarity objectives based on language relationships is key to its success.
  • Layer-wise Optimization is Beneficial: Applying GradVac at a finer granularity (e.g., per layer) yields better results than applying it to the entire model at once.

Key Results

  • Significant BLEU Score Improvements: On the WMT machine translation task, GradVac achieved notable improvements in BLEU scores compared to the naive multilingual baseline and other multi-task optimization methods (GradNorm, MGDA, PCGrad). For example, on the Any→En direction, GradVac achieved a BLEU score of 23.89, outperforming PCGrad (22.87) and the baseline (22.48).
  • Improved Performance on XTREME: GradVac also demonstrated superior performance on the XTREME benchmark for multilingual language models, consistently outperforming baselines on NER and POS tasks.
  • Better Low-Resource Language Performance: GradVac showed a greater performance gain on low-resource languages compared to high-resource languages, suggesting its effectiveness in mitigating negative interference.
  • Effectiveness of Adaptive Objectives: Ablation studies showed that using EMA for adaptive objectives was crucial, outperforming a constant objective.

Limitations and Future Work

  • Model Capacity: While GradVac improves performance, the paper notes that multilingual models still perform worse on resourceful languages compared to bilingual baselines, likely due to model capacity limitations.
  • Generalizability: The authors believe their approach is generic and applicable beyond multilingual settings, suggesting future work could explore its application in other multi-task learning scenarios.
  • Hyperparameter Sensitivity: While they found effective settings through grid search, the optimal hyperparameters might vary for different domains or model architectures.
  • Dataset Characteristics: The custom dataset used is described as "heavily unbalanced and noisy," which is realistic but also presents challenges that GradVac helps to address. Future work could explore how GradVac performs on cleaner, more balanced datasets.

Summary updated

BibTeX
@inproceedings{wang2021gradient,
  author = {Zirui Wang and Yulia Tsvetkov and Orhan Firat and Yuan Cao},
  title = {{Gradient Vaccine: Investigating and Improving Multi-task Optimization in Massively Multilingual Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
}
Figure