Model Overview
Model Features
Model Capabilities
Use Cases
🚀 Mistral-Small-3.2-24B-Instruct-2506
Mistral-Small-3.2-24B-Instruct-2506は言語モデルで、Mistral-Small-3.1-24B-Instruct-2503の小規模なバージョンアップデートです。このモデルは、指示の遵守、繰り返しエラーの削減、関数呼び出しなどの面で顕著な向上が見られ、画像テキストからテキストへの変換タスクに適しています。
サポート言語
このモデルは、英語、フランス語、ドイツ語、スペイン語、ポルトガル語、イタリア語、日本語、韓国語、ロシア語、中国語、アラビア語、ペルシャ語、インドネシア語、マレー語、ネパール語、ポーランド語、ルーマニア語、セルビア語、スウェーデン語、トルコ語、ウクライナ語、ベトナム語、ヒンディー語、ベンガル語など、複数の言語をサポートしています。
ライセンス
このプロジェクトはApache - 2.0ライセンスを採用しています。
ベースモデル
mistralai/Mistral-Small-3.2-24B-Instruct-2506
ベースモデルを基に構築されています。
追加説明
当社があなたの個人情報をどのように扱うかについて詳しく知りたい場合は、プライバシーポリシーをご覧ください。
モデル構築情報
- GGUFは
mistralai/Mistral-Small-3.1-24B-Instruct-2503
のchat_template.json
、preprocessor_config.json
、processor_config.json
、special_tokens_map.json
、tokenizer.json
、tokenizer_config.json
を使用して作成されています。 mmproj
はunsloth/Mistral-Small-3.1-24B-Instruct-2503-GGUF
から取得されています。
🚀 クイックスタート
✨ 主な機能
Mistral-Small-3.2-24B-Instruct-2506は、以下の点で改善されています。
- 指示の遵守:Small - 3.2は、正確な指示を遵守する能力が向上しています。
- 繰り返しエラー:Small - 3.2は、無限生成や繰り返しの答えの問題を減らしています。
- 関数呼び出し:Small - 3.2の関数呼び出しテンプレートはより堅牢です。詳細はこちらと例を参照してください。
ベンチマークテスト結果
テキストタスク
モデル | Wildbench v2 | Arena Hard v2 | IF(内部;正解率) |
---|---|---|---|
Small 3.1 24B Instruct | 55.6% | 19.56% | 82.75% |
Small 3.2 24B Instruct | 65.33% | 43.1% | 84.78% |
無限生成に関しては、Small 3.2は、挑戦的で長く繰り返しのあるプロンプトで、無限生成の発生率を2倍に減らしています。
モデル | 無限生成(内部;低いほど良い) |
---|---|
Small 3.1 24B Instruct | 2.11% |
Small 3.2 24B Instruct | 1.29% |
STEM関連のタスクでは:
モデル | MMLU | MMLU Pro(5 - shot CoT) | MATH | GPQA Main(5 - shot CoT) | GPQA Diamond(5 - shot CoT) | MBPP Plus - Pass@5 | HumanEval Plus - Pass@5 | SimpleQA(総正解率) |
---|---|---|---|---|---|---|---|---|
Small 3.1 24B Instruct | 80.62% | 66.76% | 69.30% | 44.42% | 45.96% | 74.63% | 88.99% | 10.43% |
Small 3.2 24B Instruct | 80.50% | 69.06% | 69.42% | 44.22% | 46.13% | 78.33% | 92.90% | 12.10% |
ビジュアルタスク
モデル | MMMU | Mathvista | ChartQA | DocVQA | AI2D |
---|---|---|---|---|---|
Small 3.1 24B Instruct | 64.00% | 68.91% | 86.24% | 94.08% | 93.72% |
Small 3.2 24B Instruct | 62.50% | 67.09% | 87.4% | 94.86% | 92.91% |
📦 インストール
vLLM(推奨)
このモデルを使用するには、vLLMフレームワークを使用することをおすすめします。
依存関係のインストール
vLLM >= 0.9.1
をインストールしてください:
pip install vllm --upgrade
インストールが完了すると、自動的にmistral_common >= 1.6.2
がインストールされます。以下のコマンドで確認できます:
python -c "import mistral_common; print(mistral_common.__version__)"
Dockerイメージを使用するか、Docker Hubから取得することもできます。
サービスの起動
Mistral - Small - 3.2 - 24B - Instruct - 2506は、サーバー/クライアント環境で使用することをおすすめします。
- サーバーを起動します:
vllm serve mistralai/Mistral-Small-3.2-24B-Instruct-2506 --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice --limit_mm_per_prompt 'image=10' --tensor-parallel-size 2
注意:GPU上でMistral - Small - 3.2 - 24B - Instruct - 2506をbf16またはfp16モードで実行するには、約55GBのGPUメモリが必要です。
- 以下の簡単なPythonコードスニペットを使用して、クライアントをテストできます。
💻 使用例
基本的な使用法
ビジュアル推論
Mistral - Small - 3.2 - 24B - Instruct - 2506のビジュアル機能を利用して、与えられたシチュエーションに基づいて最適な選択を行います。
from datetime import datetime, timedelta
from openai import OpenAI
from huggingface_hub import hf_hub_download
# Modify OpenAI's API key and API base to use vLLM's API server.
openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"
TEMP = 0.15
MAX_TOK = 131072
client = OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
models = client.models.list()
model = models.data[0].id
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()
today = datetime.today().strftime("%Y-%m-%d")
yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
model_name = repo_id.split("/")[-1]
return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
model_id = "mistralai/Mistral-Small-3.2-24B-Instruct-2506"
SYSTEM_PROMPT = load_system_prompt(model_id, "SYSTEM_PROMPT.txt")
image_url = "https://static.wikia.nocookie.net/essentialsdocs/images/7/70/Battle.png/revision/latest?cb=20220523172438"
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{
"role": "user",
"content": [
{
"type": "text",
"text": "What action do you think I should take in this situation? List all the possible actions and explain why you think they are good or bad.",
},
{"type": "image_url", "image_url": {"url": image_url}},
],
},
]
response = client.chat.completions.create(
model=model,
messages=messages,
temperature=TEMP,
max_tokens=MAX_TOK,
)
print(response.choices[0].message.content)
高度な使用法
関数呼び出し
Mistral - Small - 3.2 - 24B - Instruct - 2506は、vLLMを通じた関数/ツール呼び出しタスクで優れた性能を発揮します。
簡単な例
from openai import OpenAI
from huggingface_hub import hf_hub_download
# Modify OpenAI's API key and API base to use vLLM's API server.
openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"
TEMP = 0.15
MAX_TOK = 131072
client = OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
models = client.models.list()
model = models.data[0].id
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/Mistral-Small-3.2-24B-Instruct-2506"
SYSTEM_PROMPT = load_system_prompt(model_id, "SYSTEM_PROMPT.txt")
image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
tools = [
{
"type": "function",
"function": {
"name": "get_current_population",
"description": "Get the up-to-date population of a given country.",
"parameters": {
"type": "object",
"properties": {
"country": {
"type": "string",
"description": "The country to find the population of.",
},
"unit": {
"type": "string",
"description": "The unit for the population.",
"enum": ["millions", "thousands"],
},
},
"required": ["country", "unit"],
},
},
},
{
"type": "function",
"function": {
"name": "rewrite",
"description": "Rewrite a given text for improved clarity",
"parameters": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "The input text to rewrite",
}
},
},
},
},
]
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{
"role": "user",
"content": "Could you please make the below article more concise?\n\nOpenAI is an artificial intelligence research laboratory consisting of the non-profit OpenAI Incorporated and its for-profit subsidiary corporation OpenAI Limited Partnership.",
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "bbc5b7ede",
"type": "function",
"function": {
"name": "rewrite",
"arguments": '{"text": "OpenAI is an artificial intelligence research laboratory consisting of the non-profit OpenAI Incorporated and its for-profit subsidiary corporation OpenAI Limited Partnership."}',
},
}
],
},
{
"role": "tool",
"content": '{"action":"rewrite","outcome":"OpenAI is a FOR-profit company."}',
"tool_call_id": "bbc5b7ede",
"name": "rewrite",
},
{
"role": "assistant",
"content": "---\n\nOpenAI is a FOR-profit company.",
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Can you tell me what is the biggest country depicted on the map?",
},
{
"type": "image_url",
"image_url": {
"url": image_url,
},
},
],
}
]
response = client.chat.completions.create(
model=model,
messages=messages,
temperature=TEMP,
max_tokens=MAX_TOK,
tools=tools,
tool_choice="auto",
)
assistant_message = response.choices[0].message.content
print(assistant_message)
複雑な例
import json
from openai import OpenAI
from huggingface_hub import hf_hub_download
# Modify OpenAI's API key and API base to use vLLM's API server.
openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"
TEMP = 0.15
MAX_TOK = 131072
client = OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
models = client.models.list()
model = models.data[0].id
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/Mistral-Small-3.2-24B-Instruct-2506"
SYSTEM_PROMPT = load_system_prompt(model_id, "SYSTEM_PROMPT.txt")
image_url = "https://math-coaching.com/img/fiche/46/expressions-mathematiques.jpg"
def my_calculator(expression: str) -> str:
return str(eval(expression))
tools = [
{
"type": "function",
"function": {
"name": "my_calculator",
"description": "A calculator that can evaluate a mathematical expression.",
"parameters": {
"type": "object",
"properties": {
"expression": {
"type": "string",
"description": "The mathematical expression to evaluate.",
},
},
"required": ["expression"],
},
},
},
{
"type": "function",
"function": {
"name": "rewrite",
"description": "Rewrite a given text for improved clarity",
"parameters": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "The input text to rewrite",
}
},
},
},
},
]
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Can you calculate the results for all the equations displayed in the image? Only compute the ones that involve numbers.",
},
{
"type": "image_url",
"image_url": {
"url": image_url,
},
},
],
},
]
response = client.chat.completions.create(
model=model,
messages=messages,
temperature=TEMP,
max_tokens=MAX_TOK,
tools=tools,
tool_choice="auto",
)
tool_calls = response.choices[0].message.tool_calls
print(tool_calls)
results = []
for tool_call in tool_calls:
function_name = tool_call.function.name
function_args = tool_call.function.arguments
if function_name == "my_calculator":
result = my_calculator(**json.loads(function_args))
results.append(result)
messages.append({"role": "assistant", "tool_calls": tool_calls})
for tool_call, result in zip(tool_calls, results):
messages.append(
{
"role": "tool",
"tool_call_id": tool_call.id,
"name": tool_call.function.name,
"content": result,
}
)
response = client.chat.completions.create(
model=model,
messages=messages,
temperature=TEMP,
max_tokens=MAX_TOK,
)
print(response.choices[0].message.content)
指示の遵守
Mistral - Small - 3.2 - 24B - Instruct - 2506は、あなたの指示を正確に遵守することができます。
from openai import OpenAI
from huggingface_hub import hf_hub_download
# Modify OpenAI's API key and API base to use vLLM's API server.
openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"
TEMP = 0.15
MAX_TOK = 131072
client = OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
models = client.models.list()
model = models.data[0].id
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/Mistral-Small-3.2-24B-Instruct-2506"
SYSTEM_PROMPT = load_system_prompt(model_id, "SYSTEM_PROMPT.txt")
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{
"role": "user",
"content": "Write me a sentence where every word starts with the next letter in the alphabet - start with 'a' and end wit"
}
]
response = client.chat.completions.create(
model=model,
messages=messages,
temperature=TEMP,
max_tokens=MAX_TOK,
)
print(response.choices[0].message.content)
使用上の注意
⚠️ 重要な注意事項
比較的低い温度、例えば
temperature = 0.15
を使用することをおすすめします。モデルにシステムプロンプトを追加して、あなたのニーズにより適合させるようにしてください。モデルを汎用アシスタントとして使用する場合は、SYSTEM_PROMPT.txtファイルに記載されているプロンプトを使用することをおすすめします。
📄 ライセンス
このプロジェクトはApache - 2.0ライセンスを採用しています。









