復習シート
Applications of Foundation Models
この分野の要点を数画面にまとめました。試験の前に読み返すためのものです。
この復習シートは今のところ英語で表示しています。
3.1Choosing and tuning a model
- Select by cost, modality, latency, language, size, customization, input and output length, prompt caching.
- Start with the smallest, cheapest model that meets the quality bar.
- Prompt caching: reuse a repeated prompt start to cut cost and latency.
- Temperature: low is consistent, high is creative.
- Top-p and top-k: lower values narrow word choices.
- Maximum output length caps the reply and its cost. Stop sequences end it.
- Latency follows model size and input and output length, not temperature.
3.1RAG and vector stores
- RAG: retrieve relevant data, add it to the prompt, generate a grounded answer.
- RAG adds current and private knowledge with no retraining.
- Amazon Bedrock Knowledge Bases: managed RAG (ingest, chunk, embed, store, retrieve).
- A vector database finds the stored embeddings closest in meaning to the query.
- Neptune is the graph choice for relationships between things.
- Chunking choices: default, fixed-size, hierarchical, semantic, none.
- Closeness of vectors is often cosine similarity.
- Search engine: keyword, vector and hybrid search
- Relational rows and vectors (PostgreSQL edition)
- RDS for PostgreSQL: rows and vectors
- Graph database: graph-based RAG
Amazon S3 Vectors
- Low-cost vector storage
Amazon DocumentDB
- JSON documents and vectors
Amazon ElastiCache
- Very fast vector search
| Service | Its role in RAG |
|---|---|
| Search engine: keyword, vector and hybrid search | |
| Relational rows and vectors (PostgreSQL edition) | |
| RDS for PostgreSQL: rows and vectors | |
| Graph database: graph-based RAG | |
| Amazon S3 Vectors | Low-cost vector storage |
| Amazon DocumentDB | JSON documents and vectors |
| Amazon ElastiCache | Very fast vector search |
1 / 2
- Search engine: keyword, vector and hybrid search
- Relational rows and vectors (PostgreSQL edition)
- RDS for PostgreSQL: rows and vectors
- Graph database: graph-based RAG
| Service | Its role in RAG |
|---|---|
| Search engine: keyword, vector and hybrid search | |
| Relational rows and vectors (PostgreSQL edition) | |
| RDS for PostgreSQL: rows and vectors | |
| Graph database: graph-based RAG |
2 / 2
Amazon S3 Vectors
- Low-cost vector storage
Amazon DocumentDB
- JSON documents and vectors
Amazon ElastiCache
- Very fast vector search
| Service | Its role in RAG |
|---|---|
| Amazon S3 Vectors | Low-cost vector storage |
| Amazon DocumentDB | JSON documents and vectors |
| Amazon ElastiCache | Very fast vector search |
3.1Customization cost
- Cheapest to costliest: in-context learning, RAG, fine-tuning, distillation, pre-training.
- Changing facts: RAG, not fine-tuning.
- Distillation: a small student learns from a large teacher, so each call is cheaper.
- A custom model in Amazon Bedrock can run on Provisioned Throughput (reserved capacity). Some can also run on demand.
In-context learning
- Cost
- Lowest
- Use it when
- Examples in the prompt are enough
RAG
- Cost
- Low
- Use it when
- Facts are private or change
Fine-tuning
- Cost
- Medium
- Use it when
- Style or skill must change
Distillation
- Cost
- Medium, cheap to run after
- Use it when
- You need a small, fast model
Pre-training
- Cost
- Highest
- Use it when
- Almost never
| Approach | Cost | Use it when |
|---|---|---|
| In-context learning | Lowest | Examples in the prompt are enough |
| RAG | Low | Facts are private or change |
| Fine-tuning | Medium | Style or skill must change |
| Distillation | Medium, cheap to run after | You need a small, fast model |
| Pre-training | Highest | Almost never |
1 / 2
In-context learning
- Cost
- Lowest
- Use it when
- Examples in the prompt are enough
RAG
- Cost
- Low
- Use it when
- Facts are private or change
Fine-tuning
- Cost
- Medium
- Use it when
- Style or skill must change
| Approach | Cost | Use it when |
|---|---|---|
| In-context learning | Lowest | Examples in the prompt are enough |
| RAG | Low | Facts are private or change |
| Fine-tuning | Medium | Style or skill must change |
2 / 2
Distillation
- Cost
- Medium, cheap to run after
- Use it when
- You need a small, fast model
Pre-training
- Cost
- Highest
- Use it when
- Almost never
| Approach | Cost | Use it when |
|---|---|---|
| Distillation | Medium, cheap to run after | You need a small, fast model |
| Pre-training | Highest | Almost never |
3.1Agents and workflows
- An AI agent plans with the model, calls tools and acts to finish a goal.
- Amazon Bedrock Agents: a model, instructions, and action groups or knowledge bases.
- Action group: an OpenAPI schema or function details, plus usually an AWS Lambda function.
- The agent trace shows its reasoning step by step.
- Now Agents Classic: closed to new accounts since July 30, 2026. AgentCore is the recommended path.
- Amazon Bedrock Flows (formerly Prompt Flows): a visual workflow with steps you design.
- Flows link prompts, models, knowledge bases, Lambda functions and conditions.
- Flow versions are fixed snapshots. An alias points the application at one.
Amazon Bedrock Agents
- The model plans them
Amazon Bedrock Flows
- You design them
Amazon Bedrock AgentCore
- Your agent code, hosted at scale
| Service | Who picks the steps |
|---|---|
| Amazon Bedrock Agents | The model plans them |
| Amazon Bedrock Flows | You design them |
| Amazon Bedrock AgentCore | Your agent code, hosted at scale |
3.2Prompt techniques
- Prompt engineering steers a model with no training. It is the cheapest first step.
- Parts of a prompt: instruction, context, input data, output format, negative prompt.
- A negative prompt says what to avoid.
- Few-shot examples help with format and tone, and they add tokens.
- Chain-of-thought helps with logic and multi-step questions.
- Role prompting sets who the model acts as. A system prompt holds standing rules.
- Prompt chaining: one answer feeds the next prompt. ReAct: reasoning plus tool actions.
- Self-consistency and tree-of-thought: know the names.
Zero-shot
- The task only
Single-shot
- One example
Few-shot
- Several examples
Chain-of-thought
- A request to reason in steps
Negative prompt
- What to avoid
Role (persona)
- Who the model acts as
Prompt chaining
- One answer feeds the next prompt
ReAct
- Reasoning mixed with tool actions
Prompt template
- A reusable prompt with blanks
| Technique | You give |
|---|---|
| Zero-shot | The task only |
| Single-shot | One example |
| Few-shot | Several examples |
| Chain-of-thought | A request to reason in steps |
| Negative prompt | What to avoid |
| Role (persona) | Who the model acts as |
| Prompt chaining | One answer feeds the next prompt |
| ReAct | Reasoning mixed with tool actions |
| Prompt template | A reusable prompt with blanks |
1 / 3
Zero-shot
- The task only
Single-shot
- One example
Few-shot
- Several examples
Chain-of-thought
- A request to reason in steps
| Technique | You give |
|---|---|
| Zero-shot | The task only |
| Single-shot | One example |
| Few-shot | Several examples |
| Chain-of-thought | A request to reason in steps |
2 / 3
Negative prompt
- What to avoid
Role (persona)
- Who the model acts as
Prompt chaining
- One answer feeds the next prompt
ReAct
- Reasoning mixed with tool actions
| Technique | You give |
|---|---|
| Negative prompt | What to avoid |
| Role (persona) | Who the model acts as |
| Prompt chaining | One answer feeds the next prompt |
| ReAct | Reasoning mixed with tool actions |
3 / 3
Prompt template
- A reusable prompt with blanks
| Technique | You give |
|---|---|
| Prompt template | A reusable prompt with blanks |
3.2Best practices, risks, management
- Be specific and concise. Show examples. Add guardrails. Experiment and compare.
- Exposure: prompt or private data leaks.
- Poisoning: bad data skews training or retrieval.
- Hijacking (prompt injection): hidden instructions override the app.
- Jailbreaking: clever wording beats safety rules.
- Defenses: Amazon Bedrock Guardrails, input and output checks, trusted data, no secrets in prompts.
- Amazon Bedrock Prompt Management: prompts as templates, variants to compare, saved versions.
- Prompt optimization: Bedrock rewrites a prompt for a chosen model.
3.3Describe the training and fine-tuning process for FMs.
- Pre-training learns from huge raw data. Highest cost. Few providers do it.
- Continued pre-training adds unlabeled domain text.
- Fine-tuning uses labeled examples to teach a task or style.
- Instruction tuning: train on instruction and response pairs.
- Fine-tuning data: labeled prompt and response pairs. Continued pre-training: unlabeled text.
- In Amazon Bedrock the data sits in Amazon S3. Settings: epochs, learning rate, batch size.
- Transfer learning: reuse a pre-trained model for a new task.
- Good data: curated, governed, enough, labeled, representative. Quality beats quantity.
3.3Describe the training and fine-tuning process for FMs.
- RLHF: humans rank answers, a reward model scores, the model learns to earn higher scores.
Pre-training
- Huge unlabeled data
Continued pre-training
- Unlabeled domain data
Fine-tuning
- Labeled examples
Distillation
- Teacher model answers
| Stage | Data |
|---|---|
| Pre-training | Huge unlabeled data |
| Continued pre-training | Unlabeled domain data |
| Fine-tuning | Labeled examples |
| Distillation | Teacher model answers |
3.4Approaches and metrics
- Human-in-the-loop: best for tone and nuance, slow and costly.
- Benchmark data sets: the same standard test for every model.
- Amazon Bedrock Model Evaluation: automatic, human and LLM-as-a-judge jobs, plus RAG evaluation.
- ROUGE: summaries. BLEU: translation. BERTScore: meaning.
- Perplexity: lower is better. Benchmarks: GLUE, SuperGLUE, MMLU, HELM.
- Bedrock built-in data sets include BOLD (bias) and RealToxicityPrompts (toxicity).
- LLM-as-a-judge: a second model scores answers and explains. It can be biased, so spot-check it.
ROUGE
- Summaries
BLEU
- Translation
BERTScore
- Meaning, not exact words
Perplexity
- How well a model predicts text (lower is better)
Benchmarks
- GLUE, SuperGLUE, MMLU, HELM
Human review
- Tone and quality
| Metric | Fits |
|---|---|
| ROUGE | Summaries |
| BLEU | Translation |
| BERTScore | Meaning, not exact words |
| Perplexity | How well a model predicts text (lower is better) |
| Benchmarks | GLUE, SuperGLUE, MMLU, HELM |
| Human review | Tone and quality |
1 / 2
ROUGE
- Summaries
BLEU
- Translation
BERTScore
- Meaning, not exact words
Perplexity
- How well a model predicts text (lower is better)
| Metric | Fits |
|---|---|
| ROUGE | Summaries |
| BLEU | Translation |
| BERTScore | Meaning, not exact words |
| Perplexity | How well a model predicts text (lower is better) |
2 / 2
Benchmarks
- GLUE, SuperGLUE, MMLU, HELM
Human review
- Tone and quality
| Metric | Fits |
|---|---|
| Benchmarks | GLUE, SuperGLUE, MMLU, HELM |
| Human review | Tone and quality |
3.4Judge metrics
- Correctness: the answer is right. Completeness: it answers every part of the prompt.
- Faithfulness: it sticks to the given context. It is the hallucination check.
- Also: helpfulness, logical coherence, relevance, following instructions, professional style and tone.
- Responsible AI metrics: harmfulness, stereotyping, refusal.
- RAG retrieve-only jobs: context relevance and context coverage.
- RAG retrieve-and-generate jobs add citation precision and citation coverage.
Correctness
- The answer is right
Completeness
- It answers every part of the prompt
Faithfulness
- It sticks to the given context
Relevance
- It fits the question
Harmfulness, stereotyping, refusal
- Responsible AI checks
Context relevance
- Retrieved passages fit the question
Context coverage
- They hold what the answer needs
Citation precision and coverage
- Citations are correct and back the answer
| Metric | It measures |
|---|---|
| Correctness | The answer is right |
| Completeness | It answers every part of the prompt |
| Faithfulness | It sticks to the given context |
| Relevance | It fits the question |
| Harmfulness, stereotyping, refusal | Responsible AI checks |
| Context relevance | Retrieved passages fit the question |
| Context coverage | They hold what the answer needs |
| Citation precision and coverage | Citations are correct and back the answer |
1 / 2
Correctness
- The answer is right
Completeness
- It answers every part of the prompt
Faithfulness
- It sticks to the given context
Relevance
- It fits the question
| Metric | It measures |
|---|---|
| Correctness | The answer is right |
| Completeness | It answers every part of the prompt |
| Faithfulness | It sticks to the given context |
| Relevance | It fits the question |
2 / 2
Harmfulness, stereotyping, refusal
- Responsible AI checks
Context relevance
- Retrieved passages fit the question
Context coverage
- They hold what the answer needs
Citation precision and coverage
- Citations are correct and back the answer
| Metric | It measures |
|---|---|
| Harmfulness, stereotyping, refusal | Responsible AI checks |
| Context relevance | Retrieved passages fit the question |
| Context coverage | They hold what the answer needs |
| Citation precision and coverage | Citations are correct and back the answer |
3.4Applications and business goals
- RAG: check retrieval (relevant, complete) and generation (correct, grounded) separately.
- Agents: task completion, right tool choice, steps taken.
- Workflows: end-to-end success, speed and cost.
- Productivity: time saved. Engagement: usage. Satisfaction: ratings.
- Task completion rate: share finished without a human.
- Cost per interaction: cost of each conversation.
- A good test score is not enough. Compare with the baseline before the model.
試験のひっかけ
- “Answer from company documents without retraining” → RAG, not fine-tuning
- “Facts change often” → RAG, not fine-tuning
- “Fully managed RAG on AWS” → Amazon Bedrock Knowledge Bases
- “Relationships between entities for RAG” → Amazon Neptune, not OpenSearch
- “Keyword and vector search together” → Amazon OpenSearch Service
- “More consistent answers” → lower temperature, not higher
- “Prompt tells the model to ignore its rules” → hijacking (prompt injection), not jailbreaking
- “Summaries” → ROUGE. “Translation” → BLEU. “Meaning” → BERTScore
試験のひっかけ
- “Answers every part of the prompt” → completeness, not correctness
- “Facts not in the source” → low faithfulness, not low relevance
- “Visual workflow, steps fixed” → Amazon Bedrock Flows, not Agents
- “Model decides the steps, calls APIs through Lambda” → Amazon Bedrock Agents
- “Reserved or dedicated capacity for a custom model” → Provisioned Throughput. Some custom models also run on demand.
- “Labeled data teaches a task” → fine-tuning. “Unlabeled domain text” → continued pre-training
- “Smaller, cheaper model from a larger one” → distillation, not pre-training
試験のひっかけ
- “Resolved without a human” → task completion rate, not user satisfaction