Instructions to use mlx-community/LFM3-VL-2B-OptiQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/LFM3-VL-2B-OptiQ-4bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("mlx-community/LFM3-VL-2B-OptiQ-4bit") config = load_config("mlx-community/LFM3-VL-2B-OptiQ-4bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use mlx-community/LFM3-VL-2B-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-VL-2B-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-VL-2B-OptiQ-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use mlx-community/LFM3-VL-2B-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-VL-2B-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-VL-2B-OptiQ-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/LFM3-VL-2B-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-VL-2B-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-VL-2B-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-VL-2B-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-VL-2B, Liquid's LFM3 vision-language model. It reads images and text and answers in text. It is 1.7 GB on disk, down from 3.9 GB at bf16, with a 128k context.
The language model is the LFM3 backbone: short convolutions and attention, with 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. The vision tower stays at bf16 in a sidecar, optiq_vision.safetensors.
What it is
| Property | Value |
|---|---|
| Base | LiquidAI/LFM3-VL-2B |
| Architecture | lfm3_vl: LFM3 language model (24 layers: 13 convolution, 5 sliding-window attention of 256 tokens, 6 full attention) plus a vision tower |
| Method | OptiQ mixed-precision, sensitivity-driven (bf16 reference); vision tower at bf16 |
| On disk | 1.7 GB (bf16: 3.9 GB) |
| Context | 128k |
About half of the language model's 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) | 68.9% | 70.6% |
| GSM8K | 83.2% | 76.4% |
| IFEval (strict) | 44.4% | 35.7% |
| BFCL-V3 simple (200 calls) | 91.0% | 90.5% |
| HumanEval (164 problems, pass@1) | 55.5% | 43.9% |
| HashHop (long-context retrieval) | 3.0% | 0.0% |
| Capability Score (mean of 6) | 57.67 | 52.85 |
The OptiQ quant is ahead by 4.8 points overall, with the largest gains on code (+11.6), instruction following (+8.7) and math (+6.8).
Run it
pip install -U mlx-optiq
optiq serve --model mlx-community/LFM3-VL-2B-OptiQ-4bit
That gives you an OpenAI and Anthropic compatible endpoint that takes images as well as text, with mixed-precision KV cache (kv_config.json in this repo), tool calling, and prompt caching. Send an image as an image_url content part, as with any OpenAI vision request.
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.
Links
- Project website: mlx-optiq.com
- All OptiQ quants: mlx-optiq.com/models
- PyPI: pypi.org/project/mlx-optiq
- Base model: LiquidAI/LFM3-VL-2B
- Downloads last month
- 169
4-bit