The smallest model in the Ministral 3 family, Ministral 3 3B is a powerful, efficient tiny language model with vision capabilities.
This model is the instruct post-trained version in FP8, fine-tuned for instruction tasks, making it ideal for chat and instruction based use cases.
The Ministral 3 family is designed for edge deployment, capable of running on a wide range of hardware. Ministral 3 3B can even be deployed locally, capable of fitting in 8GB of VRAM in FP8, and less if further quantized.
Key Features
Ministral 3 3B consists of two main architectural components:
3.4B Language Model
0.4B Vision Encoder
The Ministral 3 3B Instruct model offers the following capabilities:
Vision: Enables the model to analyze images and provide insights based on visual content, in addition to text.
Multilingual: Supports dozens of languages, including English, French, Spanish, German, Italian, Portuguese, Dutch, Chinese, Japanese, Korean, Arabic.
System Prompt: Maintains strong adherence and support for system prompts.
Agentic: Offers best-in-class agentic capabilities with native function calling and JSON outputting.
Edge-Optimized: Delivers best-in-class performance at a small scale, deployable anywhere.
Apache 2.0 License: Open-source license allowing usage and modification for both commercial and non-commercial purposes.
Large Context Window: Supports a 256k context window.
Use Cases
Ideal for lightweight, real-time applications on edge or low-resource devices, such as:
Image captioning
Text classification
Real-time efficient translation
Data extraction
Short content generation
Fine-tuning and specialization
And more...
Bringing advanced AI capabilities to edge and distributed environments for embedded systems.
Due to their size and the FP8 format of their weights Ministral-3-3B-Instruct-2512, Ministral-3-8B-Instruct-2512 and Ministral-3-14B-Instruct-2512 can run on a single 1xH200 GPU.
enable-auto-tool-choice: Required when enabling tool usage.
tool-call-parser mistral: Required when enabling tool usage.
Additional flags:
You can set --max-model-len to preserve memory. By default it is set to 262144 which is quite large but not necessary for most scenarios.
You can set --max-num-batched-tokens to balance throughput and latency, higher means higher throughput but higher latency.
Usage of the model
Here we asumme that the model mistralai/Ministral-3-3B-Instruct-2512 is served and you can ping it to the domain localhost with the port 8000 which is the default for vLLM.
Vision Reasoning
Let's see if the Ministral 3 knows when to pick a fight !
python
1from datetime import datetime, timedelta
23from openai import OpenAI
4from huggingface_hub import hf_hub_download
56# Modify OpenAI's API key and API base to use vLLM's API server.7openai_api_key ="EMPTY"8openai_api_base ="http://localhost:8000/v1"910TEMP =0.1511MAX_TOK =2621441213client = OpenAI(14 api_key=openai_api_key,15 base_url=openai_api_base,16)1718models = client.models.list()19model = models.data[0].id202122defload_system_prompt(repo_id:str, filename:str)->str:23 file_path = hf_hub_download(repo_id=repo_id, filename=filename)24withopen(file_path,"r")asfile:25 system_prompt =file.read()26 today = datetime.today().strftime("%Y-%m-%d")27 yesterday =(datetime.today()- timedelta(days=1)).strftime("%Y-%m-%d")28 model_name = repo_id.split("/")[-1]29return system_prompt.format(name=model_name, today=today, yesterday=yesterday)303132SYSTEM_PROMPT = load_system_prompt(model,"SYSTEM_PROMPT.txt")33image_url ="https://static.wikia.nocookie.net/essentialsdocs/images/7/70/Battle.png/revision/latest?cb=20220523172438"3435messages =[36{"role":"system","content": SYSTEM_PROMPT},37{38"role":"user",39"content":[40{41"type":"text",42"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.",43},44{"type":"image_url","image_url":{"url": image_url}},45],46},47]4849print(messages)505152response = client.chat.completions.create(53 model=model,54 messages=messages,55 temperature=TEMP,56 max_tokens=MAX_TOK,57)5859print(response.choices[0].message.content)
Function Calling
Let's solve some equations thanks to our simple Python calculator tool.
python
1import json
2from openai import OpenAI
3from huggingface_hub import hf_hub_download
45# Modify OpenAI's API key and API base to use vLLM's API server.6openai_api_key ="EMPTY"7openai_api_base ="http://localhost:8000/v1"89TEMP =0.1510MAX_TOK =2621441112client = OpenAI(13 api_key=openai_api_key,14 base_url=openai_api_base,15)1617models = client.models.list()18model = models.data[0].id192021defload_system_prompt(repo_id:str, filename:str)->str:22 file_path = hf_hub_download(repo_id=repo_id, filename=filename)23withopen(file_path,"r")asfile:24 system_prompt =file.read()25return system_prompt
262728SYSTEM_PROMPT = load_system_prompt(model,"SYSTEM_PROMPT.txt")2930image_url ="https://math-coaching.com/img/fiche/46/expressions-mathematiques.jpg"313233defmy_calculator(expression:str)->str:34returnstr(eval(expression))353637tools =[38{39"type":"function",40"function":{41"name":"my_calculator",42"description":"A calculator that can evaluate a mathematical expression.",43"parameters":{44"type":"object",45"properties":{46"expression":{47"type":"string",48"description":"The mathematical expression to evaluate.",49},50},51"required":["expression"],52},53},54},55{56"type":"function",57"function":{58"name":"rewrite",59"description":"Rewrite a given text for improved clarity",60"parameters":{61"type":"object",62"properties":{63"text":{64"type":"string",65"description":"The input text to rewrite",66}67},68},69},70},71]7273messages =[74{"role":"system","content": SYSTEM_PROMPT},75{76"role":"user",77"content":[78{79"type":"text",80"text":"Thanks to your calculator, compute the results for the equations that involve numbers displayed in the image.",81},82{83"type":"image_url",84"image_url":{85"url": image_url,86},87},88],89},90]9192response = client.chat.completions.create(93 model=model,94 messages=messages,95 temperature=TEMP,96 max_tokens=MAX_TOK,97 tools=tools,98 tool_choice="auto",99)100101tool_calls = response.choices[0].message.tool_calls
102103results =[]104for tool_call in tool_calls:105 function_name = tool_call.function.name
106 function_args = tool_call.function.arguments
107if function_name =="my_calculator":108 result = my_calculator(**json.loads(function_args))109 results.append(result)110111messages.append({"role":"assistant","tool_calls": tool_calls})112for tool_call, result inzip(tool_calls, results):113 messages.append(114{115"role":"tool",116"tool_call_id": tool_call.id,117"name": tool_call.function.name,118"content": result,119}120)121122123response = client.chat.completions.create(124 model=model,125 messages=messages,126 temperature=TEMP,127 max_tokens=MAX_TOK,128)129130print(response.choices[0].message.content)
Text-Only Request
Ministral 3 can follow your instructions to the letter.
python
1from openai import OpenAI
2from huggingface_hub import hf_hub_download
34# Modify OpenAI's API key and API base to use vLLM's API server.5openai_api_key ="EMPTY"6openai_api_base ="http://localhost:8000/v1"78TEMP =0.159MAX_TOK =2621441011client = OpenAI(12 api_key=openai_api_key,13 base_url=openai_api_base,14)1516models = client.models.list()17model = models.data[0].id181920defload_system_prompt(repo_id:str, filename:str)->str:21 file_path = hf_hub_download(repo_id=repo_id, filename=filename)22withopen(file_path,"r")asfile:23 system_prompt =file.read()24return system_prompt
252627SYSTEM_PROMPT = load_system_prompt(model,"SYSTEM_PROMPT.txt")2829messages =[30{"role":"system","content": SYSTEM_PROMPT},31{32"role":"user",33"content":"Write me a sentence where every word starts with the next letter in the alphabet - start with 'a' and end with 'z'.",34},35]3637response = client.chat.completions.create(38 model=model,39 messages=messages,40 temperature=TEMP,41 max_tokens=MAX_TOK,42)4344assistant_message = response.choices[0].message.content
45print(assistant_message)
Transformers
You can also use Ministral 3 3B Instruct 2512 with Transformers !
Transformers very recently added prelimenary support for FP8, so please make sure to install from main:
To make the best use of our model with Transformers make sure to have installedmistral-common >= 1.8.6 to use our tokenizer.
pip install mistral-common --upgrade
Try it out by running the following snippet.
[!Tip]
By default Transformers will load the checkpoint in FP8 and dequantize it to BF16 on the fly,
which means the model currently does not make use of accelerated FP8-kernels.
Compatibility with accelerated FP8-kernels is currently worked on and will be available in a couple of weeks.
Stay tuned!
Python snippet
python
1import torch
2from transformers import Mistral3ForConditionalGeneration, MistralCommonBackend
34model_id ="mistralai/Ministral-3-3B-Instruct-2512"56tokenizer = MistralCommonBackend.from_pretrained(model_id)7model = Mistral3ForConditionalGeneration.from_pretrained(model_id, device_map="auto")89image_url ="https://static.wikia.nocookie.net/essentialsdocs/images/7/70/Battle.png/revision/latest?cb=20220523172438"1011messages =[12{13"role":"user",14"content":[15{16"type":"text",17"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.",18},19{"type":"image_url","image_url":{"url": image_url}},20],21},22]2324tokenized = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True)2526tokenized["input_ids"]= tokenized["input_ids"].to(device="cuda")27tokenized["pixel_values"]= tokenized["pixel_values"].to(dtype=torch.bfloat16, device="cuda")28image_sizes =[tokenized["pixel_values"].shape[-2:]]2930output = model.generate(31**tokenized,32 image_sizes=image_sizes,33 max_new_tokens=512,34)[0]3536decoded_output = tokenizer.decode(output[len(tokenized["input_ids"][0]):])37print(decoded_output)
Note:
Transformers allows you to automatically convert the checkpoint to Bfloat16. To so simple load the model as follows:
You must not use this model in a manner that infringes, misappropriates, or otherwise violates any third party’s rights, including intellectual property rights.