Instructions to use hermitdave/LFM3-1.7B-MLX-DWQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use hermitdave/LFM3-1.7B-MLX-DWQ-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("hermitdave/LFM3-1.7B-MLX-DWQ-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 hermitdave/LFM3-1.7B-MLX-DWQ-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 "hermitdave/LFM3-1.7B-MLX-DWQ-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": "hermitdave/LFM3-1.7B-MLX-DWQ-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use hermitdave/LFM3-1.7B-MLX-DWQ-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 "hermitdave/LFM3-1.7B-MLX-DWQ-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "hermitdave/LFM3-1.7B-MLX-DWQ-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hermitdave/LFM3-1.7B-MLX-DWQ-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use hermitdave/LFM3-1.7B-MLX-DWQ-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 "hermitdave/LFM3-1.7B-MLX-DWQ-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 hermitdave/LFM3-1.7B-MLX-DWQ-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use hermitdave/LFM3-1.7B-MLX-DWQ-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 "hermitdave/LFM3-1.7B-MLX-DWQ-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 "hermitdave/LFM3-1.7B-MLX-DWQ-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"
LFM3-1.7B โ MLX 4-bit DWQ
Provenance, up front. The bit allocation and the integer weights in this model are Liquid AI's, from LiquidAI/LFM3-1.7B-MLX-4bit. DWQ was applied on top by us, and it refines only the per-group scales and biases โ the quantized integers are untouched. This is a derivative of their quantization, not an independent one.
LFM3-1.7B is a 1.7B-parameter hybrid model (alternating short-convolution, full-attention and sliding-attention blocks, 24 layers, 128k vocab) from Liquid AI. This repo is their official 4-bit MLX quant with distillation- weighted quantization applied on top.
Results
Measured on held-out text (32 sequences ร 1024 tokens from FineWeb-Edu, never used in calibration), against the BF16 original:
| Model | Perplexity โ | KL vs BF16 โ | top-1 agreement โ |
|---|---|---|---|
| BF16 teacher (reference) | 23.61 | โ | โ |
| Liquid AI 4-bit RTN | 27.35 | 0.1946 | 76.81% |
| DWQ, epoch 1 | 22.67 | 0.1424 | 80.50% |
| DWQ, epoch 2 โ this model | 22.91 | 0.1181 | 81.94% |
Lower KL and higher top-1 mean the quantized model stays closer to the BF16 reference.
What the gain actually is
| Metric | RTN | DWQ (epoch 2) | Delta |
|---|---|---|---|
| KL vs BF16 | 0.1946 | 0.1181 | โ39% |
| top-1 agreement | 76.81% | 81.94% | +5.13 pts |
| Perplexity | 27.35 | 22.91 | โ16% |
Be clear about the magnitude. The KL improvement is the largest relative gap. On the metric that maps to behaviour โ how often a decisive token is predicted differently from the teacher โ the remaining disagreements are mostly near-tie positions where the teacher's own distribution is nearly flat. Between epoch 1 and epoch 2, KL improved a further 17% and top-1 agreement rose 1.4 points, while ground-truth perplexity ticked up ~1%: the student is tracking the teacher's distribution more faithfully, and where the teacher itself disagrees with ground truth that shows up as higher perplexity. If you optimise purely for ground-truth perplexity on this distribution, epoch 1 is marginally better; epoch 2 is the better match to the model's own behaviour.
Method
DWQ (distillation-weighted quantization) treats the quantization grid โ per-group scales and biases โ as free parameters and fits them by gradient descent against a higher-precision teacher's output distribution (a KL loss over the teacher's top-1024 logits, temperature 2.0). The quantized integer weights never change; only the grid moves. RTN (round-to-nearest) leaves the grid at its analytic default.
Setup for this model:
- Student: LiquidAI/LFM3-1.7B-MLX-4bit โ 4-bit, group size 64, affine.
- Teacher: Liquid AI's BF16 original (
LiquidAI/LFM3-1.7B). - Calibration: FineWeb-Edu, LFM3-tokenized. Epoch 1: 512 samples (480 train / 32 valid), sequence length 1024. Epoch 2: continuation from the epoch-1 checkpoint, 1,056 samples (1,024 train / 32 valid), sequence length 2048. Held-out evaluation on 32 fresh sequences.
- Optimizer: Adam. Epoch 1: lr 1e-6, batch size 4, 120 steps. Epoch 2: lr 5e-7 (continuation), batch size 4, 256 steps.
Quantization details
- 4-bit, group size 64, mode affine (inherited from the Liquid AI allocation)
- Trainable surface during DWQ: the per-group scales and biases only โ 3.147% of parameters (54.4M of 1,728.8M)
- Weights: 973 MB, single safetensors shard (unchanged from the RTN source)
Usage
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler
model, tokenizer = load("hermitdave/LFM3-1.7B-MLX-DWQ-4bit")
messages = [{"role": "user", "content": "What is the capital of Australia?"}]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=256,
sampler=make_sampler(temp=0.1, top_k=50)))
Recommended generation settings from the upstream card: temperature 0.1,
top_k 50, repetition_penalty 1.1. For math and science, use
temperature 1.0, top_p 0.95, top_k 20, repetition_penalty 1.0.
Limitations
- Not a fine-tune. A lossy compression of the upstream model. For knowledge-heavy work, pair it with retrieval.
- Derivative artifact. The integer weights are Liquid AI's; see the note at the top. Credit and licensing obligations follow the upstream model and quant.
- Not evaluated on task benchmarks. The numbers here are perplexity and teacher-agreement, not task accuracy. No claim is made about downstream agent or tool-use performance.
- Marginal gain over epoch 1. The second DWQ epoch is a small step โ see "What the gain actually is" above.
Attribution
- Base model: Liquid AI โ LFM3-1.7B, LFM Open License v1.0.
- Bit allocation and integer weights: LiquidAI/LFM3-1.7B-MLX-4bit by Liquid AI.
- DWQ refinement, pipeline, benchmarking and this card: Hermes Agent (Nous Research).
See the upstream model card for training details, evaluation and licensing.
- Downloads last month
- 207
4-bit