torchtune
A native-PyTorch library for LLM fine-tuning
What it is and what it does
torchtune is a native-PyTorch library that provides end-to-end support for fine-tuning and post-training large language models. It bundles PyTorch implementations of popular models (Llama, Gemma, Mistral, Phi, Qwen) with YAML-configurable training recipes covering the full post-training lifecycle: supervised fine-tuning, knowledge distillation, reinforcement learning methods (DPO, PPO, GRPO), and quantization-aware training. It supports single-device, multi-device, and multi-node training with various weight-update strategies including full fine-tuning and LoRA/QLoRA.
The library targets researchers and practitioners who need to adapt pre-trained models to specific tasks or domains. It abstracts away low-level PyTorch complexity while exposing configuration through YAML, allowing users to experiment with different training methods and model sizes without rewriting training loops. Dependencies include data-loading libraries (torchdata, datasets, huggingface_hub), tokenizers (sentencepiece, tiktoken, tokenizers), and utility packages (omegaconf, psutil, Pillow) to support model loading, preprocessing, and monitoring.
Use it for:
- Fine-tune models on custom datasets using LoRA to reduce memory requirements on a single GPU.
- Perform knowledge distillation to compress a large teacher model into a smaller student model using LoRA on distributed hardware.
- Apply DPO to align model outputs with human preferences using multi-device training.
- Run quantization-aware training on distributed nodes to produce efficient inference-ready models.
- Experiment with different post-training methods via config swaps without rewriting training code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
torchtune is a PyTorch library for fine-tuning, post-training, and experimenting with large language models using recipes for SFT, knowledge distillation, DPO, PPO, GRPO, and quantization-aware training.
Yes. torchtune is actively maintained (latest release April 2025), has no known vulnerabilities, low install friction, and a permissive BSD license. It is purpose-built for LLM fine-tuning with broad recipe coverage and model support. Install if you need to fine-tune or post-train language models; skip if you only need inference or work exclusively with models outside its supported set.
Install
torchtune on PyPI
pip
pip install torchtuneuv
uv add torchtunepoetry
poetry add torchtuneInstalling torchtune
Before you install
Low install friction; pure Python wheel with 14 runtime dependencies including PyTorch ecosystem packages and tokenization libraries. Active maintenance with latest release in April 2025 and 5797 GitHub stars.
License in practice
BSD 3-Clause permissive license allows commercial and private use with attribution and liability disclaimer; no restrictions on derivative works or redistribution.
Quickstart
pip install torchtune
from torchtune.models.llama3_2 import llama3_2
# Configure and run a training recipe via CLI:
# tune run lora_finetune_single_device --config llama3_2/3B_lora_single_device
Requires Python >=3.9 and PyTorch with CUDA support for GPU training; model weights must be downloaded from huggingface_hub or kagglehub.
Verify before relying
- Whether all 14 runtime dependencies are required for basic usage or if subsets suffice for specific recipes.
- Specific hardware requirements or CUDA version constraints not documented in the fact sheet.
- Production-readiness and performance characteristics of multi-node training beyond the February 2025 announcement.
Package facts
| License | BSD 3-Clause License Copyright 2024 Meta Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1.… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 14 — torchdata, datasets, huggingface_hub, safetensors, kagglehub, sentencepiece, tiktoken, blobfile, tokenizers, numpy, tqdm, omegaconf, psutil, Pillow |
| Maintenance | actively maintained — 494 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 329,013/month — #7,548 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: torchtune-0.6.1-py3-none-any.whl
Keywords: pytorch, finetuning, llm
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
torchtitantorchtitan is a PyTorch-native platform for…
permissive · top 15,000 on PyPI
tinker_cookbookTinker Cookbook provides recipes and…
permissive · top 15,000 on PyPI
torchaoTorchAO applies quantization and sparsity…
unclear · top 5,000 on PyPI
unsloth-zooUnsloth Zoo provides utilities for fine-tuning…
copyleft · top 5,000 on PyPI
lightningLightning is a framework that organizes PyTorch…
permissive · top 5,000 on PyPI
trlTRL provides trainer classes for post-training…
permissive · top 5,000 on PyPI
speechbrainSpeechBrain is a PyTorch-based toolkit for…
permissive · top 5,000 on PyPI
torchtexttorchtext provides text datasets, preprocessing…
permissive · top 15,000 on PyPI
trainerTrainer is a PyTorch model training framework…
permissive · top 15,000 on PyPI
torchaudioProvides PyTorch-based audio processing,…
permissive · top 5,000 on PyPI