LayerShuffle: Enhancing Robustness in Vision Transformers by Randomizing Layer Execution Order

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Freiberger, Matthias, Kun, Peter, Løvlie, Anders Sundnes, Risi, Sebastian
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917859224977408
author Freiberger, Matthias
Kun, Peter
Løvlie, Anders Sundnes
Risi, Sebastian
author_facet Freiberger, Matthias
Kun, Peter
Løvlie, Anders Sundnes
Risi, Sebastian
contents Due to their architecture and how they are trained, artificial neural networks are typically not robust toward pruning or shuffling layers at test time. However, such properties would be desirable for different applications, such as distributed neural network architectures where the order of execution cannot be guaranteed or parts of the network can fail during inference. In this work, we address these issues through a number of training approaches for vision transformers whose most important component is randomizing the execution order of attention modules at training time. With our proposed approaches, vision transformers are capable to adapt to arbitrary layer execution orders at test time assuming one tolerates a reduction (about 20\%) in accuracy at the same model size. We analyse the feature representations of our trained models as well as how each layer contributes to the models prediction based on its position during inference. Our analysis shows that layers learn to contribute differently based on their position in the network. Finally, we layer-prune our models at test time and find that their performance declines gracefully. Code available at https://github.com/matfrei/layershuffle.
format Preprint
id arxiv_https___arxiv_org_abs_2407_04513
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle LayerShuffle: Enhancing Robustness in Vision Transformers by Randomizing Layer Execution Order
Freiberger, Matthias
Kun, Peter
Løvlie, Anders Sundnes
Risi, Sebastian
Computer Vision and Pattern Recognition
Artificial Intelligence
Machine Learning
Due to their architecture and how they are trained, artificial neural networks are typically not robust toward pruning or shuffling layers at test time. However, such properties would be desirable for different applications, such as distributed neural network architectures where the order of execution cannot be guaranteed or parts of the network can fail during inference. In this work, we address these issues through a number of training approaches for vision transformers whose most important component is randomizing the execution order of attention modules at training time. With our proposed approaches, vision transformers are capable to adapt to arbitrary layer execution orders at test time assuming one tolerates a reduction (about 20\%) in accuracy at the same model size. We analyse the feature representations of our trained models as well as how each layer contributes to the models prediction based on its position during inference. Our analysis shows that layers learn to contribute differently based on their position in the network. Finally, we layer-prune our models at test time and find that their performance declines gracefully. Code available at https://github.com/matfrei/layershuffle.
title LayerShuffle: Enhancing Robustness in Vision Transformers by Randomizing Layer Execution Order
topic Computer Vision and Pattern Recognition
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2407.04513