Papers › Linear Attention for Efficient Bidirectional Sequence Modeling

Linear Attention for Efficient Bidirectional Sequence Modeling

22 Feb 2025arXiv:2502.16249archive 2025-07-28

Arshia Afzal, Elias Abad Rocamora, Leyla Naz Candogan, Pol Puigdemont, Francesco Tonin, Yongtao Wu, Mahsa Shoaran, Volkan Cevher

Transformers with linear attention enable fast and parallel training. Moreover, they can be formulated as Recurrent Neural Networks (RNNs), for efficient linear-time inference. While extensively evaluated in causal sequence modeling, they have yet to be extended to the bidirectional setting. This work introduces the LION framework, establishing new theoretical foundations for linear transformers in bidirectional sequence modeling. LION constructs a bidirectional RNN equivalent to full Linear Attention. This extends the benefits of linear transformers: parallel training, and efficient inference, into the bidirectional setting. Using LION, we cast three linear transformers to their bidirectional form: LION-LIT, the bidirectional variant corresponding to (Katharopoulos et al., 2020); LION-D, extending RetNet (Sun et al., 2023); and LION-S, a linear transformer with a stable selective mask inspired by selectivity of SSMs (Dao & Gu, 2024). Replacing the attention block with LION (-LIT, -D, -S) achieves performance on bidirectional tasks that approaches that of Transformers and State-Space Models (SSMs), while delivering significant improvements in training speed. Our implementation is available in http://github.com/LIONS-EPFL/LION.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2502.16249")

Code

Syntology Ran 14 of 14 code samples harvested from 1 repository linked to this paper; 0 have no recorded run. Of those that ran: 3 ran · honoured contract; 5 ran · our draft was wrong; 5 ran · fixture could not drive it; 1 ran with no contract checked.

By repository: official repository: 14 samples from 1 repository, 14 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

lions-epfl/lion officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

14 samples harvested; 14 ran; 3 honoured the contract we drafted; 0 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

3ran · honoured contract
5ran · our draft was wrong
5ran · fixture could not drive it
1ran

Licence: 14 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from lions-epfl/lion. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Casual_Mask_Decay_Partial lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · our draft was wrong fingerprinted licence not identified · pointer only · 173c2a794682a779 · report
Casual_Mask_Selective_Partial lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · fixture could not drive it licence not identified · pointer only · 74d6e1e65a29b46c · report
Causal_Mask_Decay lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · our draft was wrong fingerprinted licence not identified · pointer only · b7d6d1185456f649 · report
Causal_Mask_Selective lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · fixture could not drive it fingerprinted licence not identified · pointer only · ff5e874a04ef822f · report
Lion_Attention lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · metamorphic tier: deterministic licence not identified · pointer only · 0fd20524afba58d9 · report
compute_curve_order lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · fixture could not drive it licence not identified · pointer only · 96ac937123b116ca · report
coords_to_index lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · fixture could not drive it licence not identified · pointer only · 4ef8a90a9ec9a0f6 · report
create_matrix_from_tensor lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · honoured contract fingerprinted licence not identified · pointer only · 233f32ffc1bfedb1 · report
create_matrix_from_tensor_backward lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · our draft was wrong fingerprinted licence not identified · pointer only · 2c6f64b164f56782 · report
create_matrix_from_tensor_forward lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · our draft was wrong fingerprinted licence not identified · pointer only · 663e12d457f7ff82 · report
elu_shifted lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · honoured contract fingerprinted licence not identified · pointer only · 90399293d39e23ac · report
index_to_coords_indexes lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · our draft was wrong licence not identified · pointer only · 882f6b4910fe627d · report
s_curve lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · honoured contract licence not identified · pointer only · 5745d11adac3446b · report
silu_shifted lions-epfl/lion/img_classification/lion/models_lion.py official repository ran · fixture could not drive it fingerprinted licence not identified · pointer only · 19c5151cad5ba8a1 · report

Tasks

State Space Models

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionLionSoftmax

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections