model-pruning

Reduces LLM size and accelerates inference using pruning techniques like Wanda and SparesGPT.

1|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/informatico-madrid/Architect-Expert-Gap-Forge --skill model-pruning-informatico-madrid
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-pruning
Source: https://github.com/informatico-madrid/Architect-Expert-Gap-Forge/tree/main/.github/skills/model-pruning
Command: npx skills add https://github.com/informatico-madrid/Architect-Expert-Gap-Forge --skill model-pruning-informatico-madrid

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires transformers, torch, accelerate, datasets, lm_eval, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the need to reduce the size and computational cost of Large Language Models (LLMs) for efficient deployment and faster inference, especially on resource-constrained hardware.

Core Features & Use Cases

  • Model Compression: Reduce LLM size by 40-60% with minimal accuracy loss using techniques like Wanda and SparseGPT.
  • Inference Acceleration: Achieve faster inference times (2-4x speedup) through hardware-friendly sparsity patterns (N:M).
  • Deployment on Edge Devices: Enable LLM deployment on mobile or edge devices with limited memory and processing power.
  • Use Case: Compress a large Llama-2 7B model to 50% sparsity using Wanda pruning to enable faster response times in a real-time chatbot application.

Quick Start

Use the model-pruning skill to compress the 'meta-llama/Llama-2-7b-hf' model to 50% sparsity using the Wanda method.

Frequently Asked Questions about model-pruning

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

FAQPage Schema
How do I compress an LLM for faster inference without retraining?

Pruning an LLM without retraining is possible using one-shot methods like Wanda and SparseGPT. These techniques achieve high sparsity, such as 50%, with minimal accuracy degradation, reducing model size and computational cost for efficient deployment on resource-constrained hardware.

What is the difference between Wanda and SparseGPT for model pruning?

Wanda and SparseGPT are both one-shot pruning methods for LLMs. Wanda prunes weights based on magnitude and input activations, while SparseGPT uses a sparse regression approach to compress models. Both achieve high sparsity without retraining, but differ in their internal pruning mechanisms.

Can I use N:M sparsity patterns to accelerate inference on hardware accelerators?

Yes, you can use N:M sparsity patterns to accelerate inference on hardware accelerators. These hardware-friendly sparsity patterns enable 2-4x inference speedups by structuring the sparsity to match accelerator capabilities, making them ideal for real-time applications like chatbots.

How much accuracy loss should I expect when pruning a Llama-2 7B model to 50% sparsity?

When pruning a Llama-2 7B model to 50% sparsity using Wanda, you should expect minimal accuracy degradation. The method is designed to preserve model performance while cutting size in half, enabling faster response times in applications like real-time chatbots.

Does model pruning support both structured and unstructured sparsity for edge deployment?

Yes, model pruning supports both structured and unstructured sparsity, alongside N:M and magnitude pruning. This flexibility enables LLM deployment on mobile or edge devices with limited memory and processing power by tailoring the sparsity pattern to specific hardware constraints.

What dependencies do I need to run LLM pruning scripts with PyTorch and transformers?

To run LLM pruning scripts, you need PyTorch, transformers, accelerate, datasets, and lm_eval. These dependencies provide the foundational model loading, acceleration utilities, evaluation datasets, and benchmarking frameworks required to execute and assess the pruning workflow.