Sample-based Dynamic Hierarchical Transformer with Layer and Head Flexibility via Contextual Bandit

Fanfei Meng, Lele Zhang, Yu Chen, Yuxin Wang
12/5/2023
cs.LGcs.AIcs.NE
transformer-attention

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Transformer requires a fixed number of layers and heads which makes them inflexible to the complexity of individual samples and expensive in training and inference. To address this, we propose a sample-based Dynamic Hierarchical Transformer (DHT) model whose layers and heads can be dynamically configured with single data samples via solving contextual bandit problems.

Show full abstract

To determine the number of layers and heads, we use the Uniform Confidence Bound while we deploy combinatorial Thompson Sampling in order to select specific head combinations given their number. Different from previous work that focuses on compressing trained networks for inference only, DHT is not only advantageous for adaptively optimizing the underlying network architecture during training but also has a flexible network for efficient inference. To the best of our knowledge, this is the first comprehensive data-driven dynamic transformer without any additional auxiliary neural networks that implement the dynamic system. According to the experiment results, we achieve up to 74% computational savings for both training and inference with a minimal loss of accuracy.

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. 1 weaker match is hidden by default — 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{meng2023samplebased,
  title  = {Sample-based Dynamic Hierarchical Transformer with Layer and Head Flexibility via Contextual Bandit},
  author = {Fanfei Meng and Lele Zhang and Yu Chen and Yuxin Wang},
  year   = {2023},
  eprint = {2312.03038},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2312.03038v3}
}

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/2312.03038.svg)](https://codeofpaper.com/paper/2312.03038)

Discussion