Instructions to use lilcheaty/LFM2.5-230M-MLX-attn8-base6 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use lilcheaty/LFM2.5-230M-MLX-attn8-base6 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("lilcheaty/LFM2.5-230M-MLX-attn8-base6") 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 lilcheaty/LFM2.5-230M-MLX-attn8-base6 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "lilcheaty/LFM2.5-230M-MLX-attn8-base6"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "lilcheaty/LFM2.5-230M-MLX-attn8-base6" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use lilcheaty/LFM2.5-230M-MLX-attn8-base6 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 "lilcheaty/LFM2.5-230M-MLX-attn8-base6"
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 lilcheaty/LFM2.5-230M-MLX-attn8-base6
Run Hermes
hermes
- OpenClaw new
How to use lilcheaty/LFM2.5-230M-MLX-attn8-base6 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "lilcheaty/LFM2.5-230M-MLX-attn8-base6"
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 "lilcheaty/LFM2.5-230M-MLX-attn8-base6" \ --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"
- MLX LM
How to use lilcheaty/LFM2.5-230M-MLX-attn8-base6 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "lilcheaty/LFM2.5-230M-MLX-attn8-base6"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "lilcheaty/LFM2.5-230M-MLX-attn8-base6" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lilcheaty/LFM2.5-230M-MLX-attn8-base6", "messages": [ {"role": "user", "content": "Hello"} ] }'
LFM2.5-230M-MLX-attn8-base6
A custom mixed-precision MLX quant of Liquid AI's LFM2.5-230M: 6-bit base weights + 8-bit attention. On an M4 MacBook Air it runs ~17% faster than stock 8-bit at identical quality — the speed of a 6-bit model with the correctness of 8-bit.
A faster sibling,
attn8_base5(5-bit base + 8-bit attention, ~35% faster than 8-bit, same quality), lives on theattn8_base5branch.
Why mixed precision
Quantizing LFM2.5 uniformly trades quality for speed, and the damage is concentrated in specific weights. Per-task probing on extraction / classification / factual prompts showed:
- Attention (q/k/v/out, ~5% of params) must stay 8-bit. This is what controls "extract directly" vs "write a regex script." Drop it to 6-bit and the model starts dumping Python regex instead of answering an "extract the emails" instruction.
- Embeddings (the tied lm_head / logit matrix, ~29% of params) need ≥5-bit. At 4-bit they corrupt both extraction and factual recall.
- Everything else (the ~48% MLP, conv blocks, embeddings) tolerates 6-bit fine.
So this model keeps attention at 8-bit and everything else at 6-bit (group size 64,
affine). It's effectively "the known-good 6-bit model, patched at exactly the one
capability 6-bit broke" — the smallest change that recovers full 8-bit quality while
beating 8-bit speed. (config.json records the per-layer bits: 24 layers @ 8-bit, 59 @ 6-bit.)
Benchmarks (M4 MacBook Air 16 GB, mlx-lm 0.31.3, greedy, 256 tok)
Speed = median of 3 timed runs. Quality = a fixed set of 6 checkable extraction/classification/factual tasks; an arithmetic task all variants fail is excluded — this isn't a math model.
| variant | gen tok/s | peak GB | quality |
|---|---|---|---|
| LiquidAI MLX-4bit | ~492 | 0.168 | 4/6 — fumbles email extraction & "capital of Japan" |
| LiquidAI MLX-6bit | ~390 | 0.208 | 5/6 — fixes facts, still regex-dumps on extraction |
| this model (attn8-base6) | ~381 | 0.213 | 6/6 — clean, matches 8-bit |
attn8_base5 branch |
~438 | 0.187 | 6/6 — clean |
| LiquidAI MLX-8bit | ~325 | 0.263 | 6/6 — clean |
| LiquidAI MLX-bf16 | ~188 | 0.477 | 6/6 — clean |
Before → after: stock 8-bit @ ~325 tok/s → this model @ ~381 tok/s (+17%) at the same 6/6 quality. Numbers are machine-specific; reproduce with the recipe below.
Usage
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler
# default branch = attn8_base6 (6-bit base + 8-bit attention)
model, tok = load("lilcheaty/LFM2.5-230M-MLX-attn8-base6")
# faster sibling (5-bit base + 8-bit attention):
# model, tok = load("lilcheaty/LFM2.5-230M-MLX-attn8-base6", revision="attn8_base5")
prompt = tok.apply_chat_template(
[{"role": "user", "content": "Extract all emails from: 'Reach ana@acme.io or sales@acme.io'. Comma-separated."}],
add_generation_prompt=True,
)
print(generate(model, tok, prompt, max_tokens=128, sampler=make_sampler(temp=0.0)))
CLI:
python -m mlx_lm generate --model lilcheaty/LFM2.5-230M-MLX-attn8-base6 \
--prompt "Summarize the benefits of on-device LLMs." --max-tokens 128
How it was built
from mlx_lm.convert import convert
def predicate(path, module):
# attention at 8-bit, everything else at 6-bit; group size 64
bits = 8 if "self_attn" in path else 6
return {"group_size": 64, "bits": bits, "mode": "affine"}
convert(
hf_path="LiquidAI/LFM2.5-230M-MLX-bf16",
mlx_path="attn8_base6",
quantize=True, q_group_size=64, q_bits=6,
quant_predicate=predicate,
)
Intended use & limitations
LFM2.5-230M is a small extraction / classification / lightweight-agentic model — great for data extraction, structured output, and on-device tasks. It is not for heavy reasoning, math, or long-form creative writing (it cannot reliably do multi-digit arithmetic, by design). This quant preserves the base model's capabilities and limits.
License & attribution
Derivative of LiquidAI/LFM2.5-230M
(© Liquid AI), redistributed under the LFM Open License v1.0 (lfm1.0). All credit for
the model goes to Liquid AI; this repo only re-quantizes the weights for MLX. Please review
the base model's license for your use case.
- Downloads last month
- 64
6-bit
Model tree for lilcheaty/LFM2.5-230M-MLX-attn8-base6
Base model
LiquidAI/LFM2.5-230M-Base