TL;DR
Granite 4.2는 3B·8B·30B Dense Decoder-only reasoning LLM family로, 약 15T tokens의 5단계 Pre-training과 약 720만 SFT samples를 거친 뒤 RLVR·Skill booster·Agentic RL·RLHF를 순차적으로 적용합니다. 모든 모델은 Thinking 전환과 Native Tool calling을 지원하지만 8B와 30B만 실제 Repository Sandbox, Live shell, Web search 환경에서 SWE·Terminal·Search Agentic RL을 학습합니다. Asynchronous GRPO는 Generation과 Training을 분리하고 NeMo-RL과 NeMo-Gym이 각각 학습·환경 실행을 맡으며, 30B는 SWE-Bench Verified 57.0%, AIME25 89.17, RULER 128K 81.38을 기록했습니다. FP8·NVFP4·MXFP4·GGUF Quantization과 Transformers·vLLM·OpenCode·OpenHands 연동도 제공되어 추론과 Agentic coding에 바로 활용할 수 있습니다.
섹션별 상세
- Granite 4.2는 3B, 8B, 30B 크기의 Dense Decoder-only reasoning LLM family이며 약 15T tokens로 처음부터 학습됐다. — TL;DR와 Granite 4.2 개요의 모델 크기 및 Pre-training 설명

- Agentic RL은 8B와 30B에만 적용되며 SWE, Terminal, Search 순서로 실제 환경에서 수행된다. — Staged Curriculum과 Agentic RL 섹션, 이미지 1과 이미지 2
- 각 RL 단계는 이전 Checkpoint에서 Warm-start하는 별도의 GRPO run이다. — Training Methodology와 The Staged Curriculum의 단계별 학습 설명
- Asynchronous GRPO는 Generation worker와 Trainer를 Shared buffer로 분리하고 Truncated importance sampling으로 정책 지연의 영향을 제한한다. — Training Methodology의 Asynchronous GRPO 설명


- NeMo-RL은 학습을, NeMo-Gym은 Tool·Sandbox·Verifier·Reward resource를 포함한 Rollout 환경을 담당한다. — Agentic AI Infrastructure for Scalable RL과 이미지 3의 NeMo-RL + NeMo-Gym 구조도


- 30B는 SWE-Bench Verified 57.0, SWE-Bench Pro 33.3, Terminal-Bench 2.1 29.2의 Agentic coding Resolve rate를 기록했다. — Results의 Agentic coding benchmark 표와 이미지 5
용어 해설
- Dense Decoder-only Transformer
- — 각 토큰이 모든 층의 동일한 전체 파라미터를 통과하는 Transformer 구조입니다. Decoder 블록만 사용해 앞선 토큰을 바탕으로 다음 토큰을 생성하며, Mixture-of-Experts처럼 일부 전문가만 선택하는 방식과 달리 모델 크기만큼의 계산을 매 토큰에 적용합니다. Granite 4.2의 3B, 8B, 30B 모델이 이 구조를 공유합니다.
- Grouped Query Attention
- — 여러 Query head가 더 적은 수의 Key·Value head를 공유하는 Attention 방식입니다. Granite 4.2는 모델 크기에 따라 32개 또는 40개의 Attention head와 8개의 KV head를 사용해 KV cache의 메모리 부담을 줄이는 구성을 택했습니다. 긴 문맥과 추론 서버 운영에서 메모리 효율을 높이는 역할을 합니다.
- GRPO
- — 같은 프롬프트에서 생성한 여러 응답의 보상을 서로 비교해 상대적 Advantage를 계산하는 강화학습 알고리즘입니다. 각 응답은 다른 응답들의 평균 보상을 기준으로 평가되므로 별도의 Value network가 필요하지 않습니다. Granite 4.2는 모든 RL 단계를 asynchronous GRPO로 수행하며, 검증 가능한 보상부터 에이전트 환경 보상까지 같은 학습 골격을 사용합니다.
- RLVR
- — 정답 일치, 숨은 테스트, 형식 검사기처럼 결과를 객관적으로 판정할 수 있는 Verifiable Reward를 이용하는 강화학습 방식입니다. Granite 4.2에서는 수학, Lean 형식 증명, 경쟁 프로그래밍, 과학, 지시 따르기, Tool calling 등의 과제를 각 Verifier와 연결합니다. 3B와 8B는 두 차례, 30B는 세 차례 RLVR를 거칩니다.
- RLHF
- — 사람의 선호와 안전 기준에 맞도록 모델의 응답 정책을 조정하는 후속 학습 단계입니다. Granite 4.2는 생성형 Reward Model로 선호를 평가하고 Jailbreak 저항성과 적절한 거부를 위한 안전 보상을 함께 최적화합니다. 앞선 단계에서 지나치게 길어진 추론을 줄이는 Reasoning-length penalty도 이 마지막 단계에 포함합니다.
코드 예제
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "ibm-granite/granite-4.2-3b"
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))Transformers에서 Granite 4.2 3B를 불러온 뒤 Thinking Mode로 응답을 생성합니다.
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))OpenAI function definition schema로 날씨 Tool을 등록하고 모델이 호출할 함수를 선택하도록 구성합니다.
messages = [
{"role": "user", "content": "What's the weather like in Boston right now?"},
{"role": "assistant", "content": "
The user wants to know the current weather in Boston. I should call get_current_weather.
", "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))이전 Assistant Tool call과 Tool 응답을 대화 기록에 넣어 다중 턴 Tool 사용을 이어갑니다.
curl -fsSL https://opencode.ai/install | bash
opencode opencode run "your task description"vLLM으로 제공되는 Granite 4.2를 OpenCode 코딩 에이전트에서 사용하기 위한 설치와 실행 명령입니다.
messages = [
{"role": "user", "content": "What is 15 * 37?"},
{"role": "assistant", "content": "
Let me calculate 15 * 37.
15 * 37 = 15 * 30 + 15 * 7 = 450 + 105 = 555
15 * 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)다중 턴 대화에서 이전 Thinking 내용을 제거해 문맥을 절약하거나 전체 기록을 보존하는 설정입니다.
기술
- Granite 4.2
- Grouped Query Attention (GQA)
- Rotary Position Embedding (RoPE)
- SwiGLU
- RMSNorm
- bfloat16
- OpenHands
- OpenCode
- Terminus-2
- SWE-agent
- OpenResearcher
- MiniSWE
- OpenSeeker
- EnvScaler
- Gemini CLI
- Hermes
- Codex
- Goose
- GPT-OSS-120B
- Gemma 4
- GRPO
- NeMo-RL
- Megatron-Core
- vLLM
- Megatron-Bridge
- NeMo-Gym
- Transformers
- SGLang
- LLM Compressor
- llama.cpp
- GPTQ
- OpenAI-compatible API
활용 사례
- Thinking Mode와 Non-thinking Mode를 전환하는 일반 질의응답
- OpenAI function-calling format을 이용한 Native Tool calling
- OpenCode·Pi·OpenHands를 이용한 Agentic coding
- 실제 Repository Sandbox에서 코드 수정과 Hidden test 실행
- Live shell에서 다단계 명령 실행과 오류 복구
- Web search를 이용한 다중 단계 조사와 답변 생성
- vLLM·llama.cpp 기반 Quantized model의 저메모리 추론
언급된 리소스
AI 요약 · 북마크 · 개인 피드 설정 — 무료
출처 · 인용 안내
인용 시 "요약 출처: AI Trends (aitrends.kr)"를 표기하고, 사실 확인은 원문 보기 기준으로 진행해 주세요. 자세한 기준은 운영 정책을 참고해 주세요.
