본문으로 건너뛰기

Granite 4.2의 추론과 에이전트 학습 설계

Granite 4.2는 단계형 GRPO와 실제 환경 Agentic RL로 추론·Tool calling·코딩 능력을 쌓은 3B·8B·30B LLM family입니다.

이 요약은 AI가 원문을 분석해 생성했습니다. 정확한 내용은 원문 기준으로 확인하세요.

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에 바로 활용할 수 있습니다.

섹션별 상세

01
Granite 4.2는 기존 Granite의 지시 따르기 중심 설계에 명시적 추론과 Agent 기능을 더한 Dense Decoder-only reasoning LLM family로, 3B·8B·30B 세 크기로 구성됩니다. 세 모델은 처음부터 약 15T tokens로 사전 학습한 뒤 SFT와 다단계 RL을 거치며, 512K tokens까지 문맥 창을 확장하는 5단계 Pre-training을 공유합니다. 모든 모델은 Thinking·Non-thinking 전환, 쉬운 문제에 짧은 예산만 쓰는 Low-effort Thinking, Native Tool calling을 제공하고 Apache 2.0 license로 공개됩니다.
근거
  • Granite 4.2는 3B, 8B, 30B 크기의 Dense Decoder-only reasoning LLM family이며 약 15T tokens로 처음부터 학습됐다. TL;DR와 Granite 4.2 개요의 모델 크기 및 Pre-training 설명
02
Granite 4.2의 모델 구조는 3B·8B·30B 모두 Decoder-only Dense Transformer이며 GQA, RoPE, SwiGLU, RMSNorm, bfloat16을 공통으로 사용합니다. 3B는 40개 층과 40개 Attention head, 8B는 40개 층과 32개 Attention head, 30B는 64개 층과 32개 Attention head를 가지며 세 모델 모두 8개 KV head를 둡니다. 학습 시 Sequence length는 131,072 tokens이고, RoPE의 θ는 10,000,000으로 설정되어 긴 문맥 처리 기반을 구성합니다.
03
SFT는 Agentic data 31.6%와 Non-agentic data 68.4%를 합친 약 720만 개 샘플, 약 100B tokens 규모의 혼합물로 Base model을 Instruction-following·Reasoning·Tool-using Assistant로 바꿉니다. OpenHands, OpenCode, Terminus-2, SWE-agent 등 여러 Harness에서 만든 궤적을 OpenAI Chat format으로 정규화한 뒤 GPT-OSS-120B와 Gemma 4를 Judge로 사용해 낮은 품질 샘플, 허위 정보, 잘못된 Tool interaction, 정의되지 않은 함수 호출을 제거합니다. SHA-256으로 Tools와 Messages 필드를 검사하는 Local·Global Deduplication을 적용하고, 30B에는 Agentic·SWE·Coding data와 원래 SFT의 약 16% Replay data를 추가한 두 번째 SFT 단계를 수행합니다.
04
Post-training은 한 번의 RL pass가 아니라 RLVR, Instruction-following booster, Code booster, SWE, Terminal, Search, RLHF를 순차적으로 연결한 Curriculum입니다. 각 단계는 독립적인 GRPO run으로 이전 Checkpoint에서 Warm-start하며, 3B는 Foundational RL과 Alignment까지만 수행하고 8B와 30B는 Coding-boosted Checkpoint 위에 SWE·Terminal·Search Agentic RL을 추가합니다. RLVR와 SWE 2처럼 보상이 객관적인 단계는 KL 0으로 자유롭게 탐색하고, Code booster와 RLHF처럼 현재 정책 보존이 중요한 단계는 KL 0.05를 사용합니다.
Granite 4.2의 모델 크기별 단계형 RL Curriculum을 나타내는 구조도입니다.
DiagramSFT에서 RLVR와 Skill boosters를 거치는 Foundational RL은 3B·8B·30B 모두에 적용되고, SWE·Terminal·Search를 거치는 Agentic RL은 8B와 30B에만 적용됩니다. 각 단계는 앞선 Checkpoint에서 Warm-start하며 마지막에 RLHF를 수행하고, 3B 경로는 Agentic RL을 건너뛰고 RLHF로 이어집니다.
근거
  • Agentic RL은 8B와 30B에만 적용되며 SWE, Terminal, Search 순서로 실제 환경에서 수행된다. Staged Curriculum과 Agentic RL 섹션, 이미지 1과 이미지 2
  • 각 RL 단계는 이전 Checkpoint에서 Warm-start하는 별도의 GRPO run이다. Training Methodology와 The Staged Curriculum의 단계별 학습 설명
05
Asynchronous GRPO는 Generation worker와 Trainer가 서로 기다리지 않도록 Shared buffer를 사이에 두고, 완성된 Rollout이 쌓이면 Trainer가 Optimizer step을 수행한 뒤 갱신된 파라미터를 Generator에 흘려보냅니다. Worker는 새 정책으로 갱신되는 동안 기존 KV cache를 재사용하므로 하나의 Trajectory가 인접한 두 Policy version에 걸칠 수 있으며, 한 번의 Update 이상 뒤처지지 않도록 제한하고 Truncated importance sampling으로 Log-probability ratio를 상한에 묶습니다. RLVR에서는 256 Prompts마다 16개 응답을 생성해 4,096개 Example batch를 만들고, Leave-one-out baseline으로 같은 Prompt의 다른 응답 평균 보상과 비교해 별도의 Value network 없이 Advantage를 계산합니다.
근거
  • Asynchronous GRPO는 Generation worker와 Trainer를 Shared buffer로 분리하고 Truncated importance sampling으로 정책 지연의 영향을 제한한다. Training Methodology의 Asynchronous GRPO 설명
06
Foundational RL은 수학의 Boxed-answer와 Lean 검증, 숨은 테스트를 이용한 Competitive coding, STEM·Graduate science MCQA, Structured output, Tool calling, Reasoning puzzle과 Abstention을 각 Verifier에 연결합니다. 이후 IF booster는 Multi-turn chat과 Inverse-IFEval을, Code booster는 Competitive coding만 집중해 현재 능력에서 특정 기술을 끌어올립니다. Agentic RL에서는 8B와 30B가 실제 Sandbox에서 SWE Repository를 읽고 편집한 뒤 테스트를 실행하고, Live shell에서 명령을 계획·실행·복구하며, Web search를 여러 단계 호출해 최종 답변을 작성합니다.
SWE, Terminal, Search Agent가 사용하는 Harness·Environment·Data·Loop·Reward 구성을 비교한 도식입니다.
DiagramSWE Agent는 OpenHands와 Repository Sandbox에서 코드를 수정하고 테스트를 통과시키며, Terminal Agent는 Harbor·Terminus-2와 Live shell에서 명령을 실행하고 오류를 복구합니다. Search Agent는 Multi-hop research loop에서 Live web-search tool을 호출하고 최종 답변을 LLM Judge로 평가받으며, 세 Agent 모두 Coding-boosted Checkpoint에서 시작합니다.
07
SWE Agent는 OpenHands Harness와 Repository별 Sandbox에서 여러 내부 턴 동안 코드 읽기·파일 편집·Test suite 실행을 수행하고 Hidden test 통과 여부로 검증 가능한 보상을 받습니다. Terminal Agent는 Harbor와 Terminus-2 Harness를 통해 Live shell에서 최대 64 Environment turns의 명령 실행과 오류 복구를 학습하며, Search Agent는 Browsing loop에서 다중 경로 Web search를 수행하고 최종 답변에 대한 LLM Judge 점수를 받습니다. 세 단계 모두 Multi-turn Tool use, 실제 환경, Sparse outcome reward를 공유하지만 3B에는 이 Agentic RL block이 없습니다.
08
학습 시스템은 Training side의 NeMo-RL과 Rollout side의 NeMo-Gym을 분리해 구성합니다. NeMo-RL은 Megatron-Core로 학습하고 vLLM으로 Rollout을 생성하며 Megatron-Bridge로 Hugging Face와 Megatron 가중치를 변환하고, NeMo-Gym은 Verifier·Tool·Sandbox·Reward model을 동일한 Resource interface로 묶어 Math checker와 SWE Sandbox를 GRPO에 같은 방식으로 연결합니다. 서로 다른 GPU pool에서 Generation과 Policy update를 실행하기 때문에 Live Agentic environment가 Optimizer step 동안 유휴 상태에 머물지 않습니다.
NeMo-RL의 Training side와 NeMo-Gym의 Rollout side가 GRPO 학습을 연결하는 시스템 구조도입니다.
DiagramNeMo-RL 쪽에는 Megatron-Core, GRPO, vLLM, Megatron-Bridge가 배치되어 Policy 학습·Rollout 생성·가중치 변환을 담당합니다. NeMo-Gym 쪽의 Agent가 Models와 Resources를 조율하고, Resources에 Tool·Reward·Verifier·Sandbox를 연결해 실제 SWE Repository, Shell, Web-search 환경을 공통 Interface로 제공합니다.
근거
  • NeMo-RL은 학습을, NeMo-Gym은 Tool·Sandbox·Verifier·Reward resource를 포함한 Rollout 환경을 담당한다. Agentic AI Infrastructure for Scalable RL과 이미지 3의 NeMo-RL + NeMo-Gym 구조도
09
벤치마크에서는 모델 크기가 커질수록 Reasoning 점수가 상승했으며, AIME25는 3B 78.33에서 8B 86.67, 30B 89.17로 높아졌고 GPQA는 54.80, 64.14, 66.41을 기록했습니다. Agentic coding에서는 8B와 30B만 평가되어 SWE-Bench Verified가 47.7과 57.0, SWE-Bench Pro가 19.1과 33.3, Terminal-Bench 2.1이 20.6과 29.2의 Resolve rate를 보였습니다. Long-context RULER 128K도 3B 55.30, 8B 71.41, 30B 81.38로 나타나며, 모델 크기와 Agentic RL 적용 범위가 능력 차이를 만드는 축으로 작동합니다.
Granite 4.2 3B·8B·30B의 Reasoning benchmark pass@1 점수를 비교한 막대그래프입니다.
ChartAIME25는 78.3, 86.7, 89.2로, HMMT Feb25는 66.7, 78.3, 89.2로 모델 크기에 따라 상승합니다. GPQA, LiveCode-Bench v6, SciCode에서도 30B가 각각 66.4, 75.8, 38.8로 가장 높은 점수를 기록해 수학·과학·코드 추론의 크기별 차이를 나타냅니다.
Granite 4.2 8B와 30B의 Agentic coding benchmark Resolve rate를 비교한 막대그래프입니다.
Chart30B는 SWE-Bench Verified 57.0%, SWE-Bench Multilingual 41.9%, SWE-Bench Pro 33.3%, Terminal-Bench 2.1 29.2%를 기록해 모든 표시된 과제에서 8B의 47.7%, 30.8%, 19.1%, 20.6%보다 높습니다. 이 결과는 Agentic RL을 적용한 두 모델에서 Repository·Terminal 작업 해결률을 비교하는 근거로 사용됩니다.
근거
  • 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
10
배포 측면에서는 FP8, NVFP4, MXFP4, GGUF 형식의 Quantized variant를 제공해 vLLM 또는 llama.cpp 기반의 저메모리 추론을 지원합니다. FP8은 Calibration 없이 Dynamic per-channel weight와 Per-token activation을 사용하고, NVFP4와 MXFP4는 SFT data에서 뽑은 2K samples로 GPTQ calibration을 수행하며 Calibration context는 2K입니다. Transformers에서는 enable_thinking=True로 Thinking Mode, enable_thinking=False로 Non-thinking Mode, low_effort=True로 짧은 추론 예산을 선택할 수 있고 OpenAI-compatible endpoint를 통해 OpenCode·Pi·OpenHands 같은 Agentic coding Harness와 연결할 수 있습니다.

용어 해설

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도 이 마지막 단계에 포함합니다.

코드 예제

python
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로 응답을 생성합니다.

python
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을 등록하고 모델이 호출할 함수를 선택하도록 구성합니다.

python
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 사용을 이어갑니다.

bash
curl -fsSL https://opencode.ai/install | bash
opencode opencode run "your task description"

vLLM으로 제공되는 Granite 4.2를 OpenCode 코딩 에이전트에서 사용하기 위한 설치와 실행 명령입니다.

python
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 요약 · 북마크 · 개인 피드 설정 — 무료

출처 · 인용 안내

원문 발행 2026. 08. 26.수집 2026. 08. 26.출처 타입 RSS

인용 시 "요약 출처: AI Trends (aitrends.kr)"를 표기하고, 사실 확인은 원문 보기 기준으로 진행해 주세요. 자세한 기준은 운영 정책을 참고해 주세요.