model-pruning

model-pruning is a skill for Claude Code from Orchestra-Research/AI-Research-SKILLs. It costs 70 tokens per session (3,762 once invoked), scanned A, a copy of model-pruning, MIT.

A model-compression guide for removing parts of a large language model so it uses less memory and can run faster. It covers pruning methods such as Wanda and SparseGPT without retraining the model.

In plain words
What is it for?
Use it to apply unstructured, structured, or N:M pruning to language models and prepare them for more efficient inference.
Why use it?
It helps when a model is too large or slow for available hardware, such as a mobile or edge device.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the emerging-techniques plugin — 6 skills shipped together

Good fit Use it to apply unstructured, structured, or N:M pruning to language models and prepare them for more efficient inference.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/orchestra-research/ai-research-skills/model-pruning
About the project

AI Research Skills Library is a collection of reusable instructions that guide AI agents through research and machine-learning engineering tasks, from finding ideas and writing papers to training, evaluation, and deployment. It is for configuring agents such as Claude Code, Codex, and Gemini to perform research workflows.

Orchestra-Research/AI-Research-SKILLs · 12,508 stars · on GitHub · orchestra-research.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Orchestra-Research/AI-Research-SKILLs --skill model-pruning
Clone the repo
git clone --depth 1 https://github.com/Orchestra-Research/AI-Research-SKILLs

Made for: Claude Code.

Or install emerging-techniques, the plugin that ships this one along with the rest of its 6 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for model-pruning

README.md
[![agentmods](https://agentmods.dev/badge/skills/orchestra-research/ai-research-skills/model-pruning/github.svg)](https://agentmods.dev/skills/orchestra-research/ai-research-skills/model-pruning)
Your own site
<a href="https://agentmods.dev/skills/orchestra-research/ai-research-skills/model-pruning"><img src="https://agentmods.dev/badge/skills/orchestra-research/ai-research-skills/model-pruning/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for model-pruning

Your own site · 80×15
<a href="https://agentmods.dev/skills/orchestra-research/ai-research-skills/model-pruning"><img src="https://agentmods.dev/badge/skills/orchestra-research/ai-research-skills/model-pruning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,762 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 18 Mar 2026
  • Snyk warn 16 Feb 2026
How audits are shown
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00070 $0.03762
Opus 5 $0.00035 $0.01881
Sonnet 5 $0.00014 $0.00752
Haiku 4.5 $0.00007 $0.00376

Measured 7d ago against content hash aca913d834bc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

model-pruning scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to model-pruning — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

19-emerging-techniques/model-pruning/SKILL.md · 496 lines

How it starts

The opening of the file, as written. The whole thing — 496 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Model Pruning: Compressing LLMs

When to Use This Skill

Use Model Pruning when you need to:

  • Reduce model size by 40-60% with <1% accuracy loss
  • Accelerate inference using hardware-friendly sparsity (2-4× speedup)
  • Deploy on constrained hardware (mobile, edge devices)
  • Compress without retraining using one-shot methods
  • Enable efficient serving with reduced memory footprint

Key Techniques: Wanda (weights × activations), SparseGPT (second-order), structured pruning, N:M sparsity

Papers: Wanda ICLR 2024 (arXiv 2306.11695), SparseGPT (arXiv 2301.00774)

Installation

# Wanda implementation
git clone https://github.com/locuslab/wanda
cd wanda
pip install -r requirements.txt

# Optional: SparseGPT
git clone https://github.com/IST-DASLab/sparsegpt
cd sparsegpt
pip install -e .

# Dependencies
pip install torch transformers accelerate

Quick Start

Wanda Pruning (One-Shot, No Retraining)

Source: ICLR 2024 (arXiv 2306.11695)

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load model
model = AutoModelForCausalLM.from_pretrained(
    "meta-llama/Llama-2-7b-hf",
    torch_dtype=torch.float16,
    device_map="cuda"
)
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf")

# Calibration data (small dataset for activation statistics)
calib_data = [
    "The quick brown fox jumps over the lazy dog.",
    "Machine learning is transforming the world.",
    "Artificial intelligence powers modern applications.",
]

# Wanda pruning function
def wanda_prune(model, calib_data, sparsity=0.5):
    """
    Wanda: Prune by weight magnitude × input activation.

    Args:
        sparsity: Fraction of weights to prune (0.5 = 50%)
    """
    # 1. Collect activation statistics
    activations = {}

    def hook_fn(name):
        def hook(module, input, output):
            # Store input activation norms
            activations[name] = input[0].detach().abs().mean(dim=0)
        return hook

    # Register hooks for all linear layers
    hooks = []
    for name, module in model.named_modules():
        if isinstance(module, torch.nn.Linear):
            hooks.append(module.register_forward_hook(hook_fn(name)))

    # Run calibration data
    model.eval()
    with torch.no_grad():
        for text in calib_data:
            inputs = tokenizer(text, return_tensors="pt").to(model.device)
            model(**inputs)

    # Remove hooks
    for hook in hooks:
        hook.remove()

    # 2. Prune weights based on |weight| × activation
    for name, module in model.named_modules():
        if isinstance(module, torch.nn.Linear) and name in activations:
            W = module.weight.data
            act = activations[name]

            # Compute importance: |weight| × activation
            importance = W.abs() * act.unsqueeze(0)

            # Flatten and find threshold
            threshold = torch.quantile(importance.flatten(), sparsity)

            # Create mask
            mask = importance >= threshold

            # Apply mask (prune)
            W *= mask.float()

    return model

# Apply Wanda pruning (50% sparsity, one-shot, no retraining)
pruned_model = wanda_prune(model, calib_data, sparsity=0.5)

# Save
pruned_model.save_pretrained("./llama-2-7b-wanda-50")

Read the full file on GitHub · 496 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 496 lines · 70 tokens per session scan A aca913d834bc

Subscribe to this mod's changes

model-pruning is a skill published in the GitHub repository Orchestra-Research/AI-Research-SKILLs (12,508 stars, last pushed 2mo ago), licensed MIT. It adds 70 tokens to every session and 3,762 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to model-pruning, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

model-pruning

Reduce LLM size and accelerate inference using pruning techniques like Wanda and SparseGPT. Use when compressing models without retraining, achieving 50% sparsity with minimal accuracy loss, or enabling faster inference on hardware accelerators. Covers unstructured pruning, structured pruning, N:M sparsity, magnitude…

davila7/claude-code-templates · 70 tokens

model-pruning

Reduce LLM size and accelerate inference using pruning techniques like Wanda and SparseGPT. Use when compressing models without retraining, achieving 50% sparsity with minimal accuracy loss, or enabling faster inference on hardware accelerators. Covers unstructured pruning, structured pruning, N:M sparsity, magnitude…

OpenLAIR/dr-claw · 70 tokens

model-pruning

Reduce LLM size and accelerate inference using pruning techniques like Wanda and SparseGPT. Use when compressing models without retraining, achieving 50% sparsity with minimal accuracy loss, or enabling faster inference on hardware accelerators. Covers unstructured pruning, structured pruning, N:M sparsity, magnitude…

liortesta/ClawdAgent · 70 tokens

model-pruning

Reduce LLM size and accelerate inference using pruning techniques like Wanda and SparseGPT. Use when compressing models without retraining, achieving 50% sparsity with minimal accuracy loss, or enabling faster inference on hardware accelerators. Covers unstructured pruning, structured pruning, N:M sparsity, magnitude…

OpenLAIR/dr-claw-plugin-cc · 70 tokens

model-pruning

Reduce LLM size and accelerate inference using pruning techniques like Wanda and SparseGPT. Use when compressing models without retraining, achieving 50% sparsity with minimal accuracy loss, or enabling faster inference on hardware accelerators. Covers unstructured pruning, structured pruning, N:M sparsity, magnitude…

ihatesea69/HieuNghi-AI-Skills · 70 tokens

knowledge-distillation

Compress large language models using knowledge distillation from teacher to student models. Use when deploying smaller models with retained performance, transferring GPT-4 capabilities to open-source models, or reducing inference costs. Covers temperature scaling, soft targets, reverse KLD, logit distillation, and…

davila7/claude-code-templates · 65 tokens