Effective prompting is the primary way to control foundation model behaviour on Amazon Bedrock. The exam tests understanding of prompt techniques, inference parameters, and Bedrock Guardrails for safe, accurate outputs.

Key Points

  • System prompt: sets model persona, constraints, and response format — always pass via the system field
  • Zero-shot: no examples; works well for simple tasks with capable models like Claude 3
  • Few-shot: include 2–5 example input-output pairs in the prompt for consistent formatting
  • Chain-of-Thought (CoT): "Think step by step" — improves reasoning accuracy on complex questions
  • Temperature: 0 = deterministic/factual; 0.7 = balanced; 1.0 = creative/diverse
  • Top-P (Nucleus sampling): limits token pool to those comprising top P% probability mass
  • Top-K: limits to the K most likely next tokens — use with Top-P
  • Max Tokens: controls response length — set appropriately to avoid truncation or unnecessary cost
  • Bedrock Guardrails: apply filters for harmful content, topic denial, PII redaction, hallucination grounding
  • Bedrock Prompt Management: store, version, and share prompt templates across your organisation
  • Prompt injection mitigation: validate inputs, use Guardrails, separate system/user contexts clearly
ParameterEffectRecommended Value
TemperatureRandomness/creativity0 for factual, 0.7 for conversational, 1.0 for creative
Top-PDiversity of tokens0.9 for most tasks; lower for more focused
Top-KHard limit on token choices50–100 for balanced output
Max TokensResponse length limitSet to expected max output + 20% buffer
Stop sequencesStop generation at a stringUse to prevent model from continuing past the answer

Real-World Example

Amazon Q Business uses Bedrock with strict system prompts and Guardrails to ensure the enterprise AI assistant only answers questions based on company-approved knowledge bases — refusing to answer questions outside the configured topics and automatically redacting PII from responses.