Agent skill
unsloth-quantization
Install this agent skill to your Project
npx add-skill https://github.com/cuba6112/skillfactory/tree/main/skills/unsloth-quantization
SKILL.md
Overview
Unsloth utilizes advanced quantization techniques to reduce the memory footprint of LLM fine-tuning. This includes "Dynamic 4-bit" loading (protecting sensitive layers), FP8 training for modern GPUs, and the use of 8-bit optimizers to save gigabytes of VRAM.
When to Use
- When training on GPUs with limited VRAM (e.g., 8GB, 12GB, or 16GB).
- When aiming for the fastest possible training speeds on H100 or RTX 40 series GPUs.
- When trying to balance model size and reasoning performance.
Decision Tree
- Is your GPU RTX 40 series or newer (Ada/Hopper)?
- Yes: Use FP8 Dynamic for 2x faster training.
- No: Use BF16/FP16.
- Running out of VRAM?
- Yes: Ensure
load_in_4bit=Trueand useadamw_8bitoptimizer.
- Yes: Ensure
- Is accuracy dropping significantly?
- Yes: Use "Dynamic" variants that protect the first and last layers.
Workflows
FP8 Training Configuration
- Select a model variant ending in '-FP8-Dynamic'.
- Configure the trainer to use the FP8 backend (available for H100 and Ada Lovelace architectures).
- Verify speedup, which typically reaches 2x compared to standard BF16.
VRAM-Constrained Training Setup
- Set
load_in_4bit=Trueanduse_gradient_checkpointing='unsloth'. - Apply 'adamw_8bit' optimizer in
TrainingArguments. - Set
per_device_train_batch_sizeto 1 and maximizegradient_accumulation_steps.
Non-Obvious Insights
- Unsloth's "Dynamic 4-bit" (unsloth-bnb-4bit) differs from standard BNB 4-bit by protecting the first and last layers, which are critical for reasoning and output quality.
- Quantization-Aware Training (QAT) is implicitly supported through Unsloth's specialized kernels, allowing the model to adapt to the lower precision during the LoRA update process.
- Switching to the
adamw_8bitoptimizer can save up to 2GB of VRAM on optimizer states alone for a 7B parameter model.
Evidence
- "load_in_4bit = True – Enables 4-bit quantization, reducing memory use 4× for fine-tuning." Source
- "FP8 Dynamic offers slightly faster training and lower VRAM usage than FP8 Block." Source
Scripts
scripts/unsloth-quantization_tool.py: Script to check GPU compatibility and suggest quantization settings.scripts/unsloth-quantization_tool.js: Memory usage estimator for different quantization levels.
Dependencies
- unsloth
- bitsandbytes
- torch
References
- [[references/README.md]]
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
prompt-engineering
Comprehensive prompt engineering techniques for Claude models. Use this skill when crafting, optimizing, or debugging prompts for Claude API, Claude Code, or any Claude-powered application. Covers system prompts, role prompting, multishot examples, chain of thought, XML structuring, long context handling, extended thinking, prompt chaining, Claude 4.x-specific best practices, and agentic orchestration including subagents, agent loops, skills, MCP integration, and multi-agent workflows.
adk-rag-agent
Build RAG (Retrieval-Augmented Generation) agents with Google ADK and Vertex AI RAG Engine. Use when implementing document Q&A, knowledge base search, or citation-backed responses. Covers VertexAiRagRetrieval tool, corpus setup, and citation formatting.
headless-cli-agents
Build agentic systems using Claude CLI in headless mode or the Claude Agent SDK. Use when building automation pipelines, CI/CD integrations, multi-agent orchestration, or programmatic Claude interactions. Covers CLI flags (-p, --output-format), session management (--resume, --continue), Python SDK (claude-agent-sdk), custom tools, and agent loop patterns.
notion-knowledge-capture
Capture conversations and decisions into structured Notion pages; use when turning chats/notes into wiki entries, how-tos, decisions, or FAQs with proper linking.
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
gh-fix-ci
Inspect GitHub PR checks with gh, pull failing GitHub Actions logs, summarize failure context, then create a fix plan and implement after user approval. Use when a user asks to debug or fix failing PR CI/CD checks on GitHub Actions and wants a plan + code changes; for external checks (e.g., Buildkite), only report the details URL and mark them out of scope.
Didn't find tool you were looking for?