Claude認定 対策ノート

講座 › 分野4 プロンプトエンジニアリングと構造化出力

4.2 few-shotプロンプト

配点 3.3%Few-shot prompting

指示だけでは出力がぶれるときの、最も効果的な手が、少数の例。判断の理由まで見せると、初めての場面にも応用が効く。

未読

例は、形式を安定させる最も確かな手

図解:例は、形式を安定させる最も確かな手

詳しい指示だけでは、出力の書式や粒度がぶれることがあります。例を見せると、出力の形、口調、構造を、最も確実にそろえられます。

出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Few-shot examples as the most effective technique for achieving consistently formatted, actionable output when detailed instructions alone produce inconsistent results
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
出典:Prompting best practices
Examples are one of the most reliable ways to steer Claude’s output format, tone, and structure.
https://platform.claude.com/docs/en/build-with-claude/prompt-engineeri…(取得 2026-11-20)

良い例の条件

図解:良い例の条件

例は、実際の用途に近く、変化に富み、指示と区別できる形で示します。枚数は、公式の目安で3〜5個です。ガイドは、曖昧な場面に絞った2〜4個の例を挙げています。

出典:Prompting best practices
Relevant: Mirror your actual use case closely.
https://platform.claude.com/docs/en/build-with-claude/prompt-engineeri…(取得 2026-11-20)
出典:Prompting best practices
Diverse: Cover edge cases and vary enough that Claude doesn’t pick up unintended patterns.
https://platform.claude.com/docs/en/build-with-claude/prompt-engineeri…(取得 2026-11-20)
出典:Prompting best practices
Include 3–5 examples for best results.
https://platform.claude.com/docs/en/build-with-claude/prompt-engineeri…(取得 2026-11-20)
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Creating 2-4 targeted few-shot examples for ambiguous scenarios that show reasoning for why one action was chosen over plausible alternatives
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)

判断の理由を添える

図解:判断の理由を添える

曖昧な場面の例には、なぜほかの選択肢ではなく、その行動を選んだかを書きます。モデルが、事前に決めた場合だけでなく、新しい型の場面にも判断を広げられます。

出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Creating 2-4 targeted few-shot examples for ambiguous scenarios that show reasoning for why one action was chosen over plausible alternatives
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
How few-shot examples enable the model to generalize judgment to novel patterns rather than matching only pre-specified cases
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)

出力の形式を例で示す

図解:出力の形式を例で示す

指摘なら、場所、問題、重大度、修正案という形で、望む出力の形を例に含めます。書式がそろい、そのまま使える出力になります。

出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Including few-shot examples that demonstrate specific desired output format (location, issue, severity, suggested fix) to achieve consistency
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)

許容する書き方と、本当の問題を見分けさせる

図解:許容する書き方と、本当の問題を見分けさせる

問題ない書き方と、本当に問題のある書き方を並べて例にすると、誤検知を減らしながら、判断を一般化できます。

出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Providing few-shot examples distinguishing acceptable code patterns from genuine issues to reduce false positives while enabling generalization
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)

抽出では、多様な書式の例を

図解:抽出では、多様な書式の例を

書式の違う文書から、正しく取り出す例を見せると、必須の項目が空になる問題や、作り話の出力が減ります。略式の寸法表記や、構造の違う文書にも効きます。

出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Adding few-shot examples showing correct extraction from documents with varied formats to address empty/null extraction of required fields
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
The effectiveness of few-shot examples for reducing hallucination in extraction tasks (e.g., handling informal measurements, varied document structures)
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
試験のポイント