TOAST: Transformer Optimization using Adaptive and Simple Transformations

Irene Cannistraci, Simone Antonelli, Emanuele Palumbo, Thomas M. Sutter, Emanuele Rodolà, Bastian Rieck, Julia E. Vogt

TL;DR

TOAST (Transformer Optimization using Adaptive and Simple Transformations) is a training-free framework that slims down large Transformer models by replacing entire redundant blocks with simple, closed-form linear mappings or identity functions. By exploiting internal representational redundancies using only a few hundred data samples, TOAST significantly cuts down parameter counts and computational costs (GFLOPs) while maintaining—and sometimes even improving—downstream task performance.

What Problem Does This Paper Address?

As foundation models like Vision Transformers (ViTs) and Large Language Models (LLMs) scale up, their massive computational and memory footprints make edge deployment incredibly challenging. Existing efficiency techniques—such as pruning, quantization, and knowledge distillation—typically demand resource-intensive retraining or finetuning cycles to recover lost accuracy.

Recent deep learning research highlights that deep networks often learn highly correlated, redundant representations across different layers. While researchers have successfully exploited these similarities between different models (e.g., model stitching and merging), the intra-network redundancy within a single model remains largely untapped. TOAST tackles this gap by asking a simple question: Can we identify these redundant internal blocks and replace them with trivial mathematical functions without training the model from scratch?

Methods

The core idea behind TOAST is to bypass a sequence of intermediate transformer blocks (from block $s$ to block $e$) by mapping the output of block $s$ directly to an approximation of block $e$'s output using a lightweight transformation $\mathcal{T}$.

Figure 1: Framework Description. Given two latent spaces X(s) and X(e) corresponding to the outputs of blocks s and e for a random subset of 500 training samples, TOAST estimates a lightweight transformation T such that X(e) ≈T (X(s)). This allows entire transformer blocks to be approximated by simple closed-form mappings (e.g., linear or identity), reducing parameters and computation without retraining.

The framework operates in two main phases:

  1. Redundancy Identification: The authors introduce linear approximation error as a stable, lightweight metric to automatically rank and select candidate blocks for removal. By taking a tiny subset of data (as few as 50 samples), they compute how well a later layer's representations can be reconstructed from an earlier layer via a simple least-squares projection.
  2. Block Approximation: Once the redundant blocks are identified, they are replaced with either an Identity translator or a Linear translator. The optimal weights for the linear mapping are computed instantly in closed form using a small subset of training data (typically 500 samples), completely avoiding backpropagation and gradient descent.

Datasets

The authors extensively validated TOAST across multiple domains and datasets:

  • Vision Classification: MNIST, Fashion-MNIST (F-MNIST), CIFAR-10, CIFAR-100 (both coarse and fine variants), and the large-scale ImageNet-1k benchmark.
  • Semantic Segmentation: SceneParse150.
  • Text Classification: AG News.

Key Insights and Ideas

  • Redundancy is Intrinsic to the Architecture: A fascinating finding is that block-wise similarity patterns are primarily determined by the model architecture itself rather than the dataset it processes. As shown in Figure 2, the similarity matrices for DINO-B and DeiT-S remain remarkably consistent whether they are processing simple MNIST digits or complex ImageNet images.
Figure 2: Block Similarities. Block-by-block similarities in DINO-B and DeiT-S models across five datasets: MNIST, F-MNIST, CIFAR-10, CIFAR-100, and ImageNet-1k. Each matrix quantifies the linear approximation error using only the [CLS] token, averaged over a small subset of 50 training samples. The matrices reveal that the similarity between blocks is predominantly influenced by the model rather than the specific dataset. Additional results in Section A.2.1.
  • Sensitivity is Highly Architecture-Dependent: There is no "one-size-fits-all" layer to skip. DeiT models are highly sensitive at their earliest blocks but feature massive redundancy in their final layers. Conversely, DINOv2 models are easiest to linearize in their early-to-middle blocks, while ViT models display a U-shaped sensitivity profile.
  • Extreme Data Efficiency: TOAST does not require massive datasets to compute its closed-form approximations. Performance typically plateaus at just 500 training samples, meaning stable and highly effective model compression can be achieved even in low-data regimes.

Key Results

  • Negligible Accuracy Drops with Real Savings: On ImageNet-1k using a DeiT-S backbone, replacing the final block (10 $\rightarrow$ 11) with a Linear translator removed 1.62M parameters and reduced GFLOPs from 4.97 to 4.59, while only shifting accuracy by a mere 0.07% (from 73.85% to 73.78%).
  • Effective Initialization for Finetuning: For aggressive structural changes where head-only accuracy drops significantly, TOAST serves as an excellent initialization for End-to-End (E2E) finetuning. For instance, when removing 26M parameters from DINO-B (blocks 0 $\rightarrow$ 4) on CIFAR-100F, E2E finetuning successfully recovered the accuracy to 89.54% (within 3.56% of the original baseline).
  • Beyond Vision: TOAST proved its versatility by successfully compressing text models. Applying it to ModernBERT-B on the AG News dataset allowed up to 10 blocks to be approximated simultaneously (blocks 11 $\rightarrow$ 21), dropping parameters by over 56M while maintaining high text classification accuracy.

Limitations and Future Work

While TOAST delivers impressive training-free compression, the authors note a few limitations:

  • Downstream Constraints: The primary evaluation setup relies on a frozen backbone paired with a linear classifier, which is less expressive than fully finetuned, task-specific architectures.
  • Empirical Focus: The study is heavily empirical and lacks a rigorous theoretical explanation detailing why transformer architectures naturally develop such strong linear equivalences between distant layers.
  • Coarse Granularity: TOAST currently operates at the whole-block level. The authors point out that exploring redundancies at a finer granularity—such as within individual attention heads or specific feed-forward layers—could yield even more refined, context-aware optimization strategies.

Summary updated

BibTeX
@article{cannistraci2026toast,
  author = {Irene Cannistraci and Simone Antonelli and Emanuele Palumbo and Thomas M. Sutter and Emanuele Rodolà and Bastian Rieck and Julia E. Vogt},
  title = {{TOAST: Transformer Optimization using Adaptive and Simple Transformations}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2026},
}
Figure