Instructions to use mlx-community/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/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/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use mlx-community/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit
Run Hermes
hermes
- OpenClaw new
How to use mlx-community/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-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 LM
How to use mlx-community/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/Devstral-Small-2-24B-Instruct-2512-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/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }'
mlx-community/Devstral-Small-2-24B-Instruct-2512-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. Try the Lab · All OptiQ quants · Docs
A 4-bit mixed-precision MLX quant produced by mlx-optiq, the sensitivity-aware quantization toolkit for Apple Silicon. Beats stock uniform 4-bit on the six-metric Capability Score, with a standout +9 points on long-context retrieval.
A 4-bit mixed-precision MLX quant of Devstral-Small-2-24B-Instruct-2512. Per-layer bit-widths come from a KL-divergence sensitivity pass on a six-domain calibration mix (prose · reasoning · code · agent · tool-call · constraint-bearing instructions). Sensitive layers go to 8-bit; robust ones stay at 4-bit. This is the first OptiQ quant of a Mistral-family model.
Quantization details
| Property | Value |
|---|---|
| Predominant precision | 4-bit |
| Layers at 8-bit (sensitive) | 179 |
| Layers at 4-bit (robust) | 102 |
| Total quantized layers | 281 |
| Achieved bits-per-weight | 5.01 |
| Group size | 64 |
| Calibration mix | six-domain mix (40 samples × 6 domains) |
| Reference for sensitivity | uniform-4-bit (24B does not fit bf16 in typical RAM) |
We follow the same naming convention llama.cpp uses for Q4_K_M and similar mixed-precision quants: the "4-bit" label is for the predominant precision, not the weighted average. The mixed allocation puts more bits where the sensitivity pass says they matter, which is what lets this build win the Capability Score below.
Usage
Load it with mlx-lm and use it as usual:
pip install mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("mlx-community/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit")
response = generate(
model, tokenizer,
prompt="Write a Python function that returns the nth Fibonacci number.",
max_tokens=200,
)
Devstral is a tool-calling, agentic coding model. For multi-step tool use, serve it with mlx-optiq (OpenAI + Anthropic-compatible server, mixed-precision KV-cache, sensitivity-aware LoRA):
pip install mlx-optiq
optiq serve --model mlx-community/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit
optiq serve captures Mistral/Devstral tool calls correctly. They end on EOS with no closing marker, which stock servers drop after the first call, and it normalizes tool-call arguments before chat templating.
See the Mistral family guide on mlx-optiq.com for sampling defaults, agent recipes, and family-specific caveats.
Benchmarks
Six-metric Capability Score (mean of MMLU + GSM8K + IFEval + BFCL + HumanEval + HashHop). Apples-to-apples comparison against stock uniform 4-bit:
| Metric | OptiQ | Uniform 4-bit | Δ |
|---|---|---|---|
| MMLU (5-shot, 1000 samples) | 80.8% | 79.4% | +1.4 |
| GSM8K (1000 samples, 3-shot CoT) | 87.2% | 88.1% | -0.9 |
| IFEval (full set, strict) | 68.6% | 68.0% | +0.6 |
| BFCL-V3 (tool calls) | 89.5% | 88.5% | +1.0 |
| HumanEval (164 problems, pass@1) | 83.5% | 82.9% | +0.6 |
| HashHop (long-context retrieval) | 62.0% | 53.0% | +9.0 |
| Capability Score (mean of 6) | 78.60 | 76.65 | +1.95 |
| On-disk size | 15.4 GB | 12.3 GB | +3.1 |
Every metric gets one equal vote. Disk size is reported next to the score as an honest second axis instead of being folded into the score. OptiQ wins 5 of 6 metrics; the win concentrates on HashHop (long-context multi-hop retrieval), exactly where uniform 4-bit degrades most. See the eval-framework writeup for methodology.
License
Apache-2.0, inherited from the base model.
- Downloads last month
- -
4-bit
Model tree for mlx-community/Devstral-Small-2-24B-Instruct-2512-OptiQ-4bit
Base model
mistralai/Mistral-Small-3.1-24B-Base-2503