DA-Transformer: Distance-aware Transformer
Not on the map. Why?
Abstract (arXiv)
Transformer has achieved great success in the NLP field by composing various advanced models like BERT and GPT. However, Transformer and its existing variants may not be optimal in capturing token distances because the position or distance embeddings used by these methods usually cannot keep the precise information of real distances, which may not be beneficial for modeling the orders and relations of contexts. In this paper, we propose DA-Transformer, which is a distance-aware Transformer that can exploit the real distance. We propose to incorporate the real distances between tokens to re-scale the raw self-attention weights, which are computed by the relevance between attention query and key. Concretely, in different self-attention heads the relative distance between each pair of tokens is weighted by different learnable parameters, which control the different preferences on long- or short-term information of these heads. Since the raw weighted real distances may not be optimal for adjusting self-attention weights, we propose a learnable sigmoid function to map them into re-scaled coefficients that have proper ranges. We first clip the raw self-attention weights via the ReLU function to keep non-negativity and introduce sparsity, and then multiply them with the re-scaled coefficients to encode real distance information into self-attention. Extensive experiments on five benchmark datasets show that DA-Transformer can effectively improve the performance of many tasks and outperform the vanilla Transformer and its several variants.
Key facts. Cited by 23 papers in the map (data through 7 Oct 2026). First posted on arXiv 14 Oct 2020.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 6; 2022: 5; 2023: 6; 2024: 2; 2025: 4.
23 papers.
Sort:
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2021Position Information in Transformers: An Overviewcited by 103
- 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 84
- 2021SHAPE: Shifted Absolute Position Embedding for Transformerscited by 37
- 2021Hi-Transformer: Hierarchical Interactive Transformer for Efficient and Effective Long Document Modelingcited by 35
- 2022Transformer-based Entity Typing in Knowledge Graphscited by 13
- 2023Towards Real-Time Panoptic Narrative Grounding by an End-to-End Grounding Networkcited by 13
- 2023Monotonic Location Attention for Length Generalizationcited by 9
- 2023Algebraic Positional Encodingscited by 9
- 2022Time-distance vision transformers in lung cancer diagnosis from longitudinal computed tomographycited by 8
- 2023Longitudinal Multimodal Transformer Integrating Imaging and Latent Clinical Signatures From Routine EHRs for Pulmonary Nodule Classificationcited by 8
- 2021Less is More: Pre-train a Strong Text Encoder for Dense Retrieval Using a Weak Decodercited by 7
11 more
- 2024Quantformer: from attention to profit with a quantitative transformer trading strategycited by 6
- 2024Reference Neural Operators: Learning the Smooth Dependence of Solutions of PDEs on Geometric Deformationscited by 5
- 2025Group Representational Position Encodingcited by 5
- 2021CycleTransGAN-EVC: A CycleGAN-based Emotional Voice Conversion Model with Transformercited by 4
- 2023LEA: Improving Sentence Similarity Robustness to Typos Using Lexical Attention Biascited by 2
- 2022DecBERT: Enhancing the Language Understanding of BERT with Causal Attention Maskscited by 1
- 2023Enhancing Multivariate Time Series Classifiers through Self-Attention and Relative Positioning Infusioncited by 1
- 2025PIPE: Physics-Informed Position Encoding for Alignment of Satellite Images and Time Seriescited by 1
- 2022User recommendation system based on MIND datasetcited by 0
- 2025TAU: Modeling Temporal Consistency Through Temporal Attentive U-Net for PPG Peak Detectioncited by 0
- 2025Spatially-informed transformers: Injecting geostatistical covariance biases into self-attention for spatio-temporal forecastingcited by 0
- 2025Spatially-informed transformers: Injecting geostatistical covariance biases into self-attention for spatio-temporal forecasting19 Dec 2025
- 2025Group Representational Position Encoding8 Dec 2025
- 2025PIPE: Physics-Informed Position Encoding for Alignment of Satellite Images and Time Series27 May 2025
- 2025TAU: Modeling Temporal Consistency Through Temporal Attentive U-Net for PPG Peak Detection13 Mar 2025
- 2024Reference Neural Operators: Learning the Smooth Dependence of Solutions of PDEs on Geometric Deformations27 May 2024
- 2024Quantformer: from attention to profit with a quantitative transformer trading strategy30 Mar 2024
- 2023Algebraic Positional Encodings26 Dec 2023
- 2023LEA: Improving Sentence Similarity Robustness to Typos Using Lexical Attention Bias6 Jul 2023
- 2023Monotonic Location Attention for Length Generalization31 May 2023
- 2023Longitudinal Multimodal Transformer Integrating Imaging and Latent Clinical Signatures From Routine EHRs for Pulmonary Nodule Classification6 Apr 2023
- 2023Enhancing Multivariate Time Series Classifiers through Self-Attention and Relative Positioning Infusion13 Feb 2023
- 2023Towards Real-Time Panoptic Narrative Grounding by an End-to-End Grounding Network9 Jan 2023
11 more
- 2022Transformer-based Entity Typing in Knowledge Graphs20 Oct 2022
- 2022User recommendation system based on MIND dataset6 Sep 2022
- 2022Time-distance vision transformers in lung cancer diagnosis from longitudinal computed tomography4 Sep 2022
- 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolation20 May 2022
- 2022DecBERT: Enhancing the Language Understanding of BERT with Causal Attention Masks19 Apr 2022
- 2021CycleTransGAN-EVC: A CycleGAN-based Emotional Voice Conversion Model with Transformer30 Nov 2021
- 2021SHAPE: Shifted Absolute Position Embedding for Transformers13 Sep 2021
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation27 Aug 2021
- 2021Hi-Transformer: Hierarchical Interactive Transformer for Efficient and Effective Long Document Modeling2 Jun 2021
- 2021Position Information in Transformers: An Overview22 Feb 2021
- 2021Less is More: Pre-train a Strong Text Encoder for Dense Retrieval Using a Weak Decoder18 Feb 2021
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2021Position Information in Transformers: An Overviewcited by 103
- 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 84
- 2021SHAPE: Shifted Absolute Position Embedding for Transformerscited by 37
- 2021Hi-Transformer: Hierarchical Interactive Transformer for Efficient and Effective Long Document Modelingcited by 35
- 2022Transformer-based Entity Typing in Knowledge Graphscited by 13
- 2023Towards Real-Time Panoptic Narrative Grounding by an End-to-End Grounding Networkcited by 13
- 2023Monotonic Location Attention for Length Generalizationcited by 9
- 2023Algebraic Positional Encodingscited by 9
- 2022Time-distance vision transformers in lung cancer diagnosis from longitudinal computed tomographycited by 8
- 2023Longitudinal Multimodal Transformer Integrating Imaging and Latent Clinical Signatures From Routine EHRs for Pulmonary Nodule Classificationcited by 8
- 2021Less is More: Pre-train a Strong Text Encoder for Dense Retrieval Using a Weak Decodercited by 7
12 most cited of 23 All 23 (JSON)
- 2025Spatially-informed transformers: Injecting geostatistical covariance biases into self-attention for spatio-temporal forecasting19 Dec 2025
- 2025Group Representational Position Encoding8 Dec 2025
- 2025PIPE: Physics-Informed Position Encoding for Alignment of Satellite Images and Time Series27 May 2025
- 2025TAU: Modeling Temporal Consistency Through Temporal Attentive U-Net for PPG Peak Detection13 Mar 2025
- 2024Reference Neural Operators: Learning the Smooth Dependence of Solutions of PDEs on Geometric Deformations27 May 2024
- 2024Quantformer: from attention to profit with a quantitative transformer trading strategy30 Mar 2024
- 2023Algebraic Positional Encodings26 Dec 2023
- 2023LEA: Improving Sentence Similarity Robustness to Typos Using Lexical Attention Bias6 Jul 2023
- 2023Monotonic Location Attention for Length Generalization31 May 2023
- 2023Longitudinal Multimodal Transformer Integrating Imaging and Latent Clinical Signatures From Routine EHRs for Pulmonary Nodule Classification6 Apr 2023
- 2023Enhancing Multivariate Time Series Classifiers through Self-Attention and Relative Positioning Infusion13 Feb 2023
- 2023Towards Real-Time Panoptic Narrative Grounding by an End-to-End Grounding Network9 Jan 2023
12 newest of 23 All 23 (JSON)