SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.07368 · ICML · 2024

When Linear Attention Meets Autoregressive Decoding: Towards More Effective and Efficient Linearized Large Language Models

Amir Yazdanbakhsh, Haoran You, Zheng Wang, Celine Lin, Yichao Fu, Decoder En-De

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 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; 4 failures of our instrument; 4 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-22; 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/2406.07368.json · badge: /api/ran/2406.07368.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
gatech-eic/linearized-llm canonical (classifier label)
classifier basis: classifier_2025
6 ran · 4 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
padding_to_multiple_of Ran
ran, honoured the contract we drafted
gatech-eic/linearized-llm/flash_pytorch.py
code served (permissive licence) · get_code("5f4fdf97a20b1819")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T00:03:08Z). If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - padding_to_multiple_of(n, mult)
# - n: an integer (the number to pad)
# - mult: an integer (the multiple to pad to)
# - Uses: n % mult, mult - remainder
# - Returns: integer (padding amount)

ARGS = {
    "n": 10,
    "mult": 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_global_linear_attn_causal Ran
ran; our contract draft was wrong, not the code
gatech-eic/linearized-llm/experiments/llama_attn_replace.py
code served (permissive licence) · get_code("5a9b970426ac2f96")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 25, 7) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import einops

torch.manual_seed(0)

# Analyze the function signature and body:
# - q, k, v: tensors used in einsum operations with shape pattern 'bhgcs', 'bhgce', 'bhgse'
# - q_res, k_res, v_res: tensors used in einsum and size() calls
# - The function performs attention-like operations with cumulative sums

# From the einsum patterns and operations:
# q: shape (b, h, g, c, s) - batch, head, group, channel, sequence
# k: shape (b, h, g, c, s) - same structure
# v: shape (b, h, g, c, e) - batch, head, group, channel, embedding
# q_res: shape (b, h, c, s) - batch, head, channel, sequence (no group dim)
# k_res, v_res: similar structure to q_res
# kv1 will have shape (b, h, g, s, e)

b, h, g, c, s, e = 2, 3, 4, 5, 6, 7

# Create q, k, v with group dimension
q = torch.randn(b, h, g, c, s)
k = torch.randn(b, h, g, c, s)
v = torch.randn(b, h, g, c, e)

# Create q_res, k_res, v_res without group dimension
q_res = torch.randn(b, h, c, s)
k_res = torch.randn(b, h, c, s)
v_res = torch.randn(b, h, c, e)

ARGS = {
    'q': q,
    'k': k,
    'v': v,
    'q_res': q_res,
    'k_res': k_res,
    'v_res': v_res,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 25, 7) — shape (2, 3, 25, 7) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_global_linear_attn_p Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gatech-eic/linearized-llm/experiments/llama_attn_replace.py
code served (permissive licence) · get_code("288bee86546fbf67")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 5, dtype family float, shape (2, 3, 4, 5, 7) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct tiny tensors for the function
# The function uses einsum with dimensions: b, h, g, c, s, e
# q, k, v have shape (b, h, g, c, s) or (b, h, g, c, e) based on einsum patterns
# Let's use:
# b=2 (batch), h=3 (heads), g=4 (groups), c=5 (channels), s=6 (sequence), e=7 (embedding)

batch = 2
heads = 3
groups = 4
channels = 5
seq_len = 6
embed_dim = 7

q = torch.randn(batch, heads, groups, channels, seq_len)
k = torch.randn(batch, heads, groups, channels, seq_len)
v = torch.randn(batch, heads, groups, channels, embed_dim)

causal = True

ARGS = {
    "q": q,
    "k": k,
    "v": v,
    "causal": causal,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 5, dtype family float, shape (2, 3, 4, 5, 7) — shape (2, 3, 4, 5, 7) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
default Ran
ran, violated the contract we drafted
this paper's copy was not recorded; identical code first harvested from ThomasMrY/VCT
pointer only; the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("60fff7c3c400d7ff")
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.

eval_decorator Ran
ran; our contract draft was wrong, not the code
gatech-eic/linearized-llm/autoregressive_wrapper.py
code served (permissive licence) · get_code("2107ce5c9a769398")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

# Create a simple model that has training state
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create a simple function to decorate
def dummy_forward(model, x):
    return model(x)

# Create model instance
model = SimpleModel()
model.train()  # Set to training mode initially

# Create dummy input
x = torch.randn(2, 4)

# Define ARGS - eval_decorator takes fn as parameter
ARGS = {
    'fn': dummy_forward
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
exists Ran
ran, violated the contract we drafted
gatech-eic/linearized-llm/autoregressive_wrapper.py
code served (permissive licence) · get_code("b767065fd213438a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

def exists(val):
    return val is not None

# The function 'exists' takes a single parameter 'val' and checks if it is not None
# We need to provide a value for 'val'

# Test with a simple value
val = 42

ARGS = {
    "val": val
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
top_k Ran
ran; our contract draft was wrong, not the code
gatech-eic/linearized-llm/autoregressive_wrapper.py
code served (permissive licence) · get_code("5d77a7df8b8103e4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create a small logits tensor
# Shape: (batch_size=2, num_classes=4)
logits = torch.randn(2, 4)

# Define threshold parameter
thres = 0.9

# Construct ARGS dictionary
ARGS = {
    'logits': logits,
    'thres': thres
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_local_quadratic_attn_p Not yet run
unverified (harvested, no recorded run)
gatech-eic/linearized-llm/experiments/llama_attn_replace.py
code served (permissive licence) · get_code("bef480ba7a34dcdd")
How it ran

no invocation recorded.

_local_quadratic_attn_p_g1 Not yet run
unverified (harvested, no recorded run)
gatech-eic/linearized-llm/experiments/llama_attn_replace.py
code served (permissive licence) · get_code("d65e3eb5da171762")
How it ran

no invocation recorded.

linear_forward_noflashattn Not yet run
unverified (harvested, no recorded run)
gatech-eic/linearized-llm/experiments/llama_attn_replace.py
code served (permissive licence) · get_code("682226da161991da")
How it ran

no invocation recorded.

yoso_pointwise Not yet run
unverified (harvested, no recorded run)
gatech-eic/linearized-llm/experiments/llama_attn_replace.py
code served (permissive licence) · get_code("6e35e1c26b0f21f6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 4 the same month, 2 later) and 6 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
exists 486 other papers
348 dated earlier, 13 the same month, 114 later, 9 same year, order not determinable, 2 undated · 78 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
1804.04637 (2018-04)
EMBER: An Open Dataset for Training Static PE Malware Machine Learning Models
and 483 more not named here
default 163 other papers
128 dated earlier, 5 the same month, 27 later, 2 same year, order not determinable, 1 undated · 27 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1810.00825 (2018-10)
Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks
1907.01470 (2019-07)
Augmenting Self-attention with Persistent Memory
and 160 more not named here
eval_decorator 11 other papers
10 dated earlier, 1 the same month
1907.05242 (2019-07)
Large Memory Layers with Product Keys
2107.11906 (2021-07)
H-Transformer-1D: Fast One-Dimensional Hierarchical Attention for Sequences
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
and 8 more not named here
top_k 6 other papers
5 dated earlier, 1 the same month
1812.01243 (2018-12)
Efficient Attention: Attention with Linear Complexities
2006.15020 (2020-06)
Pre-training via Paraphrasing
2107.11906 (2021-07)
H-Transformer-1D: Fast One-Dimensional Hierarchical Attention for Sequences
and 3 more not named here
padding_to_multiple_of 2 other papers
2 dated earlier
2109.08668 (2021-09)
Primer: Searching for Efficient Transformers for Language Modeling
2312.11825 (2023-12)
MossFormer2: Combining Transformer and RNN-Free Recurrent Network for Enhanced Time-Domain Monaural Speech Separation

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-22.

Repositories linked to this paper

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

Abstract

Autoregressive Large Language Models (LLMs) have achieved impressive performance in language tasks but face two significant bottlenecks: (1) quadratic complexity in the attention module as the number of tokens increases, and (2) limited efficiency due to the sequential processing nature of autoregressive LLMs during generation. While linear attention and speculative decoding offer potential solutions, their applicability and synergistic potential for enhancing autoregressive LLMs remain uncertain. We conduct the first comprehensive study on the efficacy of existing linear attention methods for autoregressive LLMs, integrating them with speculative decoding. We introduce an augmentation technique for linear attention that ensures compatibility with speculative decoding, enabling more efficient training and serving of LLMs. Extensive experiments and ablation studies involving seven existing linear attention models and five encoder/decoder-based LLMs consistently validate the effectiveness of our augmented linearized LLMs. Notably, our approach achieves up to a 6.67 reduction in perplexity on the LLaMA model and up to a 2× speedup during generation compared to prior linear attention methods. Codes and models are available at https://github. com/GATECH-EIC/Linearized-LLM.

For agents

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

get_harvested_code_for_paper("2406.07368")
get_code_for_paper("2406.07368")
have("2406.07368")

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

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

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

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

Connect an agent — have() is free.