model-optimization

Quantize, prune, and convert ML models to TensorRT, TFLite, and ONNX.

2|Updated Jan 31, 2026
One-click install
npx skills add https://github.com/michaelalber/ai-toolkit --skill model-optimization-michaelalber
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-optimization
Source: https://github.com/michaelalber/ai-toolkit/tree/main/skills/model-optimization
Command: npx skills add https://github.com/michaelalber/ai-toolkit --skill model-optimization-michaelalber

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of preparing machine learning models for deployment on resource-constrained edge devices by optimizing their size, latency, and memory footprint.

Core Features & Use Cases

  • Quantization: Convert models to lower precision (FP16, INT8) to reduce size and speed up inference.
  • Format Conversion: Transform models into edge-optimized formats like TensorRT, TFLite, and ONNX.
  • Benchmarking: Accurately measure accuracy and latency before and after optimization to ensure performance targets are met.
  • Use Case: Deploying a computer vision model on a Raspberry Pi requires reducing its size and inference time. This Skill can quantize the model to INT8 and convert it to TFLite format, making it suitable for the Pi's limited resources.

Quick Start

Optimize the attached PyTorch model 'resnet50.pt' for a Jetson Nano using TensorRT INT8 quantization.

Frequently Asked Questions about model-optimization

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

FAQPage Schema
How do I optimize a PyTorch model for edge deployment on a Jetson Nano?

To optimize a PyTorch model for edge deployment on a Jetson Nano, you can apply INT8 quantization and convert the model to TensorRT format, reducing its size and inference latency to meet hardware constraints.

What is the best way to reduce machine learning model size for a Raspberry Pi?

The best way to reduce model size for a Raspberry Pi is through quantization to lower precision like INT8 and converting the model to TFLite format, significantly decreasing memory footprint and inference time.

How does INT8 quantization affect model accuracy during edge deployment?

INT8 quantization reduces model size and speeds up inference for edge deployment, but requires precise calibration data to maintain accuracy. The optimization process benchmarks accuracy before and after to ensure performance targets are met.

Can I convert models to ONNX and TFLite for edge hardware without losing performance?

Yes, converting models to ONNX and TFLite optimizes them for edge hardware. The process benchmarks latency and accuracy on target devices, ensuring the converted models meet strict resource constraints without losing performance.

Do I need calibration data to quantize a model to FP16 or INT8?

Yes, precise calibration data is required to quantize a model to FP16 or INT8. Adhering to strict optimization principles with accurate calibration data ensures reproducible results and minimizes accuracy loss.