Theoretical Analysis of Positional Encodings in Transformer Models: Impact on Expressiveness and Generalization

Fuente: arXiv
Saved in:
Bibliographic Details
Main Author: Li, Yin
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916782707572736
author Li, Yin
author_facet Li, Yin
contents Positional encodings are a core part of transformer-based models, enabling processing of sequential data without recurrence. This paper presents a theoretical framework to analyze how various positional encoding methods, including sinusoidal, learned, relative, and bias-based methods like Attention with Linear Biases (ALiBi), impact a transformer's expressiveness, generalization ability, and extrapolation to longer sequences. Expressiveness is defined via function approximation, generalization bounds are established using Rademacher complexity, and new encoding methods based on orthogonal functions, such as wavelets and Legendre polynomials, are proposed. The extrapolation capacity of existing and proposed encodings is analyzed, extending ALiBi's biasing approach to a unified theoretical context. Experimental evaluation on synthetic sequence-to-sequence tasks shows that orthogonal transform-based encodings outperform traditional sinusoidal encodings in generalization and extrapolation. This work addresses a critical gap in transformer theory, providing insights for design choices in natural language processing, computer vision, and other transformer applications.
format Preprint
id arxiv_https___arxiv_org_abs_2506_06398
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Theoretical Analysis of Positional Encodings in Transformer Models: Impact on Expressiveness and Generalization
Li, Yin
Machine Learning
Artificial Intelligence
68T07, 68Q32
I.2.6; I.2.7; F.1.1
Positional encodings are a core part of transformer-based models, enabling processing of sequential data without recurrence. This paper presents a theoretical framework to analyze how various positional encoding methods, including sinusoidal, learned, relative, and bias-based methods like Attention with Linear Biases (ALiBi), impact a transformer's expressiveness, generalization ability, and extrapolation to longer sequences. Expressiveness is defined via function approximation, generalization bounds are established using Rademacher complexity, and new encoding methods based on orthogonal functions, such as wavelets and Legendre polynomials, are proposed. The extrapolation capacity of existing and proposed encodings is analyzed, extending ALiBi's biasing approach to a unified theoretical context. Experimental evaluation on synthetic sequence-to-sequence tasks shows that orthogonal transform-based encodings outperform traditional sinusoidal encodings in generalization and extrapolation. This work addresses a critical gap in transformer theory, providing insights for design choices in natural language processing, computer vision, and other transformer applications.
title Theoretical Analysis of Positional Encodings in Transformer Models: Impact on Expressiveness and Generalization
topic Machine Learning
Artificial Intelligence
68T07, 68Q32
I.2.6; I.2.7; F.1.1
url https://arxiv.org/abs/2506.06398