alt.freeweights.granite / granite-4.2-30b
From: ibm-granite <huggingface.co/ibm-granite>Newsgroups: alt.freeweights.graniteSubject:

granite-4.2-30b

Date: 2026-11-14Commit: 9e668ceSigned: 2DC28CC7B26A283B ✓

Text generation model with 29.3B parameters. Safetensors weights, 58.6 GB in all. Published by ibm-granite under Apache-2.0.

29.3B params58.6GBgranite-4.2-30bsafetensorspermissive
FactsParams29.3BSize58.6 GBFormatssafetensorsTasktext generationLicenseApache-2.0From sourcepermissive
$ fw get ibm-granite/granite-4.2-30b
# manifest sha256 b1a6619d514a… · 58.6 GB · 24 files
$ fw verify ./granite-4.2-30b ibm-granite/granite-4.2-30b
From sourceHosted (signed)ibm-granite/granite-4.2-30bLast check: 2026-11-14 21:16 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Fine-tune of granite-4.1-30b-base.

Works with

Overview

Size
58.6 GB
Weights
58.6 GB (safetensors)
Parameters
29.3B
Formats
safetensors
Task
text generation
License
Apache-2.0 (permissive)
Files
24, each with a sha256
Publisher
ibm-granite
Added
2026-11-14
Section
alt.freeweights.granite
Lineage

Original release from the publisher.

Base model: ibm-granite/granite-4.1-30b-base

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-14 21:16 UTCpassed

Model card

From the publisher at commit 9e668ce. Shown as plain text with links; images open at the publisher.

Granite-4.2-30B#

Collection Blog GitHub License


Model Summary#

DevelopersGranite Team, IBM
Model TypeDecoder-only Dense Transformer (Reasoning)
ArchitectureGraniteForCausalLM
Base ModelGranite-4.1-30B-Base
Parameters30B
Context LengthNatively Supports 128K (Long-context extension to 512K)
Precisionbfloat16
Tested LanguagesEnglish, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, Chinese (other languages may work but have not been fully tested)
Reasoning ModeBuilt-in <think>...</think> chain-of-thought
Best ForReasoning, Code Generation, Tool Calling, Agentic Workflows, Multilingual Dialog
LicenseApache 2.0
HF CollectionGranite 4.2 Language Models
Release DateAugust 25, 2026

Model Overview#

What is IBM Granite?#

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.

For further details on the post-training methodology, please refer to the Granite-4.2 Technical Blog.


Evaluation Results#

| Task | 3B Dense | 8B Dense | 30B Dense

| Agentic (Coding)

| SWE Bench Multilingual | NA | 30.78 | 41.89

| SWE Bench Pro | NA | 19.11 | 33.29

| SWE Bench Verified | NA | 47.67 | 57

| Terminal-Bench 2.1 | NA | 20.56 | 29.24

| Agentic (General)

| τ³-bench (AVG) | 45.78 | 58.06 | 62.00

| BFCL (v4) | 52.41 | 52.39 | 61.39

| ProfBench | 32.10 | 41.20 | 42.90

| BirdBench | NA | 41.07 | 41.85

| GDPval | NA | 1189 | 1225

| Reasoning

| AIME25 | 78.33 | 86.67 | 89.17

| HMMT Feb25 | 66.67 | 78.33 | 89.17

| GPQA | 54.80 | 64.14 | 66.41

| LiveCodeBench v6 | 69.71 | 73.24 | 75.77

| SciCode | 24.11 | 36.09 | 38.76

| Chat & Instruction Following

| MMLU-Pro | 67.84 | 74.04 | 77.60

| MMLU-ProX lite (IBM) | 27.78 | 61.06 | 66.64

| Arena-Hard-V2 | 34.96 | 65.19 | 67.93

| IFBench (prompt) | 74.33 | 79.33 | 77.17

| Long Context

| RULER 64K | 67.52 | 80.99 | 89.96

| RULER 128K | 55.30 | 71.41 | 81.38

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.

ParameterValueNotes
temperature1.0Required for all modes
top_p0.95Nucleus sampling threshold
max_new_tokens8192Thinking mode (increase for complex reasoning)
max_new_tokens2048Non-thinking mode
do_sampleTrueRequired when temperature > 0
Thinking Modes#
ModeTemplate ParametersBehavior
Thinking (default)enable_thinking=TrueFull chain-of-thought reasoning inside <think>...</think>
Non-thinkingenable_thinking=FalseDirect answer with no reasoning overhead
Low-effortenable_thinking=True, low_effort=TrueBrief 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.

Starting the Server#
vllm serve ibm-granite/granite-4.2-30b \
    --served-model-name granite-4.2-30b \
    --dtype bfloat16 \
    --max-model-len 131072 \
    --reasoning-parser granite_thinking_parser \
    --reasoning-parser-plugin ./granite_thinking_parser.py \
    --tool-call-parser qwen3_coder \
    --enable-auto-tool-choice
OpenAI-Compatible API Usage#
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")

response = client.chat.completions.create(
    model="granite-4.2-30b",
    messages=[{"role": "user", "content": "Explain the Riemann hypothesis in simple terms."}],
    temperature=1.0,
    top_p=0.95,
    max_tokens=8192,
)

print(response.choices[0].message.content)
Tool Calling via vLLM#
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")

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"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="granite-4.2-30b",
    messages=[{"role": "user", "content": "What's the weather like in Boston right now?"}],
    tools=tools,
    temperature=1.0,
    top_p=0.95,
    max_tokens=4096,
)

print(response.choices[0].message.tool_calls)

Serving with SGLang#

Granite-4.2-30B can also be served with SGLang (v0.5.18+) for high-throughput inference.

Reasoning parser: Use --reasoning-parser auto, which resolves to the built-in nemotron_3 parser for this checkpoint. It separates the thinking trace into reasoning_content and the final answer into content, and it handles all three thinking modes (enable_thinking=True/False, low_effort=True) described in Thinking Modes. Tool calling parser: Use --tool-call-parser auto, which resolves to qwen3_coder for this checkpoint.

Starting the Server#
python3 -m sglang.launch_server \
    --model-path ibm-granite/granite-4.2-30b \
    --dtype bfloat16 \
    --context-length 131072 \
    --reasoning-parser auto \
    --tool-call-parser auto
OpenAI-Compatible API Usage#
from openai import OpenAI

client = OpenAI(base_url="http://localhost:30000/v1", api_key="unused")

response = client.chat.completions.create(
    model="ibm-granite/granite-4.2-30b",
    messages=[{"role": "user", "content": "Explain the Riemann hypothesis in simple terms."}],
    temperature=1.0,
    top_p=0.95,
    max_tokens=8192,
)

print(response.choices[0].message.reasoning_content)
print(response.choices[0].message.content)
Tool Calling via SGLang#
from openai import OpenAI

client = OpenAI(base_url="http://localhost:30000/v1", api_key="unused")

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"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="ibm-granite/granite-4.2-30b",
    messages=[{"role": "user", "content": "What's the weather like in Boston right now?"}],
    tools=tools,
    temperature=1.0,
    top_p=0.95,
    max_tokens=4096,
)

print(response.choices[0].message.tool_calls)

For a full deployment recipe (Docker, H200/B200 launch matrix, thinking-mode examples, and benchmark data), see the SGLang Granite 4.2 cookbook.


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.

Install:

curl -fsSL https://opencode.ai/install | bash

Configure ~/.config/opencode/opencode.json (with reasoning enabled):

{
  "$schema": "https://opencode.ai/config.json",
  "model": "ibm-granite/granite-4.2-30b",
  "providers": {
    "ibm-granite": {
      "name": "vLLM (local)",
      "package": "@opencode-ai/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "http://localhost:8000/v1",
        "apiKey": "EMPTY"
      },
      "models": {
        "granite-4.2-30b": {
          "name": "Granite 4.2 30B",
          "limit": {
            "context": 131072,
            "output": 32768
          },
          "body": {
            "chat_template_kwargs": {
              "enable_thinking": true
            }
          },
          "compatibility": {
            "reasoningField": "reasoning"
          }
        }
      }
    }
  }
}

The key fields for reasoning:

  • "body.chat_template_kwargs" — passes enable_thinking to vLLM via the request body, which the Granite chat template uses to activate <think>...</think> reasoning.
  • "compatibility.reasoningField": "reasoning" — tells OpenCode which response field contains the model's chain-of-thought (vLLM returns it in the reasoning field).

To disable reasoning, set "enable_thinking": false in the chat_template_kwargs block.

Run:

opencode
opencode run "your task description"

For full documentation, see opencode.ai/docs.

Pi#

Pi is a minimal agent harness for AI-powered coding that runs in your terminal. It supports custom providers via a models.json configuration file.

Install:

curl -fsSL https://pi.dev/install.sh | sh

Configure ~/.pi/agent/models.json (with reasoning and effort-level control):

{
  "providers": {
    "vllm": {
      "baseUrl": "http://localhost:8000/v1",
      "api": "openai-completions",
      "apiKey": "EMPTY",
      "compat": {
        "supportsDeveloperRole": false,
        "supportsReasoningEffort": true,
        "thinkingFormat": "chat-template",
        "chatTemplateKwargs": {
          "enable_thinking": {
            "$var": "thinking.enabled"
          },
          "low_effort": {
            "$var": "thinking.effort",
            "omitWhenOff": true
          }
        }
      },
      "models": [
        {
          "id": "granite-4.2-30b",
          "name": "Granite 4.2 30B",
          "reasoning": true,
          "input": ["text"],
          "contextWindow": 131072,
          "maxTokens": 32768,
          "thinkingLevelMap": {
            "low": "true",
            "high": null
          },
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
        }
      ]
    }
  }
}

The key fields for reasoning:

  • "thinkingFormat": "chat-template" — routes Pi's thinking controls through vLLM's chat_template_kwargs, which is how Granite handles reasoning modes.
  • "chatTemplateKwargs" — maps Pi's thinking toggle to enable_thinking and effort control to low_effort.
  • "reasoning": true — tells Pi to expect and display chain-of-thought reasoning output.
  • "thinkingLevelMap" — maps Pi's effort levels to Granite's two reasoning modes: "low" enables low-effort reasoning (low_effort=true, shorter chains), "high" uses full reasoning (default).

Run:

pi

Then select the granite-4.2-30b model with /model or Ctrl+L in the interactive session.

Verifying reasoning output:

The configuration above sets "reasoning": true, which tells Pi to expect and display chain-of-thought reasoning from the model. You can verify reasoning is working correctly via the API:

import requests

response = requests.post("http://localhost:8000/v1/chat/completions", json={
    "model": "granite-4.2-30b",
    "messages": [{"role": "user", "content": "How many r's are in the word 'strawberry'?"}],
    "temperature": 1.0,
    "top_p": 0.95,
    "max_tokens": 8192,
    "chat_template_kwargs": {"enable_thinking": True}
}).json()

message = response["choices"][0]["message"]

# Reasoning content contains the model's chain-of-thought
print("Reasoning:", message.get("reasoning"))

# Content contains the final answer
print("Answer:", message.get("content"))

To disable reasoning (for faster responses on simple queries), set enable_thinking to False:

response = requests.post("http://localhost:8000/v1/chat/completions", json={
    "model": "granite-4.2-30b",
    "messages": [{"role": "user", "content": "What is the capital of France?"}],
    "temperature": 1.0,
    "top_p": 0.95,
    "max_tokens": 8192,
    "chat_template_kwargs": {"enable_thinking": False}
}).json()

# No reasoning content — direct answer only
print("Answer:", response["choices"][0]["message"]["content"])

For full documentation, see pi.dev/docs.

OpenHands#

OpenHands is an AI software engineer that can plan, write code, and execute commands.

  1. Install and launch OpenHands following the official installation guide.
  2. Configure the LLM in the OpenHands settings with:
    • Model: granite-4.2-30b
    • Base URL: http://localhost:8000/v1
    • API Key: your vLLM --api-key value

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.


Quick Start (Transformers)#

Installation#
pip install torch torchvision torchaudio
pip install accelerate transformers
Basic Inference (Thinking Mode)#
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_path = "ibm-granite/granite-4.2-30b"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="cuda", torch_dtype=torch.bfloat16)
model.eval()

messages = [
    {"role": "user", "content": "How many r's are in the word 'strawberry'?"},
]

text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)

with torch.no_grad():
    output = model.generate(**inputs, max_new_tokens=8192, temperature=1.0, top_p=0.95, do_sample=True)

print(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#
messages = [
    {"role": "user", "content": "What is the capital of France?"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(text, return_tensors="pt").to(model.device)

output = model.generate(**inputs, max_new_tokens=2048, temperature=1.0, top_p=0.95, do_sample=True)
print(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|>
Low-Effort Thinking#
messages = [
    {"role": "user", "content": "What is 2 + 2?"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True,
                                     enable_thinking=True, low_effort=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)

output = model.generate(**inputs, max_new_tokens=4096, temperature=1.0, top_p=0.95, do_sample=True)
print(tokenizer.decode(output[0][inputs.input_ids.shape[-1]:], skip_special_tokens=False))

Example Output

<think>
Simple answer.
</think>
2 + 2 = 4.<|im_end|>

Tool Calling#

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#
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"]
            }
        }
    }
]

messages = [
    {"role": "user", "content": "What's the weather like in Boston right now?"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, tools=tools,
                                     add_generation_prompt=True, enable_thinking=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)

output = model.generate(**inputs, max_new_tokens=4096, temperature=1.0, top_p=0.95, do_sample=True)
print(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#
messages = [
    {"role": "user", "content": "What's the weather like in Boston right now?"},
    {"role": "assistant", "content": "<think>\nThe user wants to know the current weather in Boston. I should call get_current_weather.\n</think>",
     "tool_calls": [{"function": {"name": "get_current_weather", "arguments": {"city": "Boston"}}}]},
    {"role": "tool", "content": '{"temperature": "72°F", "condition": "Partly cloudy", "humidity": "65%"}'},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, tools=tools,
                                     add_generation_prompt=True, enable_thinking=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)

output = model.generate(**inputs, max_new_tokens=4096, temperature=1.0, top_p=0.95, do_sample=True)
print(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#
messages = [
    {"role": "user", "content": "What is 15 * 37?"},
    {"role": "assistant", "content": "<think>\nLet me calculate 15 * 37.\n15 * 37 = 15 * 30 + 15 * 7 = 450 + 105 = 555\n</think>\n15 * 37 = 555"},
    {"role": "user", "content": "Now divide that by 5"},
]

# Default: previous thinking is stripped to save context
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True,
                                     enable_thinking=True, truncate_history_thinking=True)

# To preserve full history:
text_full = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True,
                                          enable_thinking=True, truncate_history_thinking=False)
Parsing Thinking vs. Final Answer#
import re

def parse_model_output(text):
    """Separate thinking content from final answer."""
    think_match = re.search(r'<think>(.*?)</think>', text, re.DOTALL)
    if think_match:
        thinking = think_match.group(1).strip()
        answer_start = text.find('</think>') + len('</think>')
        answer_end = text.find('<|im_end|>', answer_start)
        answer = text[answer_start:answer_end].strip() if answer_end != -1 else text[answer_start:].strip()
    else:
        thinking, answer = "", text.strip()
    return thinking, answer

thinking, answer = parse_model_output(output_text)

Ethical Considerations and Limitations#

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.


Resources#

Files

24 files · 58.6 GBWeights 58.6 GB (safetensors). Sizes and sha256 from the signed manifest.
Show all 24 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
README.md38.7 KB10d0e2b083c888814dc92a6308ca34d1c6fe01f344b54ff54905a8cbe5a80b06
chat_template.jinja9.01 KBf0ba43f79b3cabca5e5a7584c77aec92f49feae45cdf7779c87d9fc54cd90258
config.json907 B82c834ac6bf6a2ecbf9801b49c3fb927008df24ea415c35e931b6091cab21277
generation_config.json207 B1b9baf0a7959d31d7fb58ff6b506c27d09a73d395cadccc7e6dd1d4b7e43fd9d
granite_thinking_parser.py4.65 KBcd5eef99f559f33dc402e0475174a97dcb43724d7e810149c702e9bbc473048a
merges.txt917 KBb6fe424e334903f7fb84d3a106d9730455f4744b9fe3c21ee136d97a00e72502
model-00001-of-00011.safetensors5.20 GB7bc0381448f1aca017530b7c4363a6b5779de2d0c51c5008384a1b477d2beeee
model-00002-of-00011.safetensors5.34 GB20751df5ef7c8eb393e276680da1f0db791602b0f010462f7785a20cbe14e02c
model-00003-of-00011.safetensors5.34 GB7ab66af66ad8aaaf5fc3a0c17fed00b00be81932a5cd9094991c5bc10b7f4266
model-00004-of-00011.safetensors5.34 GB1f693007eae097b53e78df85199c17c79ed028fe7bc48256b099305d517b6874
model-00005-of-00011.safetensors5.34 GBcfff27df03172afb2fbf6235544bfd0bcbbf327680b71c94bbd51d49ff683c7c
model-00006-of-00011.safetensors5.34 GBc2fd3b059f6b0c957e040f47fd1d4eb9d5ad3068c34a7017cf68099ec8071b3b
model-00007-of-00011.safetensors5.34 GBdf3dd87bd7a6c6fc87939fe9abc9a53f09b1c7d1f1b5d3bb9f878180b887722e
model-00008-of-00011.safetensors5.34 GB8bd6a68c890b5245e788fb3a25843f255202a20538a9f6a468f69b877e941641
model-00009-of-00011.safetensors5.34 GB5d84c5caa26efa0e65be43daf324d1041f63425d226582385b7228a87e6ef969
model-00010-of-00011.safetensors5.34 GB8c26acf6dbff176f3df76ace9245d10590639c92f00b83ed6cae973dc2ad8e2f
model-00011-of-00011.safetensors5.34 GBacd04f755c6ea90259b6a4cebe11a6a4008c68fe9d6b34d3b5067ca9800a7246
model.safetensors.index.json47.7 KB8d35bd24e3ffecd70573917c1504a49f55e2d28fb789a2963e0b19f75202d615
model.sig13.2 KB329bac627d31f920f403eeda9becf274577b7cedbb9a6599523d1e86eba1fd76
special_tokens_map.json563 Be9435fefd6d838fd9fcbbc44b97a8e3ff322be7f6dfb7e4fd2468586574bb52b
tokenizer.json7.15 MB883975314d58743726347caaf2c32ac89afd5ad57222cffbc4f052f2ab27b2d7
tokenizer_config.json17.7 KB2007f26df166ed10a2d6fa881c1c8f3cdd151e451469f59b274897f14449835f
vocab.json1.61 MBa1be0c1e0a89b5bacda6af6f8b63df09668cb8d1f656229ee9123140c9507810
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
9e668ce1c5 pinned now manifest updated, same commit2026-11-14 21:16 UTC24 files · 58.6 GB
9e668ce1c52026-11-14 21:16 UTC24 files · 58.6 GB

Use it

$ fw get ibm-granite/granite-4.2-30b
# manifest sha256 b1a6619d514a… · 58.6 GB · 24 files
$ fw verify ./granite-4.2-30b ibm-granite/granite-4.2-30b
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/ibm-granite/granite-4.2-30b.json --dir ./granite-4.2-30b $ python3 fw.py verify ./granite-4.2-30b ./ibm-granite__granite-4.2-30b.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ibm-granite/granite-4.2-30b --revision 9e668ce1c538387ef24d3644e9b0606647762636 --local-dir ./granite-4.2-30b
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("ibm-granite/granite-4.2-30b", revision="9e668ce1c538387ef24d3644e9b0606647762636") model = AutoModelForCausalLM.from_pretrained("ibm-granite/granite-4.2-30b", revision="9e668ce1c538387ef24d3644e9b0606647762636", device_map="auto")
vLLMServe an OpenAI-compatible API.
$ HF_ENDPOINT=https://freeweights.allternit.com vllm serve ibm-granite/granite-4.2-30b --revision 9e668ce1c538387ef24d3644e9b0606647762636

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-14
Text in
README.md
Text sha256
10d0e2b083c888814dc92a6308ca34d1c6fe01f344b54ff54905a8cbe5a80b06
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: ibm-granite <huggingface.co/ibm-granite>Newsgroups: alt.freeweights.graniteSubject: granite-4.2-30bDate: 2026-11-14Commit: 9e668ceSigned: 2DC28CC7B26A283B ✓
Upstream
ibm-granite/granite-4.2-30b
Pinned commit
9e668ce1c538387ef24d3644e9b0606647762636
Manifest
granite-4.2-30b.json · .minisig
Manifest sha256
b1a6619d514a94b1d60f20fe38387d697b3c33b317c63c8c002e1decd05e58cc
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-14 21:16 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-4.2-30b.json $ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-4.2-30b.json.minisig $ minisign -Vm granite-4.2-30b.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

Parent

ibm-granite/granite-4.1-30b-base · this model is a finetune of it

10 models in the catalog name this one as their parent.

Fine-tunes
1
Quantizations
9
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ibm-granite/granite-4.2-30b
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. granite-4.2-30b.json. Provenance. Takedown history: none.

Variants

9 quantized or adapter builds of granite-4.2-30b. Each has its own license check and page.

From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed1
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed2
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed3
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed1
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed2
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed3