ibm-granite/granite-4.0-350m
Captured source
source ↗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:
userPlease list one IBM Research laboratory located in the United States. You should only output its name and location. assistantAlmaden Research Center, San Jose, California
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:
systemYou 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 XML tags:
{"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"]}}}
For each tool call, return a json object with function name and arguments within XML tags:
{"name": , "arguments": }
. 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.
userWhat's the weather like in Boston right now?
assistant
{"name": "get_current_weather", "arguments": {"city": "Boston"}}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…
Excerpt shown — open the source for the full document.
Notability
notability 7.0/10IBM releases small model, decent downloads