ladderlore
ガイドをリクエスト
  • S3 や IAM などのサービス名を入力してください。

Applications of Foundation Models

復習シート

03

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.
  • OpenSearch

    Search engine: keyword, vector and hybrid search
  • Aurora

    Relational rows and vectors (PostgreSQL edition)
  • RDS

    RDS for PostgreSQL: rows and vectors
  • Neptune

    Graph database: graph-based RAG
  • Amazon S3 Vectors

    Low-cost vector storage
  • Amazon DocumentDB

    JSON documents and vectors
  • Amazon ElastiCache

    Very fast vector search
AWS services that can store embeddings.

1 / 2

  • OpenSearch

    Search engine: keyword, vector and hybrid search
  • Aurora

    Relational rows and vectors (PostgreSQL edition)
  • RDS

    RDS for PostgreSQL: rows and vectors
  • Neptune

    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
AWS services that can store embeddings.

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
Five ways to customize, cheapest first.

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

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
Five ways to customize, cheapest first.

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
Agents decide the steps. Flows follow yours.

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
What each technique adds to a prompt.

1 / 3

  • 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

3 / 3

  • Prompt template

    A reusable prompt with blanks
What each technique adds to a prompt.

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
Training stages and the data each one uses.

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
Which metric fits which task.

1 / 2

  • 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
Which metric fits which task.

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
The judge metrics most often asked about.

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

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
The judge metrics most often asked about.

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