Instructions to use sagaya/LFM2.5-1.2B-Instruct-control-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use sagaya/LFM2.5-1.2B-Instruct-control-mlx with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("sagaya/LFM2.5-1.2B-Instruct-control-mlx") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use sagaya/LFM2.5-1.2B-Instruct-control-mlx with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "sagaya/LFM2.5-1.2B-Instruct-control-mlx"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "sagaya/LFM2.5-1.2B-Instruct-control-mlx" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use sagaya/LFM2.5-1.2B-Instruct-control-mlx with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "sagaya/LFM2.5-1.2B-Instruct-control-mlx"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "sagaya/LFM2.5-1.2B-Instruct-control-mlx" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sagaya/LFM2.5-1.2B-Instruct-control-mlx", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use sagaya/LFM2.5-1.2B-Instruct-control-mlx with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "sagaya/LFM2.5-1.2B-Instruct-control-mlx"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default sagaya/LFM2.5-1.2B-Instruct-control-mlx
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use sagaya/LFM2.5-1.2B-Instruct-control-mlx with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "sagaya/LFM2.5-1.2B-Instruct-control-mlx"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "sagaya/LFM2.5-1.2B-Instruct-control-mlx" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
sagaya/LFM2.5-1.2B-Instruct-control-mlx
An MLX build of LiquidAI/LFM2.5-1.2B-Instruct made small enough for 8 GB iPhones, with recipe 6bit-g64 (Plain 6-bit, groups of 64).
This is a modified version (fine-tuned for Control by distillation, then quantized) of the original model, distributed under the LFM Open License v1.0 (LICENSE). Commercial use by an organization with annual revenue of $10M or more is not licensed under it.
Quality against the full-precision model
| Measure | This build | Full precision |
|---|---|---|
| Held-out perplexity | 23.775 | 23.607 |
| KL divergence on chat replies | 0.0047 nats | 0 |
| Same next token on chat replies | 97.7% | 100 % |
| Recall of facts ~2,000 tokens back | 4/4 | 4/4 |
| Size | 0.95 GB |
Recipes we tried
| Recipe | Size | Bits/weight | Perplexity | KL (chat) | Top-1 (chat) | Recall | Swift loads | Stops | Result |
|---|---|---|---|---|---|---|---|---|---|
| shipped-4bit | 0.66 GB | 4.5 | 29.49 (+24.9 %) | 0.088 | 88.1% | 4/4 | Yes | – | Shipped today |
| shipped-6bit | 0.95 GB | 6.5 | 24.73 (+4.8 %) | 0.020 | 96.0% | 4/4 | Yes | 100% | Shipped today (default) |
| 6bit-g64 | 0.95 GB | 6.5 | 23.78 (+0.7 %) | 0.005 | 97.7% | 4/4 | Yes | 100% | Winner |
Parity: our Swift engine vs Python mlx-lm
| Check | Value | Result |
|---|---|---|
| 6bit-g64 · top-1 agreement | 100.0% | passed |
| 6bit-g64 · greedy tokens | identical | passed |
| 6bit-g64 · max |Δlogit| | 0.219 | passed |
| 6bit-g64 · long-context recall | Swift 4/4 · Python 4/4 | passed |
| 6bit-g64 · chat template | same ids | passed |
| 6bit-g64 · app engine reply | same opening | passed |
Bench (Mac, the app's engine)
| Check | Value | Result |
|---|---|---|
| 6bit-g64 · stop reliability | 18/18 ended on their own | passed |
| 6bit-g64 · Mac decode speed | 279 tok/s | info |
| 6bit-g64 · first token (Mac) | 0.02 s | info |
| 6bit-g64 · peak memory (Mac) | 1.00 GB | info |
| 6bit-g64 · iPhone estimate | 41.7 tok/s, cool | info |
Evals
| Task | shipped-6bit · Student before | untuned · Full precision | teacher · Teacher | 6bit-g64 · Student after |
|---|---|---|---|---|
| ARC-Challenge (100) | 45.0% ± 10% | 45.0% ± 10% | 44.0% ± 10% | 40.0% ± 10% |
| GSM8K (50) | 70.0% ± 13% | 66.0% ± 13% | 96.0% ± 5% | 66.0% ± 13% |
| IFEval strict (50) | 76.0% ± 12% | 80.0% ± 11% | 90.0% ± 8% | 80.0% ± 11% |
| MMLU-Pro (3 per subject) | 33.3% ± 15% | 38.1% ± 13% | 73.8% ± 13% | 31.0% ± 14% |
| General average | 56.1% | 57.3% | 76.0% | 54.2% |
| Control tasks (quick) | 13/65 | 9/65 | 54/65 | 26/65 |
| actions | 1/5 | 0/5 | 4/5 | 5/5 |
| automations | 0/7 | 0/7 | 5/7 | 0/7 |
| calendar | 0/12 | 0/12 | 10/12 | 5/12 |
| contacts | 0/3 | 0/3 | 3/3 | 0/3 |
| general | 2/3 | 2/3 | 1/3 | 3/3 |
| health | 0/2 | 0/2 | 2/2 | 0/2 |
| longdoc | 1/4 | 1/4 | 4/4 | 1/4 |
| memory | 2/5 | 2/5 | 4/5 | 2/5 |
| permissions | 1/5 | 0/5 | 5/5 | 2/5 |
| places | 0/1 | 0/1 | 1/1 | 1/1 |
| recall | 5/5 | 4/5 | 5/5 | 5/5 |
| reminders | 0/5 | 0/5 | 5/5 | 1/5 |
| shortcuts | 1/3 | 0/3 | 1/3 | 0/3 |
| weather | 0/2 | 0/2 | 2/2 | 1/2 |
| web | 0/3 | 0/3 | 2/3 | 0/3 |
Retains the original: 6bit-g64
| Check | Original | This build | Same |
|---|---|---|---|
| Chat template | 5,487 characters | 5,487 characters | yes |
| Thinking switch | never | never | yes |
| Tool-call format | LFM2 (<|tool_call_start|> … pythonic calls) | LFM2 (<|tool_call_start|> … pythonic calls) | yes |
| Tokenizer (tokenizer.json) | present | same | yes |
| Tokenizer settings | tokenizer_config.json | same | yes |
| Special tokens | bos_token <|startoftext|> (1), eos_token <|im_end|> (7), pad_token <|pad|> (0) | same | yes |
| EOS and special token ids | bos_token_id 1, eos_token_id 7, generation bos_token_id 1, generation eos_token_id 7, generation pad_token_id 0, pad_token_id 0 | same | yes |
| Generation settings | generation_config.json | same | yes |
Distillation: held-out split
| Measure | Before | After |
|---|---|---|
| Loss of the teacher's answers | 1.093 | 0.525 |
| Call a tool or answer, like the teacher | 38.6% | 84.1% |
| Same tool as the teacher | 0.0% | 59.3% |
| Same argument values | 0.0% | 30.9% |
Use with mlx-lm
pip install mlx-lm
mlx_lm.generate --model sagaya/LFM2.5-1.2B-Instruct-control-mlx --prompt "Hello"
How it was tuned
Distilled for Control from Qwen3 30B-A3B Instruct (mlx-community/Qwen3-30B-A3B-Instruct-2507-4bit, license apache-2.0): 819 examples of Control-style requests (the app's tool specs and prompt format), LoRA, then quantized as above.
About 45% of the training rows are the original model's own answers (rehearsal), so it keeps what it knew before.
Prompts from databricks/databricks-dolly-15k, revision bdd27f4d94b9, license cc-by-sa-3.0, used under its terms with this credit.
- Downloads last month
- 149
6-bit
Model tree for sagaya/LFM2.5-1.2B-Instruct-control-mlx
Base model
LiquidAI/LFM2.5-1.2B-Base