NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

The Locality and Symmetry of Positional Encodings

Lihu Chen, Gaël Varoquaux, Fabian M. Suchanek

Introduction

Standard Transformer architectures are inherently permutation-invariant, treating input sequences as unordered sets of tokens. To process natural language effectively, these models rely on Positional Encodings (PEs) to inject information about word order. While PEs are critical for performance, the specific geometric properties they learn—and why those properties are effective—have remained largely opaque. This research investigates the underlying mechanisms of PEs in BERT-style models, identifying two dominant characteristics: Locality and Symmetry.

Quantifying Positional Properties

To move beyond qualitative visualizations of "diagonal-heavy" attention matrices, this study introduces two quantitative metrics to characterize the behavior of PEs:

  1. Locality: This metric measures the degree to which an attentional weight vector concentrates on immediate neighbors of a target token.
  2. Symmetry: This measures the similarity in how a model treats tokens to the left (preceding) versus tokens to the right (succeeding) of a target token.

To isolate these properties from the influence of word semantics, the authors utilize Identical Word Probing. By feeding the model sequences consisting of the same repeated word, they can observe the "pure" behavior of the PE. Furthermore, they developed Attenuated Encodings—parameterized PEs that allow researchers to manually adjust the levels of locality and symmetry to observe their direct impact on model performance.

The Role of Locality in Syntax

The research finds that locality serves as a vital inductive bias for learning syntax. Models use local attention to compose adjacent units, such as merging sub-tokens into words or words into local phrases. Probing experiments reveal a clear division of labor: positional information dominates short-distance dependencies (typically 1–4 words), whereas contextual semantic information becomes the primary driver for long-distance relationships.

To test whether these properties are essential or merely incidental, the authors introduced BERT-A, a model initialized with handcrafted locality and symmetry properties rather than random weights. BERT-A outperformed the original BERT by an average of 3.1 percentage points across 10 downstream tasks in the GLUE benchmark, suggesting that these geometric properties are indeed the "correct" inductive bias for natural language processing.

The Symmetry Paradox and Semantic Blindness

While locality is a clear benefit, the study uncovers a significant drawback to the Symmetry found in most PEs (including learned encodings and designed ones like RoPE or ALiBi). Because these encodings treat forward and backward context almost identically, the models develop a "semantic role" blindness.

In natural language, the order of words often determines the agent (the doer) and the patient (the receiver). A symmetrical PE treats "A before B" similarly to "B before A," making it difficult for the model to distinguish between sentences like "man bites dog" and "dog bites man."

To quantify this, the authors designed the Semantic Role Shuffling (Shuffle-SR) task. When the agent and patient in a sentence were swapped (e.g., "several women are playing volleyball" becoming "volleyball are playing several women"), the accuracy of state-of-the-art models like DeBERTa and XLNet collapsed, with performance drops ranging from 44% to 66%. Interestingly, these same models remained robust to Constituency Shuffling (swapping words within a small local phrase), with accuracy dipping by less than 1.5%. This confirms that while models are excellent at capturing local "blobs" of meaning, they struggle with the global directional logic required for precise semantic role labeling.

Conclusion and Future Directions

This research demonstrates that the success of current Transformer models relies heavily on the inductive biases of locality and symmetry. However, the inherent symmetry of modern PEs represents a fundamental limitation in understanding directional semantics.

While the study focused on bidirectional Masked Language Models (MLMs) and English-centric datasets, the implications are broad. Future architectural improvements may require the development of asymmetric positional encodings—mechanisms that preserve the syntactic benefits of locality while providing the directional sensitivity needed to resolve agent-patient confusion and other high-level semantic roles.

Summary updated

BibTeX
@inproceedings{chen2023locality,
  author = {Lihu Chen and Gaël Varoquaux and Fabian M. Suchanek},
  title = {{The Locality and Symmetry of Positional Encodings}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.955},
}
Figure