ARahim3/mlx-tune
Apple MLX fine-tuning with an Unsloth-style API for local model development
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
mlx-tune is a Python training library, not an inference service. Model wrappers such as FastLanguageModel, FastVisionModel, and FastSTTModel handle model and tokenizer or processor setup, while task-specific trainers define the training objective. A text SFT job loads a supported checkpoint, attaches LoRA with get_peft_model, prepares examples with chat templates or response-only masking, runs SFTTrainer, then saves adapters or merged weights.
Training runs natively on MLX rather than CUDA/Triton. The dependency list includes mlx>=0.20.0, mlx-lm>=0.18.0, Transformers, Tokenizers, Datasets, and Hugging Face Hub. The Python API is the integration surface: model wrappers, trainer/config pairs, and helpers such as UnslothVisionDataCollator let a training script select the right data and model path. The source tree separates the mlx_tune/ package from examples/, docs/, and tests/.
Key Capabilities & Differentiators
Text training covers SFT, DPO, ORPO, KTO, SimPO, multi-generation GRPO, and continual pretraining through CPTTrainer. The same language-model wrapper handles supported dense and MoE checkpoints; MoE-aware LoRA can target SwitchLinear expert layers in families such as Qwen3.5-MoE and Phi-3.5-MoE. Multimodal paths include VLM SFT and GRPO, Whisper and Parakeet TDT speech recognition, Orpheus and Qwen3-TTS speech synthesis, and OCR with character and word error rates plus exact match. Embedding training uses InfoNCE and exposes mean, CLS, and last-token pooling.
The v0.6.0 JEPA paths serve different purposes: LeJEPA trains a vision transformer from scratch with SIGReg, I-JEPA supports frozen-backbone, LoRA, or full fine-tuning for classification, and V-JEPA 2 exposes clip features, classification, and masked-latent prediction. LLMJEPATrainer adds a paired-view alignment term to next-token prediction while retaining a standard LoRA artifact. Export is a separate concern: supported paths include adapter-only saves, merged weights, and GGUF subject to base-model and conversion constraints.
Trade-offs & Limitations
The strongest reason to adopt mlx-tune is to prototype locally on a Mac while keeping an Unsloth-style script for a later CUDA run. Original Unsloth is the direct alternative on NVIDIA hardware. The two backends are different despite the familiar API: validate trainer arguments, data formatting, and saved artifacts on both sides before assuming portability, throughput parity, or numerical equivalence. Unified memory makes local experimentation practical, but sequence length, batch size, and GRPO rollouts can make a job that loads successfully too large to train.
Export can determine which checkpoint to start with. A 4-bit base supports QLoRA and adapter saves, but direct GGUF export from that base is blocked by the mlx-lm conversion path. The default merged_16bit dequantizes before fusion, requiring more memory and storage than a quantized artifact. merged_4bit is smaller but can round away a small LoRA update. If GGUF is mandatory, choose a supported non-quantized base and test conversion early; if inference stays on MLX, an adapter or merged MLX checkpoint avoids GGUF conversion.
Hardware & Deployment Guide
The baseline is an Apple Silicon Mac (M1–M5), macOS 13.0+, and Python 3.9+. Install with pip install mlx-tune or uv pip install mlx-tune; TTS and STT use the mlx-tune[audio] extra and system ffmpeg for audio codecs. Training executes in the local Python process, without a hosted training API. For an offline workflow, stage the required model, tokenizer or processor, and dataset files ahead of time and verify local loading before disconnecting.
The minimum is 8 GB of unified memory, with 16 GB or more recommended. Size for the chosen checkpoint, sequence length, batch size, and any generation or export step. v0.5.0 improved trainer performance and recorded an ORPO configuration at 4,096 context on a 48 GB Mac; that is not a general capacity guarantee. v0.5.1 addressed a merge bug that could make a reloaded 4-bit-base fine-tune behave like the original model. With v0.6.0 adding JEPA, pin a tested dependency set and make a fresh-process reload part of artifact acceptance.
mlx-lm in the language-model stack and FastLanguageModel as the Unsloth-style entry point.SwitchLinear expert layers; vision LoRA exposes separate controls for vision and language layers.FastJEPAModel, FastVideoJEPAModel, and LLMJEPATrainer; LLM-JEPA produces a standard LoRA artifact.Teams and researchers prototyping language or multimodal fine-tuning on Apple Silicon, validating data and adapter behavior locally, and optionally moving larger text-training jobs to Unsloth on CUDA.
You need a production inference server, train exclusively on NVIDIA, or must export GGUF directly from a 4-bit base checkpoint.
Quick Start & Installation
# Using uv (recommended - faster and more reliable) uv pip install mlx-tune # With audio support (TTS/STT fine-tuning) uv pip install 'mlx-tune[audio]' brew install ffmpeg # system dependency for audio codecs # Or using pip pip install mlx-tune # From source (for development) git clone https://github.com/ARahim3/mlx-tune.git cd mlx-tune uv pip install -e .
Comparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| mlx-tune ★ | 1.5k | +7 | Python | Apache-2.0 | Apple MLX fine-tuning with an Unsloth-style API for local model development |
| LlamaFactory | 76.4k | +86 | Python | Apache-2.0 | A unified Python framework for LLM and VLM fine-tuning with pluggable inference |
| peft | 21.9k | +32 | Python | Apache-2.0 | Python/PyTorch adapters for fine-tuning large models without updating base weigh |
| minimind | 75.4k | +3.1k | Python | Apache-2.0 | Native PyTorch dense and MoE models for end-to-end LLM training on local GPUs |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/ARahim3/mlx-tune.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about mlx-tune
How much of an existing Unsloth script can I reuse?
mlx_tune counterparts. For SFT, the familiar flow is FastLanguageModel.from_pretrained, get_peft_model, then SFTTrainer. Before scaling up, run a small job on both backends and verify chat formatting, response masking, trainer options, and checkpoint reloads. A familiar API is not a guarantee of identical behavior.How much unified memory should I budget?
Can a company use mlx-tune internally or distribute its outputs?
When should I choose mlx-tune over Unsloth, Ollama, or llama.cpp?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy