Prompt engineering techniques and best practices: Learn by doing with Anthropic’s Claude 3 on Amazon Bedrock … – AWS Blog
You have likely already had the opportunity to interact with generative artificial intelligence (AI) tools (such as virtual assistants and chatbot applications) and noticed that you dont always get the answer you are looking for, and that achieving it may not be straightforward. Large language models (LLMs), the models behind the generative AI revolution, receive instructions on what to do, how to do it, and a set of expectations for their response by means of a natural language text called a prompt. The way prompts are crafted greatly impacts the results generated by the LLM. Poorly written prompts will often lead to hallucinations, sub-optimal results, and overall poor quality of the generated response, whereas good-quality prompts will steer the output of the LLM to the output we want.
In this post, we show how to build efficient prompts for your applications. We use the simplicity of Amazon Bedrock playgrounds and the state-of-the-art Anthropics Claude 3 family of models to demonstrate how you can build efficient prompts by applying simple techniques.
Prompt engineering is the process of carefully designing the prompts or instructions given to generative AI models to produce the desired outputs. Prompts act as guides that provide context and set expectations for the AI. With well-engineered prompts, developers can take advantage of LLMs to generate high-quality, relevant outputs. For instance, we use the following prompt to generate an image with the Amazon Titan Image Generation model:
An illustration of a person talking to a robot. The person looks visibly confused because he can not instruct the robot to do what he wants.
We get the following generated image.
Lets look at another example. All the examples in this post are run using Claude 3 Haiku in an Amazon Bedrock playground. Although the prompts can be run using any LLM, we discuss best practices for the Claude 3 family of models. In order to get access to the Claude 3 Haiku LLM on Amazon Bedrock, refer to Model access.
We use the following prompt:
Claude 3 Haikus response:
The request prompt is actually very ambiguous. 10 + 10 may have several valid answers; in this case, Claude 3 Haiku, using its internal knowledge, determined that 10 + 10 is 20. Lets change the prompt to get a different answer for the same question:
Claude 3 Haikus response:
The response changed accordingly by specifying that 10 + 10 is an addition. Additionally, although we didnt request it, the model also provided the result of the operation. Lets see how, through a very simple prompting technique, we can obtain an even more succinct result:
Claude 3 Haiku response:
Well-designed prompts can improve user experience by making AI responses more coherent, accurate, and useful, thereby making generative AI applications more efficient and effective.
The Claude 3 family is a set of LLMs developed by Anthropic. These models are built upon the latest advancements in natural language processing (NLP) and machine learning (ML), allowing them to understand and generate human-like text with remarkable fluency and coherence. The family is comprised of three models: Haiku, Sonnet, and Opus.
Haiku is the fastest and most cost-effective model on the market. It is a fast, compact model for near-instant responsiveness. For the vast majority of workloads, Sonnet is two times faster than Claude 2 and Claude 2.1, with higher levels of intelligence, and it strikes the ideal balance between intelligence and speedqualities especially critical for enterprise use cases. Opus is the most advanced, capable, state-of-the-art foundation model (FM) with deep reasoning, advanced math, and coding abilities, with top-level performance on highly complex tasks.
Among the key features of the models family are:
To learn more about the Claude 3 family, see Unlocking Innovation: AWS and Anthropic push the boundaries of generative AI together, Anthropics Claude 3 Sonnet foundation model is now available in Amazon Bedrock, and Anthropics Claude 3 Haiku model is now available on Amazon Bedrock.
As prompts become more complex, its important to identify its various parts. In this section, we present the components that make up a prompt and the recommended order in which they should appear:
The following is an example of a prompt that incorporates all the aforementioned elements:
In the following sections, we dive deep into Claude 3 best practices for prompt engineering.
For prompts that deal only with text, follow this set of best practices to achieve better results:
The Claude 3 family offers vision capabilities that can process images and return text outputs. Its capable of analyzing and understanding charts, graphs, technical diagrams, reports, and other visual assets. The following are best practices when working with images with Claude 3:
Consider the following example, which is an extraction of the picture a fine gathering (Author: Ian Kirck, https://en.m.wikipedia.org/wiki/File:A_fine_gathering_(8591897243).jpg).
We ask Claude 3 to count how many birds are in the image:
Claude 3 Haikus response:
In this example, we asked Claude to take some time to think and put its reasoning in an XML tag and the final answer in another. Also, we gave Claude time to think and clear instructions to pay attention to details, which helped Claude to provide the correct response.
Lets see an example with the following image:
In this case, the image itself is the prompt: Claude 3 Haikus response:
Lets look at the following example:
Prompt:
Claude 3 Haikus response:
Lets see an example. We pass to Claude the following map chart in image format (source: https://ourworldindata.org/co2-and-greenhouse-gas-emissions), then we ask about Japans greenhouse gas emissions.
Prompt:
Claude 3 Haikus response:
Lets see an example of narration with the following image (source: Sustainable Development Goals Report 2023, https://unstats.un.org/sdgs/report/2023/The-Sustainable-Development-Goals-Report-2023.pdf):
Prompt:
Claude 3 Haikus response:
In this example, we were careful to control the content of the narration. We made sure Claude didnt mention any extra information or discuss anything it wasnt completely confident about. We also made sure Claude covered all the key details and numbers presented in the slide. This is very important because the information from the narration in text format needs to be precise and accurate in order to be used to respond to questions.
Information extraction is the process of automating the retrieval of specific information related to a specific topic from a collection of texts or documents. LLMs can extract information regarding attributes given a context and a schema. The kinds of documents that can be better analyzed with LLMs are resumes, legal contracts, leases, newspaper articles, and other documents with unstructured text.
The following prompt instructs Claude 3 Haiku to extract information from short text like posts on social media, although it can be used for much longer pieces of text like legal documents or manuals. In the following example, we use the color code defined earlier to highlight the prompt sections:
Claude 3 Haikus response:
The prompt incorporates the following best practices:
Retrieval Augmented Generation (RAG) is an approach in natural language generation that combines the strengths of information retrieval and language generation models. In RAG, a retrieval system first finds relevant passages or documents from a large corpus based on the input context or query. Then, a language generation model uses the retrieved information as additional context to generate fluent and coherent text. This approach aims to produce high-quality and informative text by using both the knowledge from the retrieval corpus and the language generation capabilities of deep learning models. To learn more about RAG, see What is RAG? and Question answering using Retrieval Augmented Generation with foundation models in Amazon SageMaker JumpStart.
The following prompt instructs Claude 3 Haiku to answer questions about a specific topic and use a context from the retrieved information. We use the color code defined earlier to highlight the prompt sections:
Claude 3 Haikus response:
The prompt incorporates the following best practices:
In this post, we explored best prompting practices and demonstrated how to apply them with the Claude 3 family of models. The Claude 3 family of models are the latest and most capable LLMs available from Anthropic.
We encourage you to try out your own prompts using Amazon Bedrock playgrounds on the Amazon Bedrock console, and try out the official Anthropic Claude 3 Prompt Engineering Workshop to learn more advanced techniques. You can send feedback to AWS re:Post for Amazon Bedrock or through your usual AWS Support contacts.
Refer to the following to learn more about the Anthropic Claude 3 family:
David Laredo is a Prototyping Architect at AWS, where he helps customers discover the art of the possible through disruptive technologies and rapid prototyping techniques. He is passionate about AI/ML and generative AI, for which he writes blog posts and participates in public speaking sessions all over LATAM. He currently leads the AI/ML experts community in LATAM.
Claudia Cortes is a Partner Solutions Architect at AWS, focused on serving Latin American Partners. She is passionate about helping partners understand the transformative potential of innovative technologies like AI/ML and generative AI, and loves to help partners achieve practical use cases. She is responsible for programs such as AWS Latam Black Belt, which aims to empower partners in the Region by equipping them with the necessary knowledge and resources.
Simn Crdova is a Senior Solutions Architect at AWS, focused on bridging the gap between AWS services and customer needs. Driven by an insatiable curiosity and passion for generative AI and AI/ML, he tirelessly explores ways to leverage these cutting-edge technologies to enhance solutions offered to customers.
Gabriel Velazquez is a Sr Generative AI Solutions Architect at AWS, he currently focuses on supporting Anthropic on go-to-market strategy. Prior to working in AI, Gabriel built deep expertise in the telecom industry where he supported the launch of Canadas first 4G wireless network. He now combines his expertise in connecting a nation with knowledge of generative AI to help customers innovate and scale.
Originally posted here:
Prompt engineering techniques and best practices: Learn by doing with Anthropic's Claude 3 on Amazon Bedrock ... - AWS Blog
- Apple Makes One Of Its Largest Ever Acquisitions, Buys The Israeli Machine Learning Firm, Q.ai - Wccftech - February 1st, 2026 [February 1st, 2026]
- Keysights Machine Learning Toolkit to Speed Device Modeling and PDK Dev - All About Circuits - February 1st, 2026 [February 1st, 2026]
- University of Missouri Study: AI/Machine Learning Improves Cardiac Risk Prediction Accuracy - Quantum Zeitgeist - February 1st, 2026 [February 1st, 2026]
- How AI and Machine Learning Are Transforming Mobile Banking Apps - vocal.media - February 1st, 2026 [February 1st, 2026]
- Machine Learning in Production? What This Really Means - Towards Data Science - January 28th, 2026 [January 28th, 2026]
- Best Machine Learning Stocks of 2026 and How to Invest in Them - The Motley Fool - January 28th, 2026 [January 28th, 2026]
- Machine learning-based prediction of mortality risk from air pollution-induced acute coronary syndrome in the Western Pacific region - Nature - January 28th, 2026 [January 28th, 2026]
- Machine Learning Predicts the Strength of Carbonated Recycled Concrete - AZoBuild - January 28th, 2026 [January 28th, 2026]
- Vertiv Next Predict is a new AI-powered, managed service that combines field expertise and advanced machine learning algorithms to anticipate issues... - January 28th, 2026 [January 28th, 2026]
- Machine Learning in Network Security: The 2026 Firewall Shift - openPR.com - January 28th, 2026 [January 28th, 2026]
- Why IBMs New Machine-Learning Model Is a Big Deal for Next-Generation Chips - TipRanks - January 24th, 2026 [January 24th, 2026]
- A no-compromise amplifier solution: Synergy teams up with Wampler and Friedman to launch its machine-learning power amp and promises to change the... - January 24th, 2026 [January 24th, 2026]
- Our amplifier learns your cabinets impedance through controlled sweeps and continues to monitor it in real-time: Synergys Power Amp Machine-Learning... - January 24th, 2026 [January 24th, 2026]
- Machine Learning Studied to Predict Response to Advanced Overactive Bladder Therapies - Sandip Vasavada - UroToday - January 24th, 2026 [January 24th, 2026]
- Blending Education, Machine Learning to Detect IV Fluid Contaminated CBCs, With Carly Maucione, MD - HCPLive - January 24th, 2026 [January 24th, 2026]
- Why its critical to move beyond overly aggregated machine-learning metrics - MIT News - January 24th, 2026 [January 24th, 2026]
- Machine Learning Lends a Helping Hand to Prosthetics - AIP Publishing LLC - January 24th, 2026 [January 24th, 2026]
- Hassan Taher Explains the Fundamentals of Machine Learning and Its Relationship to AI - mitechnews.com - January 24th, 2026 [January 24th, 2026]
- Keysight targets faster PDK development with machine learning toolkit - eeNews Europe - January 24th, 2026 [January 24th, 2026]
- Training and external validation of machine learning supervised prognostic models of upper tract urothelial cancer (UTUC) after nephroureterectomy -... - January 24th, 2026 [January 24th, 2026]
- Age matters: a narrative review and machine learning analysis on shared and separate multidimensional risk domains for early and late onset suicidal... - January 24th, 2026 [January 24th, 2026]
- Uncovering Hidden IV Fluid Contamination Through Machine Learning, With Carly Maucione, MD - HCPLive - January 24th, 2026 [January 24th, 2026]
- Machine learning identifies factors that may determine the age of onset of Huntington's disease - Medical Xpress - January 24th, 2026 [January 24th, 2026]
- AI and Machine Learning - WEF expands Fourth Industrial Revolution Network - Smart Cities World - January 24th, 2026 [January 24th, 2026]
- Machine-learning analysis reclassifies armed conflicts into three new archetypes - The Brighter Side of News - January 24th, 2026 [January 24th, 2026]
- Machine learning and AI the future of drought monitoring in Canada - sasktoday.ca - January 24th, 2026 [January 24th, 2026]
- Machine learning revolutionises the development of nanocomposite membranes for CO capture - European Coatings - January 24th, 2026 [January 24th, 2026]
- AI and Machine Learning - Leading data infrastructure is helping power better lives in Sunderland - Smart Cities World - January 24th, 2026 [January 24th, 2026]
- How banks are responsibly embedding machine learning and GenAI into AML surveillance - Compliance Week - January 20th, 2026 [January 20th, 2026]
- Enhancing Teaching and Learning of Vocational Skills through Machine Learning and Cognitive Training (MCT) - Amrita Vishwa Vidyapeetham - January 20th, 2026 [January 20th, 2026]
- New Research in Annals of Oncology Shows Machine Learning Revelation of Global Cancer Trend Drivers - Oncodaily - January 20th, 2026 [January 20th, 2026]
- Machine learning-assisted mapping of VT ablation targets: progress and potential - Hospital Healthcare Europe - January 20th, 2026 [January 20th, 2026]
- Machine Learning Achieves Runtime Optimisation for GEMM with Dynamic Thread Selection - Quantum Zeitgeist - January 20th, 2026 [January 20th, 2026]
- Machine learning algorithm predicts Bitcoin price on January 31, 2026 - Finbold - January 20th, 2026 [January 20th, 2026]
- AI and Machine Learning Transform Baldness Detection and Management - Bioengineer.org - January 20th, 2026 [January 20th, 2026]
- A longitudinal machine-learning approach to predicting nursing home closures in the U.S. - Nature - January 11th, 2026 [January 11th, 2026]
- Occams Razor in Machine Learning. The Power of Simplicity in a Complex World - DataDrivenInvestor - January 11th, 2026 [January 11th, 2026]
- Study Explores Use of Automated Machine Learning to Compare Frailty Indices in Predicting Spinal Surgery Outcomes - geneonline.com - January 11th, 2026 [January 11th, 2026]
- Hunting for "Oddballs" With Machine Learning: Detecting Anomalous Exoplanets Using a Deep-Learned Low-Dimensional Representation of Transit... - January 9th, 2026 [January 9th, 2026]
- A Machine Learning-Driven Electrophysiological Platform for Real-Time Tumor-Neural Interaction Analysis and Modulation - Nature - January 9th, 2026 [January 9th, 2026]
- Machine learning elucidates associations between oral microbiota and the decline of sweet taste perception during aging - Nature - January 9th, 2026 [January 9th, 2026]
- Prognostic model for pancreatic cancer based on machine learning of routine slides and transcriptomic tumor analysis - Nature - January 9th, 2026 [January 9th, 2026]
- Bidgely Redefines Energy AI in 2025: From Machine Learning to Agentic AI - galvnews.com - January 9th, 2026 [January 9th, 2026]
- Machine Learning in Pharmaceutical Industry Market Size Reach USD 26.2 Billion by 2031 - openPR.com - January 9th, 2026 [January 9th, 2026]
- Noise-resistant Qubit Control With Machine Learning Delivers Over 90% Fidelity - Quantum Zeitgeist - January 9th, 2026 [January 9th, 2026]
- Machine Learning Models Forecast Parshwanath Corporation Limited Uptick - Real-Time Stock Alerts & High Return Trading Ideas -... - January 9th, 2026 [January 9th, 2026]
- Machine Learning Models Forecast Imagicaaworld Entertainment Limited Uptick - Technical Resistance Breaks & Outstanding Capital Returns -... - January 2nd, 2026 [January 2nd, 2026]
- Cognitive visual strategies are associated with delivery accuracy in elite wheelchair curling: insights from eye-tracking and machine learning -... - January 2nd, 2026 [January 2nd, 2026]
- Machine Learning Models Forecast Covidh Technologies Limited Uptick - Earnings Forecast Updates & Small Investment Trading Plans -... - January 2nd, 2026 [January 2nd, 2026]
- Machine Learning Models Forecast Sri Adhikari Brothers Television Network Limited Uptick - Stock Split Announcements & Rapid Wealth Accumulation -... - January 2nd, 2026 [January 2nd, 2026]
- Army to ring in new year with new AI and machine learning career path for officers - Stars and Stripes - December 31st, 2025 [December 31st, 2025]
- Army launches AI and machine-learning career path for officers - Federal News Network - December 31st, 2025 [December 31st, 2025]
- AI and Machine Learning Transforming Business Operations, Strategy, and Growth AI - openPR.com - December 31st, 2025 [December 31st, 2025]
- New at Mouser: Infineon Technologies PSOC Edge Machine Learning MCUs for Robotics, Industrial, and Smart Home Applications - Business Wire - December 31st, 2025 [December 31st, 2025]
- Machine Learning Models Forecast The Federal Bank Limited Uptick - Double Top/Bottom Patterns & Affordable Growth Trading - bollywoodhelpline.com - December 31st, 2025 [December 31st, 2025]
- Machine Learning Models Forecast Future Consumer Limited Uptick - Stock Valuation Metrics & Free Stock Market Beginner Guides - earlytimes.in - December 31st, 2025 [December 31st, 2025]
- Machine learning identifies statin and phenothiazine combo for neuroblastoma treatment - Medical Xpress - December 29th, 2025 [December 29th, 2025]
- Machine Learning Framework Developed to Align Educational Curricula with Workforce Needs - geneonline.com - December 29th, 2025 [December 29th, 2025]
- Study Develops Multimodal Machine Learning System to Evaluate Physical Education Effectiveness - geneonline.com - December 29th, 2025 [December 29th, 2025]
- AI Indicators Detect Buy Opportunity in Everest Organics Limited - Healthcare Stock Analysis & Smarter Trades Backed by Machine Learning -... - December 29th, 2025 [December 29th, 2025]
- Automated Fractal Analysis of Right and Left Condyles on Digital Panoramic Images Among Patients With Temporomandibular Disorder (TMD) and Use of... - December 29th, 2025 [December 29th, 2025]
- Machine Learning Models Forecast Gayatri Highways Limited Uptick - Inflation Impact on Stocks & Fast Profit Trading Ideas - bollywoodhelpline.com - December 29th, 2025 [December 29th, 2025]
- Machine Learning Models Forecast Punjab Chemicals and Crop Protection Limited Uptick - Blue Chip Stock Analysis & Double Or Triple Investment -... - December 29th, 2025 [December 29th, 2025]
- Machine Learning Models Forecast Walchand PeopleFirst Limited Uptick - Risk Adjusted Returns & Investment Recommendations You Can Trust -... - December 27th, 2025 [December 27th, 2025]
- Machine learning helps robots see clearly in total darkness using infrared - Tech Xplore - December 27th, 2025 [December 27th, 2025]
- Momentum Traders Eye Manas Properties Limited for Quick Bounce - Market Sentiment Report & Smarter Trades Backed by Machine Learning -... - December 27th, 2025 [December 27th, 2025]
- Machine Learning Models Forecast Bigbloc Construction Limited Uptick - MACD Trading Signals & Minimal Risk High Reward - bollywoodhelpline.com - December 27th, 2025 [December 27th, 2025]
- Avoid These 10 Machine Learning Project Mistakes - Analytics Insight - December 27th, 2025 [December 27th, 2025]
- Infleqtion Secures $2M U.S. Army Contract to Advance Contextual Machine Learning for Assured Navigation and Timing - Yahoo Finance - December 12th, 2025 [December 12th, 2025]
- A county-level machine learning model for bottled water consumption in the United States - ESS Open Archive - December 12th, 2025 [December 12th, 2025]
- Grainge AI: Solving the ingredient testing blind spot with machine learning - foodingredientsfirst.com - December 12th, 2025 [December 12th, 2025]
- Improved herbicide stewardship with remote sensing and machine learning decision-making tools - Open Access Government - December 12th, 2025 [December 12th, 2025]
- Hero Medical Technologies Awarded OTA by MTEC to Advance Machine Learning and Wearable Sensing for Field Triage - PRWeb - December 12th, 2025 [December 12th, 2025]
- Lieprune Achieves over Compression of Quantum Neural Networks with Negligible Performance Loss for Machine Learning Tasks - Quantum Zeitgeist - December 12th, 2025 [December 12th, 2025]
- WFS Leverages Machine Learning to Accurately Forecast Air Cargo Volumes and Align Workforce Resources - Metropolitan Airport News - December 12th, 2025 [December 12th, 2025]
- "Emerging AI and Machine Learning Technologies Revolutionize Diagnostic Accuracy in Endoscope Imaging" - GlobeNewswire - December 12th, 2025 [December 12th, 2025]
- Study Uses Multi-Scale Machine Learning to Classify Cognitive Status in Parkinsons Disease Patients - geneonline.com - December 12th, 2025 [December 12th, 2025]
- WFS uses machine learning to forecast cargo volumes and staffing - STAT Times - December 12th, 2025 [December 12th, 2025]
- Portfolio Management with Machine Learning and AI Integration - The AI Journal - December 12th, 2025 [December 12th, 2025]
- AI, Machine Learning to drive power sector transformation: Manohar Lal - DD News - December 7th, 2025 [December 7th, 2025]