ElastiFormer: Learned Redundancy Reduction in Transformer via Self-Distillation

Junzhang Liu, Tingkai Liu, Yueyuan Sui, Stephen Xia
11/22/2024
cs.LGcs.AI

No confident code implementation found for this paper.

Abstract

We introduce ElastiFormer, a post-training technique that adapts pretrained Transformer models into an elastic counterpart with variable inference time compute. ElastiFormer introduces small routing modules (as low as .00006% additional trainable parameters) to dynamically selects subsets of network parameters and input tokens to be processed by each layer of the pretrained network in an inputdependent manner. The routing modules are trained using self-distillation losses to minimize the differences between the output of the pretrained-model and their elastic counterparts. As ElastiFormer makes no assumption regarding the modality of the pretrained Transformer model, it can be readily applied to all modalities covering causal language modeling, image modeling as well as visual-language modeling tasks. We show that 20% to 50% compute saving could be achieved for different components of the transformer layer, which could be further reduced by adding very low rank LoRA weights (rank 1) trained via the same distillation objective. Finally, by comparing routing trained on different subsets of ImageNet, we show that ElastiFormer is robust against the training domain.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{liu2024elastiformer,
  title  = {ElastiFormer: Learned Redundancy Reduction in Transformer via Self-Distillation},
  author = {Junzhang Liu and Tingkai Liu and Yueyuan Sui and Stephen Xia},
  year   = {2024},
  eprint = {2411.15281},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.15281v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2411.15281.svg)](https://codeofpaper.com/paper/2411.15281)

Discussion