SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.04798 · 2024

DAPE V2: Process Attention Score as Feature Map for Length Extrapolation

arXiv · PDF · Open in the Atlas

Code that ran

7 of 10 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, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 3 no recorded run), 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/2410.04798.json · badge: /api/ran/2410.04798.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
chuanyang-zheng/cape canonical (classifier label)
classifier basis: census
7 ran · 3 no recorded run
FunctionStatusWhere it lives
bias_gelu Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
chuanyang-zheng/cape/megatron/model/activations.py
code served (permissive licence) · get_code("eb7511606bf2a37e")
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 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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)

# bias_gelu takes two tensor arguments: bias and y
# Both are added together and passed through a GELU approximation
# They should be broadcastable tensors

bias = torch.randn(2, 4)
y = torch.randn(2, 4)

ARGS = {
    "bias": bias,
    "y": y,
}
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 2, dtype family float — no output shape is stated: observe_signature.py could not observe it (import:OSError)
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
bias_gelu_back Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
chuanyang-zheng/cape/megatron/model/activations.py
code served (permissive licence) · get_code("5dc15a21043ef7e3")
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 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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)

# The function bias_gelu_back takes three tensor arguments: g, bias, and y
# It performs element-wise operations on them
# g is the gradient tensor
# bias is a bias tensor
# y is an input tensor
# All should be floats that support tanh, multiplication, and addition

g = torch.randn(2, 4, dtype=torch.float32)
bias = torch.randn(2, 4, dtype=torch.float32)
y = torch.randn(2, 4, dtype=torch.float32)

ARGS = {
    "g": g,
    "bias": bias,
    "y": y,
}
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 2, dtype family float — no output shape is stated: observe_signature.py could not observe it (import:OSError)
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
get_checkpoint_tag Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/cape/megatron/checkpointing.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ningding-o/MemoryFormer, is pointer only (licence: NONE) · get_code("69002400aad5a8a6")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ningding-o/MemoryFormer, and GitHub detected no licence in that repository 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.

get_flops Ran
ran, honoured the contract we drafted
chuanyang-zheng/cape/megatron/logging.py
code served (permissive licence) · get_code("6464b20466536553")
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 float, 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
import math

# Initialize torch for reproducibility
torch.manual_seed(0)

# Mock the distributed module to avoid needing actual distributed setup
class MockDistributed:
    @staticmethod
    def get_world_size():
        return 1

torch.distributed.get_world_size = MockDistributed.get_world_size

# Create a minimal config object with all required attributes
class NeoxArgs:
    def __init__(self):
        self.padded_vocab_size = 50257
        self.train_batch_size = 2
        self.seq_length = 512
        self.hidden_size = 768
        self.num_layers = 12
        self.checkpoint_activations = True
        self.attention_config = ['local']  # not rwkv or mamba
        self.num_attention_heads = 12
        self.expansion_factor = None
        self.intermediate_size = None

neox_args = NeoxArgs()
iter_time_s = 1.5

ARGS = {
    'neox_args': neox_args,
    'iter_time_s': iter_time_s
}
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 float, 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
human_readable_flops Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/cape/megatron/logging.py
code served (permissive licence) · get_code("32c8c6d61ee207b7")
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 str. 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

torch.manual_seed(0)

ARGS = {
    'num': 5e12
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
pairwise Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/cape/configs/gen_docs.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ningding-o/MemoryFormer, is pointer only (licence: NONE) · get_code("50c9c165cf801f59")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ningding-o/MemoryFormer, and GitHub detected no licence in that repository 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.

to_md Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/cape/configs/gen_docs.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ningding-o/MemoryFormer, is pointer only (licence: NONE) · get_code("64dd872a8ac47294")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ningding-o/MemoryFormer, and GitHub detected no licence in that repository 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.

get_activation Not yet run
unverified (harvested, no recorded run)
chuanyang-zheng/cape/megatron/model/activations.py
code served (permissive licence) · get_code("9a2bd4d6d6d05bf6")
How it ran

no invocation recorded.

get_docs Not yet run
unverified (harvested, no recorded run)
chuanyang-zheng/cape/configs/gen_docs.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ningding-o/MemoryFormer, is pointer only (licence: NONE) · get_code("d5081f28e2befd2c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ningding-o/MemoryFormer, and GitHub detected no licence in that repository 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.

monitor_method_cuda_wall_times Not yet run
unverified (harvested, no recorded run)
chuanyang-zheng/cape/megatron/devutil.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ningding-o/MemoryFormer, is pointer only (licence: NONE) · get_code("3a5fc202b5d9ec24")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ningding-o/MemoryFormer, and GitHub detected no licence in that repository 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 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 0 the same month, 5 later) and 2 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
pairwise 5 other papers
3 dated earlier, 2 later
2205.09921 (2022-05)
KERPLE: Kernelized Relative Positional Embedding for Length Extrapolation
2312.02406 (2023-12)
Efficient Online Data Mixing For Language Model Pre-Training
2406.12428 (2024-06)
PSLM: Parallel Generation of Text and Speech with LLMs for Low-Latency Spoken Dialogue Systems
and 2 more not named here
to_md 5 other papers
3 dated earlier, 2 later
2205.09921 (2022-05)
KERPLE: Kernelized Relative Positional Embedding for Length Extrapolation
2312.02406 (2023-12)
Efficient Online Data Mixing For Language Model Pre-Training
2406.12428 (2024-06)
PSLM: Parallel Generation of Text and Speech with LLMs for Low-Latency Spoken Dialogue Systems
and 2 more not named here
get_checkpoint_tag 3 other papers
1 dated earlier, 2 later
2406.12428 (2024-06)
PSLM: Parallel Generation of Text and Speech with LLMs for Low-Latency Spoken Dialogue Systems
2411.12992 (2024-11)
MemoryFormer: Minimize Transformer Computation by Removing Fully-Connected Layers
2504.12463 (2025-04)
Dense Backpropagation Improves Training for Sparse Mixture-of-Experts
get_docs 3 other papers
1 dated earlier, 2 later
2406.12428 (2024-06)
PSLM: Parallel Generation of Text and Speech with LLMs for Low-Latency Spoken Dialogue Systems
2411.12992 (2024-11)
MemoryFormer: Minimize Transformer Computation by Removing Fully-Connected Layers
2504.12463 (2025-04)
Dense Backpropagation Improves Training for Sparse Mixture-of-Experts
monitor_method_cuda_wall_times 3 other papers
1 dated earlier, 2 later
2406.12428 (2024-06)
PSLM: Parallel Generation of Text and Speech with LLMs for Low-Latency Spoken Dialogue Systems
2411.12992 (2024-11)
MemoryFormer: Minimize Transformer Computation by Removing Fully-Connected Layers
2504.12463 (2025-04)
Dense Backpropagation Improves Training for Sparse Mixture-of-Experts
bias_gelu 1 other paper
1 dated earlier
2205.09921 (2022-05)
KERPLE: Kernelized Relative Positional Embedding for Length Extrapolation
bias_gelu_back 1 other paper
1 dated earlier
2205.09921 (2022-05)
KERPLE: Kernelized Relative Positional Embedding for Length Extrapolation
human_readable_flops 1 other paper
1 dated earlier
2312.02406 (2023-12)
Efficient Online Data Mixing For Language Model Pre-Training

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

The attention mechanism is a fundamental component of the Transformer model, contributing to interactions among distinct tokens, in contrast to earlier feed-forward neural networks. In general, the attention scores are determined simply by the key-query products. However, this work's occasional trial (combining DAPE and NoPE) of including additional MLPs on attention scores without position encoding indicates that the classical key-query multiplication may limit the performance of Transformers. In this work, we conceptualize attention as a feature map and apply the convolution operator (for neighboring attention scores across different heads) to mimic the processing methods in computer vision. Specifically, the main contribution of this paper is identifying and interpreting the Transformer length extrapolation problem as a result of the limited expressiveness of the naive query and key dot product, and we successfully translate the length extrapolation issue into a well-understood feature map processing problem. The novel insight, which can be adapted to various attention-related models, reveals that the current Transformer architecture has the potential for further evolution. Extensive experiments demonstrate that treating attention as a feature map and applying convolution as a processing method significantly enhances Transformer performance.

For agents

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

get_harvested_code_for_paper("2410.04798")
get_code_for_paper("2410.04798")
have("2410.04798")

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

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

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

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

Connect an agent — have() is free.