I've been experimenting with a new quantization approach that selectively elevates the precision of key layers beyond what the default IMatrix configuration provides.
In my testing, standard IMatrix quantization underperforms at lower bit depths, especially with Mixture of Experts (MoE) models. To address this, I'm using the --tensor-type option in llama.cpp to manually "bump" important layers to higher precision. You can see the implementation here:
👉 Layer bumping with llama.cpp
While this does increase model file size, it significantly improves precision for a given quantization level.
I'd love your feedback—have you tried this? How does it perform for you?
A balanced model in the Ministral 3 family, Ministral 3 8B is a powerful, efficient tiny language model with vision capabilities.
This model is the reasoning post-trained version, trained for reasoning tasks, making it ideal for math, coding and stem related use cases.
The Ministral 3 family is designed for edge deployment, capable of running on a wide range of hardware. Ministral 3 8B can even be deployed locally, capable of fitting in 24GB of VRAM in BF16, and less than 12GB of RAM/VRAM when quantized.
Key Features
Ministral 3 8B consists of two main architectural components:
8.4B Language Model
0.4B Vision Encoder
The Ministral 3 8B Reasoning 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.
Reasoning: Excels at complex, multi-step reasoning and dynamic problem-solving.
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
Perfect for balanced performance in local or embedded systems, combining versatility with efficiency.
Chat interfaces in constrained environments
Local daily-driver AI assistant
Image/document description and understanding
Translation and content generation
Specialized agentic use cases
Fine-tuning and specialization
And more...
Bringing advanced AI capabilities to resource-constrained environments.
enable-auto-tool-choice: Required when enabling tool usage.
tool-call-parser mistral: Required when enabling tool usage.
reasoning-parser mistral: Required when enabling reasoning.
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 assume that the model mistralai/Ministral-3-8B-Reasoning-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 model knows when to pick a fight !
python
1from typing import Any
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.711TOP_P =0.9512MAX_TOK =26214413client = 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)->dict[str, Any]:23 file_path = hf_hub_download(repo_id=repo_id, filename=filename)24withopen(file_path,"r")asfile:25 system_prompt =file.read()2627 index_begin_think = system_prompt.find("[THINK]")28 index_end_think = system_prompt.find("[/THINK]")2930return{31"role":"system",32"content":[33{"type":"text","text": system_prompt[:index_begin_think]},34{35"type":"thinking",36"thinking": system_prompt[37 index_begin_think +len("[THINK]"): index_end_think
38],39"closed":True,40},41{42"type":"text",43"text": system_prompt[index_end_think +len("[/THINK]"):],44},45],46}474849SYSTEM_PROMPT = load_system_prompt(model,"SYSTEM_PROMPT.txt")5051image_url ="https://static.wikia.nocookie.net/essentialsdocs/images/7/70/Battle.png/revision/latest?cb=20220523172438"5253messages =[54 SYSTEM_PROMPT,55{56"role":"user",57"content":[58{59"type":"text",60"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.",61},62{"type":"image_url","image_url":{"url": image_url}},63],64},65]666768stream = client.chat.completions.create(69 model=model,70 messages=messages,71 stream=True,72 temperature=TEMP,73 top_p=TOP_P,74 max_tokens=MAX_TOK,75)7677print("client: Start streaming chat completions...:\n")78printed_reasoning_content =False79answer =[]8081for chunk in stream:82 reasoning_content =None83 content =None84# Check the content is reasoning_content or content85ifhasattr(chunk.choices[0].delta,"reasoning_content"):86 reasoning_content = chunk.choices[0].delta.reasoning_content
87ifhasattr(chunk.choices[0].delta,"content"):88 content = chunk.choices[0].delta.content
8990if reasoning_content isnotNone:91ifnot printed_reasoning_content:92 printed_reasoning_content =True93print("Start reasoning:\n", end="", flush=True)94print(reasoning_content, end="", flush=True)95elif content isnotNone:96# Extract and print the content97ifnot reasoning_content and printed_reasoning_content:98 answer.extend(content)99print(content, end="", flush=True)100101if answer:102print("\n\n=============\nAnswer\n=============\n")103print("".join(answer))104else:105print("\n\n=============\nNo Answer\n=============\n")106print(107"No answer was generated by the model, probably because the maximum number of tokens was reached."108)
Now we'll make it compute some maths !
python
1from typing import Any
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.711TOP_P =0.9512MAX_TOK =26214413client = 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)->dict[str, Any]:23 file_path = hf_hub_download(repo_id=repo_id, filename=filename)24withopen(file_path,"r")asfile:25 system_prompt =file.read()2627 index_begin_think = system_prompt.find("[THINK]")28 index_end_think = system_prompt.find("[/THINK]")2930return{31"role":"system",32"content":[33{"type":"text","text": system_prompt[:index_begin_think]},34{35"type":"thinking",36"thinking": system_prompt[37 index_begin_think +len("[THINK]"): index_end_think
38],39"closed":True,40},41{42"type":"text",43"text": system_prompt[index_end_think +len("[/THINK]"):],44},45],46}474849SYSTEM_PROMPT = load_system_prompt(model,"SYSTEM_PROMPT.txt")5051image_url ="https://i.ytimg.com/vi/5Y3xLHeyKZU/hqdefault.jpg"5253messages =[54 SYSTEM_PROMPT,55{56"role":"user",57"content":[58{59"type":"text",60"text":"Solve the equations. If they contain only numbers, use your calculator, else only think. Answer in the language of the image.",61},62{"type":"image_url","image_url":{"url": image_url}},63],64},65]6667stream = client.chat.completions.create(68 model=model,69 messages=messages,70 stream=True,71 temperature=TEMP,72 top_p=TOP_P,73 max_tokens=MAX_TOK,74)7576print("client: Start streaming chat completions...:\n")77printed_reasoning_content =False78answer =[]7980for chunk in stream:81 reasoning_content =None82 content =None83# Check the content is reasoning_content or content84ifhasattr(chunk.choices[0].delta,"reasoning_content"):85 reasoning_content = chunk.choices[0].delta.reasoning_content
86ifhasattr(chunk.choices[0].delta,"content"):87 content = chunk.choices[0].delta.content
8889if reasoning_content isnotNone:90ifnot printed_reasoning_content:91 printed_reasoning_content =True92print("Start reasoning:\n", end="", flush=True)93print(reasoning_content, end="", flush=True)94if content isnotNone:95# Extract and print the content96ifnot reasoning_content and printed_reasoning_content:97 answer.extend(content)98print(content, end="", flush=True)99100if answer:101print("\n\n=============\nAnswer\n=============\n")102print("".join(answer))103else:104print("\n\n=============\nNo Answer\n=============\n")105print(106"No answer was generated by the model, probably because the maximum number of tokens was reached."107)
Text-Only Request
Let's do more maths and leave it up to the model to figure out how to achieve a result.
python
1from typing import Any
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.710TOP_P =0.9511MAX_TOK =26214412client = 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)->dict[str, Any]:22 file_path = hf_hub_download(repo_id=repo_id, filename=filename)23withopen(file_path,"r")asfile:24 system_prompt =file.read()2526 index_begin_think = system_prompt.find("[THINK]")27 index_end_think = system_prompt.find("[/THINK]")2829return{30"role":"system",31"content":[32{"type":"text","text": system_prompt[:index_begin_think]},33{34"type":"thinking",35"thinking": system_prompt[36 index_begin_think +len("[THINK]"): index_end_think
37],38"closed":True,39},40{41"type":"text",42"text": system_prompt[index_end_think +len("[/THINK]"):],43},44],45}464748SYSTEM_PROMPT = load_system_prompt(model,"SYSTEM_PROMPT.txt")4950query ="Use each number in 2,5,6,3 exactly once, along with any combination of +, -, ×, ÷ (and parentheses for grouping), to make the number 24."5152messages =[53 SYSTEM_PROMPT,54{"role":"user","content": query}55]56stream = client.chat.completions.create(57 model=model,58 messages=messages,59 stream=True,60 temperature=TEMP,61 top_p=TOP_P,62 max_tokens=MAX_TOK,63)6465print("client: Start streaming chat completions...:\n")66printed_reasoning_content =False67answer =[]6869for chunk in stream:70 reasoning_content =None71 content =None72# Check the content is reasoning_content or content73ifhasattr(chunk.choices[0].delta,"reasoning_content"):74 reasoning_content = chunk.choices[0].delta.reasoning_content
75ifhasattr(chunk.choices[0].delta,"content"):76 content = chunk.choices[0].delta.content
7778if reasoning_content isnotNone:79ifnot printed_reasoning_content:80 printed_reasoning_content =True81print("Start reasoning:\n", end="", flush=True)82print(reasoning_content, end="", flush=True)83if content isnotNone:84# Extract and print the content85ifnot reasoning_content and printed_reasoning_content:86 answer.extend(content)87print(content, end="", flush=True)8889if answer:90print("\n\n=============\nAnswer\n=============\n")91print("".join(answer))92else:93print("\n\n=============\nNo Answer\n=============\n")94print("No answer was generated by the model, probably because the maximum number of tokens was reached.")
Transformers
You can also use Ministral 3 3B Reasoning 2512 with Transformers !
Make sure to install Transformers from its first v5 release candidate or from "main":
pip install transformers==5.0.0rc0
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
Then load our tokenizer along with the model and generate:
Python snippet
python
1import torch
2from transformers import Mistral3ForConditionalGeneration, MistralCommonBackend
34model_id ="mistralai/Ministral-3-8B-Reasoning-2512"56tokenizer = MistralCommonBackend.from_pretrained(model_id)7model = Mistral3ForConditionalGeneration.from_pretrained(8 model_id, torch_dtype=torch.bfloat16, device_map="auto"9)1011image_url ="https://static.wikia.nocookie.net/essentialsdocs/images/7/70/Battle.png/revision/latest?cb=20220523172438"1213messages =[14{15"role":"user",16"content":[17{18"type":"text",19"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.",20},21{"type":"image_url","image_url":{"url": image_url}},22],23},24]2526tokenized = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True)2728tokenized["input_ids"]= tokenized["input_ids"].to(device="cuda")29tokenized["pixel_values"]= tokenized["pixel_values"].to(dtype=torch.bfloat16, device="cuda")30image_sizes =[tokenized["pixel_values"].shape[-2:]]3132output = model.generate(33**tokenized,34 image_sizes=image_sizes,35 max_new_tokens=8092,36)[0]3738decoded_output = tokenizer.decode(output[len(tokenized["input_ids"][0]):])39print(decoded_output)
You must not use this model in a manner that infringes, misappropriates, or otherwise violates any third party’s rights, including intellectual property rights.
🚀 If you find these models useful
Help me test my AI-Powered Quantum Network Monitor Assistant with quantum-ready security checks:
The full Open Source Code for the Quantum Network Monitor Service available at my github repos ( repos with NetworkMonitor in the name) : Source Code Quantum Network Monitor. You will also find the code I use to quantize the models if you want to do it yourself GGUFModelBuilder
💬 How to test:
Choose an AI assistant type:
TurboLLM (GPT-4.1-mini)
HugLLM (Hugginface Open-source models)
TestLLM (Experimental CPU-only)
What I’m Testing
I’m pushing the limits of small open-source models for AI network monitoring, specifically:
Function calling against live network services
How small can a model go while still handling:
Automated Nmap security scans
Quantum-readiness checks
Network Monitoring tasks
🟡 TestLLM – Current experimental model (llama.cpp on 2 CPU threads on huggingface docker space):
✅ Zero-configuration setup
⏳ 30s load time (slow inference but no API costs) . No token limited as the cost is low.
🔧 Help wanted! If you’re into edge-device AI, let’s collaborate!
Other Assistants
🟢 TurboLLM – Uses gpt-4.1-mini :
**It performs very well but unfortunatly OpenAI charges per token. For this reason tokens usage is limited.
Create custom cmd processors to run .net code on Quantum Network Monitor Agents
Real-time network diagnostics and monitoring
Security Audits
Penetration testing (Nmap/Metasploit)
🔵 HugLLM – Latest Open-source models:
🌐 Runs on Hugging Face Inference API. Performs pretty well using the lastest models hosted on Novita.
💡 Example commands you could test:
"Give me info on my websites SSL certificate"
"Check if my server is using quantum safe encyption for communication"
"Run a comprehensive security audit on my server"
'"Create a cmd processor to .. (what ever you want)" Note you need to install a Quantum Network Monitor Agent to run the .net code on. This is a very flexible and powerful feature. Use with caution!
Final Word
I fund the servers used to create these model files, run the Quantum Network Monitor service, and pay for inference from Novita and OpenAI—all out of my own pocket. All the code behind the model creation and the Quantum Network Monitor project is open source. Feel free to use whatever you find helpful.
If you appreciate the work, please consider buying me a coffee ☕. Your support helps cover service costs and allows me to raise token limits for everyone.
I'm also open to job opportunities or sponsorship.