ai/devstral-small-2

Verified Publisher

By Docker

Updated 1 day ago

Artifact
Model
4

10K+

ai/devstral-small-2 repository overview

Read our How to Run Devstral 2 Guide!

Unsloth Dynamic 2.0 achieves superior accuracy & outperforms other leading quants.

Devstral Small 2 24B Instruct 2512

Devstral is an agentic LLM for software engineering tasks. Devstral Small 2 excels at using tools to explore codebases, editing multiple files and power software engineering agents.
The model achieves remarkable performance on SWE-bench.

This model is an Instruct model in FP8, fine-tuned to follow instructions, making it ideal for chat, agentic and instruction based tasks for SWE use cases.

For enterprises requiring specialized capabilities (increased context, domain-specific knowledge, etc.), we invite companies to reach out to us.

Key Features

The Devstral Small 2 Instruct model offers the following capabilities:

  • Agentic Coding: Devstral is designed to excel at agentic coding tasks, making it a great choice for software engineering agents.
  • Lightweight: with its compact size of just 24 billion parameters, Devstral is light enough to run on a single RTX 4090 or a Mac with 32GB RAM, making it an appropriate model for local deployment and on-device use.
  • Apache 2.0 License: Open-source license allowing usage and modification for both commercial and non-commercial purposes.
  • Context Window: A 256k context window.

Updates compared to Devstral Small 1.1:

  • Vision Capabilities: Enables the model to analyze images and provide insights based on visual content, in addition to text.
  • Improved Performance: Devstral Small 2 is a step-up compared to its predecessors.
  • Attention Softmax Temperature: Devstral Small 2 uses the same architecture as Ministral 3 using rope-scaling as introduced by Llama 4 and Scalable-Softmax Is Superior for Attention.
  • Better Generalization: Generalises better to diverse prompts and coding environments.
Use Cases

AI Code Assistants, Agentic Coding, and Software Engineering Tasks. Leveraging advanced AI capabilities for complex tool integration and deep codebase understanding in coding environments.

Benchmark Results

Model/BenchmarkSize (B Parameters)SWE Bench VerifiedSWE Bench MultilingualTerminal Bench 2
Devstral 212372.2%61.3%32.6%
Devstral Small 22468.0%55.7%22.5%
GLM 4.645568.0%--24.6%
Qwen 3 Coder Plus48069.6%54.7%25.4%
MiniMax M223069.4%56.5%30.0%
Kimi K2 Thinking100071.3%61.1%35.7%
DeepSeek v3.267173.1%70.2%46.4%
GPT 5.1 Codex High--73.7%--52.8%
GPT 5.1 Codex Max--77.9%--60.4%
Gemini 3 Pro--76.2%--54.2%
Claude Sonnet 4.5--77.2%68.0%42.8%

*Benchmark results presented are based on publicly reported values for competitor models.

Usage

Scaffolding

Together with Devstral 2, we are releasing Mistral Vibe, a CLI tool allowing developers to leverage Devstral capabilities directly in your terminal.

Devstral 2 can also be used with the following scaffoldings:

You can use Devstral 2 either through our API or by running locally.

Mistral Vibe

The Mistral Vibe CLI is a command-line tool designed to help developers leverage Devstral’s capabilities directly from their terminal.

We recommend installing Mistral Vibe using uv for faster and more reliable dependency management:

uv tool install mistral-vibe

You can also run:

curl -LsSf https://mistral.ai/vibe/install.sh | sh

If you prefer using pip, use:

pip install mistral-vibe

To launch the CLI, navigate to your project's root directory and simply execute:

vibe

If this is your first time running Vibe, it will:

  • Create a default configuration file at ~/.vibe/config.toml.
  • Prompt you to enter your API key if it's not already configured, follow these instructions to create an Account and get an API key.
  • Save your API key to ~/.vibe/.env for future use.
Local Deployment

The model can also be deployed with the following libraries, we advise everyone to use the Mistral AI API if the model is subpar with local serving:

Coming soon:

Note

Current llama.cpp/ollama/lmstudio implementations may not be accurate, we invite developers to test them via the following [prompt tests](#tests).
Expand

We recommend using this model with the vLLM library to implement production-ready inference pipelines.

Installation

Please make sure to use our custom vLLM docker image mistralllm/vllm_devstral:latest:

docker pull mistralllm/vllm_devstral:latest
docker run -it mistralllm/vllm_devstral:latest

Alternatively, you can also install vllm from latest main by following instructions here.

Warning

Make sure that your vllm installation includes [this commit](https://github.com/vllm-project/vllm/commit/5c213d2899f5a2d439c8d771a0abc156a5412a2b). If you do not have this commit included, you will get incorrectly parsed tool calls.

Also make sure to have installed mistral_common >= 1.8.6. To check:

python -c "import mistral_common; print(mistral_common.__version__)"

Launch server

We recommand that you use Devstral in a server/client setting.

  1. Spin up a server:
vllm serve mistralai/Devstral-Small-2-24B-Instruct-2512 --tool-call-parser mistral --enable-auto-tool-choice --tensor-parallel-size 2
  1. To ping the client you can use a simple Python snippet.
import requests
import json
from huggingface_hub import hf_hub_download


url = "http://<your-server-url>:8000/v1/chat/completions"
headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}

model = "mistralai/Devstral-Small-2-24B-Instruct-2512"

def load_system_prompt(repo_id: str, filename: str) -> str:
    file_path = hf_hub_download(repo_id=repo_id, filename=filename)
    with open(file_path, "r") as file:
        system_prompt = file.read()
    return system_prompt

SYSTEM_PROMPT = load_system_prompt(model, "CHAT_SYSTEM_PROMPT.txt")

messages = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "<your-command>",
            },
        ],
    },
]

data = {"model": model, "messages": messages, "temperature": 0.15}

# Devstral Small 2 supports tool calling. If you want to use tools, follow this:
# tools = [ # Define tools for vLLM
#     {
#         "type": "function",
#         "function": {
#             "name": "git_clone",
#             "description": "Clone a git repository",
#             "parameters": {
#                 "type": "object",
#                 "properties": {
#                     "url": {
#                         "type": "string",
#                         "description": "The url of the git repository",
#                     },
#                 },
#                 "required": ["url"],
#             },
#         },
#     }
# ] 
# data = {"model": model, "messages": messages, "temperature": 0.15, "tools": tools} # Pass tools to payload.

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json()["choices"][0]["message"]["content"])
Transformers
Expand

Make sure to install from main:

uv pip install git+https://github.com/huggingface/transformers

And run the following code snippet:

Warning

While the checkpoint is serialized in FP8 format, there is currently a problem with "true" FP8 inference. Hence the weights are automatically dequantized to BFloat16 as per [this config setting](https://huggingface.co/mistralai/Devstral-Small-2-24B-Instruct-2512/blob/main/config.json#L13). Once the bug is fixed, we will by default run the model in "true" FP8. Stay tuned by following [this issue](https://github.com/huggingface/transformers/issues/42746).
import torch
from transformers import (
    Mistral3ForConditionalGeneration,
    MistralCommonBackend,
)

model_id = "mistralai/Devstral-Small-2-24B-Instruct-2512"

tokenizer = MistralCommonBackend.from_pretrained(model_id)
model = Mistral3ForConditionalGeneration.from_pretrained(model_id, device_map="auto")
model = model.to(torch.bfloat16)

SP = """You are operating as and within Mistral Vibe, a CLI coding-agent built by Mistral AI and powered by default by the Devstral family of models. It wraps Mistral's Devstral models to enable natural language interaction with a local codebase. Use the available tools when helpful.

You can:

- Receive user prompts, project context, and files.
- Send responses and emit function calls (e.g., shell commands, code edits).
- Apply patches, run commands, based on user approvals.

Answer the user's request using the relevant tool(s), if they are available. Check that all the required parameters for each tool call are provided or can reasonably be inferred from context. IF there are no relevant tools or there are missing values for required parameters, ask the user to supply these values; otherwise proceed with the tool calls. If the user provides a specific value for a parameter (for example provided in quotes), make sure to use that value EXACTLY. DO NOT make up values for or ask about optional parameters. Carefully analyze descriptive terms in the request as they may indicate required parameter values that should be included even if not explicitly quoted.

Always try your hardest to use the tools to answer the user's request. If you can't use the tools, explain why and ask the user for more information.

Act as an agentic assistant, if a user asks for a long task, break it down and do it step by step.

When you want to commit changes, you will always use the 'git commit' bash command. It will always
be suffixed with a line telling it was generated by Mistral Vibe with the appropriate co-authoring information.
The format you will always uses is the following heredoc.

```bash
git commit -m "<Commit message here>

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>"
```"""

input = {
    "messages": [
        {
            "role": "system",
            "content": SP,
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Can you implement in Python a method to compute the fibonnaci sequence at the `n`th element with `n` a parameter passed to the function ? You should start the sequence from 1, previous values are invalid.\nThen run the Python code for the function for n=5 and give the answer.",
                }
            ],
        },
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "add_number",
                "description": "Add two numbers.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "a": {"type": "string", "description": "The first number."},
                        "b": {"type": "string", "description": "The second number."},
                    },
                    "required": ["a", "b"],
                },
            },
        },
        {
            "type": "function",
            "function": {
                "name": "multiply_number",
                "description": "Multiply two numbers.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "a": {"type": "string", "description": "The first number."},
                        "b": {"type": "string", "description": "The second number."},
                    },
                    "required": ["a", "b"],
                },
            },
        },
        {
            "type": "function",
            "function": {
                "name": "substract_number",
                "description": "Substract two numbers.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "a": {"type": "string", "description": "The first number."},
                        "b": {"type": "string", "description": "The second number."},
                    },
                    "required": ["a", "b"],
                },
            },
        },
        {
            "type": "function",
            "function": {
                "name": "write_a_story",
                "description": "Write a story about science fiction and people with badass laser sabers.",
                "parameters": {},
            },
        },
        {
            "type": "function",
            "function": {
                "name": "terminal",
                "description": "Perform operations from the terminal.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "command": {
                            "type": "string",
                            "description": "The command you wish to launch, e.g `ls`, `rm`, ...",
                        },
                        "args": {
                            "type": "string",
                            "description": "The arguments to pass to the command.",
                        },
                    },
                    "required": ["command"],
                },
            },
        },
        {
            "type": "function",
            "function": {
                "name": "python",
                "description": "Call a Python interpreter with some Python code that will be ran.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "code": {
                            "type": "string",
                            "description": "The Python code to run",
                        },
                        "result_variable": {
                            "type": "string",
                            "description": "Variable containing the result you'd like to retrieve from the execution.",
                        },
                    },
                    "required": ["code", "result_variable"],
                },
            },
        },
    ],
}

tokenized = tokenizer.apply_chat_template(
    conversation=input["messages"],
    tools=input["tools"],
    return_tensors="pt",
    return_dict=True,
)

input_ids = tokenized["input_ids"].to(device="cuda")

output = model.generate(
    input_ids,
    max_new_tokens=200,
)[0]

decoded_output = tokenizer.decode(output[len(tokenized["input_ids"][0]) :])
print(decoded_output)

Tests

To help test our model via vLLM or test that other frameworks' implementations are correct, here is a set of prompts you can try with the expected outputs.

  1. Call one tool
Messages and tools
messages = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "Could you write me a story ?",
            },
        ],
    },
]
tools = [
    {
        "type": "function",
        "function": {
            "name": "add_number",
            "description": "Add two numbers.",
            "parameters": {
                "type": "object",
                "properties": {
                    "a": {
                        "type": "string",
                        "description": "The first number.",
                    },
                    "b": {
                        "type": "string",
                        "description": "The second number.",
                    },
                },
                "required": ["a", "b"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "multiply_number",
            "description": "Multiply two numbers.",
            "parameters": {
                "type": "object",
                "properties": {
                    "a": {
                        "type": "string",
                        "description": "The first number.",
                    },
                    "b": {
                        "type": "string",
                        "description": "The second number.",
                    },
                },
                "required": ["a", "b"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "substract_number",
            "description": "Substract two numbers.",
            "parameters": {
                "type": "object",
                "properties": {
                    "a": {
                        "type": "string",
                        "description": "The first number.",
                    },
                    "b": {
                        "type": "string",
                        "description": "The second number.",
                    },
                },
                "required": ["a", "b"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "write_a_story",
            "description": "Write a story about science fiction and people with badass laser sabers.",
            "parameters": {},
        },
    },
    {
        "type": "function",
        "function": {
            "name": "terminal",
            "description": "Perform operations from the terminal.",
            "parameters": {
                "type": "object",
                "properties": {
                    "command": {
                        "type": "string",
                        "description": "The command you wish to launch, e.g `ls`, `rm`, ...",
                    },
                    "args": {
                        "type": "string",
                        "description": "The arguments to pass to the command.",
                    },
                },
                "required": ["command"],
            },
        },
    },
    {
        "type": "function",
        "function": {
            "name": "python",
            "description": "Call a Python interpreter with some Python code that will be ran.",
            "parameters": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "The Python code to run",
                    },
                    "result_variable": {
                        "type": "string",
                        "description": "Variable containing the result you'd like to retrieve from the execution.",
                    },
                },
                "required": ["code", "result_variable"],
            },
        },
    },
]
Expected output trace
[
    {
      "role": "assistant",
      "tool_calls": [
        {
          "id": "chatcmpl-tool-8a1f267a212e66e5",
          "function": {
            "arguments": "{}",
            "name": "write_a_story"
          },
          "type": "function"
        }
      ],
      "content": null
    },
    {
      "role": "tool",
      "tool_call_id": "chatcmpl-tool-8a1f267a212e66e5",
      "name": "write_a_story",
      "content": "A long time ago in a galaxy far, far away..."
    },
    {
      "role": "assistant",
      "tool_calls": [],
      "content": "A long time ago in a galaxy far, far away, there was a planet called Eldoria, known for its breathtaking landscapes and advanced civilization. The people of Eldoria were not just ordinary beings; they were warriors, scientists, and dreamers, all wielding the power of laser sabers.\n\nAmong them was a young warrior named Kael. Kael was not like the others. While his peers trained rigorously to master the art of the laser saber, Kael was more interested in the science behind it. He spent his days in the ancient libraries of Eldoria, deciphering the secrets of the laser sabers and the energy that powered them.\n\nOne day, Kael discovered an old, forgotten text that spoke of a legendary laser saber, the \"Eldoria Star,\" said to be the most powerful weapon in the galaxy. According to the text, the Eldoria Star was hidden in the heart of the planet's core, guarded by an ancient force.\n\nDriven by curiosity and a desire to protect his planet, Kael set out on a perilous journey to find the Eldoria Star. Along the way, he encountered various challenges and made unlikely allies, each with their own unique skills and laser sabers.\n\nThere was Lyra, a cunning thief with a laser saber that could change colors; Zara, a wise old sage who could manipulate energy fields; and Jax, a former enemy tu

…(truncated — see the full README on HuggingFace)

Tag summary

Content type

Unrecognized

Digest

sha256:aca8cb96a

Size

48.1 GB

Last updated

1 day ago

docker pull ai/devstral-small-2:safetensors

This week's pulls

Pulls:

6,625

Last week