A Comprehensive Guide to Prompt Engineering: Text and Image Generation Techniques
Whether you’re new to generative AI or looking to level up your prompt engineering skills, understanding how to effectively communicate with large language models (LLMs) can dramatically improve your results. Amazon Bedrock Playground offers a powerful sandbox for experimenting with different prompting techniques across multiple AI models. In this comprehensive guide, we’ll explore proven prompting strategies, model-specific approaches, and best practices for both text and image generation.
The video version of this blog can be found here
Important Note: Non-Deterministic Responses
⚠️ Why This Guide Doesn’t Include Example Outputs
You’ll notice this guide provides detailed prompts but not the actual model responses, exept for the math questions. This is intentional. Large language models exhibit non-deterministic behavior—they generate different responses each time you run the same prompt, even with identical settings.
Why Responses Vary
- Sampling processes introduce randomness during token selection
- Temperature and top-p parameters deliberately inject variability
- Model updates mean responses change as providers improve their foundation models
- Different models produce substantially different outputs for identical prompts
What This Means for You
If we included example outputs, they would set false expectations. Your results will differ—sometimes slightly, sometimes significantly. This isn’t a bug; it’s a feature that enables creative diversity and multiple solution approaches.
Exception: Mathematical calculations with very low temperature settings (0.1-0.2) produce more consistent results, though explanations will still vary in wording.
Best Practice
- Run prompts multiple times to see the range of outputs
- Adjust temperature based on whether you need consistency (lower) or creativity (higher)
- Test across models to find what works best for your use case
- Iterate and refine - your first output rarely is your best
Understanding How LLMs Handle Mathematics
🔢 Why Math is Challenging for Language Models
Large language models don’t actually “calculate” in the traditional sense. They predict the next token based on patterns learned during training. This creates an important limitation:
How LLMs Process Math
Pattern Recognition (Default Behavior)
- LLMs have seen many examples of “2 + 2 = 4” during training
- They predict “4” as the likely next token, not because they calculated it
- Problem: This fails with complex calculations, large numbers, or multi-step problems
- Why: The model may not have seen that exact pattern before
Chain-of-Thought Prompting (Better Approach)
- Adding “Think step by step” or “Show your work” dramatically improves accuracy
- Forces the model to break problems into smaller, recognizable patterns
- Each intermediate step becomes a prediction based on patterns
- Still not perfect: Can make errors in multi-step reasoning
Modern Solutions: Tool Use and Agents
Function Calling / Tool Use
- Advanced implementations detect when calculation is needed
- Call external tools (Python interpreters, calculators, APIs)
- Return verified results back to the LLM
- Examples: Claude with tool use, GPT-4 with function calling
Agent-Based Systems
- Autonomous agents recognize their limitations
- Decide when to use external computational tools
- Amazon Bedrock Agents can integrate with AWS Lambda for calculations
- ReAct prompting (Reasoning + Acting) mimics this behavior
Code Interpretation
- Some systems write Python/JavaScript code to solve problems
- Execute the code in a sandbox
- Return programmatically verified results
Practical Takeaway
For simple arithmetic and step-by-step problems: Chain-of-Thought prompting with low temperature works reasonably well.
For complex calculations, precise numerical work, or production systems: Integrate external computational tools through function calling, agents, or code interpretation—don’t rely on the LLM alone.
In Bedrock: Consider using Bedrock Agents with Lambda functions for mathematical operations requiring guaranteed accuracy.
Why Prompt Engineering Matters
Think of prompts as the programming language for AI. The way you structure your request can mean the difference between a generic, unhelpful response and a precisely tailored output that saves hours of work. With Amazon Bedrock supporting multiple foundation models—including Amazon Titan, Anthropic Claude, AI21 Jurassic-2, Stability AI, and others—understanding how to craft effective prompts is essential.
Basic Prompting Techniques
Zero-Shot Prompting: The Foundation
Zero-shot prompting is exactly what it sounds like—asking the model to perform a task without providing examples. It’s the most straightforward approach and works well for common tasks.
Marketing Use Case - Product Description
Write a compelling product description for a wireless noise-canceling headphone that highlights its key features and benefits for busy professionals.
Recommended Settings: Temperature: 0.7 (balanced creativity)
Math Use Case - Problem Solving
Calculate the compound interest on $10,000 invested at 5% annual interest rate for 3 years, compounded quarterly.
Recommended Settings: Temperature: 0.1 (precise, factual output)
A: 11607.55
Customer Service Use Case
Draft a professional email response to a customer who is complaining about a delayed shipment and wants a refund.
Recommended Settings: Temperature: 0.4 (structured but empathetic)
Pro Tip: Use zero-shot prompting when the task is straightforward and doesn’t require specialized formatting or domain-specific knowledge.
Few-Shot Prompting: Teaching by Example
Few-shot prompting involves providing the model with examples of the desired output format before asking it to complete a similar task. This technique dramatically improves consistency and accuracy.
Content Classification - Marketing
Classify these product reviews as positive, negative, or neutral:
"This laptop is amazing, fast performance!" - Positive
"The battery life is terrible, very disappointed." - Negative
"It's an okay product, nothing special." - Neutral
"Love the design and build quality!" -
Recommended Settings: Temperature: 0.2 (consistent classification)
Data Extraction - Business
Extract key information from these meeting notes:
Meeting: Q1 Planning
Date: Jan 15, 2024
Attendees: John, Sarah
Key Points: Budget increase of 20%, new hire needed
Action Items: Sarah to draft job posting
Meeting: Product Launch
Date: Feb 3, 2024
Attendees: Mike, Lisa, Tom
Key Points: Launch delayed to March, marketing campaign ready
Action Items: Mike to update timeline
Meeting: Customer Feedback Review
Recommended Settings: Temperature: 0.1 (precise extraction)
Pro Tip: Few-shot prompting is invaluable for tasks requiring specific formatting, classification, or when working with domain-specific terminology.
Chain-of-Thought Prompting: Unlocking Complex Reasoning
Chain-of-Thought (CoT) prompting encourages the model to break down complex problems into logical steps. Simply adding “Think step by step” or “Let’s approach this systematically” can significantly improve reasoning quality.
Math Use Case
A store offers a 20% discount on all items, then an additional 10% discount for members. If an item originally costs $150, what is the final price for a member? Think step by step.
Recommended Settings: Temperature: 0.2 (logical reasoning)
A: The final price for a member is $108.
Business Strategy Use Case
A company wants to expand into a new market. Think step by step about the key factors they should consider before making this decision.
Recommended Settings: Temperature: 0.6 (creative but structured thinking)
Pro Tip: CoT prompting is especially powerful for mathematical problems, logical puzzles, and strategic planning scenarios.
Model-Specific Prompting Strategies
Different foundation models have different “personalities” and respond better to specific prompting styles. Here’s how to optimize for each major model family available in Bedrock.
Amazon Titan: Clear Structure and Constraints
Amazon Titan responds well to clearly defined roles, tasks, and constraints. Use explicit formatting and provide fallback instructions.
Content Creation - Marketing
You are a professional marketing copywriter.
Task: Create a social media post for a new fitness app.
Requirements:
- Target audience: Young professionals aged 25-35
- Tone: Motivational and energetic
- Include a call-to-action
- Keep it under 280 characters
If you cannot create an appropriate post, respond with "Unable to generate suitable content."
Recommended Settings: Temperature: 0.7 (creative but focused)
Anthropic Claude: XML-Style Structured Prompts
Claude excels with XML-like tags that create clear boundaries between different sections of your prompt. This structure helps Claude understand context and produce more accurate responses.
Technical Documentation - Software Development
<task>
Write API documentation for a user authentication endpoint
</task>
<requirements>
- Include endpoint URL, HTTP method, parameters, and response format
- Provide example request and response
- Add error handling information
- Use clear, technical language
</requirements>
<format>
Please structure your response using these tags:
<endpoint_info></endpoint_info>
<example_request></example_request>
<example_response></example_response>
<error_codes></error_codes>
</format>
Response length: Approximately 300-400 words.
Recommended Settings: Temperature: 0.3 (structured, technical)
AI21 Jurassic-2: Numbered Instructions
Jurassic-2 responds particularly well to numbered, sequential instructions. This model excels at creative tasks when given clear structural constraints.
Creative Writing - Entertainment
Write a short story about a time traveler who accidentally changes history.
Instructions:
1. Set the story in Victorian London
2. Include exactly three characters
3. Create a plot twist in the middle
4. End with a cliffhanger
5. Write exactly 8 sentences
Keep the language simple and engaging.
Recommended Settings: Temperature: 0.8 (high creativity for storytelling)
Advanced Prompting Techniques
RAG-Style Prompting: Grounding in Context
Retrieval-Augmented Generation (RAG) prompting involves providing the model with specific context or documents and asking it to answer based solely on that information.
Research Use Case - Academic
Based on the provided research papers about climate change impacts on agriculture, summarize the key findings about crop yield changes in the last decade. Focus on:
1. Temperature effects on major crops
2. Precipitation pattern changes
3. Regional variations in impact
4. Adaptation strategies mentioned
If the provided context doesn't contain sufficient information about any of these points, clearly state what information is missing.
Recommended Settings: Temperature: 0.4 (balanced accuracy and readability)
Pro Tip: Always instruct the model to acknowledge when information is missing from the provided context. This reduces hallucination.
ReAct-Style Prompting: Reasoning + Acting
ReAct (Reasoning and Acting) prompting creates a structured loop of thought, action, and observation. This approach is excellent for complex problem-solving tasks.
Problem Solving - Business Analytics
I need to analyze our company's sales performance for Q3 2024.
Thought: I should break this down into steps to get comprehensive insights.
Action: First, let me identify what specific metrics I need to examine.
Observation: I need to look at total revenue, growth rate, top products, and regional performance.
Thought: Now I should gather the relevant data.
Action: I'll need to access sales data, compare it to previous quarters, and identify trends.
Continue this analysis step by step, thinking through each action needed to provide a complete sales performance analysis.
Recommended Settings: Temperature: 0.5 (structured reasoning with some flexibility)
Tree of Thoughts: Exploring Multiple Pathways
Tree of Thoughts prompting asks the model to generate multiple reasoning paths, then evaluate and select the best approach. This technique is powerful for strategic decision-making.
Strategic Planning - Business
Our meal and exercise based on highly customizable user preferences startup needs to choose between three growth strategies: expanding to new markets, developing new products, or improving existing services.
Generate three initial thoughts about each strategy:
Strategy 1 - Market Expansion:
Thought 1a: [Your analysis]
Thought 1b: [Your analysis]
Thought 1c: [Your analysis]
Strategy 2 - New Product Development:
Thought 2a: [Your analysis]
Thought 2b: [Your analysis]
Thought 2c: [Your analysis]
Strategy 3 - Service Improvement:
Thought 3a: [Your analysis]
Thought 3b: [Your analysis]
Thought 3c: [Your analysis]
Then evaluate and expand on the most promising thoughts to reach a final recommendation.
Recommended Settings: Temperature: 0.6 (creative strategic thinking)
Image Analysis Prompting (Multimodal Models)
Some Bedrock models, like Claude 3 and later versions, support vision capabilities, allowing you to upload images and ask questions about them.
Visual Analysis - Marketing
Analyze this product image and create a marketing description that highlights the visual appeal and key features you can observe. Focus on colors, design elements, and perceived quality.
Recommended Settings: Temperature: 0.6 (descriptive creativity)
Quality Control - Manufacturing
Examine this product image for any visible defects or quality issues. Provide a detailed inspection report noting any anomalies, surface imperfections, or deviations from expected appearance.
Recommended Settings: Temperature: 0.2 (precise, factual analysis)
Creative Content - Social Media
Look at this image and create an engaging Instagram caption that would appeal to millennials. Include relevant hashtags and a call-to-action that encourages engagement.
Recommended Settings: Temperature: 0.8 (high creativity for social media)
Image Generation Prompting (Stability AI & Titan Image)
Image generation works fundamentally differently from text generation. While text prompts describe what you want, negative prompts are equally important—they specify what you DON’T want in the generated image.
Understanding Positive and Negative Prompts
Positive Prompt: Describes what you want to see Negative Prompt: Describes what you want to avoid
This dual-prompt system helps the model understand boundaries and produce more accurate results.
Product Photography Example
Positive Prompt:
Professional product photography of a luxury smartwatch on a marble surface, studio lighting, high resolution, sharp focus, elegant composition, reflections on surface, modern minimalist style, commercial photography, 8K quality
Negative Prompt:
blurry, low quality, pixelated, distorted, cluttered background, poor lighting, grainy, oversaturated, text, watermark, logos, fingers, hands, people, multiple watches, cartoonish, amateur
Recommended Settings:
- CFG Scale: 7-10 (how closely to follow the prompt)
- Steps: 50-75 (quality vs. speed)
- Seed: Set a specific number for reproducibility
Landscape/Scene Generation Example
Positive Prompt:
Serene mountain lake at sunrise, misty atmosphere, pine trees reflecting in crystal clear water, golden hour lighting, photorealistic, stunning natural beauty, professional landscape photography, vibrant colors, HDR, ultra detailed
Negative Prompt:
people, buildings, urban elements, cars, roads, text, watermark, low quality, blurry, oversaturated, artificial, CGI, cartoon, anime style, dark, gloomy, stormy
Character/Portrait Generation Example
Positive Prompt:
Professional headshot of a confident business executive, neutral gray background, natural lighting, sharp focus on face, professional attire, friendly expression, high-quality studio photography, 50mm lens, bokeh effect
Negative Prompt:
multiple people, blurry, low resolution, distorted features, unnatural proportions, harsh shadows, overexposed, underexposed, amateur, selfie style, busy background, sunglasses, hats, text, watermark, signature
Abstract/Artistic Generation Example
Positive Prompt:
Abstract digital art, flowing liquid metal textures, iridescent colors, purple and gold color scheme, smooth gradients, ethereal atmosphere, high contrast, modern contemporary art, wallpaper quality, 4K resolution
Negative Prompt:
realistic, photographic, people, faces, animals, recognizable objects, text, logos, low quality, pixelated, muddy colors, chaotic, cluttered, watermark
Common Negative Prompt Terms to Remember
Build your negative prompt library with these commonly problematic elements:
Quality Issues:
- blurry, pixelated, low resolution, grainy, distorted, artifacts, noise, compression
Unwanted Elements:
- text, watermark, signature, logo, date stamp, username, copyright
Composition Problems:
- cluttered, chaotic, busy background, cropped, cut off, out of frame
Style Mismatches:
- cartoonish (if you want realistic), photorealistic (if you want artistic), anime, CGI
Anatomical Issues (for people/creatures):
- deformed, mutated, extra limbs, missing limbs, floating limbs, disconnected, malformed
Lighting Problems:
- overexposed, underexposed, harsh shadows, flat lighting, incorrect lighting
Image Generation Best Practices
-
Be Specific: Generic prompts produce generic results. Include style references, lighting details, and composition notes.
-
Use Technical Terms: Terms like “bokeh,” “golden hour,” “studio lighting,” and “8K” help the model understand quality expectations.
-
Iterate with Seeds: When you get a result close to what you want, note the seed number and adjust only the prompt for consistency.
-
Balance Positive and Negative: Don’t neglect negative prompts—they’re just as important as positive ones for quality control.
- Adjust CFG Scale:
- Lower (3-7): More creative interpretation
- Higher (8-15): Stricter adherence to prompt
- Experiment with Steps:
- 20-30 steps: Fast, lower quality
- 40-60 steps: Balanced quality/speed
- 70-100 steps: Maximum quality, slower
System Prompts: 🎯 An Important Layer of Prompt Engineering
In addition to the prompts you’ve seen throughout this guide, most modern LLM platforms such as Amazon Bedrock support system prompts—a separate layer of instructions that sets persistent behavior and context before any user interaction begins.
What Are System Prompts?
System prompts define the model’s role, tone, constraints, and behavior that persist across all interactions. Think of them as the “operating instructions” that govern how the model responds, while user prompts contain the specific tasks or questions.
Key Difference:
- System Prompt: Set once, defines how the model behaves (role, style, constraints)
- User Prompt: Changes each time, defines what you want the model to do (specific task)
Simple Example
System Prompt:
You are a professional technical documentation writer. Always use clear,
concise language with proper markdown formatting. Structure responses with
headers and bullet points. If you're unsure about technical details,
state your assumptions clearly rather than guessing.
User Prompt:
Explain how to configure an S3 bucket for static website hosting.
The system prompt ensures all responses follow your documentation standards without repeating those instructions in every user prompt.
Best Practice
Keep system prompts focused on behavior and style. Use user prompts for specific tasks and context. This separation makes your prompts more maintainable and cost-effective since you’re not repeating instructions with every request.
Inference Parameter Guidelines: The Fine-Tuning Dials
Understanding inference parameters is crucial for getting consistent, quality outputs. Here’s your quick reference guide:
Temperature (0.0 - 1.0+)
Controls randomness and creativity in responses.
- 0.1 - 0.3: Factual, precise tasks
- Math calculations
- Data extraction
- Technical documentation
- Compliance documents
- 0.4 - 0.6: Balanced tasks
- Business analysis
- Educational explanations
- Customer service responses
- Report writing
- 0.7 - 0.9: Creative tasks
- Marketing copy
- Storytelling
- Brainstorming
- Social media content
- 1.0+: Maximum creativity
- Experimental creative writing
- Artistic descriptions
- Abstract thinking exercises
Top-p / Nucleus Sampling (0.0 - 1.0)
Controls vocabulary diversity by considering only the top probability tokens.
- 0.1 - 0.3: Very focused, limited vocabulary (technical writing)
- 0.5 - 0.7: Balanced diversity (general content)
- 0.8 - 1.0: Maximum diversity (creative content)
Pro Tip: Use lower top-p with higher temperature for creative but focused outputs.
Top-k (1 - 500)
Limits the model to choosing from the top k most likely tokens.
- 1 - 10: Very deterministic
- 40 - 80: Standard setting
- 100+: More randomness
Max Tokens
Controls the maximum length of the generated response.
- Set based on your needs, but remember: more tokens = higher cost
- Include buffer space for complete thoughts (don’t cut off mid-sentence)
- Typical ranges:
- Short answers: 100-300 tokens
- Medium content: 500-1000 tokens
- Long-form: 2000+ tokens
Stop Sequences
Define specific strings that tell the model to stop generating.
Examples:
"\n\n"- Stop at double line break"###"- Stop at specific delimiter"End of response"- Stop at custom phrase
Use Case: Perfect for structured outputs where you want control over section endings.
Putting It All Together: A Real-World Workflow
Let’s walk through a complete example of developing a prompt from scratch.
Scenario: You need to create weekly email summaries of customer support tickets for your team.
Step 1: Start Simple (Zero-Shot)
Summarize these customer support tickets into a weekly email.
Result: Generic, unstructured output.
Step 2: Add Structure (Few-Shot)
Create a weekly summary email from these support tickets. Format like this example:
Ticket #123: Billing Issue
Status: Resolved
Summary: Customer charged twice, refund processed
Ticket #124: Login Problem
Status: In Progress
Summary: Password reset email not received, investigating email server
Now summarize these tickets:
[Your ticket data]
Result: Better formatting, but lacks context.
Step 3: Add Role and Requirements (Structured)
You are a customer support team lead creating a weekly summary email.
<task>
Summarize the following support tickets for the team's weekly review meeting.
</task>
<requirements>
- Group tickets by category (Technical, Billing, Product Feedback)
- Highlight any urgent or escalated issues
- Include resolution rates
- Keep tone professional but friendly
- Total length: 200-300 words
</requirements>
<format>
Subject: [Auto-generated subject]
Summary Statistics:
[Key metrics]
By Category:
[Organized summaries]
Action Items:
[Any follow-ups needed]
</format>
<tickets>
[Your ticket data]
</tickets>
Recommended Settings: Temperature: 0.4, Top-p: 0.7
Result: Professional, well-structured, actionable summary.
Common Pitfalls and How to Avoid Them
1. Vague Instructions
Problem: “Write something about our product.” Solution: “Write a 150-word product description for [specific product] targeting [specific audience] with a [specific tone].”
2. Conflicting Instructions
Problem: “Be creative and original but follow this exact format.” Solution: Separate structural requirements from creative freedom areas.
3. Assuming Context
Problem: “Improve this.” Solution: “Improve this marketing email by making it more concise, adding a stronger call-to-action, and adjusting the tone to be more professional.”
4. Wrong Temperature Settings
Problem: Using Temperature 0.9 for mathematical calculations. Solution: Match temperature to task type (see guidelines above).
5. Ignoring Model Strengths
Problem: Using the same prompt format for all models. Solution: Adapt prompts to model-specific styles (XML for Claude, numbered lists for Jurassic-2, etc.).
Experimentation Framework: Your Testing Protocol
Effective prompt engineering requires systematic testing. Here’s a framework:
1. Baseline Test
- Create a simple, clear prompt
- Test with default parameters
- Document results
2. Variation Testing
- Change one variable at a time:
- Prompt structure
- Temperature
- Top-p
- Model selection
3. Edge Case Testing
- Test with minimal input
- Test with maximum complexity
- Test with ambiguous instructions
4. Consistency Testing
- Run the same prompt multiple times
- Check for output consistency
- Adjust temperature if needed
5. Cost-Benefit Analysis
- Compare token usage across approaches
- Balance quality vs. cost
- Optimize for your use case
Advanced Tips for Power Users
1. Prompt Chaining
Break complex tasks into sequential prompts, using the output of one as input for the next.
Example:
- First prompt: Extract key points from document
- Second prompt: Organize key points into categories
- Third prompt: Write executive summary from categorized points
2. Dynamic Few-Shot Selection
Programmatically select the most relevant examples based on the input task.
3. Ensemble Prompting
Run the same task with multiple models or prompt variations, then combine or select the best result.
4. Iterative Refinement
Use follow-up prompts to refine outputs: “Make this more concise” or “Add more technical details.”
5. Metacognitive Prompting
Ask the model to evaluate its own response: “Rate your confidence in this answer and explain your reasoning.”
Use Case Library: Quick Reference
Copy and adapt these prompts for common business scenarios:
Content Marketing
- Blog post generation (Temp: 0.7)
- SEO meta descriptions (Temp: 0.5)
- Social media content (Temp: 0.8)
- Email campaigns (Temp: 0.6)
Customer Service
- Response templates (Temp: 0.4)
- Sentiment analysis (Temp: 0.2)
- FAQ generation (Temp: 0.5)
- Escalation summaries (Temp: 0.3)
Data Analysis
- Report generation (Temp: 0.4)
- Data extraction (Temp: 0.1)
- Trend analysis (Temp: 0.5)
- Visualization descriptions (Temp: 0.6)
Software Development
- Code documentation (Temp: 0.3)
- Bug report analysis (Temp: 0.4)
- Test case generation (Temp: 0.5)
- Code review comments (Temp: 0.4)
Business Strategy
- SWOT analysis (Temp: 0.6)
- Competitive research (Temp: 0.5)
- Market analysis (Temp: 0.6)
- Strategic planning (Temp: 0.7)
Key Takeaways:
-
Match technique to task: Zero-shot for simple tasks, few-shot for consistency, chain-of-thought for reasoning.
-
Adapt to your model: Different foundation models respond better to different prompting styles.
-
Control with parameters: Temperature, top-p, and other inference parameters are powerful tools—use them strategically.
-
Structure matters: Clear instructions, defined roles, and explicit formatting requirements produce better results.
-
For image generation: Balance positive and negative prompts, use technical terminology, and iterate with seeds.
-
Test systematically: Document what works, iterate methodically, and build your own prompt library.
-
Start simple, then refine: Begin with basic prompts and add complexity only when needed.
Next Steps:
- Open Amazon Bedrock Playground
- Copy one of the prompts from this guide
- Run it with the recommended settings
- Modify one element and observe the difference
- Build your own variations
Remember: every expert prompt engineer started exactly where you are now. The difference is they experimented, failed, learned, and iterated. Your perfect prompt is just a few experiments away.
Happy prompting!* 🚀
Transparency Notice
This blog post was created with the assistance of artificial intelligence. The content, examples, and recommendations are based on current best practices in prompt engineering and have been structured to provide practical, actionable guidance.