What is MLX-Tune?
MLX-Tune is a Python library for fine-tuning models locally on Apple Silicon Macs (M1 through M5). It wraps Apple's MLX framework in an API that mirrors Unsloth and TRL: you load a model with FastLanguageModel, add LoRA adapters with get_peft_model, and train with SFTTrainer. It sits in the Fine-Tuning Frameworks category of the Training & Fine-Tuning tools and is open-source, written in Python and licensed Apache-2.0.
Overview
MLX-Tune is a Python library for fine-tuning models locally on Apple Silicon Macs (M1 through M5). It wraps Apple's MLX framework in an API that mirrors Unsloth and TRL: you load a model with FastLanguageModel, add LoRA adapters with get_peft_model, and train with SFTTrainer. The stated goal is code portability — write a training script on a Mac, test it with small datasets, then run the same script on a CUDA cluster with the original Unsloth by swapping the imports. The project was originally published as unsloth-mlx and was renamed because it is an unofficial community project, not affiliated with Unsloth AI or Apple.
Does Unsloth run on Apple Silicon? Unsloth's requirements page lists the original Unsloth Core library for Linux and Windows with NVIDIA, AMD and Intel GPUs, and still says Apple Silicon/MLX support is "in the works". Unsloth's separate Studio app does list macOS support for training and MLX inference. MLX-Tune is the community route for running Unsloth-style scripts (FastLanguageModel, SFTTrainer) natively on a Mac today, with the same imports you would use on a CUDA machine.
Beyond text LLMs it covers a wide range of model types: vision-language models through mlx-vlm, text-to-speech (Orpheus, OuteTTS, Spark-TTS, Sesame/CSM, Qwen3-TTS), speech-to-text (Whisper, Moonshine, Qwen3-ASR, Canary, Voxtral, Parakeet TDT), sentence-embedding models trained with InfoNCE, dedicated OCR models with built-in CER/WER metrics, Mixture-of-Experts models with per-expert LoRA, and continual pretraining on raw text. Version 0.6.0 added a JEPA family — LeJEPA pretraining, Meta's I-JEPA and V-JEPA 2 encoders, and an LLM-JEPA trainer.
Trained models can be saved as LoRA adapters, merged into a 16-bit model, exported to GGUF for Ollama and llama.cpp, converted from Hugging Face to MLX format, or pushed to the Hugging Face Hub. The README documents known limitations, notably that GGUF export does not work directly from a 4-bit quantized base model (an mlx-lm limitation) and lists workarounds.
What it does
- Unsloth-compatible API — FastLanguageModel, get_peft_model and SFTTrainer with the same call shapes, so scripts move between Mac and CUDA by changing imports
- Native MLX trainers for SFT, DPO, ORPO, GRPO, KTO and SimPO, plus Vision GRPO and OCR GRPO
- Vision-language, text-to-speech, speech-to-text, embedding and OCR fine-tuning through dedicated FastVisionModel, FastTTSModel, FastSTTModel, FastEmbeddingModel and FastOCRModel classes
- Mixture-of-Experts fine-tuning that detects MoE layers and applies per-expert LoRA automatically
- Continual pretraining with CPTTrainer, including decoupled embedding learning rate and full-weight mode
- Chat templates and response-only training via get_chat_template and train_on_responses_only
- Export to LoRA adapters, merged 16-bit weights, GGUF, MLX format, or the Hugging Face Hub
Getting started
MLX-Tune needs an Apple Silicon Mac running macOS 13.0 or later, Python 3.9+, and 8GB of unified memory (16GB recommended). It installs from PyPI.
Install the package
The project recommends uv. Audio (TTS/STT) fine-tuning needs the audio extra and ffmpeg.
uv pip install mlx-tune
# With audio support (TTS/STT fine-tuning)
uv pip install 'mlx-tune[audio]'
brew install ffmpegLoad a model and add LoRA adapters
Any Hugging Face model works; the quick start uses a 4-bit 1B Llama from mlx-community.
from mlx_tune import FastLanguageModel, SFTTrainer, SFTConfig
from datasets import load_dataset
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="mlx-community/Llama-3.2-1B-Instruct-4bit",
max_seq_length=2048,
load_in_4bit=True,
)
model = FastLanguageModel.get_peft_model(
model,
r=16,
target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
lora_alpha=16,
)Train with SFTTrainer
The trainer takes the same arguments as TRL's SFTTrainer.
dataset = load_dataset("yahma/alpaca-cleaned", split="train[:100]")
trainer = SFTTrainer(
model=model,
train_dataset=dataset,
tokenizer=tokenizer,
args=SFTConfig(
output_dir="outputs",
per_device_train_batch_size=2,
learning_rate=2e-4,
max_steps=50,
),
)
trainer.train()Save the result
Save adapters only, a merged 16-bit model, or GGUF. GGUF export needs a non-quantized base model or dequantize=True.
model.save_pretrained("lora_model") # Adapters only
model.save_pretrained_merged("merged", tokenizer) # Full model (16-bit)
model.save_pretrained_gguf("model", tokenizer) # GGUFCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Prototype a fine-tuning pipeline on a MacBook before paying for cloud GPUs, then run the same script with Unsloth on NVIDIA hardware
- Adapt a Whisper, Parakeet or other speech-to-text model to a new domain or language entirely on a Mac
- Fine-tune an embedding model on anchor-positive pairs to improve semantic search for a specific corpus
- Train a small LoRA on a local model and export it to GGUF for use in Ollama or llama.cpp
How MLX-Tune compares
MLX-Tune alongside other open-source fine-tuning frameworks tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Unsloth | ★ 80.5k | A library that speeds up LoRA and QLoRA fine-tuning while cutting memory use, aimed at training models on a single GPU. |
| LLaMA-Factory | ★ 76.3k | An end-to-end training suite with a web UI that covers pre-training, supervised fine-tuning, and RLHF for hundreds of LLMs and multimodal models. |
| PEFT | ★ 21.9k | Hugging Face's library of parameter-efficient fine-tuning methods such as LoRA, DoRA, and prompt tuning that train small adapters instead of full models. |
| FinGPT | ★ 21.7k | FinGPT is an open-source project of financial LLMs, fine-tuned with LoRA on news and tweet data for tasks like sentiment analysis, relation extraction, and stock-move forecasting. |
| ms-swift | ★ 16.2k | ModelScope's framework for fine-tuning and deploying 600+ LLMs and 300+ multimodal models, supporting PEFT and full-parameter SFT, DPO, and GRPO. |
| LitGPT | ★ 13.8k | An open-source toolkit from Lightning AI to pretrain, finetune, and serve 20+ large language models, each written from scratch for speed and full control. |
| Axolotl | ★ 12.8k | A config-driven tool for fine-tuning and post-training open LLMs that supports SFT, LoRA/QLoRA, DPO, GRPO, and multi-GPU training across many model families. |
| MLX-Tune | ★ 1.5k | Fine-tune LLMs, vision, speech, embedding and OCR models on an Apple Silicon Mac, with an Unsloth-compatible API built on MLX |
