モデル概要
モデル特徴
モデル能力
使用事例
🚀 Devstral Small 1.1
Devstralは、Mistral AI と All Hands AI が共同で構築した、ソフトウェアエンジニアリングタスク用のエージェント型大規模言語モデル(LLM)です🙌。Devstralは、コードベースの探索、複数ファイルの編集、ソフトウェアエンジニアリングエージェントの強化など、ツールの使用に優れています。このモデルはSWE-benchで卓越した性能を発揮し、このベンチマークにおいてオープンソースモデルとして1位にランクインしています。
このモデルは Mistral-Small-3.1 からファインチューニングされており、最大128kトークンの長いコンテキストウィンドウを持っています。コーディングエージェントとして、Devstralはテキストのみを扱い、Mistral-Small-3.1
からのファインチューニング前にビジョンエンコーダーが削除されています。
特殊な機能(コンテキストの拡張、ドメイン固有の知識など)を必要とする企業向けに、Mistral AIがコミュニティに提供するもの以上の商用モデルをリリースする予定です。
ブログ記事 でDevstralの詳細を学ぶことができます。
Devstral Small 1.0
との比較による更新点:
- 性能が向上しています。詳細は ベンチマーク結果 を参照してください。
Devstral Small 1.1
は依然としてOpenHandsと組み合わせると優れた性能を発揮します。この新バージョンは、他のプロンプトやコーディング環境にもより良く汎化しています。- Mistralの関数呼び出し形式 をサポートしています。
✨ 主な機能
- エージェント型コーディング:Devstralは、エージェント型コーディングタスクで優れた性能を発揮するように設計されており、ソフトウェアエンジニアリングエージェントに最適です。
- 軽量性:わずか240億のパラメータで構成されているため、単一のRTX 4090や32GB RAMのMacでも実行でき、ローカルデプロイやデバイス上での使用に適したモデルです。
- Apache 2.0ライセンス:商用および非商用目的での使用と改変が許可されるオープンライセンスです。
- コンテキストウィンドウ:最大128kトークンのコンテキストウィンドウを持っています。
- トークナイザー:131kの語彙サイズを持つTekkenトークナイザーを使用しています。
📈 ベンチマーク結果
SWE-Bench
Devstral Small 1.1は、SWE-Bench Verifiedで 53.6% のスコアを達成し、Devstral Small 1.0を+6.8%上回り、2番目に良い最先端モデルを+11.4%上回っています。
モデル | エージェント型スキャフォールド | SWE-Bench Verified (%) |
---|---|---|
Devstral Small 1.1 | OpenHands Scaffold | 53.6 |
Devstral Small 1.0 | OpenHands Scaffold | 46.8 |
GPT-4.1-mini | OpenAI Scaffold | 23.6 |
Claude 3.5 Haiku | Anthropic Scaffold | 40.6 |
SWE-smith-LM 32B | SWE-agent Scaffold | 40.2 |
Skywork SWE | OpenHands Scaffold | 38.0 |
DeepSWE | R2E-Gym Scaffold | 42.2 |
同じテストスキャフォールド(All Hands AIによって提供されるOpenHands🙌)で評価した場合、DevstralはDeepseek-V3-0324やQwen3 232B-A22Bなどのはるかに大きなモデルを上回っています。
🚀 クイックスタート
Devstralを使用する際には、OpenHands スキャフォールドの使用をおすすめします。APIを通じて、またはローカルで実行することができます。
API
これらの手順 に従って、Mistralアカウントを作成し、APIキーを取得してください。
次に、OpenHandsのDockerコンテナを起動するために以下のコマンドを実行します。
export MISTRAL_API_KEY=<MY_KEY>
mkdir -p ~/.openhands && echo '{"language":"en","agent":"CodeActAgent","max_iterations":null,"security_analyzer":null,"confirmation_mode":false,"llm_model":"mistral/devstral-small-2507","llm_api_key":"'$MISTRAL_API_KEY'","remote_runtime_resource_factor":null,"github_token":null,"enable_default_condenser":true}' > ~/.openhands-state/settings.json
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.48-nikolaik
docker run -it --rm --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.48-nikolaik \
-e LOG_ALL_EVENTS=true \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/.openhands:/.openhands \
-p 3000:3000 \
--add-host host.docker.internal:host-gateway \
--name openhands-app \
docker.all-hands.dev/all-hands-ai/openhands:0.48
ローカル推論
このモデルは以下のライブラリを使用してデプロイすることもできます。
vllm (推奨)
:こちら を参照mistral-inference
:こちら を参照transformers
:こちら を参照LMStudio
:こちら を参照llama.cpp
:こちら を参照ollama
:こちら を参照
vLLM (推奨)
展開する
このモデルを本番環境で使用可能な推論パイプラインを実装するために、[vLLMライブラリ](https://github.com/vllm-project/vllm) の使用をおすすめします。インストール
vLLM >= 0.9.1
をインストールしてください。
pip install vllm --upgrade
また、mistral_common >= 1.7.0
をインストールしてください。
pip install mistral-common --upgrade
確認するには、以下のコマンドを実行します。
python -c "import mistral_common; print(mistral_common.__version__)"
準備ができた Dockerイメージ または Docker Hub を使用することもできます。
サーバーの起動 Devstralをサーバー/クライアント環境で使用することをおすすめします。
- サーバーを起動します。
vllm serve mistralai/Devstral-Small-2507 --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice --tensor-parallel-size 2
- クライアントをpingするには、以下の簡単なPythonスニペットを使用できます。
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-2507"
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, "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 1.1 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"])
Mistral-inference
展開する
Devstralをすばやく試すために、mistral-inferenceの使用をおすすめします。インストール mistral_inference >= 1.6.0をインストールしてください。
pip install mistral_inference --upgrade
ダウンロード
from huggingface_hub import snapshot_download
from pathlib import Path
mistral_models_path = Path.home().joinpath('mistral_models', 'Devstral')
mistral_models_path.mkdir(parents=True, exist_ok=True)
snapshot_download(repo_id="mistralai/Devstral-Small-2507", allow_patterns=["params.json", "consolidated.safetensors", "tekken.json"], local_dir=mistral_models_path)
チャット 以下のコマンドを使用してモデルを実行できます。
mistral-chat $HOME/mistral_models/Devstral --instruct --max_tokens 300
その後、任意のプロンプトを入力することができます。
Transformers
展開する
transformersでこのモデルを最適に使用するには、[`mistral-common >= 1.7.0`](https://github.com/mistralai/mistral-common) をインストールして、トークナイザーを使用してください。 ```bash pip install mistral-common --upgrade ``` 次に、トークナイザーとモデルをロードし、生成を行います。 ```python import torchfrom mistral_common.protocol.instruct.messages import ( SystemMessage, UserMessage ) from mistral_common.protocol.instruct.request import ChatCompletionRequest from mistral_common.tokens.tokenizers.mistral import MistralTokenizer from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM
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
model_id = "mistralai/Devstral-Small-2507" SYSTEM_PROMPT = load_system_prompt(model_id, "SYSTEM_PROMPT.txt")
tokenizer = MistralTokenizer.from_hf_hub(model_id) model = AutoModelForCausalLM.from_pretrained(model_id)
tokenized = tokenizer.encode_chat_completion(
ChatCompletionRequest(
messages=[
SystemMessage(content=SYSTEM_PROMPT),
UserMessage(content="
output = model.generate( input_ids=torch.tensor([tokenized.tokens]), max_new_tokens=1000, )[0]
decoded_output = tokenizer.decode(output[len(tokenized.tokens):]) print(decoded_output)
</details>
#### LM Studio
<details>
<summary>展開する</summary>
以下のいずれかから重みをダウンロードします。
- LM Studio GGUFリポジトリ(推奨): https://huggingface.co/lmstudio-community/Devstral-Small-2507-GGUF
- 自社のGGUFリポジトリ: https://huggingface.co/mistralai/Devstral-Small-2507_gguf
pip install -U "huggingface_hub[cli]"
huggingface-cli download
"lmstudio-community/Devstral-Small-2507-GGUF" \ # or mistralai/Devstral-Small-2507_gguf
--include "Devstral-Small-2507-Q4_K_M.gguf"
--local-dir "Devstral-Small-2507_gguf/"
[LMStudio](https://lmstudio.ai/) を使用してモデルをローカルで提供できます。
* [LM Studio](https://lmstudio.ai/) をダウンロードしてインストールします。
* `lms cli ~/.lmstudio/bin/lms bootstrap` をインストールします。
* bashターミナルで、モデルチェックポイントをダウンロードしたディレクトリ(例:`Devstral-Small-2507_gguf`)で `lms import Devstral-Small-2507-Q4_K_M.gguf` を実行します。
* LM Studioアプリケーションを開き、ターミナルアイコンをクリックして開発者タブに移動します。「モデルを選択して読み込む」をクリックし、`Devstral Small 2507` を選択します。ステータスボタンを切り替えてモデルを起動し、設定で「ローカルネットワークで提供」をオンに切り替えます。
* 右側のタブに、`devstral-small-2507` というAPI識別子とAPI使用法の下にAPIアドレスが表示されます。このアドレスをメモしておいてください。これはOpenHandsまたはClineで使用されます。
</details>
#### llama.cpp
<details>
<summary>展開する</summary>
Hugging Faceから重みをダウンロードします。
pip install -U "huggingface_hub[cli]"
huggingface-cli download
"mistralai/Devstral-Small-2507_gguf"
--include "Devstral-Small-2507-Q4_K_M.gguf"
--local-dir "mistralai/Devstral-Small-2507_gguf/"
次に、llama.cppサーバーを使用してDevstralを実行します。
```bash
./llama-server -m mistralai/Devstral-Small-2507_gguf/Devstral-Small-2507-Q4_K_M.gguf -c 0 # -c configure the context size, 0 means model's default, here 128k.
OpenHands (推奨)
Devstral Small 1.1をデプロイするサーバーの起動
上述のように、vLLMやOllamaなどのOpenAI互換サーバーを起動してください。その後、OpenHandsを使用して Devstral Small 1.1
とやり取りすることができます。
チュートリアルの場合、以下のコマンドを実行してvLLMサーバーを起動します。
vllm serve mistralai/Devstral-Small-2507 --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice --tensor-parallel-size 2
サーバーアドレスは、http://<your-server-url>:8000/v1
の形式になります。
OpenHandsの起動
OpenHandsのインストール手順は こちら を参照してください。 OpenHandsを起動する最も簡単な方法は、Dockerイメージを使用することです。
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.48-nikolaik
docker run -it --rm --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.48-nikolaik \
-e LOG_ALL_EVENTS=true \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/.openhands:/.openhands \
-p 3000:3000 \
--add-host host.docker.internal:host-gateway \
--name openhands-app \
docker.all-hands.dev/all-hands-ai/openhands:0.48
その後、http://localhost:3000
でOpenHands UIにアクセスできます。
サーバーへの接続
OpenHands UIにアクセスすると、サーバーに接続するように促されます。詳細モードを使用して、先に起動したサーバーに接続できます。 以下のフィールドを入力してください。
- カスタムモデル:
openai/mistralai/Devstral-Small-2507
- ベースURL:
http://<your-server-url>:8000/v1
- APIキー:
token
(サーバーを起動する際に使用したトークンがある場合は、そのトークンを入力してください)
設定を表示
Cline
Devstral Small 1.1をデプロイするサーバーの起動
上述のように、vLLMやOllamaなどのOpenAI互換サーバーを起動してください。その後、OpenHandsを使用して Devstral Small 1.1
とやり取りすることができます。
チュートリアルの場合、以下のコマンドを実行してvLLMサーバーを起動します。
vllm serve mistralai/Devstral-Small-2507 --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice --tensor-parallel-size 2
サーバーアドレスは、http://<your-server-url>:8000/v1
の形式になります。
Clineの起動
Clineのインストール手順は こちら を参照してください。その後、設定でサーバーアドレスを構成できます。
設定を表示
💻 使用例
基本的な使用法
OpenHands: Mistral Commonのテストカバレッジの理解
OpenHandsスキャフォールドを起動し、リポジトリにリンクしてテストカバレッジを分析し、カバレッジが不十分なファイルを特定することができます。
ここでは、公開されている mistral-common
リポジトリから始めます。
リポジトリがワークスペースにマウントされた後、以下の指示を与えます。
Check the test coverage of the repo and then create a visualization of test coverage. Try plotting a few different types of graphs and save them to a png.
エージェントはまず、コードベースを参照してテスト構成と構造を確認します。
次に、テスト依存関係を設定し、カバレッジテストを開始します。
最後に、エージェントはカバレッジを視覚化するために必要なコードを記述し、結果をエクスポートしてプロットをPNGファイルに保存します。
実行が終了すると、以下のプロットが生成されます。
そして、モデルは結果を説明することができます。
Cline: ビデオゲームの作成
まず、VSCode内でClineを初期化し、先に起動したサーバーに接続します。 ビデオゲームを作成するために、以下の指示を与えます。
Create a video game that mixes Space Invaders and Pong for the web.
Follow these instructions:
- There are two players one at the top and one at the bottom. The players are controling a bar to bounce a ball.
- The first player plays with the keys "a" and "d", the second with the right and left arrows.
- The invaders are located at the center of the screen. They shoud look like the ones in Space Invaders. Their goal is to shoot on the players randomly. They cannot be destroyed by the ball that pass through them. This means that invaders never die.
- The players goal is to avoid shootings from the space invaders and send the ball to the edge of the over player.
- The ball bounces on the left and right edges.
- Once the ball touch one of the player's edge, the player loses.
- Once a player is touched 3 times or more by a shooting, the player loses.
- The player winning is the last one standing.
- Display on the UI, the number of times a player touched the ball, and the remaining health.
エージェントはまず、ゲームを作成します。
次に、ゲームを起動する方法を説明します。
最後に、ゲームがプレイできる状態になります。
ゲームを改善するために、Devstralに繰り返し指示を与えたり、より多くの情報を提供したりすることを躊躇しないでください!
📄 ライセンス
このプロジェクトは Apache 2.0 ライセンスの下でライセンスされています。



