AICLCVLGJun 20, 2024

Tracing Representation Progression: Analyzing and Enhancing Layer-Wise Similarity

arXiv:2406.14479v330 citations
Originality Incremental advance
AI Analysis

This work addresses the challenge of understanding and improving internal representations in transformers for researchers and practitioners, offering a method to enhance model efficiency and interpretability, though it is incremental in building on existing similarity analysis techniques.

The paper tackles the problem of analyzing and enhancing layer-wise similarity in transformer models, showing that a simple cosine similarity metric aligns with complex methods and that increasing similarity improves shallow layer effectiveness, enabling multi-exit models with a single classifier to achieve competitive performance.

Analyzing the similarity of internal representations has been an important technique for understanding the behavior of deep neural networks. Most existing methods for analyzing the similarity between representations of high dimensions, such as those based on Centered Kernel Alignment (CKA), rely on statistical properties of the representations for a set of data points. In this paper, we focus on transformer models and study the similarity of representations between the hidden layers of individual transformers. In this context, we show that a simple sample-wise cosine similarity metric is capable of capturing the similarity and aligns with the complicated CKA. Our experimental results on common transformers reveal that representations across layers are positively correlated, with similarity increasing when layers get closer. We provide a theoretical justification for this phenomenon under the geodesic curve assumption for the learned transformer. We then show that an increase in representation similarity implies an increase in predicted probability when directly applying the last-layer classifier to any hidden layer representation. We then propose an aligned training method to improve the effectiveness of shallow layer by enhancing the similarity between internal representations, with trained models that enjoy the following properties: (1) more early saturation events, (2) layer-wise accuracies monotonically increase and reveal the minimal depth needed for the given task, (3) when served as multi-exit models, they achieve on-par performance with standard multi-exit architectures which consist of additional classifiers designed for early exiting in shallow layers. To our knowledge, our work is the first to show that one common classifier is sufficient for multi-exit models. We conduct experiments on both vision and NLP tasks to demonstrate the performance of the proposed aligned training.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes