SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.15786 · 2024

What Matters in Transformers? Not All Attention is Needed

arXiv · PDF · Open in the Atlas

Code that ran

5 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, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 5 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/2406.15786.json · badge: /api/ran/2406.15786.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
case-lab-umd/llm-drop canonical (classifier label)
classifier basis: census
5 ran · 5 no recorded run
FunctionStatusWhere it lives
count_parameters Ran
ran, honoured the contract we drafted
case-lab-umd/llm-drop/src/llmtuner/extras/misc.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from youganglyu/MACPO, is pointer only (licence: NONE) · get_code("5995c2562cfcbc33")
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 youganglyu/MACPO, 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.

generate_torch Ran
ran; our contract draft was wrong, not the code
case-lab-umd/llm-drop/src/benchmark_speed.py
code served (permissive licence) · get_code("e52f261bfb32b88e")
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 tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import torch.nn as nn
import time

torch.manual_seed(0)

class SimpleLanguageModel(nn.Module):
    def __init__(self, vocab_size=100, hidden_size=4):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_size)
        self.linear = nn.Linear(hidden_size, vocab_size)
    
    def forward(self, input_ids, use_cache=False):
        x = self.embedding(input_ids)
        x = self.linear(x)
        return (x,)

model = SimpleLanguageModel(vocab_size=100, hidden_size=4)
model.eval()

input_ids = [[1, 2, 3], [4, 5, 6]]

n_generate = 3

ARGS = {
    'model': model,
    'input_ids': input_ids,
    'n_generate': n_generate
}
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 tuple — a tuple output has no array shape of its own; none is 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
get_logger Ran
ran; our contract draft was wrong, not the code
case-lab-umd/llm-drop/src/llmtuner/extras/logging.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from youganglyu/MACPO, is pointer only (licence: NONE) · get_code("4049a2f89b11dd2f")
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 youganglyu/MACPO, 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.

max_with_tolerance Ran
ran; our contract draft was wrong, not the code
case-lab-umd/llm-drop/src/llmtuner/compression/prune/block_drop.py
code served (permissive licence) · get_code("02c5c966e64fd4a4")
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 tuple. 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)

# Create a small similarities tensor
# The function calls torch.max(similarities, dim=0) and torch.where on it
# So similarities should be 2D: (num_layers, num_features)
similarities = torch.randn(4, 3)

# tolerance is a float for comparison
tolerance = 0.5

ARGS = {
    "similarities": similarities,
    "tolerance": tolerance,
}
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 tuple — a tuple output has no array shape of its own; none is 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
smooth Ran
ran, violated the contract we drafted
case-lab-umd/llm-drop/src/llmtuner/extras/ploting.py
code served (permissive licence) · get_code("70c7f6d657ef0a9e")
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 list, ndim 1, 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 math
from typing import List

torch_imported = False
try:
    import torch
    torch_imported = True
except ImportError:
    pass

# Create a simple list of float scalars for testing
scalars = [1.0, 2.5, 3.2, 4.1, 5.0, 6.3, 7.1, 8.5]

ARGS = {
    "scalars": scalars
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
discrete_layer_dropping Not yet run
unverified (harvested, no recorded run)
case-lab-umd/llm-drop/src/llmtuner/compression/prune/layer_drop.py
code served (permissive licence) · get_code("9885027831acc7a5")
How it ran

no invocation recorded.

get_block_similarities Not yet run
unverified (harvested, no recorded run)
case-lab-umd/llm-drop/src/llmtuner/compression/prune/block_drop.py
code served (permissive licence) · get_code("e8a9f68f74108b49")
How it ran

no invocation recorded.

get_block_similarities_consecutive Not yet run
unverified (harvested, no recorded run)
case-lab-umd/llm-drop/src/llmtuner/compression/prune/block_drop.py
code served (permissive licence) · get_code("a5ceec399132f3c7")
How it ran

no invocation recorded.

get_layer_similarities Not yet run
unverified (harvested, no recorded run)
case-lab-umd/llm-drop/src/llmtuner/compression/prune/layer_drop.py
code served (permissive licence) · get_code("3ff4456dbf47be57")
How it ran

no invocation recorded.

infer_optim_dtype Not yet run
unverified (harvested, no recorded run)
case-lab-umd/llm-drop/src/llmtuner/extras/misc.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from youganglyu/MACPO, is pointer only (licence: NONE) · get_code("0ace211ff2e7d07f")
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 youganglyu/MACPO, 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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 4 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
get_logger 8 other papers
4 dated earlier, 4 later
2311.13246 (2023-11)
CoachLM: Automatic Instruction Revisions Improve the Data Quality in LLM Instruction Tuning
2312.02554 (2023-12)
ULMA: Unified Language Model Alignment with Human Demonstration and Point-wise Preference
2403.13786 (2024-03)
Chain-of-Interaction: Enhancing Large Language Models for Psychiatric Behavior Understanding by Dyadic Contexts
and 5 more not named here
infer_optim_dtype 5 other papers
2 dated earlier, 3 later
2303.18223 (2023-03)
A Survey of Large Language Models
2403.13786 (2024-03)
Chain-of-Interaction: Enhancing Large Language Models for Psychiatric Behavior Understanding by Dyadic Contexts
2410.07672 (2024-10)
MACPO: Weak-to-Strong Alignment via Multi-Agent Contrastive Preference Optimization
and 2 more not named here
smooth 5 other papers
1 dated earlier, 4 later
2403.13786 (2024-03)
Chain-of-Interaction: Enhancing Large Language Models for Psychiatric Behavior Understanding by Dyadic Contexts
2410.14157 (2024-10)
Beyond Autoregression: Discrete Diffusion for Complex Reasoning and Planning
2410.17599 (2024-10)
Cross-model Control: Improving Multiple Large Language Models in One-time Training
and 2 more not named here
count_parameters 4 other papers
1 dated earlier, 3 later
2403.13786 (2024-03)
Chain-of-Interaction: Enhancing Large Language Models for Psychiatric Behavior Understanding by Dyadic Contexts
2410.07672 (2024-10)
MACPO: Weak-to-Strong Alignment via Multi-Agent Contrastive Preference Optimization
2410.14157 (2024-10)
Beyond Autoregression: Discrete Diffusion for Complex Reasoning and Planning
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-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

While scaling Transformer-based large language models (LLMs) has demonstrated promising performance across various tasks, it also introduces redundant architectures, posing efficiency challenges for real-world deployment. Despite some recognition of redundancy in LLMs, the variability of redundancy across different architectures in transformers, such as MLP and Attention layers, is under-explored. In this work, we investigate redundancy across different modules within Transformers, including Blocks, MLP, and Attention layers, using a similarity-based metric. Surprisingly, despite the critical role of attention layers in distinguishing transformers from other architectures, we found that a large portion of these layers exhibit excessively high similarity and can be pruned without degrading performance. For instance, Llama-2-70B achieved a 48.4\% speedup with only a 2.4\% performance drop by pruning half of the attention layers. Furthermore, by tracing model checkpoints throughout the training process, we observed that attention layer redundancy is inherent and consistent across training stages. Additionally, we further propose a method that jointly drops Attention and MLP layers, allowing us to more aggressively drop additional layers. For instance, when dropping 31 layers (Attention + MLP), Llama-2-13B still retains 90\% of the performance on the MMLU task. Our work provides valuable insights for future network architecture design. The code is released at: \url{https://github.com/Shwai-He/LLM-Drop}.

For agents

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

get_harvested_code_for_paper("2406.15786")
get_code_for_paper("2406.15786")
have("2406.15786")

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

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

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

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

Connect an agent — have() is free.