Instructions to use badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit 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("badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit") 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
- LM Studio
- Pi
How to use badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit"
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": "badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit 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 "badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit"
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 badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit
Run Hermes
hermes
- MLX LM
How to use badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit", "messages": [ {"role": "user", "content": "Hello"} ] }'
Devstral Small 2 24B Instruct (MLX 3-bit)
MLX-optimized 3-bit quantization of mistralai/Devstral-Small-2-24B-Instruct-2512 for Apple Silicon Macs.
Model Details
- Base Model: Devstral Small 2 24B Instruct (December 2512 release)
- Architecture: Mistral3 (40 layers, GQA)
- Quantization: 3-bit affine, group size 64 (~3.5 bits/weight effective)
- Size: ~9.6 GB (vs ~48 GB BF16, ~12 GB 4-bit)
- Framework: MLX via mlx-lm
Key Features
- Native Tool Calling: Full
[AVAILABLE_TOOLS]/[TOOL_CALLS]/[TOOL_RESULTS]support - Agentic Coding: Designed for code generation, editing, and multi-step tool use
- 256K Context: Supports up to 256K token context window
- Speculative Decoding Compatible: Works with Mistral Tekken tokenizer draft models
Quantization Method
This model was created using a dequantize-requantize workflow for optimal 3-bit quality:
# Step 1: Dequantize the MLX 4-bit model back to BF16
mlx_lm.convert \
--hf-path mlx-community/mistralai_Devstral-Small-2-24B-Instruct-2512-MLX-4Bit \
--mlx-path ./devstral-v2-bf16 \
--dequantize --dtype bfloat16
# Step 2: Requantize from BF16 to 3-bit
mlx_lm.convert \
--hf-path ./devstral-v2-bf16 \
--mlx-path ./devstral-v2-3bit \
--quantize --q-bits 3 --q-group-size 64
Why this works: Direct 3-bit quantization from the original HuggingFace BF16 weights produces degenerate output ("decay decay decay") due to weight distribution differences during the PyTorch-to-MLX conversion. Going through the MLX 4-bit model's dequantized BF16 preserves the weight structure that MLX inference requires.
Usage
from mlx_lm import load, generate
model, tokenizer = load("badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit")
messages = [{"role": "user", "content": "Write a Python function to sort a list."}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, max_tokens=500)
print(response)
With Tool Calling
tools = [{"type": "function", "function": {"name": "read_file", "description": "Read a file", "parameters": {"type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"]}}}]
messages = [{"role": "user", "content": "Read the file main.py"}]
prompt = tokenizer.apply_chat_template(messages, tools=tools, tokenize=False, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, max_tokens=200)
# Output: [TOOL_CALLS]read_file[ARGS]{"path": "main.py"}
With Speculative Decoding
from mlx_lm import load
from mlx_lm.generate import speculative_generate_step
model, tokenizer = load("badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit")
draft_model, _ = load("badmadrad/Mistral-Small-3.1-DRAFT-0.5B-MLX-4bit")
# Draft model proposes tokens, main model verifies — faster generation
Hardware Requirements
- Apple Silicon Mac (M1/M2/M3/M4)
- Minimum 16 GB unified memory
- macOS 13.5+
Comparison
| Variant | Size | Quality | Tool Calling |
|---|---|---|---|
| BF16 (original) | ~48 GB | Best | Yes |
| 4-bit (mlx-community) | ~12 GB | Great | Yes |
| 3-bit (this model) | ~9.6 GB | Good | Yes |
License
Apache 2.0 (same as base model)
- Downloads last month
- 158
3-bit
Model tree for badmadrad/Devstral-Small-2-24B-Instruct-2512-MLX-3bit
Base model
mistralai/Mistral-Small-3.1-24B-Base-2503