granite-4.0-350m GGUF Models
Model Generation Details
This model was generated using llama.cpp at commit 16724b5b6.
Click here to get info on choosing the right GGUF model format
Granite-4.0-350M
Model Summary: Granite-4.0-350M is a lightweight instruct model finetuned from Granite-4.0-350M-Base using a combination of open source instruction datasets with permissive license and internally collected synthetic datasets. This model is developed using a diverse set of techniques including supervised finetuning, reinforcement learning, and model merging.
- Developers: Granite Team, IBM
- HF Collection: Granite 4.0 Nano Language Models HF Collection
- GitHub Repository: ibm-granite/granite-4.0-nano-language-models
- Website: Granite Docs
- Release Date: October 28, 2025
- License: Apache 2.0
Supported Languages: English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. Users may fine-tune Granite 4.0 Nano models to support languages beyond those included in this list.
Intended use: Granite 4.0 Nano instruct models feature strong instruction following capabilities bringing advanced AI capabilities within reach for on-device deployments and research use cases. Additionally, their compact size makes them well-suited for fine-tuning on specialized domains without requiring massive compute resources.
Capabilities
- Summarization
- Text classification
- Text extraction
- Question-answering
- Retrieval Augmented Generation (RAG)
- Code related tasks
- Function-calling tasks
- Multilingual dialog use cases
- Fill-In-the-Middle (FIM) code completions
Generation: This is a simple example of how to use Granite-4.0-350M model.
Install the following libraries:
pip install torch torchvision torchaudio
pip install accelerate
pip install transformers
Then, copy the snippet from the section that is relevant for your use case.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"
model_path = "ibm-granite/granite-4.0-350M"
tokenizer = AutoTokenizer.from_pretrained(model_path)
# drop device_map if running on CPU
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
model.eval()
# change input text as desired
chat = [
{ "role": "user", "content": "Please list one IBM Research laboratory located in the United States. You should only output its name and location." },
]
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
# tokenize the text
input_tokens = tokenizer(chat, return_tensors="pt").to(device)
# generate output tokens
output = model.generate(**input_tokens,
max_new_tokens=100)
# decode output tokens into text
output = tokenizer.batch_decode(output)
# print output
print(output[0])
Expected output:
<|start_of_role|>user<|end_of_role|>Please list one IBM Research laboratory located in the United States. You should only output its name and location.<|end_of_text|>
<|start_of_role|>assistant<|end_of_role|>Almaden Research Center, San Jose, California<|end_of_text|>
Tool-calling: Granite-4.0-350M comes with enhanced tool calling capabilities, enabling seamless integration with external functions and APIs. To define a list of tools please follow OpenAI's function definition schema.
This is an example of how to use Granite-4.0-350M model tool-calling ability:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"
model_path = "ibm-granite/granite-4.0-350M"
tokenizer = AutoTokenizer.from_pretrained(model_path)
# drop device_map if running on CPU
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
model.eval()
tools = [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather for a specified city.",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "Name of the city"
}
},
"required": ["city"]
}
}
}
]
# change input text as desired
chat = [
{ "role": "user", "content": "What's the weather like in Boston right now?" },
]
chat = tokenizer.apply_chat_template(chat, \
tokenize=False, \
tools=tools, \
add_generation_prompt=True)
# tokenize the text
input_tokens = tokenizer(chat, return_tensors="pt").to(device)
# generate output tokens
output = model.generate(**input_tokens,
max_new_tokens=100)
# decode output tokens into text
output = tokenizer.batch_decode(output)
# print output
print(output[0])
Expected output:
<|start_of_role|>system<|end_of_role|>You are a helpful assistant with access to the following tools. You may call one or more tools to assist with the user query.
You are provided with function signatures within <tools></tools> XML tags:
<tools>
{"type": "function", "function": {"name": "get_current_weather", "description": "Get the current weather for a specified city.", "parameters": {"type": "object", "properties": {"city": {"type": "string", "description": "Name of the city"}}, "required": ["city"]}}}
</tools>
For each tool call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.<|end_of_text|>
<|start_of_role|>user<|end_of_role|>What's the weather like in Boston right now?<|end_of_text|>
<|start_of_role|>assistant<|end_of_role|><tool_call>
{"name": "get_current_weather", "arguments": {"city": "Boston"}}
</tool_call><|end_of_text|>
Evaluation Results:
| Benchmarks | Metric | 350M Dense | H 350M Dense | 1B Dense | H 1B Dense |
|---|---|---|---|---|---|
| General Tasks | |||||
| MMLU | 5-shot | 35.01 | 36.21 | 59.39 | 59.74 |
| MMLU-Pro | 5-shot, CoT | 12.13 | 14.38 | 34.02 | 32.86 |
| BBH | 3-shot, CoT | 33.07 | 33.28 | 60.37 | 59.68 |
| AGI EVAL | 0-shot, CoT | 26.22 | 29.61 | 49.22 | 52.44 |
| GPQA | 0-shot, CoT | 24.11 | 26.12 | 29.91 | 29.69 |
| Alignment Tasks | |||||
| IFEval | Instruct, Strict | 61.63 | 67.63 | 80.82 | 82.37 |
| IFEval | Prompt, Strict | 49.17 | 55.64 | 73.94 | 74.68 |
| IFEval | Average | 55.4 | 61.63 | 77.38 | 78.53 |
| Math Tasks | |||||
| GSM8K | 8-shot | 30.71 | 39.27 | 76.35 | 69.83 |
| GSM Symbolic | 8-shot | 26.76 | 33.7 | 72.3 | 65.72 |
| Minerva Math | 0-shot, CoT | 13.04 | 5.76 | 45.28 | 49.4 |
| DeepMind Math | 0-shot, CoT | 8.45 | 6.2 | 34 | 34.98 |
| Code Tasks | |||||
| HumanEval | pass@1 | 39 | 38 | 74 | 73 |
| HumanEval+ | pass@1 | 37 | 35 | 69 | 68 |
| MBPP | pass@1 | 48 | 49 | 65 | 69 |
| MBPP+ | pass@1 | 38 | 44 | 57 | 60 |
| CRUXEval-O | pass@1 | 23.75 | 25.5 | 33.13 | 36 |
| BigCodeBench | pass@1 | 11.14 | 11.23 | 30.18 | 29.12 |
| Tool Calling Tasks | |||||
| BFCL v3 | 39.32 | 43.32 | 54.82 | 50.21 | |
| Multilingual Tasks | |||||
| MULTIPLE | pass@1 | 15.99 | 14.31 | 32.24 | 36.11 |
| MMMLU | 5-shot | 28.23 | 27.95 | 45 | 49.43 |
| INCLUDE | 5-shot | 27.74 | 27.09 | 42.12 | 43.35 |
| MGSM | 8-shot | 14.72 | 16.16 | 37.84 | 27.52 |
| Safety | |||||
| SALAD-Bench | 97.12 | 96.55 | 93.44 | 96.4 | |
| AttaQ | 82.53 | 81.76 | 85.26 | 82.85 | |
| Benchmarks | # Langs | Languages |
|---|---|---|
| MMMLU | 11 | ar, de, en, es, fr, ja, ko, pt, zh, bn, hi |
| INCLUDE | 14 | hi, bn, ta, te, ar, de, es, fr, it, ja, ko, nl, pt, zh |
| MGSM | 5 | en, es, fr, ja, zh |
Model Architecture:
Granite-4.0-350M baseline is based on a decoder-only dense transformer architecture. Core components of this architecture are: GQA, MLP with SwiGLU, RMSNorm, and shared input/output embeddings.
| Model | 350M Dense | H 350M Dense | 1B Dense | H 1B Dense |
|---|---|---|---|---|
| Embedding size | 1024 | 768 | 2048 | 1536 |
| Number of layers | 28 attention | 4 attention / 28 Mamba2 | 40 attention | 4 attention / 36 Mamba2 |
| Attention head size | 64 | 64 | 128 | 128 |
| Number of attention heads | 16 | 12 | 16 | 12 |
| Number of KV heads | 4 | 4 | 4 | 4 |
| Mamba2 state size | - | 128 | - | 128 |
| Number of Mamba2 heads | - | 48 | - | 48 |
| MLP / Shared expert hidden size | 2048 | 2048 | 4096 | 4096 |
| Num. Experts | - | - | - | - |
| Num. active Experts | - | - | - | - |
| Expert hidden size | - | - | - | - |
| MLP activation | SwiGLU | SwiGLU | SwiGLU | SwiGLU |
| Sequence length | 32K | 32K | 128K | 128K |
| Position embedding | RoPE | NoPE | RoPE | NoPE |
| # Parameters | 350M | 340M | 1.6B | 1.5B |
| # Active parameters | 350M | 340M | 1.6B | 1.5B |
Training Data: Overall, our SFT data is largely comprised of three key sources: (1) publicly available datasets with permissive license, (2) internal synthetic data targeting specific capabilities, and (3) a select set of human-curated data.
Infrastructure: We trained the Granite 4.0 Nano Language Models utilizing an NVIDIA GB200 NVL72 cluster hosted in CoreWeave. Intra-rack communication occurs via the 72-GPU NVLink domain, and a non-blocking, full Fat-Tree NDR 400 Gb/s InfiniBand network provides inter-rack communication. This cluster provides a scalable and efficient infrastructure for training our models over thousands of GPUs.
Ethical Considerations and Limitations: Granite 4.0 Nano Instruct Models are primarily finetuned using instruction-response pairs mostly in English, but also multilingual data covering multiple languages. Although this model can handle multilingual dialog use cases, its performance might not be similar to English tasks. In such case, introducing a small number of examples (few-shot) can help the model in generating more accurate outputs. While this model has been aligned by keeping safety in consideration, the model may in some cases produce inaccurate, biased, or unsafe responses to user prompts. So we urge the community to use this model with proper safety testing and tuning tailored for their specific tasks.
Resources
- βοΈ Learn about the latest updates with Granite: https://www.ibm.com/granite
- π Get started with tutorials, best practices, and prompt engineering advice: https://www.ibm.com/granite/docs/
- π‘ Learn about the latest Granite learning resources: https://ibm.biz/granite-learning-resources
π 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.
Thank you! π
- Downloads last month
- 696
Model tree for Mungert/granite-4.0-350m-GGUF
Base model
ibm-granite/granite-4.0-350m-base