Instructions to use mlx-community/LFM3-1.7B-OptiQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/LFM3-1.7B-OptiQ-4bit 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("mlx-community/LFM3-1.7B-OptiQ-4bit") 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 mlx-community/LFM3-1.7B-OptiQ-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/LFM3-1.7B-OptiQ-4bit"
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": "mlx-community/LFM3-1.7B-OptiQ-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mlx-community/LFM3-1.7B-OptiQ-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/LFM3-1.7B-OptiQ-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/LFM3-1.7B-OptiQ-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/LFM3-1.7B-OptiQ-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use mlx-community/LFM3-1.7B-OptiQ-4bit 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 "mlx-community/LFM3-1.7B-OptiQ-4bit"
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 mlx-community/LFM3-1.7B-OptiQ-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/LFM3-1.7B-OptiQ-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/LFM3-1.7B-OptiQ-4bit"
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 "mlx-community/LFM3-1.7B-OptiQ-4bit" \ --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-community/LFM3-1.7B-OptiQ-4bit
Built with mlx-optiq, the MLX-native toolkit to quantize, fine-tune, and serve LLMs locally on Apple Silicon, no PyTorch and no cloud. All OptiQ quants ยท Docs
An OptiQ mixed-precision quant of LiquidAI/LFM3-1.7B, the first model in Liquid's LFM3 family. It is 1.3 GB on disk, down from 3.5 GB at bf16, with a 256k context.
LFM3 keeps Liquid's hybrid backbone of short convolutions and attention, and adds sliding-window attention, so only 6 of its 24 layers keep a full-length KV cache. OptiQ measures each layer's sensitivity and assigns its bit-width from that.
What it is
| Property | Value |
|---|---|
| Base | LiquidAI/LFM3-1.7B |
| Architecture | lfm3: 24 layers, 13 convolution, 5 sliding-window attention (256 tokens), 6 full attention |
| Method | OptiQ mixed-precision, sensitivity-driven (bf16 reference) |
| On disk | 1.3 GB (bf16: 3.5 GB) |
| Context | 256k |
About half of the weight matrices stay at 8-bit (75 of 153), the ones whose quantization moved the output most. The rest are at 4-bit.
Capability Score
Six-metric mean, the standard OptiQ eval, run in reasoning mode because the model thinks before it answers by default. The baseline is a uniform 4-bit quant of the same model, scored the same way.
| Metric | OptiQ | Uniform 4-bit |
|---|---|---|
| MMLU (generative) | 77.6% | 76.3% |
| GSM8K | 92.4% | 92.4% |
| IFEval (strict) | 72.6% | 66.5% |
| BFCL-V3 simple (200 calls) | 91.5% | 93.0% |
| HumanEval (164 problems, pass@1) | 72.6% | 64.0% |
| HashHop (long-context retrieval) | 21.0% | 14.0% |
| Capability Score (mean of 6) | 71.29 | 67.70 |
The OptiQ quant is ahead by 3.6 points overall. The gains are on instruction following (+6.1) and code (+8.6). BFCL is 1.5 points behind, inside its ยฑ3.5 point margin on 200 calls.
Run it
pip install -U mlx-optiq
optiq serve --model mlx-community/LFM3-1.7B-OptiQ-4bit
That gives you an OpenAI and Anthropic compatible endpoint with mixed-precision KV cache (kv_config.json in this repo), tool calling, and prompt caching.
The model reasons before it answers, so give it a generous max_tokens. Liquid's recommended sampling (temperature 0.1, top_k 50, repetition_penalty 1.1) ships in generation_config.json, and optiq serve applies it automatically.
Or from Python. mlx-lm does not know the LFM3 architecture yet, so register OptiQ's implementation first:
from optiq.models import install_vendored
from mlx_lm import load, generate
install_vendored()
model, tokenizer = load("mlx-community/LFM3-1.7B-OptiQ-4bit")
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "Summarise this contract clause in two sentences."}],
add_generation_prompt=True, tokenize=False,
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=4096))
Links
- Project website: mlx-optiq.com
- All OptiQ quants: mlx-optiq.com/models
- PyPI: pypi.org/project/mlx-optiq
- Base model: LiquidAI/LFM3-1.7B
- Downloads last month
- 30
4-bit