SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.18886 · EMNLP · 2025

On Pruning State-Space LLMs

Roy Schwartz, Michael Hassid, Tamer Ghattas

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 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; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 5 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2502.18886.json · badge: /api/ran/2502.18886.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
schwartz-lab-NLP/SSM-Pruner canonical (classifier label)
classifier basis not recorded on the link
7 ran · 2 no recorded run
FunctionStatusWhere it lives
all_gather_raw Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
schwartz-lab-NLP/SSM-Pruner/original_mamba/mamba_ssm/distributed/distributed_utils.py
code served (permissive licence) · get_code("0f2196b3902caf16")
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
from torch.distributed import ProcessGroup
from unittest.mock import MagicMock

torch.manual_seed(0)

# Create a mock ProcessGroup
mock_process_group = MagicMock(spec=ProcessGroup)

# Create a small input tensor
input_tensor = torch.randn(2, 4, dtype=torch.float32)

# Mock torch.distributed functions to make this work without actual distributed setup
original_get_world_size = torch.distributed.get_world_size
original_all_gather_into_tensor = torch.distributed.all_gather_into_tensor

def mock_get_world_size(group=None):
    return 2

def mock_all_gather_into_tensor(output, input_, group=None, async_op=False):
    # Simulate gathering by repeating the input
    output[:input_.shape[0]] = input_
    output[input_.shape[0]:] = input_
    mock_handle = MagicMock()
    mock_handle.wait = MagicMock()
    return mock_handle

torch.distributed.get_world_size = mock_get_world_size
torch.distributed.all_gather_into_tensor = mock_all_gather_into_tensor

ARGS = {
    'input_': input_tensor,
    'process_group': mock_process_group,
    'async_op': False
}
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
calculate_parameter_count Ran
ran on a synthesized input
schwartz-lab-NLP/SSM-Pruner/benchmark_throughput.py
code served (permissive licence) · get_code("36e8bf79ceaecbb7")
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 dict. 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)

# Create a simple model with both trainable and non-trainable parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        # Trainable parameters
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
        
        # Non-trainable parameters (frozen)
        self.linear3 = nn.Linear(2, 1)
        self.linear3.weight.requires_grad = False
        self.linear3.bias.requires_grad = False
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        x = self.linear3(x)
        return x

model = SimpleModel()

ARGS = {
    'model': model
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
measure_generation_throughput Ran
ran on a synthesized input
schwartz-lab-NLP/SSM-Pruner/benchmark_throughput.py
code served (permissive licence) · get_code("e432ae199b10e664")
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 numpy as np

torch.manual_seed(0)

class MockGenerativeModel(nn.Module):
    """
    Minimal generative model that implements the generate() method.
    The function calls model.generate(input_ids=..., max_length=..., top_k=...)
    """
    def __init__(self, vocab_size=100, hidden_dim=8):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.lm_head = nn.Linear(hidden_dim, vocab_size)
        
    def forward(self, input_ids):
        embedded = self.embedding(input_ids)
        logits = self.lm_head(embedded)
        return logits
    
    def generate(self, input_ids, max_length, top_k=1):
        """
        Mock generate method that produces tokens up to max_length.
        Returns generated token ids.
        """
        batch_size = input_ids.shape[0]
        current_ids = input_ids
        
        while current_ids.shape[1] < max_length:
            logits = self.forward(current_ids)
            next_token_logits = logits[:, -1, :]
            
            if top_k > 1:
                top_k_logits, top_k_indices = torch.topk(next_token_logits, top_k, dim=-1)
                next_token = top_k_indices[:, 0:1]
            else:
                next_token = torch.argmax(next_token_logits, dim=-1, keepdim=True)
            
            current_ids = torch.cat([current_ids, next_token], dim=1)
        
        return current_ids

model = MockGenerativeModel(vocab_size=100, hidden_dim=8)
model.eval()

input_ids = torch.randint(0, 100, (2, 3), dtype=torch.long)

ARGS = {
    "model": model,
    "input_ids": input_ids,
    "generate_length": 10,
    "n_runs": 2,
    "warmup_runs": 1,
    "use_amp": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
reduce_scatter_raw Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
schwartz-lab-NLP/SSM-Pruner/original_mamba/mamba_ssm/distributed/distributed_utils.py
code served (permissive licence) · get_code("2d002bb9a87211b8")
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
from torch.distributed import ProcessGroup
from unittest.mock import MagicMock

torch.manual_seed(0)

# Create a mock ProcessGroup since we can't actually initialize distributed training
# The function only calls torch.distributed.get_world_size() and passes it to reduce_scatter_tensor
mock_process_group = MagicMock(spec=ProcessGroup)

# Create input tensor: batch dimension must be divisible by world_size
# Using world_size=2 for simplicity, so batch size = 4
input_tensor = torch.randn(4, 3, dtype=torch.float32, device='cpu')

# Mock torch.distributed functions to work without actual distributed setup
def mock_get_world_size(process_group):
    return 2

def mock_reduce_scatter_tensor(output, input_tensor, group, async_op=False):
    # Return a mock handle
    mock_handle = MagicMock()
    return mock_handle

# Patch the distributed functions
torch.distributed.get_world_size = mock_get_world_size
torch.distributed.reduce_scatter_tensor = mock_reduce_scatter_tensor

ARGS = {
    'input_': input_tensor,
    'process_group': mock_process_group,
    'async_op': False
}
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
segsum Ran
ran; our contract draft was wrong, not the code
schwartz-lab-NLP/SSM-Pruner/original_mamba/mamba_ssm/modules/ssd_minimal.py
code served (permissive licence) · get_code("ef936c81f5d4c41c")
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, 4, 3, 3) 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 einops import rearrange, repeat

torch.manual_seed(0)

# The function takes a single parameter 'x' which should be a tensor
# Looking at the function body:
# - x.size(-1) is called, so x must be a tensor
# - repeat() is used on x with pattern '... d -> ... d e'
# - masked_fill, cumsum operations are performed
# - The tensor should have at least 2 dimensions (based on dim=-2 usage)

# Create a small test tensor with shape (batch, dim, time)
# Using distinct sizes: batch=2, dim=4, time=3
x = torch.randn(2, 4, 3)

ARGS = {
    "x": x
}
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, 4, 3, 3) — shape (2, 4, 3, 3) 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
segsum_unstable Ran
ran; our contract draft was wrong, not the code
schwartz-lab-NLP/SSM-Pruner/original_mamba/mamba_ssm/modules/ssd_minimal.py
code served (permissive licence) · get_code("f641b66c642a2908")
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 3, dtype family float, shape (2, 4, 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

torch.manual_seed(0)

# Create a small tensor for testing
# The function expects x to be a tensor with a last dimension T
# x_cumsum will have shape [..., T]
# x_segsum will have shape [..., T, T]
# The function uses x.size(-1), x.device, x.cumsum, masked_fill operations
x = torch.randn(2, 4)  # batch size 2, sequence length 4

ARGS = {
    "x": x
}
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 3, dtype family float, shape (2, 4, 4) — shape (2, 4, 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
ssd_minimal_discrete Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
schwartz-lab-NLP/SSM-Pruner/original_mamba/mamba_ssm/modules/ssd_minimal.py
code served (permissive licence) · get_code("f5c3ef656ef76878")
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
import torch.nn.functional as F
from einops import rearrange, repeat

torch.manual_seed(0)

# Define dimensions (using distinct sizes)
batch = 2
length = 8
n_heads = 3
d_head = 4
d_state = 5
block_len = 4

# Create tensors with proper shapes and dtypes
X = torch.randn(batch, length, n_heads, d_head, dtype=torch.float32)
A = torch.randn(batch, length, n_heads, dtype=torch.float32)
B = torch.randn(batch, length, n_heads, d_state, dtype=torch.float32)
C = torch.randn(batch, length, n_heads, d_state, dtype=torch.float32)

# initial_states is optional, set to None to test default behavior
initial_states = None

ARGS = {
    'X': X,
    'A': A,
    'B': B,
    'C': C,
    'block_len': block_len,
    'initial_states': initial_states,
}
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 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
all_reduce_raw Not yet run
unverified (harvested, no recorded run)
schwartz-lab-NLP/SSM-Pruner/original_mamba/mamba_ssm/distributed/distributed_utils.py
code served (permissive licence) · get_code("a06d70b09eb46b60")
How it ran

no invocation recorded.

measure_throughput Not yet run
unverified (harvested, no recorded run)
schwartz-lab-NLP/SSM-Pruner/benchmark_throughput.py
code served (permissive licence) · get_code("edcf31317694b9ec")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 0 later) and 3 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
all_gather_raw 2 other papers
2 dated earlier
2405.21060 (2024-05)
Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
2412.08160 (2024-12)
DG-Mamba: Robust and Efficient Dynamic Graph Structure Learning with Selective State Space Models
all_reduce_raw 2 other papers
2 dated earlier
2405.21060 (2024-05)
Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
2412.08160 (2024-12)
DG-Mamba: Robust and Efficient Dynamic Graph Structure Learning with Selective State Space Models
reduce_scatter_raw 2 other papers
2 dated earlier
2405.21060 (2024-05)
Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
2412.08160 (2024-12)
DG-Mamba: Robust and Efficient Dynamic Graph Structure Learning with Selective State Space Models
segsum 1 other paper
1 dated earlier
2405.21060 (2024-05)
Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
segsum_unstable 1 other paper
1 dated earlier
2405.21060 (2024-05)
Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
ssd_minimal_discrete 1 other paper
1 dated earlier
2405.21060 (2024-05)
Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality

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

Repositories linked to this paper

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

Abstract

Recent work proposed state-space models (SSMs) as an efficient alternative to transformer-based LLMs. Can these models be pruned to further reduce their computation costs? We adapt several pruning methods to the SSM structure, and apply them to four SSMbased LLMs across multiple tasks. We find that such models are quite robust to some pruning methods (e.g., WANDA), while using other methods lead to fast performance degradation. 1

For agents

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

get_harvested_code_for_paper("2502.18886")
get_code_for_paper("2502.18886")
have("2502.18886")

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

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

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

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

Connect an agent — have() is free.