AI Prompt Engineering · レッスン

推論モデルと標準モデルの使い分け

数学、コード、複数段階の論理など、Extended Thinkingの効果が高い問題を学びます。

レッスン 3/413 ステップ

「推論モデルと標準モデルの使い分け」はCoddyKit上の無料AI Prompt Engineeringレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはAI Prompt Engineering学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 AI Prompt Engineeringコースには全4レッスンが含まれています。

すべてのタスクに推論モデルが必要なわけではない

推論モデルは強力ですが、高価で処理も遅くなります。各タスクに適したモデルの種類を選ぶことは、LLMシステム設計において最も影響の大きい判断の一つです。

核心となる問いは、そのタスクが本当に長時間の熟考による恩恵を受けるかどうかです。多くのタスクはそうではありません。品質を向上させずに推論モデルを使うと、費用を無駄にすることになります。

推論モデルが力を発揮する分野: 多段階の数学

推論モデルは、複数の段階を必要とする数学の問題、特に段階をまたいでエラーが積み重なる問題で、標準モデルを大幅に上回ります。

import anthropic

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

# Multi-step math: use reasoning model
hard_math_prompt = (
    'A company has 3 factories. Factory A produces 240 units/day, '
    'Factory B produces 180 units/day, and Factory C produces 300 units/day. '
    'They operate 5 days/week. A unit sells for $47.50. Operating costs are '
    '$18,000/week for A, $14,500/week for B, and $22,000/week for C. '
    'What is the total weekly profit across all factories?'
)

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

推論モデルが力を発揮する分野: 複雑なコード

データ構造の実装、微妙な論理エラーのデバッグ、効率的な解決策の設計など、アルゴリズムに関する問題では、推論モデルが標準モデルを上回ります。最終的な方針を決める前に、内部で複数のアプローチを検討できるためです。

import anthropic

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

# Complex coding: use reasoning model
code_prompt = (
    'Implement a thread-safe LRU cache in Python with these requirements:\n'
    '- O(1) get and put operations\n'
    '- Thread-safe using minimal locking\n'
    '- Support a max_size parameter\n'
    '- Include full docstrings and type hints\n'
    '- Handle edge cases: empty cache, size=1, duplicate keys'
)

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

推論モデルが力を発揮する分野: 戦略的計画

複数の選択肢の比較、多くの観点にわたるトレードオフの評価、長期的な影響の検討が必要なタスクは、拡張推論の恩恵を受けます。例として、アーキテクチャ設計の判断、プロダクトロードマップの評価、投資分析などがあります。

import anthropic

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

# Strategic decision: reasoning model adds real value
strategy_prompt = (
    'We are a B2B SaaS startup with $2M ARR, 15% monthly churn, '
    '3 engineers, and $800K runway. We have two options:\n'
    'A) Raise a Series A now at a $10M valuation\n'
    'B) Cut costs, extend runway 18 months, raise at higher valuation\n\n'
    'Analyze the trade-offs and recommend a course of action with reasoning.'
)

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

標準モデルが優位な分野: 単純なQ&A

簡単に答えられる事実に関する質問は、拡張推論の恩恵を受けません。「フランスの首都はどこですか」のような質問にo3やClaudeの拡張思考を使うと、結果が同じなのに20~50倍も多くの費用がかかります。

import anthropic

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

# Simple Q&A: standard model is just as good, much cheaper
simple_questions = [
    'What is the capital of France?',
    'Who wrote Hamlet?',
    'What year did the Berlin Wall fall?',
]

for q in simple_questions:
    # Use claude-haiku-4-5 — fast, cheap, equally accurate for factual recall
    r = client.messages.create(
        model='claude-haiku-4-5',
        max_tokens=50,
        messages=[{'role': 'user', 'content': q}]
    )
    print(f'Q: {q}\nA: {r.content[0].text}\n')

# Reasoning model would give the same answers at 50-100x the cost

標準モデルが優位な分野: テキストの整形

テキストの再フォーマット、要約、翻訳、変換には深い推論は必要ありません。必要なのは言語運用能力です。標準モデルは、はるかに低いコストとレイテンシーでこれらに優れています。

import anthropic

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

# Text formatting tasks: standard model wins
formatting_tasks = [
    ('Summarize in 2 sentences: The Eiffel Tower was built in 1889...', 100),
    ('Translate to Spanish: Good morning, how are you?', 50),
    ('Convert to bullet points: We need to buy milk, eggs, and bread.', 50),
]

for prompt, max_tok in formatting_tasks:
    r = client.messages.create(
        model='claude-haiku-4-5',  # Fastest, cheapest
        max_tokens=max_tok,
        messages=[{'role': 'user', 'content': prompt}]
    )
    print(r.content[0].text, '\n')

# Reasoning model: same quality, 50-100x more expensive, 10-30x slower

標準モデルが優位な分野: 低レイテンシーのアプリケーション

チャットボット、オートコンプリート、ライブアシスタンスなどのリアルタイムアプリケーションでは、30~60秒の応答時間は許容できません。標準モデルは1~5秒で応答します。ユーザー向けのリアルタイムインタラクションには標準モデルを使用してください。

import anthropic
import time

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

def latency_comparison(question):
    # Standard model: fast for real-time use
    start = time.time()
    r1 = client.messages.create(
        model='claude-haiku-4-5',
        max_tokens=200,
        messages=[{'role': 'user', 'content': question}]
    )
    t_standard = time.time() - start

    # Reasoning model: accurate but slow
    start = time.time()
    r2 = client.messages.create(
        model='claude-opus-4-5',
        max_tokens=5000,
        thinking={'type': 'enabled', 'budget_tokens': 3000},
        messages=[{'role': 'user', 'content': question}]
    )
    t_reasoning = time.time() - start

    print(f'Standard: {t_standard:.1f}s | Reasoning: {t_reasoning:.1f}s')

latency_comparison('What does API stand for?')

曖昧な推論問題

一部の問題は曖昧で、明示されていない前提によって正解が変わります。推論モデルは、内部で複数の解釈を検討し、最も妥当なものを選ぶため、標準モデルよりも適切に対処できます。

import anthropic

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

# Ambiguous reasoning: reasoning model handles this much better
ambiguous_prompt = (
    'Alice, Bob, and Carol are in a room. Alice says Bob is lying. '
    'Bob says Carol is lying. Carol says both Alice and Bob are lying. '
    'Who, if anyone, is telling the truth? '
    'Explain all possible consistent interpretations.'
)

# Reasoning model explores the logical space
response = client.messages.create(
    model='claude-opus-4-5',
    max_tokens=8000,
    thinking={'type': 'enabled', 'budget_tokens': 6000},
    messages=[{'role': 'user', 'content': ambiguous_prompt}]
)
print(next(b.text for b in response.content if b.type == 'text')[:400])

意思決定フレームワーク: どのモデルを使うか

標準モデルと推論モデルを選ぶための実用的な判断ツリーは次のとおりです。

  • 問題は数学的に複雑、または多段階の論理を必要とするか。→ 推論モデル
  • 多くの変数を含むトレードオフの評価が必要か。→ 推論モデル
  • 事実の想起、要約、翻訳か。→ 標準モデル
  • 2秒未満の応答時間が必要か。→ 標準モデル
  • 大規模運用でクエリあたりのコストが重要か。→ 標準モデル(品質差が大きい場合を除く)
  • 難しいエッジケース(医療、法律、金融)での正確性が重要か。→ 推論モデル

ハイブリッドルーティング: 両方の長所を活かす

本番環境では、クエリを分類し、適切なモデル層に振り分けるルーティング層を使用してください。単純なクエリは高速で安価なモデルに送り、複雑なクエリは推論モデルにエスカレーションします。

import anthropic

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

def classify_complexity(query):
    prompt = (
        f'Classify this query as SIMPLE or COMPLEX:\n'
        f'SIMPLE: factual, formatting, translation, short Q&A\n'
        f'COMPLEX: multi-step reasoning, analysis, code design, math\n\n'
        f'Query: {query}\n\n'
        f'Reply with only SIMPLE or COMPLEX.'
    )
    r = client.messages.create(
        model='claude-haiku-4-5',
        max_tokens=10,
        messages=[{'role': 'user', 'content': prompt}]
    )
    return r.content[0].text.strip()

def smart_query(query):
    complexity = classify_complexity(query)
    if complexity == 'SIMPLE':
        model, thinking = 'claude-haiku-4-5', None
    else:
        model = 'claude-opus-4-5'
        thinking = {'type': 'enabled', 'budget_tokens': 8000}

    kwargs = {'model': model, 'max_tokens': 2048, 'messages': [{'role': 'user', 'content': query}]}
    if thinking:
        kwargs['thinking'] = thinking
        kwargs['max_tokens'] = 10000

    r = client.messages.create(**kwargs)
    print(f'Used: {model} ({complexity})')
    return r.content[-1].text

推論が役立つ場合を評価する

推論が常に役立つと思い込まないでください。測定してください。ラベル付きの評価セットを使い、対象タスクの種類について標準モデルと推論モデルの精度を比較します。

import anthropic

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

def compare_models_on_task(task_examples, metric_fn):
    results = {'standard': [], 'reasoning': []}

    for ex in task_examples:
        # Standard model
        r_std = client.messages.create(
            model='claude-haiku-4-5',
            max_tokens=200,
            messages=[{'role': 'user', 'content': ex.question}]
        )
        results['standard'].append(
            metric_fn(ex.answer, r_std.content[0].text)
        )

        # Reasoning model
        r_rsn = client.messages.create(
            model='claude-opus-4-5',
            max_tokens=8000,
            thinking={'type': 'enabled', 'budget_tokens': 5000},
            messages=[{'role': 'user', 'content': ex.question}]
        )
        ans = next(b.text for b in r_rsn.content if b.type == 'text')
        results['reasoning'].append(metric_fn(ex.answer, ans))

    for model, scores in results.items():
        avg = sum(scores) / len(scores)
        print(f'{model}: {avg:.1%}')
    return results

理解度チェック: タスクのルーティング

標準モデルと比べて、推論モデルの恩恵を受ける可能性が最も低いタスクの種類はどれですか。

まとめ: 推論モデルと標準モデルの使い分け

推論モデルは、多段階の数学、複雑なアルゴリズムコーディング、戦略的計画、曖昧な論理問題、コストより正確性が優先される重要な判断に使用してください。標準モデルは、単純なQ&A、テキストの整形、翻訳、要約、そしてレイテンシーが重視されるすべてのリアルタイムアプリケーションに使用してください。本番環境では、クエリの複雑さを分類し、各リクエストを適切なモデル層に振り分けるルーティング層を構築します。20~100倍のコスト増を支払う前に、推論によって特定のタスクの精度が実際に向上するかを必ず測定してください。

無料で開始

AI チューターと学ぶ AI Prompt Engineering — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
53
レッスン
199

よくある質問

「推論モデルと標準モデルの使い分け」レッスンは無料ですか?

はい。「推論モデルと標準モデルの使い分け」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、AI Prompt Engineeringコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 AI Prompt Engineeringコースには全4レッスンが含まれています。

「推論モデルと標準モデルの使い分け」で何を学びますか?

数学、コード、複数段階の論理など、Extended Thinkingの効果が高い問題を学びます。 ブラウザで直接実行するハンズオンコードでAI Prompt Engineeringを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

AI Prompt Engineeringを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのAI Prompt Engineeringは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「推論モデルと標準モデルの使い分け」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このAI Prompt Engineeringレッスンでコードを書いて実行できますか?

はい。すべてのAI Prompt Engineeringレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. 推論モデルの違い
  2. Extended Thinkingに効果的なプロンプト
  3. 推論モデルと標準モデルの使い分け
  4. コストとレイテンシのトレードオフ
← AI Prompt Engineeringに戻る