SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2312.08874 · 2023

Agent Attention: On the Integration of Softmax and Linear Attention

arXiv · PDF · Open in the Atlas

Code that ran

13 of 19 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 10 failures of our instrument; 6 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2312.08874.json · badge: /api/ran/2312.08874.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
leaplabthu/agent-attention canonical (classifier label)
classifier basis: census
12 ran · 6 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
leaplabthu/agent-attention/agent_transformer/models/agent_swin.py
pointer only (licence: NONE) · get_code("144d10b49baeb8a6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build_optimizer Ran
ran; our contract draft was wrong, not the code
leaplabthu/agent-attention/agent_transformer/optimizer.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("fcf2d41dd445a70b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build_scheduler Ran
ran; our contract draft was wrong, not the code
leaplabthu/agent-attention/agent_transformer/lr_scheduler.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("07e8b4b487c0abb6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

check_keywords_in_name Ran
ran, violated the contract we drafted
leaplabthu/agent-attention/agent_transformer/optimizer.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("b0a5beb34716d5a6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

checkpoint_filter_fn Ran
ran; our contract draft was wrong, not the code
leaplabthu/agent-attention/agent_transformer/models/agent_deit.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("5dac11fdc41c896b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

count_parameters Ran
ran, honoured the contract we drafted
leaplabthu/agent-attention/agent_transformer/temp.py
pointer only (licence: NONE) · get_code("f6b944f50d3f15ae")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

create_logger Ran
ran; our contract draft was wrong, not the code
leaplabthu/agent-attention/agent_transformer/logger.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("82e52feafbf040bb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

exists Ran
ran, violated the contract we drafted
this paper's copy was not recorded; identical code first harvested from lucidrains/gradnorm-pytorch
pointer only · get_code("b7c3487f192e31b7")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

img2windows Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
leaplabthu/agent-attention/agent_transformer/models/agent_cswin.py
pointer only (licence: NONE) · get_code("39b18f062e0cc6d9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

resize_pos_embed Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
leaplabthu/agent-attention/agent_transformer/models/agent_deit.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("1dbef2d4da4ee10f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

set_weight_decay_and_lr Ran
ran; our contract draft was wrong, not the code
leaplabthu/agent-attention/agent_transformer/optimizer.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("104af48a94364f24")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

window_reverse Ran
ran; our contract draft was wrong, not the code
leaplabthu/agent-attention/agent_transformer/models/agent_swin.py
pointer only (licence: NONE) · get_code("61bf152e6a42a184")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

windows2img Ran
ran; our contract draft was wrong, not the code
leaplabthu/agent-attention/agent_transformer/models/agent_cswin.py
pointer only (licence: NONE) · get_code("ab01fbfe58c75b08")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Agent_CSWin_64_24181_tiny_224 Not yet run
unverified (harvested, no recorded run)
leaplabthu/agent-attention/agent_transformer/models/agent_cswin.py
pointer only (licence: NONE) · get_code("9ea67e130f91790b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

agent_pvt_medium Not yet run
unverified (harvested, no recorded run)
leaplabthu/agent-attention/agent_transformer/models/agent_pvt.py
pointer only (licence: NONE) · get_code("cde1668e5b186869")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

agent_pvt_small Not yet run
unverified (harvested, no recorded run)
leaplabthu/agent-attention/agent_transformer/models/agent_pvt.py
pointer only (licence: NONE) · get_code("941e08e41b939a56")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

agent_pvt_tiny Not yet run
unverified (harvested, no recorded run)
leaplabthu/agent-attention/agent_transformer/models/agent_pvt.py
pointer only (licence: NONE) · get_code("18fe6a56092254c6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

build_model Not yet run
unverified (harvested, no recorded run)
leaplabthu/agent-attention/agent_transformer/models/build.py
pointer only (licence: NONE) · get_code("11b1272f108e216a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_config Not yet run
unverified (harvested, no recorded run)
leaplabthu/agent-attention/agent_transformer/config.py
pointer only (licence: NONE); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("20681a9065c0a731")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, leaplabthu/agent-attention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 19 samples lifted from this paper's linked repositories, 19 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 14 are also present in other papers whose code we hold (14 with at least one paper dated earlier, 5 the same month, 14 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
window_reverse 227 other papers
130 dated earlier, 10 the same month, 78 later, 9 same year, order not determinable · 34 only as an assembly brick
1608.03983 (2016-08)
SGDR: Stochastic Gradient Descent with Warm Restarts
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 224 more not named here
window_partition 223 other papers
128 dated earlier, 10 the same month, 76 later, 9 same year, order not determinable · 32 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 220 more not named here
count_parameters 180 other papers
107 dated earlier, 2 the same month, 67 later, 4 same year, order not determinable · 8 only as an assembly brick
1705.08415 (2017-05)
Supervised Community Detection with Line Graph Neural Networks
1707.01926 (2017-07)
Diffusion Convolutional Recurrent Neural Network: Data-Driven Traffic Forecasting
1808.09367 (2018-08)
Deriving Machine Attention from Human Rationales
and 177 more not named here
get_config 51 other papers
21 dated earlier, 27 later, 3 same year, order not determinable
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2106.03650 (2021-06)
Shuffle Transformer: Rethinking Spatial Shuffle for Vision Transformer
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
and 48 more not named here
checkpoint_filter_fn 37 other papers
15 dated earlier, 1 the same month, 18 later, 3 same year, order not determinable · 1 only as an assembly brick
2105.12723 (2021-05)
Nested Hierarchical Transformer: Towards Accurate, Data-Efficient and Interpretable Visual Understanding
2112.07658 (2021-12)
AdaViT: Adaptive Tokens for Efficient Vision Transformer
and 34 more not named here
check_keywords_in_name 31 other papers
16 dated earlier, 14 later, 1 same year, order not determinable
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2106.03650 (2021-06)
Shuffle Transformer: Rethinking Spatial Shuffle for Vision Transformer
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
and 28 more not named here
exists 27 other papers
8 dated earlier, 19 later · 3 only as an assembly brick
1810.00825 (2018-10)
Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks
2006.15055 (2020-06)
Object-Centric Learning with Slot Attention
2010.10241 (2020-10)
BYOL works even without batch statistics
and 24 more not named here
img2windows 14 other papers
6 dated earlier, 8 later · 1 only as an assembly brick
2107.00652 (2021-07)
CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
2208.08630 (2022-08)
Unifying Visual Perception by Dispersible Points Learning
2211.13654 (2022-11)
Cross Aggregation Transformer for Image Restoration
and 11 more not named here
resize_pos_embed 14 other papers
10 dated earlier, 1 the same month, 3 later
2112.07658 (2021-12)
AdaViT: Adaptive Tokens for Efficient Vision Transformer
2203.05962 (2022-03)
Anti-Oversmoothing in Deep Vision Transformers via the Fourier Domain Analysis: From Theory to Practice
2203.12614 (2022-03)
Unsupervised Salient Object Detection with Spectral Cluster Voting
and 11 more not named here
windows2img 14 other papers
6 dated earlier, 8 later · 1 only as an assembly brick
2107.00652 (2021-07)
CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
2208.08630 (2022-08)
Unifying Visual Perception by Dispersible Points Learning
2211.13654 (2022-11)
Cross Aggregation Transformer for Image Restoration
and 11 more not named here
build_scheduler 13 other papers
4 dated earlier, 9 later
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2307.06947 (2023-07)
Video-FocalNets: Spatio-Temporal Focal Modulation for Video Action Recognition
2309.01430 (2023-09)
DAT++: Spatially Dynamic Vision Transformer with Deformable Attention
and 10 more not named here
create_logger 5 other papers
1 dated earlier, 4 later
2309.01430 (2023-09)
DAT++: Spatially Dynamic Vision Transformer with Deformable Attention
00666 (2024 (year only))
AttnZero: Efficient Attention Discovery for Vision Transformers
2405.11582 (2024-05)
SLAB: Efficient Transformers with Simplified Linear Attention and Progressive Re-parameterized Batch Normalization
and 2 more not named here
build_optimizer 4 other papers
1 dated earlier, 3 later
2309.01430 (2023-09)
DAT++: Spatially Dynamic Vision Transformer with Deformable Attention
00666 (2024 (year only))
AttnZero: Efficient Attention Discovery for Vision Transformers
2412.06590 (2024-12)
Bridging the Divide: Reconsidering Softmax and Linear Attention
and 1 more not named here
set_weight_decay_and_lr 4 other papers
1 dated earlier, 3 later
2309.01430 (2023-09)
DAT++: Spatially Dynamic Vision Transformer with Deformable Attention
00666 (2024 (year only))
AttnZero: Efficient Attention Discovery for Vision Transformers
2412.06590 (2024-12)
Bridging the Divide: Reconsidering Softmax and Linear Attention
and 1 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The attention module is the key component in Transformers. While the global attention mechanism offers high expressiveness, its excessive computational cost restricts its applicability in various scenarios. In this paper, we propose a novel attention paradigm, Agent Attention, to strike a favorable balance between computational efficiency and representation power. Specifically, the Agent Attention, denoted as a quadruple $(Q, A, K, V)$, introduces an additional set of agent tokens $A$ into the conventional attention module. The agent tokens first act as the agent for the query tokens $Q$ to aggregate information from $K$ and $V$, and then broadcast the information back to $Q$. Given the number of agent tokens can be designed to be much smaller than the number of query tokens, the agent attention is significantly more efficient than the widely adopted Softmax attention, while preserving global context modelling capability. Interestingly, we show that the proposed agent attention is equivalent to a generalized form of linear attention. Therefore, agent attention seamlessly integrates the powerful Softmax attention and the highly efficient linear attention. Extensive experiments demonstrate the effectiveness of agent attention with various vision Transformers and across diverse vision tasks, including image classification, object detection, semantic segmentation and image generation. Notably, agent attention has shown remarkable performance in high-resolution scenarios, owning to its linear attention nature. For instance, when applied to Stable Diffusion, our agent attention accelerates generation and substantially enhances image generation quality without any additional training. Code is available at https://github.com/LeapLabTHU/Agent-Attention.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2312.08874")
get_code_for_paper("2312.08874")
have("2312.08874")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2312.08874.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2312.08874.svg)](https://syntology.ai/paper/2312.08874)

Connect an agent — have() is free.