Contextual priority attention enables linear time sequence modeling in transformers

The quadratic computational complexity of the self-attention mechanism in Transformer models severely constrains their applicability to long sequence inputs. We propose Contextual Priority Attention (CPA), a novel attention mechanism that reduces computational complexity from [Formula: see text] to [Formula: see text] theoretically, with experimentally observed linear scaling, while preserving the essential contextual modeling capabilities of traditional attention. Unlike existing efficient attention variants that approximate the full attention matrix, CPA fundamentally reimagines attention as a global-context-driven priority system. Our approach first computes a Global Context Vector (GCV) to capture the overall sequence information, then uses this context to assign priority scores to individual tokens, enabling sparse attention allocation. In encoder-decoder architectures, we apply CPA to the encoder while maintaining standard attention in the decoder, achieving substantial efficiency improvements while preserving full model expressivity for sequence-to-sequence tasks. Through theoretical analysis and extensive experimentation across language understanding, translation, and long document tasks, we demonstrate that CPA achieves comparable performance to standard self-attention while offering significant efficiency gains. On long-sequence benchmarks (8K+ tokens), CPA outperforms traditional Transformers and state-of-the-art efficient attention variants while using substantially fewer computational resources. Our findings suggest that pairwise token interactions may be unnecessary for effective contextual modeling, opening new avenues for efficient large-scale language models.

Authors

Institutions

Publication Details

Journal
Scientific Reports
Published
2025-12-17
DOI
https://doi.org/10.1038/s41598-025-32639-x
Primary Topic
Topic Modeling
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Contextual priority attention enables linear time sequence modeling in transformers

Davy Monticolo, K. Khaled
Scientific Reports
Topic Modeling
article

Contextual priority attention enables linear time sequence modeling in transformers

Davy Monticolo, K. Khaled
article en

Abstract

The quadratic computational complexity of the self-attention mechanism in Transformer models severely constrains their applicability to long sequence inputs. We propose Contextual Priority Attention (CPA), a novel attention mechanism that reduces computational complexity from [Formula: see text] to [Formula: see text] theoretically, with experimentally observed linear scaling, while preserving the essential contextual modeling capabilities of traditional attention. Unlike existing efficient attention variants that approximate the full attention matrix, CPA fundamentally reimagines attention as a global-context-driven priority system. Our approach first computes a Global Context Vector (GCV) to capture the overall sequence information, then uses this context to assign priority scores to individual tokens, enabling sparse attention allocation. In encoder-decoder architectures, we apply CPA to the encoder while maintaining standard attention in the decoder, achieving substantial efficiency improvements while preserving full model expressivity for sequence-to-sequence tasks. Through theoretical analysis and extensive experimentation across language understanding, translation, and long document tasks, we demonstrate that CPA achieves comparable performance to standard self-attention while offering significant efficiency gains. On long-sequence benchmarks (8K+ tokens), CPA outperforms traditional Transformers and state-of-the-art efficient attention variants while using substantially fewer computational resources. Our findings suggest that pairwise token interactions may be unnecessary for effective contextual modeling, opening new avenues for efficient large-scale language models.

Scientific ReportsVol. 16(1)
Imagerie Adaptative Diagnostique et Interventionnelle (FR), Équipe de Recherche sur les Processus Innovatifs, Université de Lorraine (FR)
Openalex Percentile: Top 78%
Topic Modeling
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.