emerging-techniques-model-pruning

emerging-techniques-model-pruning is a skill for Claude Code, Codex from davila7/claude-code-templates. It costs 74 tokens per session (3,771 once invoked), scanned A, original, MIT.

A set of techniques for removing selected weights or connections from a language model so it becomes sparse and smaller. It covers methods such as Wanda, SparseGPT, structured pruning, and N:M sparsity.

In plain words
What is it for?
Use it to compress language models, create sparse versions, and prepare them for more efficient deployment.
Why use it?
It reduces memory and can speed up inference without requiring a full retraining process. This helps when running models on constrained devices or hardware accelerators.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to compress language models, create sparse versions, and prepare them for more efficient deployment.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/davila7/claude-code-templates/emerging-techniques-model-pruning
About the project

Claude Code Templates is a command-line tool and catalogue for configuring Anthropic’s Claude Code with agents, commands, settings, hooks, integrations, skills, and project templates. Developers use it to browse and install reusable components for their coding workflows. The catalogue includes many of these Claude Code components.

davila7/claude-code-templates · 33,194 stars · on GitHub · aitmpl.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 davila7/claude-code-templates --skill emerging-techniques-model-pruning
Clone the repo
git clone --depth 1 https://github.com/davila7/claude-code-templates

Made for: Claude Code, Codex.

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 emerging-techniques-model-pruning

README.md
[![agentmods](https://agentmods.dev/badge/skills/davila7/claude-code-templates/emerging-techniques-model-pruning/github.svg)](https://agentmods.dev/skills/davila7/claude-code-templates/emerging-techniques-model-pruning)
Your own site
<a href="https://agentmods.dev/skills/davila7/claude-code-templates/emerging-techniques-model-pruning"><img src="https://agentmods.dev/badge/skills/davila7/claude-code-templates/emerging-techniques-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 emerging-techniques-model-pruning

Your own site · 80×15
<a href="https://agentmods.dev/skills/davila7/claude-code-templates/emerging-techniques-model-pruning"><img src="https://agentmods.dev/badge/skills/davila7/claude-code-templates/emerging-techniques-model-pruning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,771 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
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found 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.00074 $0.03771
Opus 5.5 $0.00030 $0.01508
Sonnet 5.5 $0.00015 $0.00754
Haiku 4.5 $0.00007 $0.00377

Measured 12d ago against content hash 33415053f1d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

emerging-techniques-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 12d 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

Copies of this mod

3 near-identical copies found in the catalogue:

cli-tool/components/skills/ai-research/emerging-techniques-model-pruning/SKILL.md · 497 lines

How it starts

The opening of the file, as written. The whole thing — 497 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 · 497 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. 12d ago Changed · +4 tokens per session 33415053f1d5
  2. 14d ago Changed · +1 lines b91956fc5ae1
  3. 2mo ago First seen · 496 lines · 70 tokens per session scan A aca913d834bc

Subscribe to this mod's changes

emerging-techniques-model-pruning is a skill published in the GitHub repository davila7/claude-code-templates (33,194 stars, last pushed today), licensed MIT. It adds 74 tokens to every session and 3,771 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

emerging-techniques-model-pruning compared with skills from other repositories

emerging-techniques-model-pruning next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
emerging-techniques-model-pruningdavila7/claude-code-templatesSkill33ktodayMITA74Claude Code, Codex
ccc-dataKevinZai/commanderSkill6yesterdayMITA36Claude Code
couchbase-ftscelticht32/Couchbase-Skills-for-Claude.aiSkill44mo agoMITA208Claude Code, Codex
couchbase-ai-applicationscelticht32/Couchbase-Skills-for-Claude.aiSkill44mo agoMITA202Claude Code, Codex
feature-engineerinbharatai/claude-skillsSkill437mo agoMITA23Claude Code, Codex
gcp-architectinbharatai/claude-skillsSkill437mo agoMITA28Claude Code, Codex
midjourney-prompterinbharatai/claude-skillsSkill437mo agoMITA28Claude Code, Codex