Equi-Tuning: Group Equivariant Fine-Tuning of Pretrained Models

Sourya Basu, Prasanna Sattigeri, Karthikeyan Natesan Ramamurthy, Vijil Chenthamarakshan, Kush R. Varshney, Lav R. Varshney, Payel Das

Abstract

Modern deep learning models, while powerful, often lack an inherent understanding of symmetries, leading to fragility in geometric tasks and biases in language generation. We present Equi-Tuning, a novel fine-tuning framework that transforms standard pretrained models into group equivariant architectures. By leveraging the Reynold’s operator, Equi-Tuning enforces symmetry constraints on black-box models without requiring architectural redesign. Our experiments across image classification, compositional generalization, and algorithmic fairness demonstrate that Equi-Tuning significantly enhances model robustness and generalization while preserving the semantic knowledge of the original pretrained weights.

Introduction

Pretrained models like ResNet and GPT-2 have revolutionized machine learning by providing a rich foundation of semantic knowledge. However, these models are typically not group equivariant; a transformation of the input (e.g., rotating an image or swapping gendered pronouns) does not necessarily result in a predictable, symmetric transformation of the output. This lack of inductive bias leads to several critical failures:

  1. Geometric Fragility: Classifiers are often sensitive to simple rotations or reflections.
  2. Compositional Failure: Language models struggle to generalize to novel combinations of known primitives (e.g., the SCAN benchmark).
  3. Social Bias: Models exhibit disparate performance or sentiment across different demographic groups.

While equivariant architectures like Group-Convolutional Neural Networks (GCNNs) exist, they are often built from scratch, ignoring the vast knowledge in existing non-equivariant pretrained models. Equi-Tuning bridges this gap by providing a principled way to "equi-tune" any pretrained model.

Methodology: The Reynold’s Operator

The core of Equi-Tuning is the application of the Reynold’s operator to a pretrained model $M$. Instead of modifying the internal weights of the model, Equi-Tuning treats $M$ as a black box and enforces equivariance through a specific input-output averaging process.

For a group $G$ of symmetries, the equivariant version of the model $M_G$ is defined as: $$M_G(x) = \frac{1}{|G|} \sum_{g \in G} g^{-1} M(gx)$$

This process involves three steps:

  1. Input Transformation: The input $x$ is transformed by every element $g$ in the group $G$.
  2. Parallel Inference: Each transformed input is passed through the original model $M$.
  3. Inverse Transformation and Averaging: The outputs are transformed back using the inverse group element $g^{-1}$ and then averaged.
The Equi-Tuning architecture utilizes a shared pretrained model M across multiple transformed versions of the input, followed by an inverse transformation and a custom equivariant layer to produce a symmetric output Y.

This approach is mathematically proven to find the closest equivariant model to the original in terms of $L_2$ distance, ensuring minimal loss of the pretrained knowledge.

Experimental Evaluation

We evaluated Equi-Tuning across three distinct domains to test its versatility.

1. Image Classification

Using the Hymenoptera (ants vs. bees) and CIFAR-10 datasets, we tested robustness to 90-degree rotations. Equi-Tuning consistently outperformed standard fine-tuning. For instance, on Hymenoptera, ResNet accuracy improved from ~89% to ~92% when enforcing rotational symmetry.

2. Compositional Generalization

The SCAN benchmark tests a model's ability to handle novel command combinations (e.g., "jump twice"). While standard LSTMs fail completely (0% accuracy) on the "Add jump" task, Equi-tuned LSTMs achieved ~98% accuracy, demonstrating a superior ability to generalize through symmetry.

3. Fairness in Natural Language Generation

We applied Equi-Tuning to GPT-2 to reduce demographic bias. By defining a group of "demographic swaps" (e.g., swapping "he" for "she"), we created "EquiLM." This model significantly reduced disparities in "regard" scores across gender and race without sacrificing language modeling performance (perplexity) on Wikitext-2/103.

Key Insights

Equi-Tuning's "black-box" nature makes it compatible with any architecture, from CNNs to Transformers. By enforcing symmetry at the boundaries, the model's internal representations become more robust and structured.

Visualization of feature maps showing how Equi-Tuning preserves symmetry in internal representations across different input transformations.

Discussion and Limitations

While Equi-Tuning provides a powerful tool for injecting inductive biases, it introduces a computational trade-off. The inference cost scales linearly with the size of the symmetry group $|G|$. For a group of 8 transformations (rotations and flips), the model is 8x slower. Future work will focus on extending this framework to continuous groups and automating the discovery of symmetry sets in language tasks.

Summary updated

BibTeX
@inproceedings{basu2023equi,
  author = {Sourya Basu and Prasanna Sattigeri and Karthikeyan Natesan Ramamurthy and Vijil Chenthamarakshan and Kush R. Varshney and Lav R. Varshney and Payel Das},
  title = {{Equi-Tuning: Group Equivariant Fine-Tuning of Pretrained Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i6.25832},
}
Figure