agent-distill-lfm3-1.7b-lora
a compact LoRA for multi-step AI agents
2 min readupdated
This is a research LoRA adapter (a small add-on to a base model) that teaches the compact language model LiquidAI/LFM3-1.7B to function as a full-fledged multi-step agent. The model learns to correctly invoke external tools (APIs and functions) in a native XML format, clarify missing parameters, and decline to call a function if none is available. Created by author davidoneil using knowledge distillation from the large teacher model Qwen/Qwen3.8-27B-FP8 on synthetic scenarios. The main difference from the base version is a sharp jump in multi-step task execution accuracy without bloating size, making it an excellent choice for developers of local and mobile AI assistants, including on iPhones via MLX.
Key features
- Enhanced agent skills: trained on 3,179 verified synthetic trajectories covering read-before-act (
read_before_act), multi-step chains (multi_step_workflow), parameter clarification, and refusal when a tool is missing. - Benchmark leakage-free: completely excludes BFCL v4 Multi-Turn tasks during data generation and training (verified via 5-gram Jaccard ≤ 0.30 and MiniLM cosine similarity ≤ 0.85).
- Long-context support: trained on sequences up to 12,000 tokens without truncating the context (3,020 train and 159 validation examples).
- Optimized for mobile inference: tested in bf16 and prepared for further evaluation in 4-bit MLX format (
LiquidAI/LFM3-1.7B-MLX-4bit) with thinking disabled (enable_thinking=False).
What you can do
- Build a local smartphone agent: apply the adapter to
LiquidAI/LFM3-1.7Bor convert it to 4-bit MLX format to run an autonomous assistant on an iPhone. - Automate multi-step workflows: integrate the model into pipelines where the assistant first gathers data through one tool and then performs an action through another.
- Improve function parsing reliability: use for tasks requiring strict adherence to XML markup
and accurate parameter re-prompting.
Example
The model is trained to generate external function calls in the base model's native XML format:
...
Read more
DetailsInternal bf16 Smoke Eval verification (on a holdout split, not BFCL): Verifier Pass Rate increased from 25.0% (15/60) on the base
LFM3-1.7B to 85.0% (51/60) with LoRA, and native format validity reached 100.0% (325/325).Training parameters: PEFT LoRA (bf16), r=16, alpha=32, dropout=0.05, 116 target linear modules (attention and MLP), 2 epochs, lr=0.0001, effective batch size 16.
Final validation loss decreased from 0.5359 at step zero to 0.1901.
Limitations: experimental research adapter; license subject to LFM Open License v1.0 and the teacher model's Apache-2.0.










Comments