SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.09025 · ICML · 2024

SLEB: Streamlining LLMs through Redundancy Verification and Elimination of Transformer Blocks

Jae-Joon Kim, Taesu Kim, Yulhwa Kim, Hyungjun Kim, Jiwon Song, Kyungseok Oh

arXiv · PDF · Open in the Atlas

Code that ran

6 of 12 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 6 no recorded run), measured 2026-11-21; 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/2402.09025.json · badge: /api/ran/2402.09025.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
jiwonsong-dev/SLEB canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
jiwonsong-dev/sleb marked official in Papers with Code
Papers with Code archive
5 ran · 6 no recorded run
FunctionStatusWhere it lives
block_remove Ran
ran; our contract draft was wrong, not the code
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("97b79932a67ad62d")
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 LlamaForCausalLM. 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
import torch.nn as nn

torch.manual_seed(0)

class SelfAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer_idx = 0

class LlamaDecoderLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.self_attn = SelfAttention()

class LlamaModel(nn.Module):
    def __init__(self, num_layers=4):
        super().__init__()
        self.layers = nn.ModuleList([LlamaDecoderLayer() for _ in range(num_layers)])

class LlamaForCausalLM(nn.Module):
    def __init__(self, num_layers=4):
        super().__init__()
        self.model = LlamaModel(num_layers)
        self.name = "LlamaForCausalLM"

class OPTDecoder(nn.Module):
    def __init__(self, num_layers=4):
        super().__init__()
        self.layers = nn.ModuleList([nn.Linear(4, 4) for _ in range(num_layers)])

class OPTModel(nn.Module):
    def __init__(self, num_layers=4):
        super().__init__()
        self.decoder = OPTDecoder(num_layers)

class OPTForCausalLM(nn.Module):
    def __init__(self, num_layers=4):
        super().__init__()
        self.model = OPTModel(num_layers)
        self.name = "OPTForCausalLM"

# Test with LLaMA model
llama_model = LlamaForCausalLM(num_layers=6)
llama_kill_list = [1, 3, 5]

# Test with OPT model
opt_model = OPTForCausalLM(num_layers=6)
opt_kill_list = [0, 2, 4]

ARGS = {
    "model": llama_model,
    "kill_list": llama_kill_list.copy()
}
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 LlamaForCausalLM — a LlamaForCausalLM output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LlamaForCausalLM 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
block_remove_llama Ran
ran; our contract draft was wrong, not the code
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("7a2e338ff7fb21b0")
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 LlamaForCausalLM. 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
import torch.nn as nn

torch.manual_seed(0)

class SelfAttention(nn.Module):
    def __init__(self, layer_idx):
        super().__init__()
        self.layer_idx = layer_idx

class TransformerLayer(nn.Module):
    def __init__(self, layer_idx):
        super().__init__()
        self.self_attn = SelfAttention(layer_idx)

class LlamaModel(nn.Module):
    def __init__(self, num_layers):
        super().__init__()
        self.layers = nn.ModuleList([
            TransformerLayer(i) for i in range(num_layers)
        ])

class LlamaForCausalLM(nn.Module):
    def __init__(self, num_layers):
        super().__init__()
        self.model = LlamaModel(num_layers)

model = LlamaForCausalLM(num_layers=5)
kill_list = [1, 3]

ARGS = {
    "model": model,
    "kill_list": kill_list,
}
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 LlamaForCausalLM — a LlamaForCausalLM output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LlamaForCausalLM 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
block_remove_opt Ran
ran; our contract draft was wrong, not the code
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("62cb0034e375daea")
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 ModelWrapper. 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
import torch.nn as nn

torch.manual_seed(0)

# Build a minimal model with the structure the function expects
class MinimalDecoder(nn.Module):
    def __init__(self, num_layers=5):
        super().__init__()
        self.layers = nn.ModuleList([
            nn.Linear(4, 4) for _ in range(num_layers)
        ])

class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.decoder = MinimalDecoder(num_layers=5)

class ModelWrapper(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = MinimalModel()

# Create the model
model = ModelWrapper()

# Create a kill_list with indices to remove (sorted)
kill_list = [1, 3]

ARGS = {
    "model": model,
    "kill_list": kill_list,
}
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 ModelWrapper — a ModelWrapper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModelWrapper 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
eval_ppl Ran
ran, honoured the contract we drafted
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("a7e0158215732c17")
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 torch.nn as nn

torch.manual_seed(0)

# Build a minimal model that satisfies the function's usage
class MinimalLanguageModel(nn.Module):
    def __init__(self, vocab_size=128, seqlen=8, hidden_dim=4):
        super().__init__()
        self.seqlen = seqlen
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.lm_head = nn.Linear(hidden_dim, vocab_size)
    
    def forward(self, input_ids):
        # input_ids shape: (batch_size, seqlen)
        x = self.embedding(input_ids)  # (batch_size, seqlen, hidden_dim)
        logits = self.lm_head(x)  # (batch_size, seqlen, vocab_size)
        
        # Return object with logits attribute
        class Output:
            pass
        output = Output()
        output.logits = logits
        return output

# Build a stand-in for testenc (tokenizer output)
class TokenizerOutput:
    def __init__(self, input_ids):
        self.input_ids = input_ids

# Create test data
# We need nsamples = testenc.numel() // model.seqlen to work out
# Let's say seqlen=8, and we want nsamples=4
# So testenc should have 4 * 8 = 32 tokens total
# Shape: (1, 32) for a single document
vocab_size = 128
seqlen = 8
num_tokens = 32  # Will give nsamples = 4

model = MinimalLanguageModel(vocab_size=vocab_size, seqlen=seqlen, hidden_dim=4)
model.eval()

# Create testenc with input_ids of shape (1, 32)
input_ids = torch.randint(0, vocab_size, (1, num_tokens))
testenc = TokenizerOutput(input_ids)

ARGS = {
    "model": model,
    "testenc": testenc,
    "bs": 2,
    "device": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — 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
get_loss Ran
ran, honoured the contract we drafted
jiwonsong-dev/SLEB/sleb.py
code served (permissive licence) · get_code("084002d7f8a76578")
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 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 torch.nn as nn

torch.manual_seed(0)

# Create a minimal model that satisfies the function's requirements
class MinimalLM(nn.Module):
    def __init__(self, vocab_size=256, seqlen=8, hidden_dim=4):
        super().__init__()
        self.seqlen = seqlen
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.lm_head = nn.Linear(hidden_dim, vocab_size)
    
    def forward(self, input_ids):
        # input_ids shape: (batch_size, seqlen)
        x = self.embedding(input_ids)  # (batch_size, seqlen, hidden_dim)
        logits = self.lm_head(x)  # (batch_size, seqlen, vocab_size)
        
        # Return object with .logits attribute
        class Output:
            pass
        output = Output()
        output.logits = logits
        return output

# Create a stand-in for testenc with input_ids attribute
class TestEncoding:
    def __init__(self, input_ids):
        self.input_ids = input_ids

# Build the model
model = MinimalLM(vocab_size=256, seqlen=8, hidden_dim=4)

# Create test encoding: shape (1, 32) - 4 samples of seqlen=8
# This gives nsamples = 32 // 8 = 4
testenc = TestEncoding(torch.randint(0, 256, (1, 32)))

# Define ARGS
ARGS = {
    "model": model,
    "testenc": testenc,
    "bs": 2,
    "device": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
load_and_eval_ppl Ran
ran, honoured the contract we drafted
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("ece3a1bcea1d0f62")
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. 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, 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 as nn

torch.manual_seed(0)

class StandInModel(nn.Module):
    def __init__(self, seqlen=8, vocab_size=256):
        super().__init__()
        self.seqlen = seqlen
        self.name = "test_model"
        self.embedding = nn.Embedding(vocab_size, 16)
        self.lm_head = nn.Linear(16, vocab_size)
    
    def forward(self, input_ids):
        x = self.embedding(input_ids)
        logits = self.lm_head(x)
        
        class Output:
            pass
        
        output = Output()
        output.logits = logits
        return output

class StandInTokenizer:
    def __init__(self):
        self.vocab_size = 256

class StandInTestData:
    def __init__(self, seqlen=8, num_samples=4):
        self.input_ids = torch.randint(0, 256, (1, seqlen * num_samples))

model = StandInModel(seqlen=8, vocab_size=256)
testloader = StandInTestData(seqlen=8, num_samples=4)
tokenizer = StandInTokenizer()
device = torch.device('cpu')

ARGS = {
    'model': model,
    'device': device,
    'dataset': 'wikitext2',
    'testloader': testloader,
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — 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
block_replace Not yet run
unverified (harvested, no recorded run)
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("490bf0726aca1461")
How it ran

no invocation recorded.

eval_zero_shot Not yet run
unverified (harvested, no recorded run)
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("01995feb8be8923d")
How it ran

no invocation recorded.

get_llm Not yet run
unverified (harvested, no recorded run)
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("3d35b1f3a44e3c8d")
How it ran

no invocation recorded.

sleb Not yet run
unverified (harvested, no recorded run)
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("acd45bf0eb9cb9f4")
How it ran

no invocation recorded.

turn_off Not yet run
unverified (harvested, no recorded run)
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("cb61b072985a3343")
How it ran

no invocation recorded.

turn_on Not yet run
unverified (harvested, no recorded run)
jiwonsong-dev/sleb/sleb.py
code served (permissive licence) · get_code("19d5226fd25d03fc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 9 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
block_remove
brick of this paper's assembly: model
1 other paper
1 later
2502.14910 (2025-02)
EvoP: Robust LLM Inference via Evolutionary Pruning
block_remove_llama
brick of this paper's assembly: helper
1 other paper
1 later
2502.14910 (2025-02)
EvoP: Robust LLM Inference via Evolutionary Pruning
block_remove_opt
brick of this paper's assembly: helper
1 other paper
1 later
2502.14910 (2025-02)
EvoP: Robust LLM Inference via Evolutionary Pruning

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

Repositories linked to this paper

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

Abstract

Large language models (LLMs) have proven to be highly effective across various natural language processing tasks. However, their large number of parameters poses significant challenges for practical deployment. Pruning, a technique aimed at reducing the size and complexity of LLMs, offers a potential solution by removing redundant components from the network. Despite the promise of pruning, existing methods often struggle to achieve substantial end-to-end LLM inference speedup. In this paper, we introduce SLEB, a novel approach designed to streamline LLMs by eliminating redundant transformer blocks. We choose the transformer block as the fundamental unit for pruning, because LLMs exhibit block-level redundancy with high similarity between the outputs of neighboring blocks. This choice allows us to effectively enhance the processing speed of LLMs. Our experimental results demonstrate that SLEB outperforms previous LLM pruning methods in accelerating LLM inference while also maintaining superior perplexity and accuracy, making SLEB as a promising technique for enhancing the efficiency of LLMs. The code is available at: https://github. com/jiwonsong-dev/SLEB.

For agents

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

get_harvested_code_for_paper("2402.09025")
get_code_for_paper("2402.09025")
have("2402.09025")

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

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

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

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

Connect an agent — have() is free.