Natively Supports 128K (Long-context extension to 512K)
Precision
bfloat16
Tested Languages
English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, Chinese (other languages may work but have not been fully tested)
Granite is a family of open-source large language models developed by IBM, designed for enterprise and research use. Granite models are built to be versatile, safe, and efficient — covering a range of sizes and capabilities from compact edge-deployable models to large-scale reasoning systems. All Granite models are released under the Apache 2.0 license, enabling unrestricted commercial and academic use.
The Granite 4.2 generation introduces native reasoning (thinking) capabilities, allowing models to perform step-by-step chain-of-thought reasoning before producing final answers. This significantly improves performance on complex math, coding, multi-step logic, and agentic tool-calling tasks.
Description
Granite-4.2-30B is the flagship reasoning model in the Granite 4.2 family. It delivers the strongest performance across reasoning-intensive tasks by leveraging built-in <think>...</think> chain-of-thought. It supports flexible thinking modes — full thinking (default), non-thinking, and low-effort — allowing users to balance depth vs. latency on a per-query basis.
Key capabilities:
Built-in Reasoning: Native chain-of-thought that significantly improves performance on math, coding, and complex multi-step problems.
Flexible Thinking Modes: Seamlessly switch between full thinking, non-thinking, and low-effort modes within a single model.
Reasoning-Augmented Tool Calling: The model reasons about which tools to invoke and why, producing more accurate function calls.
512K Context Window: Supports long documents, multi-turn conversations, and complex agentic workflows.
Apache 2.0 Licensed: Fully open for commercial and research use.
Model Design
Granite-4.2-30B is built on a decoder-only dense transformer architecture with the following core components:
Attention: Grouped Query Attention (GQA) with 32 attention heads and 8 KV heads
Position Embedding: Rotary Position Embedding (RoPE) with θ = 10,000,000
Feed-Forward: MLP with SwiGLU activation (hidden size 32768)
Normalization: RMSNorm (ε = 1e-5)
Embeddings: Separate input/output embeddings (not tied)
Precision: bfloat16
Component
3B Dense
8B Dense
30B Dense
Embedding size
2560
4096
4096
Number of layers
40
40
64
Attention head size
64
128
128
Number of attention heads
40
32
32
Number of KV heads
8
8
8
MLP hidden size
8192
12800
32768
MLP activation
SwiGLU
SwiGLU
SwiGLU
Sequence length
131072
131072
131072
Position embedding
RoPE
RoPE
RoPE
# Parameters
3B
8B
30B
Training Methodology
Granite-4.2-30B is post-trained from Granite-4.1-30B-Base through a rigorous multi-stage pipeline that progressively unlocks reasoning, tool use, and instruction-following capabilities. A full listing of training datasets is available in the Granite 4.2 GitHub repository. The training pipeline consists of three stages:
Stage 1: Pre-Training
Granite-4.2-30B builds on Granite-4.1-30B-Base, which was pre-trained on a large-scale English as well as multilingual corpus. For full pre-training details (data composition, training recipe, and infrastructure), refer to our Granite 4.1 Technical Blog.
Stage 2: Supervised Fine-Tuning
The SFT stage draws on instruction-following, chain-of-thought, and reasoning data to cultivate the model's reasoning and thinking abilities. For all the three, 3B, 8B and 30B models, the training corpus comprises four sources: (1) publicly available datasets under permissive licenses, (2) internally generated synthetic data targeting reasoning, tool calling, and chain-of-thought capabilities, (3) agentic traces collected across a diverse range of tasks, and (4) a curated selection of human-authored data. Hyperparameters were tuned before training was scaled to all three model sizes. For the 30B model, we conducted a second SFT phase, in which the agentic data was up-sampled while a smaller share of general replay data was retained. This phase trained for a single epoch, starting from a lower learning rate than Phase 1.
Stage 3: Reinforcement Learning
The final stage of training applies multi-phase, multi-environment reinforcement learning using Group Relative Policy Optimization (GRPO). Training spans a broad mix of environments including math, code, science, instruction following, tool use, general chat and structured output. Most environments provide verifiable rewards, while open-ended prompts are scored by a generative reward model. Training runs asynchronously: generation and policy updates occupy separate GPU pools rather than proceeding in lockstep, and weights are refreshed in flight.
After the reward-driven phases, a preference-alignment (RLHF) phase tunes helpfulness, conversational quality, and safety. Reinforcement learning is carried out with NeMo RL, and the RL environments run on NeMo Gym.
Infrastructure:
We trained the Granite 4.2 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.
Evaluations are run with an evaluation framework based on NeMo Evaluator SDK.
Inference
Generation Parameters
Important: Use temperature=1.0 and top_p=0.95 across all tasks and serving backends, including general chat, reasoning, and tool calling.
Parameter
Value
Notes
temperature
1.0
Required for all modes
top_p
0.95
Nucleus sampling threshold
max_new_tokens
8192
Thinking mode (increase for complex reasoning)
max_new_tokens
2048
Non-thinking mode
do_sample
True
Required when temperature > 0
Thinking Modes
Mode
Template Parameters
Behavior
Thinking (default)
enable_thinking=True
Full chain-of-thought reasoning inside <think>...</think>
Non-thinking
enable_thinking=False
Direct answer with no reasoning overhead
Low-effort
enable_thinking=True, low_effort=True
Brief reasoning for simpler queries
How It Works
Thinking enabled — The generation prompt ends with <|im_start|>assistant\n<think>\n, causing the model to reason until it emits </think>, then produce the final answer.
Thinking disabled — The prompt ends with <|im_start|>assistant\n<think></think>, bypassing reasoning entirely.
Low-effort — Appends {reasoning effort: low} to the user message, signaling shorter reasoning chains.
History Truncation
In multi-turn conversations, thinking content from previous assistant turns is automatically stripped (truncate_history_thinking=True by default) to conserve context window space. Only the current generation produces full reasoning. Set truncate_history_thinking=False to preserve full reasoning history.
Serving with vLLM
Granite-4.2-30B is optimized for deployment with vLLM.
Reasoning parser: Use the custom granite_thinking_parser included in this repository (requires vLLM v0.20+). The model also works with the built-in nemotron_v3 parser, but granite_thinking_parser provides better formatting of reasoning output. Native support for granite_thinking_parser will be added to vLLM and SGLang very soon.
Tool calling parser: Use qwen3_coder.
1from openai import OpenAI
23client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")45tools =[6{7"type":"function",8"function":{9"name":"get_current_weather",10"description":"Get the current weather for a specified city.",11"parameters":{12"type":"object",13"properties":{14"city":{"type":"string","description":"Name of the city"}15},16"required":["city"]17}18}19}20]2122response = client.chat.completions.create(23 model="granite-4.2-30b",24 messages=[{"role":"user","content":"What's the weather like in Boston right now?"}],25 tools=tools,26 temperature=1.0,27 top_p=0.95,28 max_tokens=4096,29)3031print(response.choices[0].message.tool_calls)
Using with Agentic Coding Harnesses
Granite-4.2-30B can be used as the backbone model for agentic coding tools. Since it supports reasoning and tool calling via the OpenAI-compatible API, it integrates with popular agentic harnesses out of the box. Start the vLLM server as shown in the Serving with vLLM section above, then follow the harness-specific instructions below.
OpenCode
OpenCode is an AI coding agent that runs in your terminal.
Note: The openai/ prefix is required when connecting to OpenAI-compatible endpoints like vLLM. Refer to the OpenHands local LLM documentation for detailed setup instructions, troubleshooting, and alternative installation methods.
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
34model_path ="ibm-granite/granite-4.2-30b"5tokenizer = AutoTokenizer.from_pretrained(model_path)6model = AutoModelForCausalLM.from_pretrained(model_path, device_map="cuda", torch_dtype=torch.bfloat16)7model.eval()89messages =[10{"role":"user","content":"How many r's are in the word 'strawberry'?"},11]1213text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=True)14inputs = tokenizer(text, return_tensors="pt").to(model.device)1516with torch.no_grad():17 output = model.generate(**inputs, max_new_tokens=8192, temperature=1.0, top_p=0.95, do_sample=True)1819print(tokenizer.decode(output[0][inputs.input_ids.shape[-1]:], skip_special_tokens=False))
Example Output
<think>
Okay, let's see. The problem is to find how many 'r's are in the word 'strawberry'.
First, I need to write out the word: s t r a w b e r r y.
Now, I need to count the number of 'r' letters. Let's list each letter and check for 'r'.
1. s – not r
2. t – not r
3. r – yes, that's one
4. a – no
5. w – no
6. b – no
7. e – no
8. r – yes, that's two
9. r – yes, that's three
10. y – no
Total r's = 3.
</think>
There are **3** r's in the word "strawberry".<|im_end|>
Non-Thinking Mode
python
1messages =[2{"role":"user","content":"What is the capital of France?"},3]4text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)5inputs = tokenizer(text, return_tensors="pt").to(model.device)67output = model.generate(**inputs, max_new_tokens=2048, temperature=1.0, top_p=0.95, do_sample=True)8print(tokenizer.decode(output[0][inputs.input_ids.shape[-1]:], skip_special_tokens=False))
Example Output
<think></think>The capital of France is Paris.<|im_end|>
Granite-4.2-30B supports tool calling with integrated reasoning — the model thinks about which tool to call and why before making the call. Tools are defined using the OpenAI function definition schema.
Basic Tool Calling
python
1tools =[2{3"type":"function",4"function":{5"name":"get_current_weather",6"description":"Get the current weather for a specified city.",7"parameters":{8"type":"object",9"properties":{10"city":{"type":"string","description":"Name of the city"}11},12"required":["city"]13}14}15}16]1718messages =[19{"role":"user","content":"What's the weather like in Boston right now?"},20]21text = tokenizer.apply_chat_template(messages, tokenize=False, tools=tools,22 add_generation_prompt=True, enable_thinking=True)23inputs = tokenizer(text, return_tensors="pt").to(model.device)2425output = model.generate(**inputs, max_new_tokens=4096, temperature=1.0, top_p=0.95, do_sample=True)26print(tokenizer.decode(output[0][inputs.input_ids.shape[-1]:], skip_special_tokens=False))
Example Output
<think>
Okay, the user is asking for the weather in Boston right now. Let me check the tools
available. There's a function called get_current_weather that takes a city parameter.
I need to call that with the city set to Boston.
</think>
<tool_call>
<function=get_current_weather>
<parameter=city>
Boston
</parameter>
</function>
</tool_call>
<|im_end|>
Multi-Turn with Tool Response
python
1messages =[2{"role":"user","content":"What's the weather like in Boston right now?"},3{"role":"assistant","content":"<think>\nThe user wants to know the current weather in Boston. I should call get_current_weather.\n</think>",4"tool_calls":[{"function":{"name":"get_current_weather","arguments":{"city":"Boston"}}}]},5{"role":"tool","content":'{"temperature": "72°F", "condition": "Partly cloudy", "humidity": "65%"}'},6]7text = tokenizer.apply_chat_template(messages, tokenize=False, tools=tools,8 add_generation_prompt=True, enable_thinking=True)9inputs = tokenizer(text, return_tensors="pt").to(model.device)1011output = model.generate(**inputs, max_new_tokens=4096, temperature=1.0, top_p=0.95, do_sample=True)12print(tokenizer.decode(output[0][inputs.input_ids.shape[-1]:], skip_special_tokens=False))
Example Output
<think>
The tool returned the weather data for Boston: temperature 72°F, partly cloudy, humidity 65%.
I need to present this information clearly to the user.
</think>
The current weather in Boston is 72°F, partly cloudy, with 65% humidity.<|im_end|>
Multi-Turn Conversations
History Thinking Truncation
python
1messages =[2{"role":"user","content":"What is 15 * 37?"},3{"role":"assistant","content":"<think>\nLet me calculate 15 * 37.\n15 * 37 = 15 * 30 + 15 * 7 = 450 + 105 = 555\n</think>\n15 * 37 = 555"},4{"role":"user","content":"Now divide that by 5"},5]67# Default: previous thinking is stripped to save context8text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True,9 enable_thinking=True, truncate_history_thinking=True)1011# To preserve full history:12text_full = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True,13 enable_thinking=True, truncate_history_thinking=False)
Granite 4.2 models are primarily finetuned using instruction-response pairs mostly in English, but also multilingual data covering the supported languages listed above. Although this model handles multilingual dialog, its performance may vary compared to English. Few-shot examples can help in such cases.
While aligned for safety, the model may occasionally produce inaccurate, biased, or unsafe responses. The content within <think>...</think> tags represents internal reasoning and may contain unpolished or intermediate thoughts that do not represent final conclusions.
To enhance safety in deployments, we recommend using Granite 4.2 alongside Granite Guardian to detect and flag risks across key dimensions outlined in the IBM AI Risk Atlas.