New Tool Radar

Local AI

How to Fuse a LoRA Adapter into a Standalone MLX Model

Merge a trained LoRA adapter back into its base model with mlx_lm.fuse, so you get one self-contained model folder with no adapter to load.

Schematic diagram with three steps: train a LoRA adapter, fuse it into the base model with mlx_lm.fuse, then use the fused model with no adapter flag.

Fine-tuning with LoRA leaves you with two pieces: the unchanged base model and a small adapter folder that patches it. That pair works, but every run has to load both — and tools that take one model file cannot use it at all. Fusing bakes the adapter’s weights into the base model and writes out a normal, standalone model you can load, serve, or share on its own.

Fuse the adapter into the base

The command is mlx_lm.fuse, with the base model, the adapter folder, and a folder to write the fused model into. This example comes from a fine-tuning guide that uses the same base model as its training example:

mlx_lm.fuse \
  --model mlx-community/Mistral-7B-Instruct-v0.3-4bit \
  --adapter-path ./adapters \
  --save-path ./fused-model

The guide’s reason for doing this: “for deployment you often want a single, self-contained model”, and fusing “merges the adapter back into the base weights”. The fused folder holds the merged weights, so it is a full model in its own right.

Use the fused model like any model

Load it without any adapter flag. Generate a reply to check it answers:

mlx_lm.generate --model ./fused-model --prompt "What time does the lighthouse lamp get checked?"

Or serve it over the local API, as the same guide does:

mlx_lm.server --model ./fused-model --port 8080
Check What you should see If you do not see it
Adapter ./adapters holds the trained adapter (adapter_config.json and adapters.safetensors) The adapter folder is from a different run — use the one saved by your training
Fused ./fused-model exists after the fuse command, with model weights inside The fuse command failed — check the base model name and adapter path
Standalone mlx_lm.generate --model ./fused-model answers with no –adapter-path flag You pointed generate at the base model plus the adapter — point it at the fused folder instead

Expected result. We checked a third-party MLX fine-tuning guide for the fuse command and mlx-lm’s own README for the package install and generate command. We did not run mlx_lm.

Limits

The fuse command itself comes from a third-party guide, not from mlx-lm’s own docs, so confirm the flags with mlx_lm.fuse -h on your installed version. mlx-lm runs on Apple Silicon Macs, and the example base model above is the guide’s own — replace it with the base your adapter was trained on, since an adapter only matches its own base. The fused model is a second full copy of the weights, so it needs the base model’s disk space again. The prompt above is fictional. We did not run mlx_lm, so no output here is a recorded result.

Sources

See all