model-pruning

Prune transformer models with Wanda, SparseGPT, and N:M sparsity patterns.

2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-config --skill model-pruning-clay-hhk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-pruning
Source: https://github.com/Clay-HHK/claude-config/tree/main/skills/AI-research-SKILLs/19-emerging-techniques/model-pruning
Command: npx skills add https://github.com/Clay-HHK/claude-config --skill model-pruning-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Model pruning reduces large language model size and inference latency by removing redundant parameters, enabling deployment on constrained hardware and lower-cost serving while minimizing accuracy loss.

Core Features & Use Cases

  • One-shot activation-aware pruning using Wanda for fast compression without retraining.
  • Second-order pruning via SparseGPT for higher-quality, low-degradation pruning.
  • Structured and N:M sparsity patterns for hardware-accelerated inference on NVIDIA tensor cores.
  • Iterative and layer-wise strategies for gradual pruning and fine-tuning to recover accuracy.
  • Use case: Compress meta-llama/Llama-2-7b to ~50% sparsity to halve memory footprint and enable faster inference with <1% accuracy degradation.

Quick Start

Prune a Hugging Face Llama-2-7b model to 50% sparsity using Wanda with a small calibration dataset to produce a one-shot pruned model ready for evaluation.

Frequently Asked Questions about model-pruning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prune a large language model to 50% sparsity without losing accuracy?

Achieve 50% sparsity with minimal accuracy loss by applying one-shot Wanda or SparseGPT pruning to transformer models using PyTorch and Hugging Face Transformers with a calibration dataset.

What's the best way to compress a Llama-2-7b model for faster inference?

Compress Llama-2-7b using Wanda or SparseGPT to reduce redundant weights, halving the memory footprint and accelerating inference with under 1% accuracy degradation.

How does N:M structured pruning work for hardware-accelerated LLM inference?

N:M structured pruning removes weights in hardware-friendly patterns, enabling accelerated inference on NVIDIA tensor cores while maintaining model performance.

Does SparseGPT require fine-tuning after pruning a transformer model?

SparseGPT supports one-shot second-order pruning without retraining, though optional iterative and layer-wise fine-tuning strategies are available to recover accuracy.

Can I apply unstructured pruning to any Hugging Face causal or encoder-decoder model?

Unstructured pruning applies to large transformer-based causal and encoder-decoder models, utilizing pruning hooks and calibration datasets to remove redundant parameters.

Why does model pruning require a calibration dataset?

Calibration datasets guide activation-aware pruning methods like Wanda by providing sample inputs to evaluate weight importance, ensuring minimal accuracy degradation during compression.