model-pruning

Prune LLMs with Wanda and SparseGPT to reduce size and accelerate inference.

2|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/zhuangbiaowei/smart_bot --skill model-pruning-zhuangbiaowei
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-pruning
Source: https://github.com/zhuangbiaowei/smart_bot/tree/main/skills/model-pruning
Command: npx skills add https://github.com/zhuangbiaowei/smart_bot --skill model-pruning-zhuangbiaowei

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 challenge of large, computationally expensive Large Language Models (LLMs) by reducing their size and speeding up inference times without significant accuracy loss.

Core Features & Use Cases

  • Model Compression: Reduce LLM size by 40-60% using techniques like Wanda and SparseGPT.
  • Inference Acceleration: Achieve faster inference speeds (2-4x) through hardware-friendly sparsity.
  • Deployment on Constrained Hardware: Enable LLM deployment on devices with limited memory and processing power.
  • Use Case: Deploy a large language model on an edge device for real-time natural language processing by first pruning it to reduce its memory footprint and computational requirements.

Quick Start

Use the model-pruning skill to compress the '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 a large language model for faster inference?

Compress a large language model for faster inference by applying advanced pruning techniques like Wanda and SparseGPT. These methods reduce model size by 40-60% and accelerate inference speeds by 2-4x without significant accuracy loss.

What is the best way to prune an LLM without retraining?

The best way to prune an LLM without retraining is using one-shot compression methods. This skill supports one-shot compression via Wanda and SparseGPT, enabling significant model size reduction without the need for iterative fine-tuning.

How does N:M sparsity accelerate LLM inference on constrained hardware?

N:M sparsity accelerates LLM inference on constrained hardware by creating hardware-friendly sparsity patterns. This structured pruning approach reduces memory footprint and computational requirements, enabling deployment on edge devices for real-time processing.

Can I use Wanda and SparseGPT to achieve unstructured and structured pruning?

Yes, you can use Wanda and SparseGPT to achieve both unstructured and structured pruning. The skill supports both methods, offering hardware-friendly N:M sparsity patterns alongside unstructured compression for optimal accuracy.

Do I need PyTorch and Hugging Face Transformers to prune a llama-2-7b model?

Yes, you need PyTorch and Hugging Face Transformers to prune a llama-2-7b model. The skill relies on dependencies including torch, transformers, accelerate, and datasets to execute the model compression and evaluate accuracy.

What are the limitations of using one-shot LLM pruning for edge deployment?

A limitation of one-shot LLM pruning for edge deployment is the potential for accuracy degradation compared to iterative approaches with fine-tuning. While one-shot compression avoids retraining, iterative methods deliver optimal accuracy for resource-constrained hardware.