model-pruning

Prune LLMs with Wanda and SparseGPT for reduced size and faster inference.

3|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/ihatesea69/HieuNghi-AI-Skills --skill model-pruning-ihatesea69
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-pruning
Source: https://github.com/ihatesea69/HieuNghi-AI-Skills/tree/main/airesearch_skills/19-emerging-techniques/model-pruning
Command: npx skills add https://github.com/ihatesea69/HieuNghi-AI-Skills --skill model-pruning-ihatesea69

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires transformers, torch, accelerate, 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 enabling their compression and acceleration through advanced pruning techniques, making them more efficient for deployment.

Core Features & Use Cases

  • Model Compression: Significantly reduce LLM size (e.g., 50% sparsity) with minimal accuracy loss.
  • Inference Acceleration: Achieve faster inference times, especially on hardware accelerators, by leveraging structured sparsity.
  • Deployment on Constrained Hardware: Enable LLMs to run on devices with limited memory and processing power.
  • Use Case: You have a large Llama-2 7B model that needs to be deployed on edge devices with limited VRAM. Use this skill to prune the model to 50% sparsity using Wanda, reducing its size and speeding up inference without a significant drop in performance.

Quick Start

Use the model-pruning skill to prune 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 prune a large language model for inference acceleration without retraining?

Prune a large language model without retraining using one-shot methods like Wanda and SparseGPT to achieve high sparsity levels with minimal accuracy degradation. This directly reduces model size and boosts inference speed on hardware accelerators.

What is the difference between unstructured pruning and N:M sparsity for LLM compression?

Unstructured pruning removes individual weights anywhere in the LLM, while N:M sparsity enforces a fixed ratio of zero weights per block. Both compression methods are supported, though structured sparsity and N:M formats better accelerate inference on hardware accelerators.

Can I deploy a pruned Llama-2 7B model on edge devices with limited VRAM?

Yes, you can deploy a large Llama-2 7B model on edge devices with limited VRAM by pruning it to 50% sparsity using Wanda. This compression significantly reduces memory requirements and speeds up inference without a significant performance drop.

Does model pruning with Wanda work with PyTorch and Transformers?

Model pruning with Wanda works directly with PyTorch and Transformers, utilizing the accelerate library for hardware optimization. This allows you to apply magnitude pruning and one-shot sparsity techniques to your existing LLM workflows.

What are the limitations of one-shot pruning methods like SparseGPT for model compression?

One-shot pruning methods like SparseGPT achieve high sparsity without retraining, but extreme compression levels may still cause accuracy degradation. Balancing the desired sparsity ratio against acceptable performance loss is necessary when deploying to constrained hardware.