PrunaAI/pruna

Pruna is a model optimization framework built for developers, enabling you to deliver faster, more efficient models with minimal overhead.

1,278

stars

356

commits

Python

primary language

Sep 11, 2026

updated

docs.pruna.ai
ai
computer-vision
deep-learning
diffusers
diffusion-models
hacktoberfest
llm
machine-learning
optimization
python
speech-recognition
transformers
Browse cluster: Diffusion Models & Image Generation

README

Pruna AI Logo

Element Simply make AI models faster, cheaper, smaller, greener! Element


Documentation   Try our Performance Models


GitHub License GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Release GitHub commit activity PyPI - Downloads Codacy

Website X (formerly Twitter) URL Devto Reddit Discord Huggingface Replicate


Pruna AI Logo

Pruna Cool Introduction

Pruna is a model optimization framework built for developers, enabling you to deliver faster, more efficient models with minimal overhead. It provides a comprehensive suite of compression algorithms including caching, quantization, pruning, distillation and compilation techniques to make your models:

  • Faster: Accelerate inference times through advanced optimization techniques
  • Smaller: Reduce model size while maintaining quality
  • Cheaper: Lower computational costs and resource requirements
  • Greener: Decrease energy consumption and environmental impact

The toolkit is designed with simplicity in mind - requiring just a few lines of code to optimize your models. It supports various model types including LLMs, Diffusion and Flow Matching Models, Vision Transformers, Speech Recognition Models and more.

Pruna Cool Installation

Pruna is currently available for installation on Linux, MacOS and Windows. However, some algorithms impose restrictions on the operating system and might not be available on all platforms.

Before installing, ensure you have:

  • Python 3.9 or higher
  • Optional: CUDA toolkit for GPU support

Option 1: Install Pruna using pip

Pruna is available on PyPI, so you can install it using pip:

pip install pruna

Option 2: Install Pruna from source

You can also install Pruna directly from source by cloning the repository and installing the package in editable mode:

git clone https://github.com/PrunaAI/pruna.git
cd pruna
pip install -e .

Pruna Cool Quick Start

Getting started with Pruna is easy-peasy pruna-squeezy!

First, load any pre-trained model. Here's an example using Stable Diffusion:

from diffusers import StableDiffusionPipeline
base_model = StableDiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")

Then, use Pruna's smash function to optimize your model. Pruna provides a variety of different optimization algorithms, allowing you to combine different algorithms to get the best possible results. You can customize the optimization process using SmashConfig:

from pruna import smash, SmashConfig

# Create and smash your model
smash_config = SmashConfig(["deepcache", "stable_fast"])
smashed_model = smash(model=base_model, smash_config=smash_config)

Your model is now optimized and you can use it as you would use the original model:

smashed_model("An image of a cute prune.").images[0]

You can then use our evaluation interface to measure the performance of your model:

from pruna.evaluation.task import Task
from pruna.evaluation.evaluation_agent import EvaluationAgent
from pruna.data.pruna_datamodule import PrunaDataModule

datamodule = PrunaDataModule.from_string("LAION256")
datamodule.limit_datasets(10)
task = Task("image_generation_quality", datamodule=datamodule)
eval_agent = EvaluationAgent(task)
eval_agent.evaluate(smashed_model)

This was the minimal example, but you are looking for the maximal example? You can check out our documentation for an overview of all supported algorithms as well as our tutorials for more use-cases and examples.

Pruna Cool Algorithm Overview

Since Pruna offers a broad range of optimization algorithms, the following table provides a high-level overview of all methods available in Pruna. For a detailed description of each algorithm, have a look at our documentation.

TechniqueDescriptionSpeedMemoryQuality
batcherGroups multiple inputs together to be processed simultaneously, improving computational efficiency and reducing processing time.
cacherStores intermediate results of computations to speed up subsequent operations.
compilerOptimizes the model with instructions for specific hardware.
distillerTrains a smaller, simpler model to mimic a larger, more complex model.
quantizerReduces the precision of weights and activations, lowering memory requirements.
prunerRemoves less important or redundant connections and neurons, resulting in a sparser, more efficient network.
recovererRestores the performance of a model after compression.
factorizerFactorization batches several small matrix multiplications into one large fused operation.
enhancerEnhances the model output by applying post-processing algorithms such as denoising or upscaling.
distributerDistributes the inference, the model or certain calculations across multiple devices.
kernelKernels are specialized GPU routines that speed up parts of the computation.

✅ (improves), ➖ (approx. the same), ❌ (worsens)



Pruna AI Logo


Pruna Sad FAQ and Troubleshooting

If you can not find an answer to your question or problem in our documentation, in our FAQs or in an existing issue, we are happy to help you! You can either get help from the Pruna community on Discord, join our Office Hours or open an issue on GitHub.

Pruna Heart Contributors

The Pruna package was made with 💜 by the Pruna AI team and our amazing contributors. Contribute to the repository to become part of the Pruna family!

Contributors

Pruna Emotional Citation

If you use Pruna in your research, feel free to cite the project! 💜

@misc{pruna,
    title = {Efficient Machine Learning with Pruna},
    year = {2023},
    note = {Software available from pruna.ai},
    url={https://www.pruna.ai/}
}

Pruna AI Logo

Contributors

(top 30 of 35)

johannaSommer

74 commits

begumcig

62 commits

gsprochette

43 commits

PrunaAI/pruna

Pruna is a model optimization framework built for developers, enabling you to deliver faster, more efficient models with minimal overhead.

1,278

stars

356

commits

Python

primary language

Sep 11, 2026

updated

docs.pruna.ai
ai
computer-vision
deep-learning
diffusers
diffusion-models
hacktoberfest
llm
machine-learning
optimization
python
speech-recognition
transformers
Browse cluster: Diffusion Models & Image Generation

README

Pruna AI Logo

Element Simply make AI models faster, cheaper, smaller, greener! Element


Documentation   Try our Performance Models


GitHub License GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Release GitHub commit activity PyPI - Downloads Codacy

Website X (formerly Twitter) URL Devto Reddit Discord Huggingface Replicate


Pruna AI Logo

Pruna Cool Introduction

Pruna is a model optimization framework built for developers, enabling you to deliver faster, more efficient models with minimal overhead. It provides a comprehensive suite of compression algorithms including caching, quantization, pruning, distillation and compilation techniques to make your models:

  • Faster: Accelerate inference times through advanced optimization techniques
  • Smaller: Reduce model size while maintaining quality
  • Cheaper: Lower computational costs and resource requirements
  • Greener: Decrease energy consumption and environmental impact

The toolkit is designed with simplicity in mind - requiring just a few lines of code to optimize your models. It supports various model types including LLMs, Diffusion and Flow Matching Models, Vision Transformers, Speech Recognition Models and more.

Pruna Cool Installation

Pruna is currently available for installation on Linux, MacOS and Windows. However, some algorithms impose restrictions on the operating system and might not be available on all platforms.

Before installing, ensure you have:

  • Python 3.9 or higher
  • Optional: CUDA toolkit for GPU support

Option 1: Install Pruna using pip

Pruna is available on PyPI, so you can install it using pip:

pip install pruna

Option 2: Install Pruna from source

You can also install Pruna directly from source by cloning the repository and installing the package in editable mode:

git clone https://github.com/PrunaAI/pruna.git
cd pruna
pip install -e .

Pruna Cool Quick Start

Getting started with Pruna is easy-peasy pruna-squeezy!

First, load any pre-trained model. Here's an example using Stable Diffusion:

from diffusers import StableDiffusionPipeline
base_model = StableDiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")

Then, use Pruna's smash function to optimize your model. Pruna provides a variety of different optimization algorithms, allowing you to combine different algorithms to get the best possible results. You can customize the optimization process using SmashConfig:

from pruna import smash, SmashConfig

# Create and smash your model
smash_config = SmashConfig(["deepcache", "stable_fast"])
smashed_model = smash(model=base_model, smash_config=smash_config)

Your model is now optimized and you can use it as you would use the original model:

smashed_model("An image of a cute prune.").images[0]

You can then use our evaluation interface to measure the performance of your model:

from pruna.evaluation.task import Task
from pruna.evaluation.evaluation_agent import EvaluationAgent
from pruna.data.pruna_datamodule import PrunaDataModule

datamodule = PrunaDataModule.from_string("LAION256")
datamodule.limit_datasets(10)
task = Task("image_generation_quality", datamodule=datamodule)
eval_agent = EvaluationAgent(task)
eval_agent.evaluate(smashed_model)

This was the minimal example, but you are looking for the maximal example? You can check out our documentation for an overview of all supported algorithms as well as our tutorials for more use-cases and examples.

Pruna Cool Algorithm Overview

Since Pruna offers a broad range of optimization algorithms, the following table provides a high-level overview of all methods available in Pruna. For a detailed description of each algorithm, have a look at our documentation.

TechniqueDescriptionSpeedMemoryQuality
batcherGroups multiple inputs together to be processed simultaneously, improving computational efficiency and reducing processing time.
cacherStores intermediate results of computations to speed up subsequent operations.
compilerOptimizes the model with instructions for specific hardware.
distillerTrains a smaller, simpler model to mimic a larger, more complex model.
quantizerReduces the precision of weights and activations, lowering memory requirements.
prunerRemoves less important or redundant connections and neurons, resulting in a sparser, more efficient network.
recovererRestores the performance of a model after compression.
factorizerFactorization batches several small matrix multiplications into one large fused operation.
enhancerEnhances the model output by applying post-processing algorithms such as denoising or upscaling.
distributerDistributes the inference, the model or certain calculations across multiple devices.
kernelKernels are specialized GPU routines that speed up parts of the computation.

✅ (improves), ➖ (approx. the same), ❌ (worsens)



Pruna AI Logo


Pruna Sad FAQ and Troubleshooting

If you can not find an answer to your question or problem in our documentation, in our FAQs or in an existing issue, we are happy to help you! You can either get help from the Pruna community on Discord, join our Office Hours or open an issue on GitHub.

Pruna Heart Contributors

The Pruna package was made with 💜 by the Pruna AI team and our amazing contributors. Contribute to the repository to become part of the Pruna family!

Contributors

Pruna Emotional Citation

If you use Pruna in your research, feel free to cite the project! 💜

@misc{pruna,
    title = {Efficient Machine Learning with Pruna},
    year = {2023},
    note = {Software available from pruna.ai},
    url={https://www.pruna.ai/}
}

Pruna AI Logo

Contributors

(top 30 of 35)

johannaSommer

74 commits

begumcig

62 commits

gsprochette

43 commits

Languages

Python

100.0%