Instructions to use AJ-Gonzalez/coder-lfm3-1.7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use AJ-Gonzalez/coder-lfm3-1.7b 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("AJ-Gonzalez/coder-lfm3-1.7b") 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
- llama.cpp
How to use AJ-Gonzalez/coder-lfm3-1.7b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M # Run inference directly in the terminal: llama cli -hf AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M # Run inference directly in the terminal: llama cli -hf AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M
Use Docker
docker model run hf.co/AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use AJ-Gonzalez/coder-lfm3-1.7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AJ-Gonzalez/coder-lfm3-1.7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AJ-Gonzalez/coder-lfm3-1.7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M
- Ollama
How to use AJ-Gonzalez/coder-lfm3-1.7b with Ollama:
ollama run hf.co/AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M
- Unsloth Desktop
- Pi
How to use AJ-Gonzalez/coder-lfm3-1.7b with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "AJ-Gonzalez/coder-lfm3-1.7b"
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": "AJ-Gonzalez/coder-lfm3-1.7b" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use AJ-Gonzalez/coder-lfm3-1.7b with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "AJ-Gonzalez/coder-lfm3-1.7b"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "AJ-Gonzalez/coder-lfm3-1.7b" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AJ-Gonzalez/coder-lfm3-1.7b", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use AJ-Gonzalez/coder-lfm3-1.7b with Docker Model Runner:
docker model run hf.co/AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M
- Lemonade
How to use AJ-Gonzalez/coder-lfm3-1.7b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AJ-Gonzalez/coder-lfm3-1.7b:Q4_K_M
Run and chat with the model
lemonade run user.coder-lfm3-1.7b-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use AJ-Gonzalez/coder-lfm3-1.7b 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 "AJ-Gonzalez/coder-lfm3-1.7b"
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 AJ-Gonzalez/coder-lfm3-1.7b
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use AJ-Gonzalez/coder-lfm3-1.7b with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "AJ-Gonzalez/coder-lfm3-1.7b"
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 "AJ-Gonzalez/coder-lfm3-1.7b" \ --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"
coder-lfm3-1.7b
LoRA SFT of LiquidAI/LFM3-1.7B on 70 reasoning traces, merged to bfloat16 and dequantized
from the official 4-bit MLX checkpoint. One of three planned subsets (Coder / IndieDev /
GenAgent) of a 250-row distill set.
This is epoch 1 of 3 โ the checkpoint with the best held-out loss, not the last one.
Training
| base | LiquidAI/LFM3-1.7B-MLX-4bit (4-bit affine g64, dequantized at merge time) |
| method | LoRA, rank 8, 8 of 24 layers, 2.753M trainable (0.159%) |
| data | xtools-at/Xiaomi-MiMo-2.6-Pro-High-Reasoning-250x, rows labelled code / CS / stats |
| rows | 70 train prompts โ 282 examples; 7 held-out prompts โ 32 examples |
| sequence | 2048 tokens, batch 1, lr 1e-5 (Adam), 282 iters (epoch 1 of a 846-iter run) |
| hardware | MacBook Air M1, 8 GB unified memory |
| throughput | 194โ211 tok/s, 2h11m for all 3 epochs |
Long assistant traces were chunked, not truncated: each row's rendered conversation was split into 2048-token windows with 256 tokens of the previous window replayed as context, so every token of the source data was trained on exactly once per epoch. Base-model NLL on the raw data would otherwise only cover 24% of the rows.
Evaluation
Held-out token NLL (lower is better), all 32 held-out chunks:
| model | Coder held-out | math rows | health rows |
|---|---|---|---|
| base (4-bit) | 1.430 | 1.959 | 1.889 |
| this model | 1.288 | 1.045 | 1.649 |
| epoch 3 (not released) | 1.294 | 0.982 | 1.670 |
Code smoke test โ generated code executed in a subprocess, single-argument functions probed against fixed cases: prime check 12/12, vowel removal 5/5, email regex 5/5. Base matches these scores exactly; the tasks are too easy to separate the two, so the gain here is style and trace format, not code ability.
No benchmark suite was run.
Usage
from mlx_lm import load, generate
model, tokenizer = load("AJ-Gonzalez/coder-lfm3-1.7b")
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "Write a Python function to check if a number is prime."}],
add_generation_prompt=True,
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=2048))
Expect long normative reasoning (The user asksโฆ We need toโฆ) inside <think> before the answer,
matching the teacher traces. Requires mlx-lm >= 0.32.2; LFM3 support was merged upstream only
recently โ with an older release, drop mlx_lm/models/lfm3.py from ml-explore/mlx-lm#2016 into
site-packages.
Weights are MLX-format safetensors as written by mlx_lm.fuse --dequantize (the repo keeps
the base model's modeling_lfm3.py / configuration_lfm3.py, but no torch conversion was
produced). Load with mlx-lm on Apple silicon.
GGUF
coder-lfm3-1.7b-Q4_K_M.gguf (1.04 GiB, 5.05 bpw) is in this repo. It was converted from the
merged MLX bf16 with llama.cpp's convert_hf_to_gguf.py and quantized with llama-quantize.
llama-cli -m coder-lfm3-1.7b-Q4_K_M.gguf \
-p "Write a Python function to check if a number is prime." -n 512 --temp 0
Measured on the M1: 38.4 tok/s for a 96-token greedy smoke test (short run, not a benchmark).
The MLX source needs the LFM3 converter's short-conv fix (squeeze() rather than squeeze(1))
so blk.N.shortconv.conv.weight reaches the expected 2D shape.
Limitations
- 70 source prompts, 3 topics, one epoch. This will not teach a coding model; it biases an existing one toward a reasoning-then-answer format.
- The validation set is 7 prompts (32 chunks); the loss differences between epochs 1โ3 are within noise. Epoch 3 scored slightly better on math, worse on Coder.
- Traces were produced by
xiaomi/mimo-v2.6-pro(the data card namesTeichAI/claude-4.5-opus-high-reasoning-250xas the origin), so the target style is second-hand. - No safety tuning, no tool-calling training, no long-context (>2048) training.
Licence
Base model: LFM Open License v1.0 (LiquidAI/LFM3-1.7B). Training data:
xtools-at/Xiaomi-MiMo-2.6-Pro-High-Reasoning-250x, listed as licence "other" on the Hub โ
check that dataset's terms before redistributing the weights commercially.
- Downloads last month
- 390
Quantized