0Pricing
AI Prompt Engineering · 강의

확장된 사고를 위한 효과적인 프롬프트

프롬프트를 단순하게 유지하고 단계별 지침은 피하며 모델이 스스로 추론하도록 맡깁니다.

확장된 사고를 위한 효과적인 프롬프트은(는) CoddyKit의 무료 AI Prompt Engineering 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 AI Prompt Engineering 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. AI Prompt Engineering 강의에는 총 4개의 강의가 포함되어 있습니다.

추론 모델에 프롬프트를 작성하는 방식은 다릅니다

일반 모델을 위해 익힌 프롬프트 작성 방식, 즉 사고 연쇄, 단계별 지침, 퓨샷 예시는 추론 모델에서는 오히려 방해가 되는 경우가 많습니다.

추론 모델은 이미 정교한 내부 추론을 수행하고 있습니다. 모델이 정확히 어떻게 사고해야 하는지 지시하면 그 과정을 방해할 수 있습니다. 추론 모델에 가장 효과적인 프롬프트는 일반 모델용 프롬프트보다 더 단순하고 직접적입니다.

단계별 지시를 하지 마십시오

일반 모델에는 다음과 같이 작성합니다: "단계별로 생각하십시오. 먼저 X를 고려한 다음 Y를 고려하고, 마지막으로 Z를 결론으로 내리십시오." 일반 모델은 이를 자동으로 수행하지 않기 때문에 이러한 안내 구조가 도움이 됩니다.

추론 모델에서는 이러한 안내 구조가 모델의 내부 추론을 최적이 아닌 경로로 제한할 수 있습니다. 대신 문제를 명확하게 제시하고 모델이 문제를 어떻게 추론할지 스스로 결정하도록 하십시오.

# Standard model: needs scaffolding
STANDARD_PROMPT = (
    'Let us think step by step.\n'
    'First, identify the variables.\n'
    'Then, set up the equation.\n'
    'Then, solve for x.\n'
    'Finally, verify your answer.\n\n'
    'Problem: If 3x + 7 = 22, what is x?'
)

# Reasoning model: just state the problem clearly
REASONING_PROMPT = (
    'Solve: If 3x + 7 = 22, what is x?'
    # The model handles the step-by-step internally
)

# Both produce correct answers; the reasoning model prompt is simpler
print('Reasoning model prefers the cleaner prompt')

문제를 명확하고 빠짐없이 제시하십시오

추론을 어떻게 지시할지는 단순하게 해야 하지만, 무엇을 요청하는지는 충분히 구체적으로 작성해야 합니다. 모든 맥락, 제약 조건, 요구 사항을 처음부터 제공하십시오. 모델은 내부 추론 중에 이를 활용합니다.

import anthropic

client = anthropic.Anthropic(api_key='sk-ant-...')

# Poor: vague problem statement
BAD_PROMPT = 'Write me a good sorting algorithm.'

# Good: clear, complete problem specification
GOOD_PROMPT = (
    'Write a Python sorting algorithm with these requirements:\n'
    '- Must sort a list of integers in ascending order\n'
    '- Must work correctly on empty lists, single-element lists, and lists with duplicates\n'
    '- Target time complexity: O(n log n) average case\n'
    '- Must not use Python built-in sort() or sorted()\n'
    '- Include a brief docstring and 3 test cases\n\n'
    'Return only the code, no explanation.'
)

response = client.messages.create(
    model='claude-opus-4-5',
    max_tokens=8000,
    thinking={'type': 'enabled', 'budget_tokens': 5000},
    messages=[{'role': 'user', 'content': GOOD_PROMPT}]
)
print(next(b.text for b in response.content if b.type == 'text')[:300])

budget_tokens를 적절히 설정하기

budget_tokens는 최대 사고 토큰 수를 조절합니다. 이를 올바르게 설정하는 것이 추론 모델을 조정하는 주요 방법입니다:

  • 1,000~2,000: 간단한 문제, 빠른 계산
  • 5,000~10,000: 중간 정도의 복잡도를 가진 코딩, 분석
  • 16,000 이상: 가장 어려운 수학, 복잡한 시스템 설계, 연구 수준의 문제
import anthropic

client = anthropic.Anthropic(api_key='sk-ant-...')

def reasoning_call(prompt, budget_tokens=5000):
    response = client.messages.create(
        model='claude-opus-4-5',
        max_tokens=budget_tokens + 2048,  # max_tokens must exceed budget_tokens
        thinking={
            'type': 'enabled',
            'budget_tokens': budget_tokens
        },
        messages=[{'role': 'user', 'content': prompt}]
    )
    answer = next((b.text for b in response.content if b.type == 'text'), '')
    thinking_blocks = [b for b in response.content if b.type == 'thinking']
    print(f'Thinking blocks: {len(thinking_blocks)}')
    return answer

# Simple problem: small budget
reasoning_call('What is 17 * 23?', budget_tokens=1000)

# Complex problem: larger budget
reasoning_call(
    'Design a distributed rate limiter that handles 100k requests/second.',
    budget_tokens=10000
)

최소한의 시스템 프롬프트

추론 모델에서는 시스템 프롬프트를 최소한으로 유지하십시오. 모델의 내부 추론이 핵심 기능이므로, 긴 동작 지침으로 모델을 지나치게 제한하지 마십시오.

추론 모델에 적합한 시스템 프롬프트는 역할을 설정하고, 출력 형식을 정의하며, 제약 조건을 지정합니다. 그게 전부입니다.

# Over-engineered system prompt (hurts reasoning models)
BAD_SYSTEM = (
    'You are an expert Python developer. '
    'Always think step by step. '
    'First understand the problem. '
    'Then plan your approach. '
    'Then implement step by step. '
    'Check each step before proceeding. '
    'Finally review your solution. '
    'Format all code with comments. '
    'Add error handling to every function. '
    '...'
)

# Minimal system prompt (helps reasoning models)
GOOD_SYSTEM = (
    'You are an expert Python developer. '
    'Return only code unless explanation is explicitly requested. '
    'Use type hints and docstrings.'
)
# The model's internal reasoning handles the rest

출력 형식 지침도 여전히 중요합니다

어떻게 추론할지는 지시하지 않아야 하지만, 원하는 출력 형식은 명확하게 지정해야 합니다. 이는 추론 지침과는 다릅니다. 출력 형식 지침은 모델이 무엇을 반환할지를 알려 주는 것이지, 어떻게 사고할지를 알려 주는 것이 아닙니다.

import anthropic

client = anthropic.Anthropic(api_key='sk-ant-...')

# Clear output format instructions are still important
prompt = (
    'Analyze the time and space complexity of this Python function:\n\n'
    'def bubble_sort(arr):\n'
    '    n = len(arr)\n'
    '    for i in range(n):\n'
    '        for j in range(0, n-i-1):\n'
    '            if arr[j] > arr[j+1]:\n'
    '                arr[j], arr[j+1] = arr[j+1], arr[j]\n\n'
    'Return your answer as JSON with keys: '
    'time_complexity, space_complexity, explanation (2 sentences max).'
)

response = client.messages.create(
    model='claude-opus-4-5',
    max_tokens=5000,
    thinking={'type': 'enabled', 'budget_tokens': 3000},
    messages=[{'role': 'user', 'content': prompt}]
)
print(next(b.text for b in response.content if b.type == 'text'))

퓨샷 예시를 더 적게 사용하기

일반 모델은 퓨샷 예시를 3~5개 제공하면 큰 도움을 받습니다. 추론 모델은 그 효과가 더 작으며, 예시가 너무 많으면 내부 추론을 방해하는 내용으로 컨텍스트 창을 채우기 때문에 오히려 성능이 저하될 수 있습니다.

추론 모델에서는 예시를 0~1개 사용하는 것이 최적인 경우가 많습니다. 출력 형식이 특이하거나 모호할 때만 예시를 사용하십시오.

# Standard model: 3 few-shot examples improve performance significantly
STANDARD_FEW_SHOT = (
    'Q: 2 + 2 = ?\nA: 4\n\n'
    'Q: 5 * 6 = ?\nA: 30\n\n'
    'Q: 100 / 4 = ?\nA: 25\n\n'
    'Q: 17 + 38 = ?\nA:'
)

# Reasoning model: 0 examples is fine; 1 is enough if format is unclear
REASONING_DIRECT = 'What is 17 + 38?'

# The reasoning model already knows math — examples are overhead, not signal
# Only use 1 example when the output format needs clarification:
REASONING_FORMAT_EXAMPLE = (
    'Answer math questions returning only the number.\n'
    'Example: Q: 2 + 2  A: 4\n\n'
    'Q: 17 + 38'
)

추론 모델 출력의 불확실성 처리

추론 모델은 일반 모델보다 실제 불확실성을 표현할 가능성이 높습니다. 실제로 해당 문제를 고민했기 때문입니다. 확신을 완곡하게 표현하는 응답도 자연스럽게 처리할 수 있도록 애플리케이션을 설계하십시오.

import anthropic
import re

client = anthropic.Anthropic(api_key='sk-ant-...')

def reasoning_with_confidence(question):
    prompt = (
        f'{question}\n\n'
        f'At the end of your answer, include a confidence statement: '
        f'Confidence: [HIGH/MEDIUM/LOW] — [one sentence why]'
    )
    response = client.messages.create(
        model='claude-opus-4-5',
        max_tokens=8000,
        thinking={'type': 'enabled', 'budget_tokens': 5000},
        messages=[{'role': 'user', 'content': prompt}]
    )
    text = next(b.text for b in response.content if b.type == 'text')

    # Parse confidence
    match = re.search(r'Confidence: (HIGH|MEDIUM|LOW)', text)
    confidence = match.group(1) if match else 'UNKNOWN'
    print(f'Confidence: {confidence}')
    return text, confidence

answer, conf = reasoning_with_confidence(
    'What will AI capabilities look like in 2030?'
)

추론 모델 출력 결과 캐싱

추론 모델 호출은 비용이 많이 들고 느립니다. 반복되거나 예측 가능한 질의의 결과를 캐시하십시오. 사고 토큰은 매우 길 수 있으므로, 캐싱하면 반복 호출에서 지연 시간과 비용을 다시 지불하지 않아도 됩니다.

import hashlib
import json
import os

cache_dir = '/tmp/reasoning_cache'
os.makedirs(cache_dir, exist_ok=True)

def cached_reasoning_call(prompt, budget_tokens=5000):
    # Create cache key from prompt
    key = hashlib.sha256(f'{prompt}:{budget_tokens}'.encode()).hexdigest()
    cache_file = os.path.join(cache_dir, f'{key}.json')

    if os.path.exists(cache_file):
        with open(cache_file) as f:
            cached = json.load(f)
        print('Cache hit!')
        return cached['answer']

    # Cache miss: call the model
    answer = reasoning_call(prompt, budget_tokens)

    with open(cache_file, 'w') as f:
        json.dump({'prompt': prompt, 'answer': answer}, f)

    return answer

추론 모델 출력 검증

추론 모델은 오류를 더 적게 만들지만 항상 정확한 것은 아닙니다. 특히 특정 분야의 사실이나 최신 주제에서는 더욱 그렇습니다. 중대한 결과가 따르는 상황에서 실제로 사용될 출력은 항상 검증하십시오.

import anthropic

client = anthropic.Anthropic(api_key='sk-ant-...')

def reasoning_with_verification(question):
    # Step 1: Get reasoning model answer
    r1 = client.messages.create(
        model='claude-opus-4-5',
        max_tokens=10000,
        thinking={'type': 'enabled', 'budget_tokens': 8000},
        messages=[{'role': 'user', 'content': question}]
    )
    answer = next(b.text for b in r1.content if b.type == 'text')

    # Step 2: Independent verification call
    verify_prompt = (
        f'Question: {question}\n\n'
        f'Proposed answer: {answer}\n\n'
        f'Is this answer correct? Respond with CORRECT, INCORRECT, or UNCERTAIN, '
        f'followed by a brief explanation.'
    )
    r2 = client.messages.create(
        model='claude-opus-4-5',
        max_tokens=256,
        messages=[{'role': 'user', 'content': verify_prompt}]
    )
    verification = r2.content[0].text
    print(f'Verification: {verification[:100]}')
    return answer, verification

추론 모델 프롬프트 실전 확인 목록

추론 모델용 프롬프트를 작성할 때는 다음 확인 목록을 따르십시오:

  • 문제를 명확하고 빠짐없이 제시하십시오
  • NOT — 단계별 추론 지침은 포함하지 마십시오
  • 시스템 프롬프트를 짧게 유지하십시오(역할 + 형식 + 제약 조건만 포함)
  • 퓨샷 예시는 최대 0~1개만 사용하십시오
  • 출력 형식을 명시적으로 지정하십시오
  • budget_tokens를 문제 복잡도에 비례해 설정하십시오
  • 10~60초의 응답 지연 시간을 고려하십시오

지식 확인: 추론 모델 프롬프트 작성

일반 모델에 비해 추론 모델에는 더 단순한 프롬프트를 사용하는 것이 권장되는 이유는 무엇입니까?

복습: 확장 사고를 위한 효과적인 프롬프트

추론 모델에는 일반 모델보다 더 단순하고 직접적인 프롬프트가 필요합니다. 어떻게 추론할지는 지시하지 말고, 문제를 명확하고 빠짐없이 제시한 다음 전략은 모델의 내부 숙고에 맡기십시오. 시스템 프롬프트는 역할, 출력 형식, 제약 조건만 포함하여 최소한으로 유지하십시오. 퓨샷 예시는 0~1개만 사용하십시오. 문제의 복잡도에 맞춰 budget_tokens를 설정하십시오(간단한 문제는 1K, 어려운 문제는 10K 이상). 상당한 지연 시간을 고려하고 가능하면 결과를 캐시하십시오. 출력 형식은 명시적으로 지정하십시오. 자세한 지침이 여전히 도움이 되는 유일한 영역이 바로 출력 형식입니다.

자주 묻는 질문

“확장된 사고를 위한 효과적인 프롬프트” 강의는 무료인가요?

네 — “확장된 사고를 위한 효과적인 프롬프트” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 AI Prompt Engineering 강의 전체를 잠금 해제할 수 있습니다. AI Prompt Engineering 강의에는 총 4개의 강의가 포함되어 있습니다.

“확장된 사고를 위한 효과적인 프롬프트”에서 뭘 배우나요?

프롬프트를 단순하게 유지하고 단계별 지침은 피하며 모델이 스스로 추론하도록 맡깁니다. 브라우저에서 직접 실행하는 실습 코드로 AI Prompt Engineering을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

AI Prompt Engineering을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 AI Prompt Engineering은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“확장된 사고를 위한 효과적인 프롬프트” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 AI Prompt Engineering 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 AI Prompt Engineering 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 추론 모델은 어떻게 다른가요?
  2. 확장된 사고를 위한 효과적인 프롬프트
  3. 추론 모델과 일반 모델은 언제 사용할까요?
  4. 비용과 지연 시간의 절충
← AI Prompt Engineering(으)로 돌아가기