Ask AI about this guideAsk AI:
Guide

How to Fine-Tune a Small Model for On-Device Use in 2026: Models, Tools and Costs

Choose a small base model, fine-tune it with LoRA on a free Colab or a cheap GPU, convert it to GGUF or MLX, and run it on a laptop or phone. Eleven tools, VRAM by size and method, and cost examples with the arithmetic shown. Prices and numbers are dated as of Nov 26, 2026.

Logos of Unsloth, Hugging Face TRL, Axolotl, MLX LM, llama.cpp, Ollama, ExecuTorch, LiteRT-LM, Together AI, Tinker and Liquid LEAP SDK, the tools compared in this guide
The eleven tools covered here, from training libraries to phone runtimes.

Get the latest on AI, LLMs & developer tools

New MCP servers, model updates, and guides like this one — delivered weekly.

The Short Answer

You want a model that answers fast, works offline and keeps user data on the device, and a general chat model is either too big or too vague for the job. The usual fix is to take a 0.8B to 4B open model, teach it your format or task with a few thousand examples, shrink it to a 4-bit file and run it locally. In 2026 that is a one-afternoon project, and it can cost nothing on a free Colab GPU.

Short version, as of Nov 26, 2026: start from Gemma 4 E2B, Qwen3.5 (0.8B to 9B) or LFM3-1.7B; train a LoRA adapter with Unsloth (NVIDIA or free Colab) or MLX LM (Mac); merge it, convert it with llama.cpp to a Q4_K_M GGUF, and run it in Ollama on a laptop or in LiteRT-LM, ExecuTorch or a llama.cpp build on a phone. If you would rather not touch GPUs, Together AI and Tinker sell the training step per token, from $4.00 per job. Check the licence before you pick: the Liquid LFM models are free only for companies under $10M annual revenue.

This guide is the on-device companion to our best fine-tuning and post-training platforms roundup. That post compares cloud platforms for any model size. This one is narrower: models small enough to ship inside an app, and the tools that get them there.

Video: "How to build on-device AI with Gemma 4" from the Android Developers channel (title and channel confirmed through YouTube oEmbed; we did not audit the full content). Gemma 4 E2B and E4B are the edge-sized models used in the walkthrough below.

Quick Picks

Each row is a recommendation for one job, backed by the tables later in the guide.

GoalPickWhy (evidence)
Best free path to a first resultUnsloth on a free Colab notebookOfficial Gemma 4 E2B and Qwen3.5 0.8B/2B/4B notebooks run on free Colab GPUs. Unsloth lists about 8 GB VRAM for Gemma 4 E2B and about 3 GB (bf16 LoRA) for Qwen3.5-0.8B.
Best on a MacMLX LM (mlx_lm.lora)One command trains LoRA, DoRA or full weights on Apple silicon, and supports qwen3_5, gemma4, lfm2 and smollm3 model code in the repo.
Best for repeatable multi-GPU recipesAxolotl or Hugging Face TRLYAML configs (Axolotl) or plain Python (TRL), both Apache-2.0, both with Gemma 4 and Qwen3.5 support.
Best way to run the result on a laptopllama.cpp, then OllamaGGUF plus llama-quantize is the common export. Ollama wraps a GGUF file in one command.
Best for Android and cross-platform appsLiteRT-LMStable Python, Kotlin and C++ APIs, a .litertlm package format, and Gemma 4 E2B/E4B builds.
Best for PyTorch-native phone deploymentExecuTorch1.0 went GA in Oct 2025, with XNNPACK, Core ML and Qualcomm backends marked production-ready.
Best if you do not want to manage GPUsTogether AI or TinkerTogether charges $0.34 to $0.38 per 1M SFT tokens on Qwen3.5 0.8B to 9B with a $4 minimum. Tinker charges $0.737 per 1M train tokens on Qwen3.5-4B.
Best licence for a companyQwen3.5, Gemma 4, SmolLM3, Phi-4-miniApache-2.0 or MIT, with no revenue threshold. LFM models are free only below $10M annual revenue.

Why Fine-Tune a Small Model

Four reasons keep coming up, and each one is a design constraint, not a slogan.

  • Latency. A model running on the device has no network round trip. Liquid reports that LFM3-1.7B decodes 1.8 to 2.8 times faster than the next model it tested (llama.cpp, Q4_0, 32K context). That figure is vendor-reported, but the direction is not in doubt: fewer parameters mean fewer bytes to read per token.
  • Privacy. Meta's ExecuTorch 1.0 announcement lists privacy and offline use as core reasons to run models at the edge. If text never leaves the phone, you carry less compliance risk.
  • Cost. Inference runs on the user's hardware. Your bill is the one-time training job, which this guide prices at $0 to a few dollars for a typical dataset.
  • Offline. Field tools, cars, wearables and apps in areas with weak signal need a model that works with no connection.

Fine-tuning is the right tool when you need a behaviour: a strict output format, a tool-call schema, a tone, a classification label set or a domain vocabulary. Google's Gemma tuning guide is blunt about the boundary. Use retrieval for facts that change often, continued pre-training for a new language or a large domain corpus, supervised fine-tuning with small adapters for a new format, persona, tool schema or task skill, and reinforcement learning when correctness is strict (code, math, SQL). It also says to start from the instruction-tuned (-it) checkpoint for most work, and that combining LoRA with RAG is a common pattern.

Liquid's own fine-tuning notes add practical numbers: prepare 500 to 5,000 task examples that match production inputs, train with the model's own chat template via apply_chat_template, and run a short LoRA job first to check the setup. If your data pipeline is the bottleneck, our guides on synthetic data tools and turning PDFs into training data cover that side.

Pick a Base Model

The field moved quickly in 2026. Three families dominate the sub-10B range for fine-tuners, and a few older models remain useful because of their size or runtime support.

Qwen3.5 small series

Alibaba's Qwen team announced the small series on Mar 2, 2026: Qwen3.5-0.8B, 2B, 4B and 9B, all Apache-2.0 on Hugging Face. The model card describes a 4B with 32 layers, a hybrid layout of Gated DeltaNet and gated attention, a vision encoder, support for 201 languages and dialects, and a native context of 262,144 tokens. Parameter counts from the Hugging Face API are 0.87B, 2.27B, 4.66B and 9.65B including the vision tower. Qwen3.6 and Qwen3.8 repos exist on the same organization page, but the ones we found start at 27B, so Qwen3.5 remains the small dense option.

Introducing the Qwen 3.5 Small Model Series: Qwen3.5-0.8B, 2B, 4B and 9B. More intelligence, less compute, built on the same Qwen3.5 foundation with native multimodality, an improved architecture and scaled RL.

— @Alibaba_Qwen March 2, 2026
Bar charts comparing Qwen3.5-9B and Qwen3.5-4B with larger models on IFBench, GPQA Diamond, HMMT, MMMLU, MMMU-Pro and other benchmarks
Vendor-reported benchmark chart from the Qwen3.5 model card, comparing the 9B and 4B with larger open and closed models. Treat vendor charts as a starting point and test on your own task. Credit: Qwen Team, Qwen3.5-4B model card on Hugging Face.

Fine-tuning caveat. Unsloth's Qwen3.5 guide says QLoRA is not recommended for any Qwen3.5 model because the quantization differences are higher than normal, requires transformers v5, and warns that the first run can be slow because of custom Mamba Triton kernels, especially on T4 GPUs. To keep reasoning ability after tuning it advises mixing reasoning-style examples with direct answers, with at least 75% reasoning.

Gemma 4

Google DeepMind released Gemma 4 on Apr 2, 2026 under Apache-2.0, a change from the custom Gemma Terms of Use that earlier Gemma versions carry. The family has five sizes: E2B, E4B, 12B Unified, 26B A4B (mixture of experts, 3.8B active) and 31B dense. The "E" means effective parameters: E2B is 2.3B effective and 5.1B with its per-layer embedding tables, E4B is 4.5B effective and 8B with embeddings. E2B and E4B take text, image and audio and have a 128K window. Google built them with the Pixel team, Qualcomm and MediaTek for phones, Raspberry Pi and Jetson Orin Nano.

Meet Gemma 4: our new family of open models you can run on your own hardware. Built for advanced reasoning and agentic workflows, we are releasing them under an Apache 2.0 license.

— @GoogleDeepMind April 2, 2026
Table of Gemma 4 31B, 26B A4B, E4B and E2B benchmark scores on MMLU, MMMU Pro, AIME 2026, LiveCodeBench v6, GPQA Diamond and tau2-bench
Vendor-reported instruction-tuned benchmark table from the Gemma 4 launch post. E4B scores 69.4% on multilingual Q&A and 52.0% on LiveCodeBench v6; E2B scores 60.0% and 44.0%. Credit: Google, Gemma 4 launch post.

Google also published quantization-aware-training variants for Gemma 4 (q4_0 GGUF, mobile-oriented builds and w4a16 builds) on Hugging Face between April and June 2026. Those are inference checkpoints. Fine-tune the regular instruction-tuned or base weights, then quantize your own result.

Liquid LFM3 and its predecessors

Liquid AI released LFM3 on Oct 27, 2026: six models of about 2B parameters on one backbone, including LFM3-1.7B (text, 256K context), LFM3-VL-2B, LFM3-Audio-2B, LFM3-Omni-2B and two decision models, d1-2B and d1-Omni-2B. The text model uses 24 layers: 13 gated short convolutions, 5 sliding-window attention and 6 global attention. Liquid says it needs about 1 GB at 4-bit and a KV cache of 1.6 GB at 128K context, against 4.3 GB for Qwen3.5-4B in its comparison (vendor-reported). The model card says it is built to be "made to be specialized" with quick single-GPU fine-tuning.

Introducing LFM3: our new generation of Liquid Foundation Models. With a new tri-hybrid architecture and new multimodal encoders, the LFM3 family is the ideal model suite for specialized intelligence.

— @liquidai October 27, 2026
Illustration of the LFM3 family: LFM3-1.7B text, LFM3-VL-2B vision, LFM3-Audio-2B audio, LFM3-Omni-2B omni and D1-Omni-2B decision
The LFM3 family as shown on Liquid AI's release post: text, vision, audio, omni and decision models. Credit: Liquid AI, Introducing LFM3.

Licence warning. The LFM Open License v1.0 defines a Threshold of $10,000,000 in annual revenue. Commercial use of the model or a derivative by a legal entity at or above the Threshold is not licensed under it, and the threshold does not apply to qualified non-profits using it for non-commercial or research purposes. Liquid's blog post does not state this, so read the LICENSE file in the repository. The LFM2 and LFM2.5 checkpoints we checked carry the same licence name.

Other models worth knowing

Gemma 3 270M (Aug 14, 2025) has about 170M embedding parameters and 100M in the transformer blocks, and Google says it was designed from the ground up for task-specific fine-tuning; its INT4 build used 0.75% of a Pixel 9 Pro battery for 25 conversations in Google's internal test. It is under the Gemma Terms of Use, not Apache-2.0. Llama 3.2 1B and 3B (Sep 25, 2024) have a 128K context and day-one Qualcomm and MediaTek support, but the licence needs "Built with Llama" attribution and a Llama-prefixed name for derived models. Phi-4-mini (3.8B, MIT, 128K) and SmolLM3-3B (Apache-2.0, trained on 64K with YaRN to 128K) are older but cleanly licensed. MiniCPM5 1B and 2B (Apache-2.0, 131,072 tokens on the 2B) are newer 2026 releases we verified on Hugging Face but did not test.

Model comparison table

ModelSizesLicenceContextRelease date
Qwen3.5 small series0.8B, 2B, 4B, 9B (dense, text plus vision)Apache-2.0262,144 nativeMar 2, 2026 (Alibaba_Qwen post)
Gemma 4 edgeE2B (2.3B effective, 5.1B with embeddings), E4B (4.5B effective, 8B with embeddings)Apache-2.0128KApr 2, 2026
Gemma 4 larger12B Unified, 26B A4B (MoE), 31BApache-2.0256KApr 2, 2026 (12B repo created May 23, 2026)
LFM3LFM3-1.7B text; VL-2B, Audio-2B, Omni-2B, d1-2BLFM Open License v1.0256K (1.7B)Oct 27, 2026
LFM2.5350M, 1.2B (also larger variants)LFM Open License v1.032,7681.2B repo Jan 4, 2026; 350M repo Mar 25, 2026
LFM2350M, 700M, 1.2B (2.6B also listed)LFM Open License v1.032,768Repos created Jul 10, 2025
MiniCPM51B, 2BApache-2.0131,072 (2B)1B repo May 21, 2026; 2B repo Sep 6, 2026
Llama 3.21B, 3BLlama 3.2 Community License (700M MAU clause, Built with Llama)128KSep 25, 2024
Phi-4-mini3.8BMIT128KRepo created Feb 19, 2025
SmolLM33BApache-2.064K trained, 128K with YaRNRepo created Jul 8, 2025
Gemma 3 small270M, 1BGemma Terms of Use32K270M Aug 14, 2025; 1B repo Mar 10, 2025

Dates come from the vendor post where one exists and otherwise from the Hugging Face repository creation date, which can precede the public announcement by a few days. Context for Gemma 3 small models is from the config files (max_position_embeddings 32,768), because the official repositories are gated.

How big is the file you will ship?

File size is parameters times bits per weight. The llama.cpp quantization README lists Q4_K_M at 4.8944 bits per weight and Q8_0 at 8.5008 for its Llama-3.1-8B example. Applying those figures to the parameter counts reported on Hugging Face gives the sizes below. This is our arithmetic: real files differ slightly because K-quants mix precisions, and the KV cache and runtime need extra memory on top.

ModelParametersQ4_K_M weightsQ8_0 weightsbf16 weights
Qwen3.5-0.8B873M0.53 GB0.93 GB1.75 GB
Qwen3.5-2B2.27B1.39 GB2.42 GB4.55 GB
Qwen3.5-4B4.66B2.85 GB4.95 GB9.32 GB
Qwen3.5-9B9.65B5.91 GB10.26 GB19.31 GB
Gemma 4 E2B5.12B with embeddings3.13 GB5.44 GB10.25 GB
Gemma 4 E4B8.00B with embeddings4.89 GB8.50 GB15.99 GB
LFM3-1.7B1.73B1.06 GB1.84 GB3.46 GB
Llama 3.2 3B3.21B1.97 GB3.41 GB6.43 GB
Phi-4-mini3.84B2.35 GB4.08 GB7.67 GB
SmolLM3-3B3.08B1.88 GB3.27 GB6.15 GB
Gemma 3 270M268M0.16 GB0.28 GB0.54 GB

Worked example: Qwen3.5-4B has 4,659,865,088 parameters. At 4.8944 bits per weight that is 4,659,865,088 x 4.8944 / 8 = 2.85 GB. Gemma 4 E2B counts 5.12B parameters because the per-layer embedding tables are stored in the file, even though only 2.3B are used in compute, so its Q4_K_M file is about 3.1 GB, not 1.4 GB.

Master Comparison Table

Eleven tools cover the full path from data to device. GitHub star counts were read from the GitHub API on Nov 26, 2026 and move daily.

ToolRolePricingHardwareGitHub (Nov 26, 2026)
Unsloth logo UnslothTraining (LoRA, QLoRA, full, RL) plus Studio UIFree (Apache-2.0 core, AGPL-3.0 Studio)NVIDIA training; Mac training and MLX; GGUF export80,277 stars
Hugging Face TRL logo Hugging Face TRLTraining library (SFT, DPO, GRPO)Free (Apache-2.0)Any PyTorch backend; use with PEFT19,835 stars
Axolotl logo AxolotlTraining framework, YAML configsFree (Apache-2.0)NVIDIA Ampere+ or AMD; FSDP2, DeepSpeed12,751 stars
MLX LM logo MLX LMTraining and inference on Apple siliconFree (MIT)Apple silicon7,762 stars (mlx-lm), 29,293 (mlx)
llama.cpp logo llama.cppInference engine, GGUF conversion and quantizationFree (MIT)CPU, Metal, CUDA, Vulkan, Android builds136,321 stars
Ollama logo OllamaLocal runtime and model registryFree app (MIT); paid cloud plansmacOS, Linux, Windows188,170 stars
ExecuTorch logo ExecuTorchPyTorch-native on-device runtimeFree, open sourceiOS, Android, embedded, desktop; CPU, GPU, NPU5,197 stars; v1.6.0 Nov 12, 2026
LiteRT-LM logo LiteRT-LMGoogle on-device LLM runtimeFree (Apache-2.0)Android, iOS (preview), web, desktop, Raspberry Pi6,939 stars; v0.20.0
Together AI logo Together AIManaged fine-tuning APIPer-token, $4 minimum per jobCloud onlyNot applicable
Tinker logo TinkerManaged training API (Thinking Machines)Per-token; free tier on one small modelCloud onlyCookbook 4,359 stars
Liquid LEAP SDK logo Liquid LEAP SDKMobile SDK for LFM (deprecated)ArchivediOS, Android (replaced by llama.cpp)Deprecated

1. Unsloth

Unsloth logo

What it is. An open-source fine-tuning and RL library plus a no-code web app, Unsloth Studio (beta). The core package is Apache-2.0 and the Studio UI is AGPL-3.0. Its pitch is training up to 2x faster with up to 70% less VRAM with no accuracy loss, which is a vendor claim. For the models in this guide the notebook table is more specific: Gemma 4 E2B 1.5x faster and 50% less memory, Qwen3.5-4B 1.5x faster and 60% less memory (also vendor-reported).

Who it is for. Anyone with an NVIDIA GPU or a free Colab account who wants the shortest route from a dataset to a GGUF file. Studio also installs on macOS, where training, MLX and GGUF inference work. The Studio page says a free Colab T4 notebook can train and run most models up to 22B parameters.

Key features. LoRA, FP8, full fine-tuning and RL kernels across 500+ models; Data Recipes that build datasets from PDF, CSV, JSON, DOCX and TXT; export to GGUF or 16-bit safetensors for llama.cpp, vLLM, Ollama and LM Studio; free notebooks for Gemma 4 E2B/E4B (text, vision, audio, DPO, GRPO) and Qwen3.5 0.8B/2B/4B. Install is curl -fsSL https://unsloth.ai/install.sh | sh then unsloth studio, or uv pip install unsloth for the library.

You can now fine-tune Gemma 4 with our free notebooks! You just need 8GB VRAM to train Gemma 4 locally! Unsloth trains Gemma4 1.5x faster with 50% less VRAM.

— @UnslothAI April 7, 2026

Pros

  • Official free Colab notebooks for the exact models in this guide
  • Lowest stated VRAM figures: about 3 GB for Qwen3.5-0.8B bf16 LoRA, 8 GB for Gemma 4 E2B
  • One call exports merged 16-bit weights or GGUF
  • Apache-2.0 core, active project (80,277 GitHub stars)

Cons

  • Training needs an NVIDIA GPU (Mac support is through Studio and MLX)
  • Its Gemma 4 page lists E4B at both 10 GB and 17 GB, and the post says 8 GB for a model that needs more
  • Qwen3.5 guide advises against QLoRA and needs transformers v5; first T4 run is slow
  • Studio is AGPL-3.0 and beta, which matters if you embed it

Benefits for this use case. It removes memory tuning for the 0.8B to 4B range and ends in the format phone runtimes want. Pricing. Free. We could not load unsloth.ai/pricing (HTTP 403), so any paid plan is not covered here. Free tier. The Colab notebooks, with Google's unpublished limits. Standout use case. A text-to-JSON extractor on Gemma 4 E2B, trained in under an hour. Skip it if you only have a Mac and want a single Apple-native stack, or you need Axolotl-style multi-node YAML.

2. Hugging Face TRL

Hugging Face TRL logo

What it is. The Transformer Reinforcement Learning library, Apache-2.0, with SFT, DPO, GRPO and other trainers built on Hugging Face Transformers. Unsloth's notebook above is itself a thin layer on SFTTrainer. Who it is for. Engineers who want plain Python, full control and maximum compatibility, and who are happy to size memory themselves.

Key features. peft_config=LoraConfig() for adapters; assistant_only_loss=True to train only on assistant turns (needs {% generation %} markers in the chat template, which TRL patches for known families such as Qwen3); packing=True; prompt-completion datasets with completion-only loss by default; tool-calling data with a tools column; and QLoRA through quantization_config. The docs recommend a higher learning rate, about 1e-4, when training adapters. Its docs also say that, since Transformers v5, a string model loads in float32 unless you pass model_init_kwargs with a dtype, which matters for memory.

from datasets import load_dataset
from peft import LoraConfig
from trl import SFTConfig, SFTTrainer

trainer = SFTTrainer(
    model="Qwen/Qwen3.5-4B",
    train_dataset=load_dataset("json", data_files="train.jsonl", split="train"),
    args=SFTConfig(output_dir="qwen35-4b-lora", learning_rate=1e-4, assistant_only_loss=True,
                   model_init_kwargs={"dtype": "bfloat16"}),
    peft_config=LoraConfig(r=16, lora_alpha=16, target_modules="all-linear"),
)
trainer.train()

Adapted from the TRL SFT Trainer documentation (v1.19.0 pages); the model id and LoRA settings are ours, not a tested recipe.

Pros

  • Most widely supported trainer; Gemma and Axolotl guides both list it
  • Dataset formats include conversational, prompt-completion and tool calling
  • Free and Apache-2.0 (19,835 GitHub stars)

Cons

  • No GGUF export; you merge and convert yourself
  • You tune memory (batch size, checkpointing, packing) without Unsloth kernels
  • Hugging Face is subject to a pending Nvidia acquisition (see below)

Corporate context. Nvidia announced on Sep 3, 2026 that it agreed to acquire Hugging Face for about $12.93 billion, and pledged that Hugging Face stays open and that NVIDIA compute will not be required. The announcement does not mention TRL or llama.cpp. Coverage we found says the deal has not closed and faces regulatory review, with Nvidia expecting completion in the first half of 2027, so treat that as pending. Pricing. Free. Skip it if you want a ready notebook that ends in a GGUF.

3. Axolotl

Axolotl logo

What it is. A free, Apache-2.0 fine-tuning framework driven by YAML files. Its documentation lists full fine-tuning, LoRA, QLoRA, GPTQ, QAT, FP8 mixed precision, preference tuning (DPO, IPO, KTO, ORPO) and RL methods (GRPO, GDPO), with multi-GPU through FSDP2 and DeepSpeed and multi-node through Torchrun and Ray. It added a Gemma 4 guide in April 2026 and lists Qwen 3.5 and, from September 2026, Qwen3.6 support.

Who it is for. Teams that want runs to be reproducible config files in git, and people scaling past one GPU. Requirements per the docs: an NVIDIA GPU (Ampere or newer for bf16 and Flash Attention) or an AMD GPU, Python 3.12 or later, and PyTorch 2.13.0 or later.

axolotl fetch examples
axolotl train examples/llama-3/lora-1b.yml     # command from the Axolotl docs; swap in a Gemma 4 or Qwen3.5 config

Pros

  • Config as code, easy to review and rerun
  • Strong multi-GPU and RL coverage
  • Free and Apache-2.0 (12,751 GitHub stars)

Cons

  • More setup than a Colab notebook; strict Python and PyTorch minimums
  • No built-in GGUF export step; merge then convert with llama.cpp
  • No consumer Mac path

Benefits. Good once you have a dataset you trust and want to run ten variants. Pricing. Free. Skip it if you are still working out your first dataset, where a notebook is faster.

4. MLX LM

MLX LM logo

What it is. Apple's mlx-lm package (MIT) for generating text and fine-tuning on Apple silicon with MLX. mlx_lm.lora supports lora (default), dora and full fine-tuning. If --model points to a quantized model, training uses QLoRA, otherwise regular LoRA. The repository's model folder includes qwen3_5, gemma4, lfm2, smollm3, phi3 and llama modules (we did not find an lfm3 module in the folder listing; check before assuming support). The LORA.md family list is older than the code, so trust the models directory over the prose.

pip install "mlx-lm[train]"

# data/train.jsonl and data/valid.jsonl, one JSON object per line:
# {"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}

mlx_lm.lora \
    --model Qwen/Qwen3.5-2B \
    --train \
    --data ./data \
    --iters 600 \
    --mask-prompt

mlx_lm.lora --model Qwen/Qwen3.5-2B --adapter-path adapters --data ./data --test   # test perplexity
mlx_lm.generate --model Qwen/Qwen3.5-2B --adapter-path adapters --prompt "..."
mlx_lm.fuse --model Qwen/Qwen3.5-2B                                               # fused_model/

Commands follow the mlx-lm LORA.md documentation. The model id is our choice; we did not run it for this guide.

Data format. JSONL with chat, tools, completions or text records, auto-detected, plus Hugging Face datasets through a YAML hf_dataset block. --mask-prompt trains on the completion only. Memory tips from the docs. Use a quantized base (QLoRA), lower --batch-size (default 4), lower --num-layers (default 16), add --grad-accumulation-steps and --grad-checkpoint. The docs example reports about 250 tokens per second for Mistral 7B on an M1 Max with 32 GB at batch size 1 and 4 layers.

Nice video introduction to LoRA fine-tuning locally with MLX and importing the adapters directly into Ollama.

— @awnihannun August 30, 2024

Post from the MLX lead developer, dated 2024. The commands may have changed; use the current LORA.md.

Pros

  • No CUDA GPU needed; trains where you already work
  • One tool for LoRA, DoRA, full weights, eval, generate and fuse
  • Free, MIT (mlx-lm 7,762 stars; mlx 29,293)

Cons

  • mlx_lm.fuse GGUF export is limited to Mistral, Mixtral and Llama-style fp16 models per the docs
  • Mac-only; throughput will not match a data-center GPU
  • Docs lag the code in places

Pricing. Free. Skip it if your end target is GGUF for Android: train in Unsloth or TRL instead and convert with llama.cpp.

5. llama.cpp

llama.cpp logo

What it is. The C/C++ inference engine behind most local-LLM tools, MIT-licensed, with the GGUF file format and the llama-quantize tool. On Feb 20, 2026, ggml.ai, the team behind it, announced it was joining Hugging Face. Hugging Face's post says the team keeps full autonomy, spends all its time on llama.cpp, and that the project stays "100% open-source and community driven".

Today ggml.ai joins Hugging Face. Together we will continue to build ggml, make llama.cpp more accessible and empower the open-source community. Our joint mission is to make local AI easy and efficient to use by everyone on their own hardware.

— @ggerganov February 20, 2026

Key features for fine-tuners. convert_hf_to_gguf.py turns a Hugging Face folder into a GGUF (the README example uses Gemma 4 E2B); --mmproj exports a multimodal projector; llama-quantize offers Q4_K_M, Q5_K_M, Q8_0 and many more, with --imatrix for importance-matrix quantization. Its quantization README measures Llama-3.1-8B (hardware not stated): Q4_K_M 4.58 GiB at 71.93 tokens per second for generation, Q5_K_M 5.33 GiB at 67.23, Q8_0 7.95 GiB at 50.93. That README has no perplexity figures, so measure quality loss on your own data. An Android build guide ships in the repository, and Liquid recommends the iOS xcframework and an NDK build for mobile.

Pros

  • De facto standard export target; most runtimes read GGUF
  • Runs on CPU, Apple Metal and many GPUs; one engine from laptop to phone
  • Free, MIT, 136,321 GitHub stars

Cons

  • New architectures need upstream support before they convert (check each model)
  • You own the integration on mobile (JNI, C API)
  • README command spelling is changing, so copy from the current docs

Pricing. Free. Skip it if your app already ships PyTorch models through ExecuTorch.

6. Ollama

Ollama logo

What it is. A local runtime and model registry with a one-command workflow, MIT-licensed (188,170 GitHub stars). Its July 9, 2026 post says it has raised $88M from Benchmark, Theory Ventures, 8VC, Y Combinator and others, 8.9 million developers use it and 85% of the Fortune 500. Press reports describe that as a $65M Series B led by Theory Ventures on top of an earlier $15M Series A; Ollama's own post gives the $88M total and does not name a lead. Since Aug 31, 2026 its Pro, Max and Team cloud plans use per-token pricing. None of that affects local use, which is free.

Fine-tuning role. Ollama does not train. It runs your result. Its import docs describe a Modelfile whose FROM points to a Safetensors directory or a GGUF file, and say it does not quantize GGUF on import. The Modelfile docs give the context default as 2048 tokens, which silently truncates long prompts until you set PARAMETER num_ctx.

# Modelfile
FROM ./gemma-4-e2b-ft-Q4_K_M.gguf
PARAMETER num_ctx 4096
SYSTEM """You answer in the JSON format used by our app."""

# then
ollama create my-gemma-ft -f Modelfile
ollama run my-gemma-ft

Pros

  • Fastest way to test a GGUF in a chat and an API
  • Free for local use; hybrid cloud if you need it
  • Large ecosystem of integrations

Cons

  • Not for phones
  • Default 2048-token context surprises people
  • Chat template mismatches make a good fine-tune look broken; verify the template after import

Pricing. Free locally; cloud plans per token. Skip it if you ship to mobile. For desktop setup see our Ollama local models guide and free open-weight models list.

7. ExecuTorch

ExecuTorch logo

What it is. The PyTorch team's on-device runtime. The 1.0 release was announced on Oct 24, 2025, and GitHub shows v1.6.0 published Nov 12, 2026. It deploys a PyTorch model to iOS, Android, embedded devices and laptops without converting it to another format. XNNPACK with Arm Kleidi (CPU), Apple Core ML, the Qualcomm AI Engine delegate (Hexagon NPU) and Arm Ethos-U were promoted to production-ready in 1.0; Vulkan GPU, OpenVINO, Samsung Exynos and others are listed as newer or alpha and beta backends.

For LLMs. Export produces a .pte file. The documented route is an export_llm YAML config (with qmode: 8da4w for int8 activation and int4 weight quantization), or Hugging Face's optimum-executorch. The export docs list Llama 2/3/3.1/3.2, Qwen 2.5/3, Phi 3.5/4-mini and SmolLM2; the optimum README also lists Gemma 3, SmolLM3 and Phi-4-mini. We did not find Gemma 4 or Qwen3.5 on those pages, so test your export early. Liquid's CTO is quoted in the 1.0 post saying ExecuTorch fits its custom LFM2 architectures, and a community LFM2.5 ExecuTorch repository exists on Hugging Face.

# Hugging Face optimum-executorch README example (swap the model id for your merged checkpoint)
optimum-cli export executorch \
    --model "HuggingFaceTB/SmolLM2-135M-Instruct" \
    --task "text-generation" \
    --recipe "xnnpack" \
    --use_custom_sdpa \
    --use_custom_kv_cache \
    --qlinear 8da4w \
    --qembedding 8w \
    --output_dir="hf_smollm2"

Command copied from the optimum-executorch README, which uses a SmolLM2 example; it was not run for this guide.

Pros

  • Stays in PyTorch: fewer numerical mismatches after export
  • Production-ready CPU, Core ML and Qualcomm NPU backends
  • Used in Meta apps and Reality Labs wearables per Meta's post

Cons

  • Per-model export work; new architectures can lag
  • Smaller community than llama.cpp (5,197 stars)
  • GitHub reports the licence as NOASSERTION; read the repository LICENSE
PyTorch social graphic for the ExecuTorch 1.0 announcement
Social card for the ExecuTorch 1.0 announcement (Oct 24, 2025). It shows the release branding, not an architecture diagram. Credit: PyTorch Foundation, Introducing ExecuTorch 1.0.

Pricing. Free. Skip it if you want one engine for every platform and already accept GGUF.

8. LiteRT-LM

LiteRT-LM logo

What it is. Google's open-source, Apache-2.0 framework for running LLMs on edge devices, listed as production-ready, with Python, Kotlin and C++ APIs marked stable, Swift and JavaScript in early preview, and a community Flutter binding. Models ship as .litertlm files; the README names Gemma (including Gemma 4 and Gemma 3n), Llama, Phi-4 and Qwen, and says Gemma 4 can use multi-token-prediction drafters for faster inference. The Gemma 4 launch post lists LiteRT-LM among the supported runtimes and says Android developers can prototype in the AICore Developer Preview, forward-compatible with Gemini Nano 4. Latest release noted on the README: v0.20.0.

uv tool install litert-lm

litert-lm run \
  --from-huggingface-repo=litert-community/gemma-4-E4B-it-litert-lm \
  gemma-4-E4B-it.litertlm \
  --backend=gpu \
  --speculative-decoding=on \
  --prompt="What is the capital of France?"

Command from the LiteRT-LM README; model repository as published there.

Pros

  • Stable Kotlin API for Android apps
  • Official Gemma 4 E2B/E4B builds, GPU and NPU acceleration
  • Free, Apache-2.0 (6,939 stars)

Cons

  • The README has no guidance for converting your own fine-tuned weights; see the product docs
  • Swift (iOS) is only an early preview
  • Mostly Google model families

Pricing. Free. Skip it if your base model is not in its supported list or you target iOS first.

9. Together AI

Together AI logo

What it is. A managed fine-tuning service on top of Together's GPU cloud, with LoRA and full fine-tuning. Pricing as of Nov 26, 2026 (pricing page): the page shows two rate tables without labelling which is LoRA and which is full fine-tuning. In the first, SFT for Qwen3.5 0.8B, 2B, 4B, 9B and for Llama 3.1 8B is $0.34 per 1M tokens and DPO is $0.84; in the second the same models are $0.38 and $0.94. Every job has a model-specific minimum, $4.00 for all of those. Gemma 4 appears only as 26B A4B and 31B (about $1.05 and $1.16 per 1M tokens), not as E2B or E4B. Hosting is billed separately per minute on a dedicated endpoint.

Billing rule from the docs. Tokens equal training tokens times epochs plus validation tokens times the number of evaluations; cancelled jobs pay for completed steps, and failed jobs are fully refunded. Third-party guides quote a lower or higher rate for some models, which is why we cite the vendor page only.

Fireworks AI comparison. Fireworks' pricing page lists a Serverless Training API per 1M tokens (for example Qwen 3.6 35B A3B at $2.14 train) and a Dedicated Training API from $8.00 per GPU-hour, but no sub-10B model, and a free Muse Glimmer 30B SFT offer through Nov 30. For a broader comparison of managed services, see best fine-tuning platforms and best AI inference providers.

Pros

  • No GPU setup; per-token price is easy to estimate
  • Covers every Qwen3.5 small size
  • Failed jobs are refunded

Cons

  • $4.00 minimum makes tiny jobs cost more than their tokens
  • Two unlabelled rate tables; you must confirm which applies in the console
  • Weights and hosting are separate decisions; a GGUF export path is not documented on the pages we read

Skip it if you need the model files in GGUF or need the Gemma 4 edge sizes.

10. Tinker (Thinking Machines)

Tinker logo

What it is. A training API from Thinking Machines Lab where you write the training loop and they run the GPUs, with a Python client (create_lora_training_client, create_sampling_client) and an Apache-2.0 cookbook (4,359 stars). Pricing as of Nov 26, 2026, per 1M tokens: Qwen3.5-4B at 64K context is $0.33 prefill, $1.005 sample, $0.737 train (256K context train is $1.34); Qwen3.5-9B at 64K is $0.30, $0.807, $1.463. Qwen3.5-0.8B, 2B and Gemma models are not listed, and Llama 3.2 1B and 3B are on the retired list from June 12, 2026.

Free tier. The page says free training and sampling are limited to 64K context and rate limits, and that you need a positive balance on prepaid accounts. We could not confirm from the page whether you can download trained weights; check that before relying on Tinker for an on-device pipeline, since a phone app needs the weights.

Pros

  • Custom training loops without owning GPUs
  • Qwen3.5-4B train price $0.737 per 1M tokens
  • Free tier for experimentation

Cons

  • Only 4B and 9B in the small Qwen range; no Gemma 4 or LFM
  • Weight export not stated on the pricing page
  • Coding a loop is more work than uploading a file

Skip it if you want a no-code job form (use Together) or need a model Tinker does not host.

11. Liquid LEAP SDK (deprecated)

Liquid LEAP SDK logo

Status correction. Our research notes listed LEAP as Liquid's edge SDK. Liquid's own documentation now says the LEAP SDK is deprecated and no longer receives new releases, and its migration guide tells developers to use llama.cpp. Existing artifacts stay on Maven Central and GitHub. The guide maps iOS to the llama.xcframework from a llama.cpp release (Metal enabled, minimum iOS 16.4 or macOS 13.3, call the C API with import llama) and Android to llama.cpp built through the NDK, with the upstream examples/llama.android module or your own CMake and JNI wrapper. Desktop and server apps run llama-server as a sidecar. The old Android SDK needed minSdk 31.

For fine-tuning, Liquid now points to its open-source Liquid Finetune stack (SFT, LoRA, DPO and GRPO for text, vision and MoE models; local GPUs, SLURM, Kubernetes or Modal; GGUF export), the TRL text LoRA path and Unsloth. Its cookbook has 2,798 stars. Skip it for new projects: it is archived.

Pricing Table

All prices as of Nov 26, 2026, from vendor pages fetched for this guide.

ToolPriceFree tier
Unsloth logo UnslothCore library and Studio are free to download. We could not load the pricing page (HTTP 403), so we cannot quote any paid tier.Free Colab notebooks (T4 class GPU, limits not published by Google)
Hugging Face TRL logo Hugging Face TRLFree. You pay for compute only.Runs on free Colab with small models
Axolotl logo AxolotlFree. You pay for compute only.None needed; local GPU or any cloud
MLX LM logo MLX LMFree. You pay for the Mac you already own.Not applicable
llama.cpp logo llama.cppFree.Not applicable
Ollama logo OllamaLocal use is free. Cloud Pro, Max and Team plans use per-token pricing since Aug 31, 2026.Free local runtime
ExecuTorch logo ExecuTorchFree.Not applicable
LiteRT-LM logo LiteRT-LMFree.Not applicable
Together AI logo Together AISFT $0.34 or $0.38 per 1M tokens for Qwen3.5 0.8B/2B/4B/9B and Llama 3.1 8B, DPO $0.84 or $0.94, minimum $4.00 per job (two rate tables on the page)None stated on the page
Tinker logo TinkerQwen3.5-4B (64K): $0.33 prefill, $1.005 sample, $0.737 train per 1M tokens. Qwen3.5-9B: $0.30, $0.807, $1.463.Free tier with 64K context and rate limits; Inkling 2 Mini (free) listed at $0
Liquid LEAP SDK logo Liquid LEAP SDKArchived. Existing artifacts remain on Maven Central and GitHub.Not applicable

Feature Matrix

Yes means documented by the vendor, partial means a limited or conditional route, no means we found no such function on the pages we read.

ToolTrains modelsExports GGUFRuns on phoneRuns on MacManaged (no GPU ops)Open source
Unsloth logo UnslothYesYesNoYesNoYes
Hugging Face TRL logo Hugging Face TRLYesNoNoPartialNoYes
Axolotl logo AxolotlYesNoNoNoNoYes
MLX LM logo MLX LMYesPartialNoYesNoYes
llama.cpp logo llama.cppNoYesYesYesNoYes
Ollama logo OllamaNoImports GGUFNoYesPartialYes
ExecuTorch logo ExecuTorchNoNoYesYesNoYes
LiteRT-LM logo LiteRT-LMNoNoYesYesNoYes
Together AI logo Together AIYesNoNoNoYesNo
Tinker logo TinkerYesNoNoNoYesNo
Liquid LEAP SDK logo Liquid LEAP SDKNoNoYes (archived)Yes (archived)NoArchived

VRAM by Model Size and Method

These are vendor figures, not our measurements, and they depend on sequence length, batch size and checkpointing. Google's Gemma numbers are peak VRAM at 2,048 tokens. Unsloth's numbers are minimums.

ModelQLoRA (4-bit)LoRA (16-bit)Full fine-tuneSource
Qwen3.5-0.8BNot recommended by Unsloth~3 GB~12 GB (4x LoRA, our arithmetic)Unsloth Qwen3.5 guide
Qwen3.5-2BNot recommended by Unsloth~5 GB~20 GB (4x LoRA)Unsloth Qwen3.5 guide
Qwen3.5-4BNot recommended by Unsloth~10 GB~40 GB (4x LoRA)Unsloth Qwen3.5 guide
Qwen3.5-9BNot recommended by Unsloth~22 GB~88 GB (4x LoRA)Unsloth Qwen3.5 guide
Gemma 4 E2B~7 GB (Google)8 to 10 GB (Unsloth)~32 GB (Google)Gemma docs, Unsloth Gemma 4 guide
Gemma 4 E4B~9 GB (Google)10 GB claimed, 17 GB also listed (Unsloth)~42 GB (Google)Gemma docs, Unsloth Gemma 4 guide
Gemma 4 12B~11 GB (Google)No figure~80 GB (Google)Gemma docs
Gemma 4 26B A4B~21 GB (Google)Over 40 GB (Unsloth)~160 GB (Google)Gemma docs, Unsloth Gemma 4 guide
Gemma 4 31B~22 GB (Google)No figure~200 GB (Google)Gemma docs
Generic 3B3.5 GB8 GBNot listedUnsloth requirements page
Generic 7B5 GB19 GBNot listedUnsloth requirements page
Generic 9B6.5 GB24 GBNot listedUnsloth requirements page
Generic 14B8.5 GB33 GBNot listedUnsloth requirements page

How to read it: a 16 GB GPU handles bf16 LoRA up to roughly the 4B class and QLoRA up to 12B. A free Colab T4 (16 GB class) fits the 2B class comfortably. Unsloth's guide also says full fine-tuning uses about four times the VRAM of LoRA for Qwen3.5, which is where the 12, 20, 40 and 88 GB values come from. The Unsloth Gemma 4 page contains a conflict for E4B (10 GB in one place and 17 GB for LoRA in another), so give yourself headroom. Unsloth also notes that E2B and E4B training loss around 13 to 15 is normal, while a loss in the hundreds points to a gradient-accumulation bug.

Step-by-Step Walkthrough: Gemma 4 E2B to a Q4_K_M GGUF

This path uses Unsloth's official Gemma4_(E2B)-Text notebook code and then llama.cpp, with the commands taken from the vendors' own documentation. We have not run it end to end for this guide, and we did not measure its runtime, so the time and cost figures later are labelled assumptions. If you prefer Qwen3.5, the same flow applies with the Qwen3.5 notebooks, bf16 LoRA instead of QLoRA, and the model names from Unsloth's Qwen3.5 guide.

Step 1: Write the dataset before anything else

Collect 500 to 5,000 examples that look like production inputs and the exact outputs you want, as conversations (system, user, assistant). Hold out 100 to 300 examples for evaluation and never train on them. Apply the model's own chat template, because Unsloth warns that the most common cause of a model that is worse after export is a wrong chat template or EOS token.

Step 2: Open the free notebook and load the model

Open the Gemma 4 E2B text notebook from the Unsloth notebooks repository in Colab and pick a GPU runtime. The notebook installs pinned versions (transformers 5.5.0 and others), so do not change them casually.

Step 3: Attach LoRA adapters

# Unsloth, official Gemma 4 E2B text notebook (unslothai/notebooks)
from unsloth import FastModel

model, tokenizer = FastModel.from_pretrained(
    model_name = "unsloth/gemma-4-E2B-it",
    dtype = None,
    max_seq_length = 1024,
    load_in_4bit = False,
    full_finetuning = False,
)

model = FastModel.get_peft_model(
    model,
    finetune_vision_layers     = False,  # text only
    finetune_language_layers   = True,
    finetune_attention_modules = True,
    finetune_mlp_modules       = True,
    r = 8, lora_alpha = 8, lora_dropout = 0, bias = "none", random_state = 3407,
)

Rank 8 with alpha 8 is the notebook default and the comment in it says larger rank means higher accuracy but might overfit. The notebook loads in 16-bit (load_in_4bit = False), which matches Unsloth's advice to avoid 4-bit for these newer hybrid architectures.

Step 4: Format data, train on responses only, and run

from unsloth.chat_templates import get_chat_template, standardize_data_formats, train_on_responses_only
from datasets import load_dataset
from trl import SFTTrainer, SFTConfig

tokenizer = get_chat_template(tokenizer, chat_template = "gemma-4")

dataset = load_dataset("mlabonne/FineTome-100k", split = "train[:3000]")  # swap in YOUR data
dataset = standardize_data_formats(dataset)
dataset = dataset.map(
    lambda ex: {"text": [tokenizer.apply_chat_template(c, tokenize = False, add_generation_prompt = False)
                         for c in ex["conversations"]]},
    batched = True,
)

trainer = SFTTrainer(
    model = model, tokenizer = tokenizer, train_dataset = dataset,
    args = SFTConfig(
        dataset_text_field = "text",
        per_device_train_batch_size = 1,
        gradient_accumulation_steps = 4,
        warmup_steps = 5,
        max_steps = 60,            # demo run; use num_train_epochs = 1 for a real one
        learning_rate = 2e-4,      # the notebook says reduce to 2e-5 for long runs
        logging_steps = 1,
        optim = "adamw_8bit",
        weight_decay = 0.001,
        lr_scheduler_type = "linear",
        seed = 3407,
        report_to = "none",
    ),
)
trainer = train_on_responses_only(trainer)
trainer_stats = trainer.train()

The notebook demo uses 60 steps at batch size 1 with gradient accumulation 4, which is only 240 examples, so it proves the pipeline works and little more. For a real run, remove max_steps and set num_train_epochs = 1 to 3, and lower the learning rate to 2e-5 for long runs as the notebook comment advises. Watch the loss: Unsloth says 13 to 15 is normal for E2B and E4B. train_on_responses_only masks the prompt so the model learns the answers, not the questions.

Step 5: Test with the training template

Generate with the settings Google recommends in the notebook: temperature 1.0, top_p 0.95, top_k 64. Run your held-out examples now, in 16-bit, so you have a baseline before quantization (see the evaluation section).

Step 6: Save the adapter, merge, and export

# Save the adapter, a merged 16-bit model, or GGUF (from the same notebook)
model.save_pretrained("gemma_4_lora")
tokenizer.save_pretrained("gemma_4_lora")

model.save_pretrained_merged("gemma-4-finetune", tokenizer)   # merged 16-bit weights

model.save_pretrained_gguf(
    "gemma_4_finetune", tokenizer,
    quantization_method = "Q8_0",   # the notebook: only Q8_0, BF16, F16 for now
)

Keep the adapter (small, reusable) and the merged 16-bit folder (what llama.cpp converts). The notebook comments say only Q8_0, BF16 and F16 are supported by save_pretrained_gguf for Gemma 4 for now, so convert and quantize with llama.cpp for smaller files.

Step 7: Convert and quantize with llama.cpp

# 1) Convert the merged Hugging Face folder to a bf16 GGUF (llama.cpp tools/quantize README form)
python convert_hf_to_gguf.py gemma-4-finetune --outfile gemma-4-e2b-ft-bf16.gguf --outtype bf16

# 2) Quantize to Q4_K_M
./build/bin/llama-quantize gemma-4-e2b-ft-bf16.gguf gemma-4-e2b-ft-Q4_K_M.gguf Q4_K_M

# 3) Run it (check the llama.cpp README for the current spelling of the CLI commands)
llama-cli -m gemma-4-e2b-ft-Q4_K_M.gguf -p "Your test prompt"

By our arithmetic from the earlier table, the Q4_K_M file for Gemma 4 E2B is about 3.1 GB and the Q8_0 about 5.4 GB. Quantize from a bf16 GGUF, not from an already quantized file.

Step 8: Run it on a laptop with Ollama or llama.cpp

Use the Modelfile from the Ollama section above, or serve with llama.cpp's server for an OpenAI-compatible endpoint. Set the context explicitly, and compare outputs to Step 5 on the same prompts.

Variants of the same path

  • Apple silicon, no CUDA: run mlx_lm.lora (snippet in the MLX LM section), then mlx_lm.fuse, and keep the fused model in MLX format for Mac and iOS use with MLX, or convert via Hugging Face weights and llama.cpp if the architecture is supported.
  • Plain Python: the TRL snippet above, then merge with PEFT and convert as in Step 7.
  • No GPU at all: upload your data to Together AI or write a Tinker loop, then download the result if the service allows it.

Video: a third-party tutorial from creator Fahd Mirza on fine-tuning Gemma 4 on your own dataset locally (title and channel confirmed through YouTube oEmbed; we did not audit its content). Use it as a second screen for the steps above.

Running It on a Phone

A phone is the hard target because of memory, thermals and APIs. Here are the four runtime routes with what each vendor documents.

RouteFormatBest forWhat the docs say
LiteRT-LM.litertlmAndroid (Kotlin), Gemma 4 E2B/E4BKotlin, Python, C++ stable; Swift early preview; GPU and NPU backends; no conversion guide in README
ExecuTorch.ptePyTorch teams, Core ML and Qualcomm NPUXNNPACK, Core ML, Qualcomm and Arm Ethos-U backends production-ready since 1.0; export via export_llm or optimum-executorch
llama.cppGGUFAny model llama.cpp supports; both OSesAndroid build guide in repo; Liquid documents llama.xcframework with Metal for iOS 16.4+
MLX Swift or MLX LMMLX weightsApple devicesMLX LM is Mac-first; we did not verify iOS packaging for this guide

Budget memory with the file-size table plus the KV cache. Liquid's published example shows how much the cache matters: at 128K context it quotes 1.6 GB for LFM3-1.7B and 4.3 GB for Qwen3.5-4B (vendor-reported), so a long context can double the footprint of a 4-bit model. For most apps, cap the context at 4K to 8K and test on the lowest-spec phone you support. Liquid's older SDK notes recommended 3 GB or more RAM and testing on a real device because emulators may crash loading models. Google's Gemma 4 post says E2B and E4B are designed to conserve memory and battery.

Cost and Time Examples

Scenario. A typical specialist dataset: 5,000 examples of about 600 tokens each, trained for 3 epochs. Tokens per epoch: 5,000 x 600 = 3,000,000. Training tokens: 3,000,000 x 3 = 9,000,000 (9M).

Managed services (vendor prices as of Nov 26, 2026)

  • Together AI, Qwen3.5-4B SFT. 9 x $0.34 = $3.06 on the first rate table, 9 x $0.38 = $3.42 on the second. Both are below the $4.00 minimum, so the job costs $4.00. A 40M-token job would be 40 x $0.34 = $13.60.
  • Tinker, Qwen3.5-4B (64K). 9 x $0.737 = $6.633, about $6.63. For Qwen3.5-9B: 9 x $1.463 = $13.167, about $13.17. Evaluation sampling is extra: for 300 test prompts of 300 prompt tokens and 300 output tokens on the 4B model, prefill is 0.09M x $0.33 = $0.03 and sampling is 0.09M x $1.005 = $0.09.

Your own GPU (RunPod list prices, page dated Nov 12, 2026)

RunPod bills per second. List prices per hour: RTX 4090 24 GB $0.34 community and $0.89 secure; A100 80GB PCIe $1.19 community and $2.09 secure; H100 80GB PCIe $1.99 and $2.89. The throughput below is an assumption, not a measurement. Replace it with the tokens-per-second you see in your own first run (the Unsloth notebook prints training runtime and peak memory).

SetupAssumed throughputTime for 9M tokensCommunity priceSecure price
Gemma 4 E2B LoRA on RTX 40903,000 tokens/s9,000,000 / 3,000 = 3,000 s = 0.83 h0.83 x $0.34 = $0.280.83 x $0.89 = $0.74
Qwen3.5-9B LoRA on A100 80GB PCIe1,500 tokens/s9,000,000 / 1,500 = 6,000 s = 1.67 h1.67 x $1.19 = $1.981.67 x $2.09 = $3.48
Free Colab (T4 class)Unknown, limits unpublishedVaries$0Not applicable
Mac with mlx_lm.loraHardware you ownVaries$0 extraNot applicable

What this means. One training run costs between $0 and roughly $7 across every route above. Budget for the iterations, not the run: five or ten experiments to tune data and learning rate is the real cost. At the assumed rates, ten 4090 runs cost about $2.80 to $7.40, ten Tinker 4B runs cost $66.33, and ten Together runs cost $40.00 because each pays the $4 minimum. The most expensive part of most projects is building a clean dataset, not renting a GPU. Add hosting only if you serve the model from the cloud: Together bills dedicated endpoints separately, and its pricing page lists an H100 at $5.49 per hour on-demand, which is why on-device shipping removes the recurring cost entirely. For GPU rental options see our GPU cloud comparison.

Evaluate Before You Ship

A fine-tune that looks good in a demo can fail in production in ways a loss curve will not show. Run this checklist before release.

  1. Hold out real examples. 100 to 300 inputs from production traffic, never seen in training, each with a pass/fail check you can compute (valid JSON, correct label, parseable tool call, exact match).
  2. Test three variants on the same prompts. The base model with your best prompt, your tuned 16-bit model, and the exact quantized file you will ship. If the base model with a good prompt matches the tuned one, you did not need to fine-tune.
  3. Test the shipped format, not a proxy. Run the GGUF in llama.cpp or the .pte or .litertlm file in the target runtime. Mismatched chat templates and end-of-sequence tokens are the top cause of regressions per Unsloth.
  4. Check regressions. Spot-check general ability and safety behaviour with a small fixed set, or a public harness such as EleutherAI's lm-evaluation-harness, because LoRA on a narrow dataset can erode skills the base model had. For Qwen3.5, Unsloth's advice is to keep at least 75% reasoning-style examples if you want reasoning preserved.
  5. Measure on the device. Record time to first token, tokens per second, peak memory, battery and temperature on the lowest-spec target phone. Vendor speed numbers (Liquid's 1.8x to 2.8x, Unsloth's 2x) are conditional on their setups.
  6. Log in production. Even on-device apps can sample opt-in prompts and failures; see our LLM observability and eval tools guide for tooling.
# Minimal held-out check: same prompts, same template, three variants
import json, statistics
def score(generate, rows):
    ok = 0
    for r in rows:
        out = generate(r["prompt"])
        ok += int(r["check"](out))          # your own pass/fail check: JSON valid, label matches, tool call parses
    return ok / len(rows)

rows = [json.loads(l) for l in open("heldout.jsonl")]      # 100 to 300 examples never used in training
# print(score(base_with_best_prompt, rows), score(tuned_bf16, rows), score(tuned_gguf_q4, rows))

Which One Should You Pick

If youPickWhy
I have a free Colab and want a result todayUnsloth notebook with Gemma 4 E2B or Qwen3.5-2BBoth have official free-Colab notebooks and small VRAM needs.
I own a MacBook and no NVIDIA GPUmlx_lm.lora, then mlx_lm.fuseNo CUDA needed. LoRA on a 4-bit model becomes QLoRA automatically.
I need a model that fits in about 1 GB on a phoneLFM3-1.7B or Qwen3.5-0.8B or Gemma 3 270MLiquid says LFM3-1.7B takes about 1 GB at 4-bit. Our arithmetic gives 0.53 GB for Qwen3.5-0.8B and 0.16 GB for Gemma 3 270M at Q4_K_M.
My company earns more than $10M a yearQwen3.5, Gemma 4, SmolLM3, Phi-4-mini, MiniCPM5Apache-2.0 or MIT. The LFM Open License does not cover commercial use at or above the $10M threshold.
I need audio or vision in the same small modelGemma 4 E2B/E4B or LFM3 VL/Audio/OmniGemma 4 E2B and E4B accept text, image and audio. LFM3 ships separate VL, Audio and Omni models.
I want a repeatable training recipe in gitAxolotl YAML or a TRL scriptConfig-as-code, multi-GPU, preference tuning and RL methods.
I do not want to rent or manage a GPUTogether AI SFT or TinkerPay per token. A 9M-token job on Qwen3.5-4B costs $4.00 at Together (minimum) or about $6.63 at Tinker.
I am shipping to AndroidLiteRT-LM (Gemma 4) or llama.cpp Android buildKotlin API is stable in LiteRT-LM. Liquid points mobile teams to llama.cpp.
I am shipping to iOSllama.cpp xcframework, ExecuTorch with Core ML, or LiteRT-LM Swift (preview)Liquid documents llama.xcframework with Metal and iOS 16.4 minimum.

A sensible default for a first project is: Gemma 4 E2B or Qwen3.5-2B, Unsloth on a free Colab, evaluation on a held-out set, llama.cpp for the GGUF, and Ollama for local testing. Move to LiteRT-LM, ExecuTorch or a llama.cpp mobile build only after the model passes your checks on a laptop. If your data is the weak point, the data pipeline tools guide will help.

Common Mistakes

  • Using QLoRA on Qwen3.5 because a tutorial did. Unsloth advises against it for the whole Qwen3.5 family. Use bf16 LoRA (about 3, 5, 10 and 22 GB for 0.8B, 2B, 4B and 9B).
  • Wrong chat template or EOS token. The model works in Colab and rambles in Ollama or llama.cpp. Train, test and export with the same template.
  • Ignoring the licence. LFM models stop being licensed for commercial use at $10M annual revenue. Llama 3.2 requires attribution and naming. Gemma 3 uses Gemma Terms. Only Gemma 4, Qwen3.5, SmolLM3, Phi-4-mini and MiniCPM5 are Apache-2.0 or MIT among the models above.
  • Training on the test set. Split first and keep the split fixed across experiments.
  • Forgetting the Ollama default context. 2048 tokens truncates long prompts silently until you set num_ctx.
  • Quantizing an already quantized file. Convert to bf16 GGUF first, then quantize once.
  • Fine-tuning for facts. Facts that change belong in retrieval, not in the weights, according to Google's Gemma guide.
  • Planning around the LEAP SDK. It is deprecated; use llama.cpp on mobile.
  • Trusting a tool's VRAM headline. Unsloth's 8 GB claim is for E2B; its own guide lists E4B higher. Leave headroom and measure.
  • Skipping the real-device test. Emulators can crash and desktop numbers do not predict phone battery or heat.

How We Evaluated

We read primary sources on Nov 26, 2026: Hugging Face model cards and the Hugging Face API for sizes, licences and repository dates; vendor blogs and X posts for release dates; vendor documentation and pricing pages for prices and commands; and the GitHub API for stars and releases. Every X embed was checked through the X syndication endpoint for the exact text and account, and every YouTube embed through oEmbed.

What we did not do. We did not run the training, conversion or phone-runtime commands, did not benchmark quality or speed, and did not test any managed service. All throughput numbers in the cost section are labelled assumptions. Benchmarks shown are vendor-reported. The ranking has no affiliate links. Where vendor pages contradict each other (Unsloth's Gemma 4 E4B VRAM, Together's two rate tables), we say so instead of picking one. Facts that may change within days: prices, star counts, the Nvidia and Hugging Face deal status, and the LEAP deprecation.

FAQ

What is the best small model to fine-tune for on-device use in 2026?

There is no single best model. For permissive licensing and strong general quality, start with Qwen3.5 (0.8B, 2B, 4B, 9B, Apache-2.0) or Gemma 4 E2B/E4B (Apache-2.0, with audio and image input). For the smallest memory footprint and long context, test LFM3-1.7B, which Liquid says takes about 1 GB at 4-bit, but check the LFM Open License revenue threshold of $10M first.

How much VRAM do I need to fine-tune a 4B model with LoRA?

Unsloth lists about 10 GB for bf16 LoRA on Qwen3.5-4B and Google lists about 9 GB QLoRA for Gemma 4 E4B (about 42 GB for full fine-tuning). Unsloth advises against QLoRA for Qwen3.5, so plan for the bf16 figure on that family. A 16 GB or 24 GB GPU, or a free Colab T4 for the 2B class, is enough to start.

Can I fine-tune on a free Colab GPU?

Yes for the smaller sizes. Unsloth publishes free Colab notebooks for Gemma 4 E2B and E4B and for Qwen3.5 0.8B, 2B and 4B. Google does not publish Colab usage limits and says free sessions last at most 12 hours depending on availability, so treat it as a prototyping tool, not a pipeline.

LoRA or QLoRA for small models?

LoRA in 16-bit is the safer default for models under 10B because they fit in modest memory. QLoRA saves VRAM but adds quantization error. Unsloth specifically recommends against QLoRA for all Qwen3.5 models, and its official Gemma 4 E2B notebook loads the model with load_in_4bit set to False.

How do I get a fine-tuned model into GGUF?

Merge the LoRA adapter into the base weights, then run llama.cpp convert_hf_to_gguf.py and llama-quantize. Unsloth wraps this in save_pretrained_gguf, but its Gemma 4 notebook states that only Q8_0, BF16 and F16 are supported there, so use llama-quantize for Q4_K_M.

Can Ollama run my fine-tuned model?

Yes. Point a Modelfile FROM line at your GGUF file and run ollama create. Ollama docs say it does not quantize GGUF files on import, so quantize first, and the default context window is 2048 tokens unless you set PARAMETER num_ctx.

How much does a managed fine-tuning job cost?

As of Nov 26, 2026, a 9M-token SFT job (5,000 examples of 600 tokens, 3 epochs) costs $4.00 at Together AI on Qwen3.5-4B (the computed $3.06 to $3.42 is below the $4 minimum) and about $6.63 on Tinker at $0.737 per 1M train tokens. Hosting the result is billed separately at Together.

Is the LEAP SDK still the way to put LFM models on phones?

No. Liquid's own documentation says the LEAP SDK is deprecated, no longer receives new releases, and tells developers to use llama.cpp directly on iOS and Android.

Does the Nvidia and Hugging Face deal change anything for TRL or llama.cpp?

Not today. Nvidia announced on Sep 3, 2026 an agreement to acquire Hugging Face for about $12.93 billion and said Hugging Face will remain open and NVIDIA compute will not be required. Coverage we found says it has not closed. TRL and llama.cpp remain Apache-2.0 and MIT licensed. ggml.ai, the llama.cpp team, joined Hugging Face on Feb 20, 2026.

How do I know my fine-tune is actually better than prompting the base model?

Hold out 100 to 300 real examples before training, score the base model with your best prompt, the tuned model in 16-bit, and the quantized file you will ship, all with the same chat template. If the quantized model loses the gain, change the quantization or the training data, not the benchmark.

Should I fine-tune or use retrieval (RAG)?

Google's Gemma tuning guide says to use RAG for frequently changing facts and to fine-tune for new output formats, personas, tool schemas or task skills. Combining a LoRA adapter with RAG is a common pattern.

Is fine-tuning legal on these models for commercial apps?

Apache-2.0 and MIT models (Qwen3.5, Gemma 4, SmolLM3, Phi-4-mini, MiniCPM5) allow commercial use. Llama 3.2 requires Built with Llama attribution and naming derivatives starting with Llama, and needs a Meta licence above 700 million monthly active users. LFM models are licensed for commercial use only below $10M annual revenue. Always read the licence file for the exact checkpoint.

Sources

All checked on Nov 26, 2026 unless stated.