# VainF/Torch-Pruning

[CVPR 2023] DepGraph: Towards Any Structural Pruning; LLMs, Vision Foundation Models, etc.

Repository: https://github.com/VainF/Torch-Pruning
Canonical: https://ross.abutalabs.com/products/torch-pruning
Homepage: https://arxiv.org/abs/2301.12900
Language: Python
License: MIT
License Family: permissive
Topics: pruning, model-compression, efficient-deep-learning, llm, transformers, vision
Last push: 2025-09-07T17:25:20+00:00

## Health v2 (maintenance only)
Score: 50/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 40, release rhythm 34, longevity 100
- inputs: {"age_days": 2453, "days_push": 360, "days_rel": 360, "gap_med": 52.5, "n_releases_24m": 7}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3348, forks 385 (observed 2026-08-28T04:07:57.777836+00:00)

## What it is
Torch-Pruning is a PyTorch framework for structural neural network pruning based on the DepGraph algorithm from CVPR 2023. It automatically groups coupled parameters across arbitrary architectures (CNNs, Transformers, LLMs, etc.) and physically removes them to compress and accelerate models.

## Use cases
- prune a pytorch model to make it faster and smaller
- compress large language models with structural pruning
- prune huggingface transformers or timm models
- remove channels from a resnet or vision transformer
- speed up inference by slimming yolov8 or sam models
- compare pruning criteria like magnitude or taylor on my network

## When to choose
- you need architecture-agnostic structural pruning that physically removes parameters rather than masking them
- you want to prune modern architectures like ViTs, LLMs, diffusion models, or detection models
- you need a research-grade toolkit with many ready-made pruning examples

## When to avoid
- you only need unstructured sparsity or weight masking, which torch.nn.utils.prune already covers
- you need post-training quantization or distillation rather than pruning
- you work outside PyTorch, e.g. TensorFlow or JAX

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, deep-learning, developer-tools
- domain: deep-learning, machine-learning, computer-vision, large-language-models
- platform: python, cross-platform
- tags: pruning, model-compression, pytorch, depgraph, structural-pruning, model-acceleration, transformers, llm, gpu

## Member repositories
- VainF/Torch-Pruning (main) score 50

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:57.777836+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:40:59.293165+00:00, confidence not recorded.
  - readme: https://github.com/VainF/Torch-Pruning (fetched 2026-08-28T04:07:57.777836+00:00, sha 39ac051e1713)
  - homepage: https://arxiv.org/abs/2301.12900 (fetched 2026-08-29T09:34:15.941348+00:00, sha 7abb31cdc08a)
  - site_page: https://info.arxiv.org/about/donate.html (fetched 2026-08-29T09:34:15.950570+00:00, sha cca9c3a11c56)
  - site_page: https://info.arxiv.org/about/ourmembers.html (fetched 2026-08-29T09:34:15.954796+00:00, sha 47cbc55ff1de)
  - site_page: https://info.arxiv.org/about (fetched 2026-08-29T09:34:15.957558+00:00, sha a1f16f915a9a)
  - registry_pypi: https://pypi.org/pypi/torch-pruning/json (fetched 2026-08-29T09:34:15.959452+00:00, sha fd5940584618)
  - site_page: https://info.arxiv.org/labs/index.html (fetched 2026-08-29T09:34:15.952324+00:00, sha b14a8d05a0ec)
- Data as of 2026-08-30T08:39:29.467469+00:00.
