Cognilytica’s Prompt Engineering Best Practices Guide: Prompt Patterns (Part 1 of 6)

Cognilytica’s Prompt Engineering Best Practices Guide: Prompt Patterns (Part 1 of 6)

🍬 We’ve got a treat for you. 

Many of you have been asking us about best practices in implementing prompt engineering. There’s a bajillion (rounded to the nearest zillion) guides out there for Prompt Engineering and LLMs like ChatGPT. For a long time we resisted putting yet another guide out there that wasn’t adding to the conversation. 

🤷  But then we realized: people are still doing things the wrong way. They’re spending hours and days or even weeks on bad prompts that generate bad results, and misapplying Generative AI to the wrong problem areas. 

Furthermore, the LLMs continue to change…rapidly. What worked one day, stops working another day. How can you possibly plan to run anything successful using prompt-based Generative AI if every day it’s another crap shoot as to whether or not you’ll get something useful?

🤔 Also, prompt engineering hasn’t even been a thing for more than a handful of years. Is there enough time now to realize what the best practices are? Sure, we have practices, but are any of them “best”?

From that perspective, we answer that there certainly are an emerging set of best practices that are holding to be true over time. The specific implementation details will no doubt change and alter as things progress, but the overarching approaches are holding to be best practices that will stay valid for a while.

✅ So buckle up, stay subscribed, and get our colleagues to subscribe to this newsletter as well. Over the course of the next many newsletters we’ll be sharing with you our Cognilytica Prompt Engineering Best Practices Guide for free, right here, in this newsletter, and nowhere else. We might also have a few AI Today podcasts on the topic, but that will be in addition to this guide. So stay subscribed to our newsletter! OK….now onto part 1 of our guide.

What We’re Really Doing when We’re Prompt Engineering

Large Language Model (LLM) based Generative AI systems are basically big “text predictors” that generate best-guess outputs based on what it expects is the most likely desired output based on what the user provides as the text-based input, the prompt.

Since the LLM is a very large AI Foundation Model that has been trained on an extremely large amount of data, the prompt needs to narrow and limit the universe of all possibilities of its training data to the most relevant data. Likewise, as there’s an infinite number of ways to generate the output, the prompt needs to guide the LLM on how to generate acceptable outputs.

There are therefore two major components of a prompt:

  • The context component which narrows the universe of all possible data to the most relevant
  • The execution and output component which guide the LLM on how to provide the output

A good prompt provides sufficient and accurate context to guide data selection and well-crafted execution and output to guide output generation. The more general your prompt, the more general your answer. So, to get useful content you need to have detailed prompts.

Prompting Best Practice #1: Use a Prompt Pattern

Since we are trying to accomplish those two goals of narrowing the universe of data from which to select the basis for responses, while also guiding how we want the system to generate output, one best practice is to adopt a structured "formula" or pattern approach.

Most of the popular formulas for creating prompts include aspects of the following:

  • Acting as a role or character
  • Performing a task or specifying a request
  • Responding in a particular format
  • Providing guidelines, guardrails or conditions for what should be included
  • Adding additional evaluation so that the output can be validated

There are a number of patterns that people have experienced different degrees of success in using which include:

  • RACE: Role, Action, Context, Execution - The role statement comes first. This sets the guardrails for much of the rest of the prompt. Begin with the role statement to establish guidelines for the prompt, incorporating specific keywords and terms that help the AI recognize relevant information to complete the task. Detail the subject area with key terminology, informing the model of its expected knowledge and defining success criteria.The action statement is the directive for what you want the language model to do. Use specific verbs like write, summarize, extract, rewrite, etc. to give the model clear directions.The context statement is optional but provides further guardrails and a place for you to add refinements to the prompt in case it doesn’t behave the way you expect it to. The optional context statement adds clarity and adjustments to refine prompts, particularly useful in writing tasks to ensure accuracy. Bulleted lists are recommended for ease and precision.The execute statement, though optional for brief prompts, is crucial for longer ones, serving as a reminder of the task at hand. Here, include formatting specifics to sharpen the output, especially useful for summaries and extractions.

Other patterns do similar things at different levels of detail:

  • RTF: Role, Task, Format - The RTF (Role, Task, Format) pattern focuses on specifying the role of the requestor or the subject, the task that needs to be accomplished, and the format in which the output should be delivered. This pattern is straightforward and effective for getting precise outputs, particularly when the format is critical, such as in coding or content creation.
  • CTF: Context, Task, Format - CTF (Context, Task, Format) zeroes in on the surrounding circumstances or background information (Context), what needs to be done (Task), and how the final output should appear (Format). It's ideal for situations where understanding the broader situation is key to creating a relevant and accurate output.
  • RASCEF: Role, Action, Steps, Context, Examples, Format - RASCEF stands out for its comprehensive structure, including the Role (who needs the task done), Action (what needs to be achieved), Steps (how to achieve it), Context (background or environment), Examples (specific instances for clarity), and Format (presentation of the output). It's particularly suited for complex tasks requiring detailed instructions and clarity.
  • PECRA: Purpose, Expectation, Context, Request, Action - PECRA covers the Purpose (why something needs to be done), Expectation (desired outcomes), Context (background information), Request (what is being asked for), and Action (what needs to be done). This pattern ensures that requests are grounded in a clear purpose and context, aiming for well-defined outcomes.
  • TREF: Task, Requirement, Expectation, Format - TREF focuses on the Task (what needs to be done), Requirement (necessary conditions or criteria), Expectation (desired outcome), and Format (how the output should be structured). It's useful for assignments where specific requirements and clear expectations are key to success.
  • GRADE: Goal, Request, Action, Detail, Examples - GRADE involves specifying the Goal (what needs to be achieved), Request (what is being asked for), Action (the steps or actions to be taken), Detail (additional important information), and Examples (illustrative scenarios). It is designed to provide a thorough understanding of what is needed for successful completion.
  • ROSES: Role, Objective, Scenario, Expected Solution, Steps - ROSES outlines the Role (who is involved), Objective (what aims to be achieved), Scenario (context or situation), Expected Solution (desired outcome), and Steps (how to get there). This pattern is ideal for planning and problem-solving in complex scenarios, ensuring all aspects are considered.
  • RDIREC: Role, Definition, Intent, Request, Example, Clarification Tone - RDIREC includes Role (who is involved), Definition (of key terms or concepts), Intent (purpose behind the request), Request (what is being asked for), Example (to clarify the request), and Clarification Tone (how uncertainties should be addressed). It's great for educational or instructional contexts where clarity and understanding are paramount.
  • RSCET: Role, Situation, Complication, Expectation, Task - RSCET focuses on Role (who is involved), Situation (the current state or context), Complication (problems or challenges faced), Expectation (desired outcomes), and Task (what needs to be done). It suits scenarios that involve problem-solving or overcoming challenges, providing a structured approach to find solutions.
  • CREATE: Explained in greater detail below

Many of these approaches are very similar, so let’s explore one in particular: the CREATE Prompt Pattern / Formula.

C.R.E.A.T.E Formula Structure for Prompt Engineering

  • Character: Define the AI’s role such as “You are a seasoned project manager with 20 years of experience”
  • Request: Specify your needs clearly. Rather than a broad request such as “Create a marketing slogan for a laptop,” be more detailed and say, “Develop an engaging slogan for the PixelBook Pro, a laptop designed for creative professionals with 4K display and unmatched battery life.”
  • Examples: For more accurate outcomes, include examples. Providing sample headlines or tone can steer the AI's response style.
  • Adjustments: Refine and tweak the prompt as needed. Persist in making adjustments to achieve your desired results. For instance, direct the AI with specific guidelines, such as "Use subheads instead of bullet points”.
  • Types of output: Describe the desired format. Specify the output format you want, like "Create a 500-word summary of the meeting, highlighting key takeaways and listing action items for each attendee.”
  • Extras/Evaluation: Outline how to gauge the task's success, including specific instructions like "Ask questions before answering," "Explain your reasoning," "Reference only trustworthy sources with citations," and "Utilize data up to 2023." 

Approaches to Choosing a Prompt Pattern / Formula

There are a number of considerations for determining which Prompt Engineering pattern or formula to consider:

  • Simplicity vs. Detail: Patterns like RTF and CTF are simpler, focusing on the essentials without excessive detail, making them ideal for straightforward tasks. In contrast, RASCEF and CREATE dive into comprehensive details, suited for complex or nuanced tasks requiring clear guidance and expectations.
  • Context and Clarity: CTF and CREATE emphasize the importance of context, recognizing that understanding the situation is key to crafting relevant outputs. This makes them particularly useful in dynamic or multifaceted situations.
  • Action Orientation: Patterns like RASCEF, GRADE, and CREATE include explicit action steps or criteria, which are crucial for tasks requiring clear, step-by-step instructions or for projects with specific milestones.
  • Evaluative Component: CREATE uniquely includes an Evaluation aspect, making it stand out for tasks where feedback or assessment is critical. This can be particularly beneficial in educational settings or project management, where outcomes need to be measured against set criteria.
  • Best Practice Considerations: The choice of pattern largely depends on the task's complexity, the need for detail, and the importance of context. For simple, straightforward tasks, RTF or CTF might be best due to their conciseness. For projects requiring thorough instructions, clear outcomes, and specific timelines, CREATE is a great choice, offering a structured approach that encompasses planning, execution, and evaluation.

For tasks requiring detailed planning, clear expectations, and specific outcomes, the CREATE pattern is highly recommended. It provides a holistic approach, from understanding the context to evaluating the results, making it versatile for a wide range of applications. For simpler inquiries or when time is of the essence, more concise patterns like RTF or CTF might be more appropriate.

➠ NEXT UP IN PART TWO: We’ll be discussing Prompt Chaining  and Splitting Large Tasks into Smaller Tasks.

✅ Stay subscribed for the part 2 in our series next week where we explore another best practice in prompt engineering: prompt chaining and task splitting.


In Case you Missed it… Insights from Cognilytica Podcasts & Content

  • ➡️ {Featured Article} What Skills Do You Need To Be An AI Project Manager? If you’re running or managing an AI project, you may have found that you need to level up your skills and understanding of terminology.  [Read here]
  • ➡️ {Featured Podcast} The People Side of AI: Interview with Ian Beacraft, Signal and Cipher. The people side of AI is changing. Generative AI is reshaping how teams brainstorm, collaborate, and embrace the future. In this episode of the AI Today podcast we interview Ian Beacraft who is CEO at Signal and Cipher, and also CPMAI certified. [Listen here]
  • ➡️ {Featured Podcast} AI’s Impact on Healthcare: Interview with Dr. Jesse Ehrenfeld, AMAs. AI is having an impact on just about every industry and healthcare is no exception. In this episode of the AI Today podcast Cognilytica AI thought leaders Kathleen Walch and Ron Schmelzer interview Dr. Jesse Ehrenfeld. He is President of the American Medical Association (AMA). [Listen here]


The Most Important AI Stories from the Past Week You Should Know:

  • 💰  {AI Investment} - Saudi Arabia Plans $40 Billion Push Into Artificial Intelligence -The country is creating a huge fund to invest in AI  technology, making them the largest investor in AI. They are looking for a  potential partnership with Andreessen Horowitz, one of Silicon Valley’s top venture capital firms. [Read More]
  • 🤖 {AI Applications} - Why is AI so bad at spelling? Because image generators aren’t actually reading text - Have you ever tried to create an image with an LLM and have a word in the image? Most likely it wasn’t spelled correctly. Learn more in this Captain Obvious article. [Read More]
  • 🖼️ {AI Applications} - Tennessee just became the first state to protect musicians and other artists against AI - Tennessee Gov. Bill Lee recently signed off on legislation designed to protect songwriters, performers and other music industry professionals against the potential dangers of AI. The bill, which goes into effect July 1, helps ensure that AI tools cannot replicate an artist’s voice without their consent. For a state long associated with music, will artists now feel less threatened by AI?[Read More]


💬 Events and Opportunities to Hear from Cognilytica

  • THIS WEEK March 28, 2024: PMI Belgium Chapter: “How to Run Successful AI Projects and Avoid Failure” Virtual / Online session - 6-7pm Belgium Time, [Register here]
  • April 2, 2024: PMI Southern MD: True Talks Live! Show, YouTube live stream, 7-8pm EST. No need to register!  This event is live and can be accessed via YouTube 
  • April 8, 2024: PMI Southern New England: “Building Trust in AI” and “How to Run Successful AI Projects and Avoid Failure” - Sessions during SNEC-PMI's 16th Annual Conference in person in Hartford, CT. [Register here]
  • April 9, 2024: PMI Washington DC Chapter: “How to Run Successful AI Projects and Avoid Failure” 6pm EST in Arlington, VA [Register here]
  • April 17, 2024: PMI New York City Chapter “How to Run Successful AI Projects and Avoid Failure” Virtual / Online session, 6-7pm EST [Register here]
  • April 18, 2024: FORUM: Women Making an IMPACT, Empowering Women in AI - virtual/ webinar, 1pm EST [Register here]
  • April 23, 2024: PMI Tulsa, OK Chapter: “The Hidden Secret of AI Success: A PMI Approach” Virtual / Online session 12:00-1:00pm CST [Register here]
  • April 29, 2024: PMI Saudi Arabia Chapter: “How to Run Successful AI Projects and Avoid Failure”, Virtual / Online session -  7PM-8PM Saudi Time (10AM-11AM Eastern Time) [Registration opening soon]
  • May 2, 2024: PMI Austin, TX Chapter: “The Future is Now:  Essential AI Skills Every Project Manager Must Have”, Professional Development Day 2024, In-person presentation, 7:30am - 16:00pm CT  [Register here]
  • May 7, 2024: PMI Delaware Valley Chapter: “How to Run Successful AI Projects and Avoid Failure”, Virtual / Online session -  6:30PM-8PM Eastern Time [Registration opening soon]
  • May 8, 2024: PMI Southwest Ohio Chapter: “How to Run Successful AI Projects and Avoid Failure”, Virtual / Online session, 6:30-7:30pm Eastern Time [Register here]
  • May 21, 2024: PMI New Jersey Chapter: “What you need to know, today, to successfully run and manage AI projects”, Virtual / Online session -  6:30PM-8PM Eastern Time [Registration opening soon]
  • July 10, 2024: PMI Madrid, Spain Chapter: “Best Practice Methods for Successful AI Projects”, Virtual / Online session - 7:00 - 8:00 PM Spanish time  [Registration opening soon]
  • July 10th, 2024: PMI San Francisco Chapter: “Successful approaches to running AI Projects - Avoiding the Top Reasons why AI Projects Fail”, Virtual / Online session -  6-7:30 pm PST [Registration opening soon]
  • July 17, 2024: PMI Northern Alberta Chapter: “The hidden secret of AI success: a PM approach” Virtual / Online session  6-8pm MT [Registration opening soon]


🗣️ Bring Cognilytica Thought Leadership to Your Organization or Event

⭐ Bring the Power and Excitement of Cognilytica to your Organization or Event!

Cognilytica’s inspiring, thoughtful, and engaging analysts deliver speaking engagements, workshops, panel participation and moderation, podcast interviews, and other engagements informed by real-world experience and thought leadership. 

Engage our analysts as keynote speakers, panel moderators and participants, workshop facilitators, podcast hosts or guests, and as experts for field marketing events.

👉 [Engage with Cognilytica for your next Event, Panel, Keynote, or Activity]


🚀 Move Forward with AI Best Practices - Training & Certification

Cognilytica’s AI best practices & Trustworthy training and certification continues to be in high demand. Haven’t yet enrolled in a certification or training? What’s holding you back?

  • 🌟 CPMAI v7 - Get Certified with comprehensive AI & ML Project Management Training. Includes: AI Fundamentals, AI Applications, Managing Data for AI, Data Preparation for AI, ML Algorithms, Generative AI, CPMAI Methodology, and Trustworthy AI. [Enroll now]
  • 💪 CPMAI+ Plus v7 - Greater Depth: Enhances CPMAI with RPA, Big Data, Data Science. Includes: All CPMAI Training Content, including AI & ML Fundamentals, CPMAI Methodology, plus Fundamentals of Big Data, Big Data platforms, Foundations of Data Science, Foundations & Applications of Robotic Process Automation (RPA), Big Data Engineering, Security & Governance, and more! [Enroll now]
  • 🔥 CPMAI+E v7 - Our most comprehensive training & certification! Adds Ethical & Trustworthy AI to CPMAI+. Includes: All CPMAI+ Plus Training Content, Ethical AI Concepts, Responsible AI Concepts, Transparent AI Concepts, Governed AI Concepts, Explainable AI Concepts, The Trustworthy AI Framework, Putting Trustworthy AI into Practice. [Enroll now]
  • ✅ Trustworthy AI Framework v3  - Most Comprehensive, Vendor-Neutral Trustworthy AI Training & Certification. Learn how to Build and Run Trustworthy AI Systems. Boost your credentials. Keep Your AI Solutions, Organization, Customers, and Stakeholders Trustworthy. Advance your career. [Enroll now]


AI Resources

📚 Check out our AI & Data Resource List: Dive Deeper! ✨

Loving this deep dive into Prompt Engineering! 🚀 Remember, Aristotle once alluded - excellence is not an act, but a habit. Continually refining our approaches with AI will surely lead to groundbreaking innovations. Thrilled to see where this leads! #Innovation #AI

Like
Reply

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics