[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,62 +2,157 @@
|
||||
id: wiki-2026-0508-test-time-compute-scaling-추론-시간-
|
||||
title: Test Time Compute Scaling (추론 시간 계산 스케일링)
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AI-TEST-TIME-COMPUTE]
|
||||
aliases: [Test-Time Compute, Inference-Time Scaling, Reasoning Models]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.97
|
||||
tags: [LLM, Inference, Scale, OpenAI-o1]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [llm, reasoning, scaling, test-time-compute]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: Python
|
||||
framework: vLLM / Anthropic SDK / OpenAI SDK
|
||||
---
|
||||
|
||||
# [[Test-Time Compute Scaling (추론 시간 계산 스케일링)|Test-Time Compute Scaling (추론 시간 계산 스케일링)]]
|
||||
# Test Time Compute Scaling (추론 시간 계산 스케일링)
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "모델이 크지 않아도, 더 오래 생각하게 하면 더 똑똑해진다." 훈련 단계의 스케일링을 넘어, 추론(Inference) 시에 더 많은 연산 자원(사고 단계)을 투입하여 정답률을 높이는 새로운 패러다임이다.
|
||||
## 매 한 줄
|
||||
> **"매 think longer, get smarter"**. Test-time compute scaling 매 inference 시 더 많은 compute (매 longer chain-of-thought, sampling, search) 로 quality 의 trade off. OpenAI o1 (2024-09) → o3 / DeepSeek-R1 (2025-01) → Claude 4.x extended thinking (2025+) 의 paradigm. 매 training-time scaling laws 의 보완.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **The Concept**:
|
||||
- 기존에는 모델의 크기(파라미터 수)가 지능을 결정한다고 믿었으나, OpenAI o1 등 최신 모델은 답변 전 'Self-Correction'과 추론 과정을 늘리는 것만으로도 거대 모델을 압도할 수 있음을 증명함.
|
||||
- **Methods**:
|
||||
- **Chain-of-Thought (CoT)**: 중간 과정을 길게 생성.
|
||||
- **[[Search|Search]] (MCTS)**: 여러 대안 답변을 탐색하고 평가하여 최적의 경로 선택.
|
||||
- **Verification**: 생성된 결과를 스스로 검증하고 틀렸으면 다시 시도.
|
||||
- **Inference Law**: 훈련 시 자원이 부족해도 추론 시 계산량을 늘림으로써 성능 한계를 돌파할 수 있다.
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- 추론 시간 계산량이 늘어나면 비용(Latency)이 기하급수적으로 증가한다. 실시간 채팅에는 부적합할 수 있으므로, '빠른 직관(System 1)'과 '신중한 사고(System 2)'를 구분하여 과제 난이도에 따라 자원을 배분하는 효율화가 핵심 과제다.
|
||||
### 매 두 axes
|
||||
- **More thinking (long CoT)** — 매 single sample 안 더 긴 reasoning trace. o1, R1, Claude extended thinking.
|
||||
- **Search / sampling** — 매 multiple samples + verifier (best-of-N, MCTS, beam). AlphaCode, ReST, MathShepherd.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- Related: [[Chain-of-Thought (CoT 사고 사슬)|Chain-of-Thought (CoT 사고 사슬)]] , Monte Carlo Tree Search (MCTS)
|
||||
- Origin: OpenAI-o1
|
||||
### 매 modern (2025-2026)
|
||||
- **RL on reasoning** — 매 RLHF + RL on verifiable rewards (math, code) → 매 long CoT 의 emerge. R1-zero, R1.
|
||||
- **Extended thinking budgets** — 매 Claude 의 `thinking_budget` parameter, OpenAI 의 `reasoning_effort`.
|
||||
- **Scaling law** — 매 log compute ↔ accuracy linear (Snell 2024, OpenAI o-series chart).
|
||||
- **Cost shift** — 매 training 1x 의 inference Nx — 매 economics 의 reshape.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 응용
|
||||
1. Math (AIME, IMO).
|
||||
2. Code (SWE-bench, competition).
|
||||
3. Agentic planning (deep tool-use chains).
|
||||
4. Scientific reasoning (GPQA).
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
## 💻 패턴
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### Claude extended thinking
|
||||
```python
|
||||
from anthropic import Anthropic
|
||||
client = Anthropic()
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
resp = client.messages.create(
|
||||
model="claude-opus-4-7",
|
||||
max_tokens=8000,
|
||||
thinking={"type": "enabled", "budget_tokens": 16000},
|
||||
messages=[{"role": "user", "content": "Solve: ..."}],
|
||||
)
|
||||
for block in resp.content:
|
||||
if block.type == "thinking":
|
||||
print("THINK:", block.thinking[:200])
|
||||
elif block.type == "text":
|
||||
print("ANS:", block.text)
|
||||
```
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### OpenAI reasoning effort
|
||||
```python
|
||||
from openai import OpenAI
|
||||
client = OpenAI()
|
||||
resp = client.responses.create(
|
||||
model="o3",
|
||||
input="Prove the AM-GM inequality.",
|
||||
reasoning={"effort": "high"}, # low / medium / high
|
||||
)
|
||||
print(resp.output_text)
|
||||
```
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
### Best-of-N + verifier
|
||||
```python
|
||||
def best_of_n(prompt, n=8, verifier=None):
|
||||
samples = [client.messages.create(
|
||||
model="claude-opus-4-7",
|
||||
max_tokens=2000,
|
||||
temperature=0.8,
|
||||
messages=[{"role": "user", "content": prompt}],
|
||||
).content[0].text for _ in range(n)]
|
||||
return max(samples, key=verifier) # 매 verifier: unit test pass count, etc.
|
||||
```
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
### Self-consistency (majority vote)
|
||||
```python
|
||||
from collections import Counter
|
||||
answers = [extract_answer(s) for s in samples]
|
||||
final = Counter(answers).most_common(1)[0][0]
|
||||
```
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
### MCTS-style search (sketch)
|
||||
```python
|
||||
def expand(node):
|
||||
children = [llm.continue_from(node.partial, temp=0.9) for _ in range(k)]
|
||||
return [Node(c, score=verifier(c)) for c in children]
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
def search(root, depth=4):
|
||||
frontier = [root]
|
||||
for _ in range(depth):
|
||||
candidates = sum((expand(n) for n in frontier), [])
|
||||
frontier = sorted(candidates, key=lambda n: -n.score)[:beam]
|
||||
return max(frontier, key=lambda n: n.score)
|
||||
```
|
||||
|
||||
### Budget controller
|
||||
```python
|
||||
def adaptive_thinking(prompt, easy_budget=2000, hard_budget=32000):
|
||||
# 매 difficulty classifier 의 first
|
||||
diff = client.messages.create(model="claude-haiku-4", ...).content[0].text
|
||||
budget = hard_budget if "hard" in diff else easy_budget
|
||||
return client.messages.create(
|
||||
model="claude-opus-4-7",
|
||||
thinking={"type": "enabled", "budget_tokens": budget},
|
||||
messages=[{"role": "user", "content": prompt}],
|
||||
)
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Math / code with verifier | RL-trained reasoning model (o3, R1) + search |
|
||||
| Open-ended reasoning | Extended thinking (Claude 4.x) |
|
||||
| Latency-critical | Skip — use small fast model |
|
||||
| Cost-critical batch | Self-consistency 4-8 samples |
|
||||
| Search exploitable | Best-of-N + verifier |
|
||||
| Fuzzy quality | Reasoning model > base model |
|
||||
|
||||
**기본값**: 매 reasoning model (o3 / Claude extended thinking) 매 hard task, base model 매 easy task — 매 difficulty router 로 split.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[LLM-Inference]] · [[Scaling-Laws]]
|
||||
- 변형: [[Chain-of-Thought]] · [[Self-Consistency]] · [[Best-of-N]] · [[MCTS]]
|
||||
- 응용: [[Agentic-AI]] · [[Code-Generation]] · [[Math-Reasoning]]
|
||||
- Adjacent: [[RLHF]] · [[Process-Reward-Model]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 hard reasoning task, verifiable output (math/code), agent planning, quality > latency.
|
||||
**언제 X**: 매 simple lookup / chat — 매 thinking 매 cost waste.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Always max thinking budget**: 매 easy task 의 32k thinking 매 cost burn — 매 router 사용.
|
||||
- **No verifier in best-of-N**: 매 random sample 매 noise — 매 verifier (unit test, math check) 의 essential.
|
||||
- **Stream thinking to user**: 매 thinking content 매 internal — 매 user UI 에 final text 만.
|
||||
- **Caching invalidation**: 매 thinking budget 변경 시 cache miss — 매 stable budget 권장.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (OpenAI o1/o3 system cards, DeepSeek-R1 paper 2025-01, Anthropic extended thinking docs, Snell et al. 2024).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — o-series / R1 / Claude extended thinking patterns |
|
||||
|
||||
Reference in New Issue
Block a user