litetune fine-tunes a small language model, converts it into a file that runs through LiteRT-LM on supported native devices — phone, desktop, embedded board, robot — and checks that the converted model still does the job.

Supported runtimes

LiteRT-LM
Google's on-device LLM runtime
$pip install litetune
$ brew install DenisovAV/tap/litetune

Apache-2.0 · Python 3.10–3.12 · full pipeline on Linux x86_64 and Apple Silicon macOS · Windows except convert · alpha

Why it exists

Converting a model so it fits on a device changes it. The file still loads, the tools still report success, and the model can still be worse at your task than it was before. litetune runs the converted model on data it was never trained on, compares it with the version it came from, and tells you the difference.

Measured end to end so far: 12 language models and 1 embedding model, each converted and compared with its float reference on held-out data.

Supported formats

Output
.litertlm — the format LiteRT-LM loads
Platforms
Android, iOS, macOS, Linux and Windows natively — web runs as a text-only preview with no function calling and no LoRA, so a tuned tool-calling model is native-only for now
Acceleration
LiteRT-LM runs compatible bundles on CPU and GPU, with platform-specific NPU support — litetune can use CUDA or Apple GPU (MPS) for training and the float reference. Conversion currently uses the CPU export path; verify measures the converted model on CPU or GPU
Models
Gemma 3 (text), Gemma 4 E2B/E4B, Qwen3 0.6B/1.7B, Qwen2.5 0.5B/1.5B Instruct, Qwen3.5, MiniCPM5 1B, Granite 4.1 3B, FunctionGemma, and EmbeddingGemma 2 as a decider — fewer have been measured end to end than export; which, and how, is on the models page

Where to run it

What it does

prepare
validates your data and makes a reproducible train/held-out split
tune
fine-tunes it, with the settings the export step will need
convert
turns the result into a file LiteRT-LM can load
verify
compares that file with the model it came from
bundle
packages it together with what the comparison found

How to fine-tune a model for LiteRT-LM

The README's example, prepare → tune → convert → verify: FunctionGemma 270M fine-tuned with LoRA (leave out --method for a full fine-tune, the default), converted to .litertlm with two quantization recipes, and compared with the float model on the held-out split.

# 1. Validate and split the data. Seconds.
litetune prepare --data raw.jsonl --output-dir data --context-length 1024 \
                 --tokenizer google/functiongemma-270m-it

# 2. Fine-tune. Chooses CUDA, then MPS on a Mac, then CPU.
litetune tune --model google/functiongemma-270m-it --data data/train.jsonl \
              --output-dir tuned --method lora --prompt-mode prerendered

# 3. Convert, sweeping recipes rather than trusting a default.
litetune convert --model tuned/model --output-dir artifacts \
                 --recipe dynamic_wi8_afp32 --recipe weight_only_wi8_afp32

# 4. Compare the converted model with its float twin.
litetune verify --model artifacts/weight_only_wi8_afp32/<name>.litertlm \
                --reference tuned/model --data data/heldout.jsonl \
                --json > manifest.json

Every flag, and the bundle step, in the README