Programmer/AI

Claude Code Extended Thinking: 깊은 사고로 퀄리티 높이기

MoreLean 2026. 1. 21. 00:57
반응형

Extended Thinking이라는 기능도 있어요.

복잡한 문제 주면 Claude Code가 스스로 여러 각도로 생각해봐요. "이렇게 하면 어떻게 되지? 저렇게 하면?" 혼자 시뮬레이션 돌리는 거죠.

시간은 오래 걸리지만 퀄리티가 확실히 달라요. 중요한 기능 만들 때 한 번씩 써보세요.


TL;DR

  • Extended Thinking = Claude가 답변 전에 깊이 생각하는 공식 기능
  • Claude Code에서 기본 활성화 (최대 31,999 토큰)
  • Ctrl+O로 thinking 과정 볼 수 있음 (verbose mode)
  • "think", "think hard", "ultrathink" 키워드로 thinking budget 조절
  • 복잡한 아키텍처, 어려운 버그, 수학/분석에 효과적
  • 시간/비용 더 들지만 퀄리티 확실히 향상

Extended Thinking이란?

"When extended thinking is turned on, Claude creates thinking content blocks where it outputs its internal reasoning. Claude incorporates insights from this reasoning before crafting a final response." — Anthropic Docs

쉽게 말해, Claude가 답변하기 전에 혼자 깊이 생각하는 시간을 갖는 거예요.

일반 모드:

질문 → 바로 답변

Extended Thinking:

질문 → [내부 추론: 여러 접근법 탐색, 엣지 케이스 분석, 자기 검증] → 답변

어떻게 생각하나?

Anthropic 연구진의 관찰:

"Some of our researchers with math and physics backgrounds have noted how eerily similar Claude's thought process is to their own way of reasoning through difficult problems: exploring many different angles and branches of reasoning, and double- and triple-checking answers." — Anthropic - Visible Extended Thinking

Claude의 thinking 과정:

  • 여러 각도에서 문제 탐색
  • 다양한 접근법 시도
  • 자기 답변 검증 (double/triple check)
  • 실수 발견 시 수정

Claude Code에서의 Extended Thinking

기본 활성화

"Extended thinking is enabled by default, reserving a portion of the output token budget (up to 31,999 tokens) for Claude to reason through complex problems step-by-step." — Claude Code Docs

Claude Code에서는 기본적으로 켜져 있어요. 별도 설정 없이도 복잡한 문제에 대해 자동으로 깊이 생각합니다.

Thinking 과정 보기

# Ctrl+O로 verbose mode 토글
# thinking 과정이 회색 이탤릭 텍스트로 표시됨

"To view Claude's thinking process, press Ctrl+O to toggle verbose mode and see the internal reasoning displayed as gray italic text." — Claude Code Docs

Thinking Budget 조절하기

키워드로 thinking에 할당되는 토큰 양을 조절할 수 있어요:

키워드 Thinking 토큰 용도

think ~4,000 일반적인 분석
think hard, megathink ~10,000 중간 복잡도
think harder, ultrathink ~31,999 최고 복잡도

"These specific phrases are mapped directly to increasing levels of thinking budget in the system: 'think' < 'think hard' < 'think harder' < 'ultrathink'" — Anthropic Best Practices

환경 변수로 제한

# thinking 토큰 상한 설정
export MAX_THINKING_TOKENS=10000
claude

"Use the MAX_THINKING_TOKENS environment variable to cap the thinking budget." — Claude Code Docs


Extended Thinking의 효과

수학 문제 성능

Anthropic 연구 결과, thinking 토큰이 늘어날수록 수학 문제 정확도가 로그 스케일로 향상:

"Its accuracy on, for example, math questions improves logarithmically with the number of 'thinking tokens' that it's allowed to sample." — Anthropic - Visible Extended Thinking

에이전트 작업 성능

Tau-Bench 평가에서 "think" 도구 + 최적화된 프롬프트 조합:

  • Airline 도메인: 0.370 → 0.570 (54% 향상)
  • Retail 도메인: 0.783 → 0.812

"The results showed dramatic improvements when Claude 3.7 effectively used the 'think' tool." — Anthropic Engineering

Extended Thinking이 도움되는 경우

"Extended thinking is particularly valuable for complex architectural decisions, challenging bugs, multi-step implementation planning, and evaluating tradeoffs between different approaches." — Claude Code Docs

효과적인 상황:

  • 복잡한 아키텍처 설계
  • 까다로운 버그 디버깅
  • 다단계 구현 계획
  • 트레이드오프 평가
  • 수학/분석 문제
  • 여러 솔루션 탐색이 필요한 경우

실전 활용 예시

1. 아키텍처 설계

> Think hard about designing a real-time collaboration system.
> Consider:
> - Conflict resolution (OT vs CRDT)
> - Scaling to 100K concurrent users
> - Offline support
> - Cost optimization

Claude의 thinking 과정 (verbose mode):

Let me analyze this systematically...

First, conflict resolution approaches:
- OT (Operational Transformation): Used by Google Docs, complex but proven
- CRDT (Conflict-free Replicated Data Types): Simpler, better for P2P
  
For 100K concurrent users, CRDT might be better because...
Wait, but OT has better compression for text...

Let me reconsider the requirements...
[더 깊은 분석 계속...]

2. 복잡한 버그 디버깅

> Ultrathink about this race condition.
> It only happens under high load in production.
> Logs show intermittent payment failures with no error messages.

Extended thinking 장점:

  • 여러 가능한 원인 탐색
  • 각 가설 검증
  • 엣지 케이스 고려
  • 재현 조건 분석

3. 알고리즘 최적화

> Think harder about optimizing this database query.
> Current execution time: 45 seconds
> Table has 50M rows with these indexes: [...]
> 
> Consider query plan, indexing strategy, and potential denormalization.

4. 테스트 케이스 검증

"For coding tasks, ask Claude to run through test cases in its extended thinking." — Anthropic Extended Thinking Tips

> Write a function to validate credit card numbers.
> Before you finish, verify your solution with test cases for:
> - Valid Visa, MasterCard, Amex
> - Invalid checksum
> - Edge cases (empty, too short, too long)
> And fix any issues you find.

5. 보안 리뷰

> Think hard about security vulnerabilities in this authentication flow.
> Consider:
> - OWASP Top 10
> - Token handling
> - Session management
> - Rate limiting bypass

Extended Thinking Tips (공식 권장)

1. 높은 수준의 지시가 더 효과적

"Claude often performs better with high level instructions to just think deeply about a task rather than step-by-step prescriptive guidance." — Anthropic Extended Thinking Tips

❌ 덜 효과적:

Think through this math problem step by step:
1. First, identify the variables
2. Then, set up the equation
3. Next, solve for x

✅ 더 효과적:

Please think about this math problem thoroughly and in great detail.
Consider multiple approaches and show your complete reasoning.
Try different methods if your first approach doesn't work.

2. 최소 budget에서 시작

"The minimum budget is 1,024 tokens. We suggest starting at the minimum and increasing the thinking budget incrementally to find the optimal range." — AWS Bedrock Docs

모든 문제에 ultrathink를 쓸 필요 없어요:

  1. 먼저 기본으로 시도
  2. 결과가 얕으면 "think" 추가
  3. 그래도 부족하면 "think hard"
  4. 정말 복잡하면 "ultrathink"

3. 자기 검증 요청

> Implement the sorting algorithm.
> After implementation, verify it handles:
> - Empty array
> - Single element
> - Already sorted
> - Reverse sorted
> - Duplicates
> Fix any issues you find.

4. 영어로 thinking하면 더 효과적

"Extended thinking performs best in English, though final outputs can be in any language Claude supports." — Anthropic Extended Thinking Tips

복잡한 문제는 영어로 질문하고, 필요하면 답변만 한국어로 요청하세요.


Extended Thinking vs Think Tool

Anthropic은 두 가지 "생각" 메커니즘을 제공해요:

Extended Thinking Think Tool

시점 답변 생성 답변 생성
목적 깊은 초기 분석 도구 사용 중 중간 점검
사용 복잡한 문제 전체 분석 긴 도구 체인에서 방향 점검

"Extended thinking is all about what Claude does before it starts generating a response... The 'think' tool is for Claude, once it starts generating a response, to add a step to stop and think about whether it has all the information it needs." — Anthropic Engineering

언제 뭘 쓸까?

  • Extended Thinking: 처음부터 깊은 분석이 필요할 때
  • Think Tool: 여러 도구를 연속 사용하며 중간 점검이 필요할 때

현재 Anthropic 권장:

"Extended thinking capabilities have improved since its initial release, such that we recommend using that feature instead of a dedicated think tool in most cases."


Thinking Mode 토글

Claude Code에서 thinking mode를 켜고 끌 수 있어요:

# 설정에서 토글
> /config

# 또는 Tab 키로 토글 (Plan Mode)

Thinking ON (기본):

  • 복잡한 문제에 더 나은 결과
  • 시간/토큰 더 사용
  • 최대 31,999 토큰

Thinking OFF:

  • 빠른 응답
  • 간단한 작업에 적합
  • 토큰 절약

비용 고려사항

"You're charged for all thinking tokens used, even though Claude 4 models show summarized thinking." — Claude Code Docs

중요:

  • Thinking 토큰도 비용 청구
  • Claude 4 모델은 요약된 thinking만 보여주지만, 전체 토큰에 대해 과금
  • ultrathink (31,999 토큰)는 상당한 비용 발생 가능

비용 최적화:

# 토큰 상한 설정
export MAX_THINKING_TOKENS=8000

CLAUDE.md에 가이드라인 추가

# Extended Thinking Guidelines

## When to Use Deep Thinking
- Architecture decisions: always use "think hard" or higher
- Bug debugging: use "think" minimum
- Security reviews: use "ultrathink"
- Simple CRUD: no special thinking needed

## Thinking Budget by Task
| Task Type | Keyword | Budget |
|-----------|---------|--------|
| Quick fix | (none) | default |
| Feature implementation | think | ~4K |
| Architecture design | think hard | ~10K |
| Complex debugging | ultrathink | ~32K |

## Self-Verification
Always verify solutions with edge cases before finalizing.

체크리스트

기본 사용

  • [ ] Ctrl+O로 verbose mode 활성화해서 thinking 과정 확인
  • [ ] 복잡한 문제에 "think" 키워드 사용
  • [ ] 아키텍처/보안에 "think hard" 또는 "ultrathink" 사용

최적화

  • [ ] 최소 budget에서 시작, 필요시 증가
  • [ ] MAX_THINKING_TOKENS로 비용 제한
  • [ ] 영어로 복잡한 문제 질문

품질 향상

  • [ ] 높은 수준의 지시 사용 (step-by-step X)
  • [ ] 자기 검증 요청 추가
  • [ ] 여러 접근법 고려 요청

마무리

Extended Thinking은 Claude Code의 핵심 기능이에요.

"Extended thinking is enabled by default, reserving a portion of the output token budget (up to 31,999 tokens) for Claude to reason through complex problems step-by-step." — Claude Code Docs

기억하세요:

  • 기본 활성화 — 별도 설정 없이도 작동
  • Ctrl+O — thinking 과정 볼 수 있음
  • think < think hard < ultrathink — budget 조절
  • 복잡한 문제에 효과적 — 아키텍처, 버그, 수학
  • 비용 발생 — thinking 토큰도 과금

복잡한 아키텍처 설계, 까다로운 버그, 중요한 기술 결정이 있다면 Extended Thinking을 적극 활용하세요. 시간은 좀 더 걸리지만, 퀄리티 차이는 확실해요.


참고 자료

Anthropic 공식

추가 자료


 

반응형