Controlled Randomness Improves the Performance of Transformer Models

Tobias Deußer, Cong Zhao, Wolfgang Krämer, David Leonhard, Christian Bauckhage, Rafet SifaarXiv 2023

TL;DR

Adding controlled uniform noise to specific components of a Transformer model during fine-tuning acts as a powerful regularizer, significantly boosting performance on downstream tasks. By targeting specific parts of the architecture—like just the bias terms or just the decoder—researchers achieved better results than adding noise to all parameters, especially in data-scarce domains.

What Problem Does This Paper Address?

Large language models (LLMs) are typically pre-trained on massive, diverse datasets to learn general linguistic patterns. However, when it comes time to "fine-tune" these models for specific tasks (like extracting data from financial reports or summarizing legal bills), the available data is often tiny by comparison.

This discrepancy creates a major challenge: overfitting. The model might memorize the small fine-tuning set too closely, losing its general reasoning capabilities or failing to generalize to new examples. While standard techniques like dropout and weight decay help, the authors of this paper explore a newer frontier: "controlled randomness." They build upon a method called NoisyTune, which adds noise to all model parameters, to see if a more surgical, localized approach to noise injection can yield even better results.

Methods

The core technique involves perturbing the model's parameter matrices ($W$) before fine-tuning begins. The authors use a formula to create a "noisy" version of a parameter matrix ($\tilde{W}$):

$$\tilde{W}_i = W_i + U(-\frac{\lambda}{2}, \frac{\lambda}{2}) \cdot \sigma(W_i)$$

Here, $U$ represents uniformly distributed noise, $\sigma(W_i)$ is the standard deviation of the original weights, and $\lambda$ is a hyperparameter that controls the noise intensity.

The novelty lies in localization. Instead of applying this to every single parameter in the model, the authors tested injecting noise into specific "zones":

  • Bias vs. Weights: Perturbing only the bias terms or only the weight matrices.
  • Add&Norm: Targeting residual connections and layer normalization steps.
  • Layer Zones: Splitting the encoder into different depths.
  • Encoder vs. Decoder: In sequence-to-sequence models, testing if one half of the architecture is more sensitive to noise than the other.

Datasets

The researchers evaluated their approach on two distinct downstream tasks:

  1. KPI-EDGAR: A dataset of financial documents used for Joint Named Entity Recognition and Relation Extraction (JNERE). It is relatively small, containing only 1,355 sentences, making it a prime candidate for testing regularization.
  2. BillSum: A dataset of U.S. Congressional and California state bills used for Abstractive Text Summarization. This is a larger dataset (over 18,000 training bills) used to test the approach on more complex, generative tasks.

Key Insights and Ideas

  • Specificity Wins: The most surprising finding was that adding noise to everything isn't always best. For the entity extraction task, adding noise only to the bias terms produced the highest scores. For summarization, adding noise only to the decoder was the winning strategy.
  • The "Shake-up" Effect: Injecting noise likely helps the model "escape" the rigid local minima of its pre-trained state, allowing it to adapt more flexibly to the new, smaller distribution of the downstream task.
  • Higher Intensity is Better: Previous research suggested that very low noise ($\lambda$ between 0.1 and 0.15) was optimal. This paper found that much higher intensities—up to $\lambda = 0.9$—actually yielded better performance depending on the task.
  • New Hyperparameters: The "location" of noise is now a critical hyperparameter. There is no universal "best approach"; the optimal noise site depends heavily on the specific architecture and dataset.

Key Results

The authors compared their localized noise approach against two baselines: a standard model with no noise and the original NoisyTune approach (noise added to all parameters).

  • For JNERE (KPI-BERT): Adding noise to the Bias terms with $\lambda=0.41$ resulted in an $F_1$ score of 43.672%. This is a nearly 3% absolute improvement over the no-noise baseline and a 0.85% improvement over adding noise to all parameters.
Results for the JNERE task showing that targeting Bias terms yields the best performance.
  • For Summarization (Longformer): Adding noise to the Decoder with $\lambda=0.8$ achieved a ROUGE-Average of 35.534%. This outperformed the no-noise baseline by 1.387% and the "All parameters" approach by 0.403%.
Results for the summarization task showing that targeting the Decoder yields the best performance.

Limitations and Future Work

While the results are promising, the authors note that finding the "optimal" location and intensity for noise currently requires manual experimentation, as it varies by task.

Future research directions include:

  • Testing on massive LLMs: Applying these techniques to models like Llama or Bloom to see if the benefits scale.
  • Different Noise Distributions: Moving beyond uniform noise to explore Gaussian distributions with "fat tails."
  • Low-Resource Languages: Investigating if this regularization can help multilingual models perform better in languages that were underrepresented during their initial pre-training.

Summary updated

BibTeX
@misc{deuer2023controlled,
  author = {Tobias Deußer and Cong Zhao and Wolfgang Krämer and David Leonhard and Christian Bauckhage and Rafet Sifa},
  title = {{Controlled Randomness Improves the Performance of Transformer Models}},
  year = {2023},
  eprint = {2310.13526},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.13526},
}
Figure