Rethinking Positional Encoding in Language Pre-training
arXiv:2006.15595
Abstract
In this work, we investigate the positional encoding methods used in language pre-training (e.g., BERT) and identify several problems in the existing formulations. First, we show that in the absolute positional encoding, the addition operation applied on positional embeddings and word embeddings brings mixed correlations between the two heterogeneous information resources. It may bring unnecessary randomness in the attention and further limit the expressiveness of the model. Second, we question whether treating the position of the symbol \texttt{[CLS]} the same as other words is a reasonable design, considering its special role (the representation of the entire sentence) in the downstream tasks. Motivated from above analysis, we propose a new positional encoding method called \textbf{T}ransformer with \textbf{U}ntied \textbf{P}ositional \textbf{E}ncoding (TUPE). In the self-attention module, TUPE computes the word contextual correlation and positional correlation separately with different parameterizations and then adds them together. This design removes the mixed and noisy correlations over heterogeneous embeddings and offers more expressiveness by using different projection matrices. Furthermore, TUPE unties the \texttt{[CLS]} symbol from other positions, making it easier to capture information from all positions. Extensive experiments and ablation studies on GLUE benchmark demonstrate the effectiveness of the proposed method. Codes and models are released at https://github.com/guolinke/TUPE.
arXiv commentupdate to ICLR's version
References in corpus (11)
- Distributed Representations of Words and Phrases and their Compositionality
- Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
- XLNet: Generalized Autoregressive Pretraining for Language Understanding
- Mixed Precision Training
- DeBERTa: Decoding-enhanced BERT with Disentangled Attention
- Aligning Books and Movies: Towards Story-like Visual Explanations by Watching Movies and Reading Books
- UniLMv2: Pseudo-Masked Language Models for Unified Language Model Pre-Training
- fairseq: A Fast, Extensible Toolkit for Sequence Modeling
- Encoding word order in complex embeddings
- Constituency Parsing with a Self-Attentive Encoder
- Learning to Encode Position for Transformer with Continuous Dynamical Model
Cited by in corpus (20)
- RoFormer: Enhanced Transformer with Rotary Position Embedding
- Swin Transformer V2: Scaling Up Capacity and Resolution
- SpectralFormer: Rethinking Hyperspectral Image Classification with Transformers
- Investigating the Limitations of Transformers with Simple Arithmetic Tasks
- Rethinking Positional Encoding
- Compound Word Transformer: Learning to Compose Full-Song Music over Dynamic Directed Hypergraphs
- Relative Positional Encoding for Transformers with Linear Complexity
- LANA: Towards Personalized Deep Knowledge Tracing Through Distinguishable Interactive Sequences
- Towards Robust Vision Transformer
- Are queries and keys always relevant? A case study on Transformer wave functions
- ERNIE-Gram: Pre-Training with Explicitly N-Gram Masked Language Modeling for Natural Language Understanding
- CAPE: Encoding Relative Positions with Continuous Augmented Positional Embeddings
- Lattice-BERT: Leveraging Multi-Granularity Representations in Chinese Pre-trained Language Models
- A Simple and Effective Positional Encoding for Transformers
- Revisiting Language Encoding in Learning Multilingual Representations
- Shatter: An Efficient Transformer Encoder with Single-Headed Self-Attention and Relative Sequence Partitioning
- Multiplicative Position-aware Transformer Models for Language Understanding
- Positional Artefacts Propagate Through Masked Language Model Embeddings
- How could Neural Networks understand Programs?
- Less is More: Pre-train a Strong Text Encoder for Dense Retrieval Using a Weak Decoder