Instructions to use mlx-community/LFM2.5-24B-A2B-Preview-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mlx-community/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use mlx-community/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-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/LFM2.5-24B-A2B-Preview-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"
LFM2.5-24B-A2B-Preview — 4bit
MLX conversion of lq-preview/LFM2.5-24B-A2B-Preview, pinned to revision f772950ce6f17d35af5469d00334b61a9c2fc034. Converted with the MLX-VLM CLI on an Apple M3 Ultra. This is a text generation model.
Affine weight-only quantization, 4 bits, group size 64. Router projections use affine 8-bit quantization (group size 64). Unquantized floating-point weights remain BF16; expert routing biases remain FP32.
The source configuration specifies a context limit of 131,072 tokens. Weight files total 13.49 GB (decimal); runtime memory also includes cache and temporary allocations.
Usage
This export was tested with the LFM2.5 port in MLX-VLM PR #2505, commit a6c7313bc053e5887616fa850808d21576eddf98, MLX 0.32.3 and Transformers 5.17.0.
pip install 'git+https://github.com/Blaizzy/mlx-vlm.git@a6c7313bc053e5887616fa850808d21576eddf98'
python -m mlx_vlm generate \
--model nativ-community/LFM2.5-24B-A2B-Preview-4bit \
--prompt "What is the capital of France? Answer briefly." \
--max-tokens 512 \
--temperature 0.1
Identical model files are published in both organizations:
Use the included chat template. The model generates reasoning before its final answer, so allow enough output tokens.
Conversion
python -m mlx_vlm convert --hf-path lq-preview/LFM2.5-24B-A2B-Preview --revision f772950ce6f17d35af5469d00334b61a9c2fc034 --mlx-path ./LFM2.5-24B-A2B-Preview-4bit --dtype bfloat16 -q --q-mode affine --q-bits 4 --q-group-size 64
The export was reloaded with strict weight matching. Prefill and cached decode produced finite logits, and two short greedy generation checks returned Paris and 391 correctly and reached EOS. These checks are smoke tests, not a comprehensive quality evaluation or a long-context benchmark. See conversion_info.json for settings and versions.
License and attribution
The original model is by Liquid AI, Inc. The original LFM Open License v1.0 is included and applies to these weights. Conversion and quantization modifications are described in NOTICE.
- Downloads last month
- 261
4-bit
Model tree for mlx-community/LFM2.5-24B-A2B-Preview-4bit
Base model
lq-preview/LFM2.5-24B-A2B-Preview