Depth-Wise Attention (DWAtt): A Layer Fusion Method for Data-Efficient Classification
Muhammad ElNokrashy, Badr AlKhamissi, Mona Diab
TL;DR
DWAtt addresses the problem that intermediate representations in deep pretrained transformers are underutilized during adaptation. It introduces Depth-Wise Attention (DWAtt), an add-on that re-surfaces signals from all encoder layers and aggregates them with a layer-aware attention mechanism, contrasting with a simple layer concatenation baseline. Across few-shot NER (CoNLL-03, WikiAnn) and MLM (WikiText-2), DWAtt and Concat improve data- and step-efficiency relative to a deeper baseline, with DWAtt outperforming Concat as data scale increases; for CoNLL-03, layer fusion yields F1 gains in the range $3.68 ightarrow 9.73\%$ across different few-shot sizes. The results support layer fusion as a practical, data-efficient strategy for adapting large pretrained models, with potential applicability to other tasks and architectures.
Abstract
Language Models pretrained on large textual data have been shown to encode different types of knowledge simultaneously. Traditionally, only the features from the last layer are used when adapting to new tasks or data. We put forward that, when using or finetuning deep pretrained models, intermediate layer features that may be relevant to the downstream task are buried too deep to be used efficiently in terms of needed samples or steps. To test this, we propose a new layer fusion method: Depth-Wise Attention (DWAtt), to help re-surface signals from non-final layers. We compare DWAtt to a basic concatenation-based layer fusion method (Concat), and compare both to a deeper model baseline -- all kept within a similar parameter budget. Our findings show that DWAtt and Concat are more step- and sample-efficient than the baseline, especially in the few-shot setting. DWAtt outperforms Concat on larger data sizes. On CoNLL-03 NER, layer fusion shows 3.68--9.73% F1 gain at different few-shot sizes. The layer fusion models presented significantly outperform the baseline in various training scenarios with different data sizes, architectures, and training constraints.
