Prompt Engineering

4 Mins Read

Advanced Prompting Techniques to Communicate Better With AI

Voiced by Amazon Polly

As AI tools become a regular part of daily work, people have come to understand the importance of proper prompting. After mastering the 5C framework for prompting, let us now understand some advanced prompting patterns, which make the AI models more reliable. These techniques enhance the accuracy and relevance of AI responses.

Freedom Month Sale — Upgrade Your Skills, Save Big!

  • Up to 80% OFF AWS Courses
  • Up to 30% OFF Microsoft Certs
  • Ends August 31
Act Fast!

Persona Pattern

The simplest way to influence the AI model is to assign it a specific role. When assigned a persona, the AI responds in the persona’s style, such as that of a teacher, a financial advisor or a full-stack developer. This pattern helps the model’s response to suit the task. For example, the below prompt

Act as a financial advisor and give me suggestions for increasing my monthly savings.

This single line replaces lengthy instructions about tone, complexity and relevance, allowing the model to focus on practical financial advice rather than technical explanations.

Question Refinement Pattern

Generative AI models give generic responses when the prompts are vague. This pattern involves creating the model itself to refine the prompt. The AI-guided refined question leads to actionable advice rather than generic information. The following prompt can be added after the primary prompt or as the root prompt. Now the model rewrites the user’s query in a clearer, more specific form.

Suggest a better version of my question that will help to get a more accurate response.

Cognitive Verifier Pattern

Some complex questions require step-by-step solutions. The cognitive verifier pattern helps to break difficult questions into smaller parts, making the reasoning more accurate. When the following prompt is placed before the actual prompt, the model can ask some clarifying questions, which helps the model understand the requirement better and respond with a high-quality response.

Always ask 3–4 focused questions to improve clarity and then give a precise and helpful answer.

Audience Persona Pattern

The same concept needs to be explained differently for different audiences. We would not be explaining any topic in the same way to a technical and a non-technical person. The audience persona pattern helps by telling the AI model about the target audience. Therefore, the model automatically adjusts the tone, vocabulary and examples to suit the audience, as follows:

Explain “What is Machine Learning” in a way so that a 10-year-old child can understand. Use the language and examples suitable for the child.

Flipped Interaction Pattern

In some scenarios, we know the final goal but not how to start. In such cases, the flipped interaction pattern is helpful because it allows the AI model to ask questions first. This removes guesswork and enables the model to gather relevant information before suggesting a solution. This pattern works well for trip planning or choosing insurance, where some relevant information is required before a solution can be provided. Consider the following prompt.

Before providing a solution to the query, repeatedly ask me simple questions that are required to fill in the missing information. Once you have gathered all the necessary information, combine everything to arrive at a suitable solution.

Using this pattern, AI produces a more personalized and complete solution instead of a generic one by asking simple questions to fill in missing information and then combining the answers.

Although this pattern resembles the Cognitive Verifier Pattern, they are not the same. The Cognitive Verifier Pattern is useful when the query is too broad or complex. Still, the Flipped Interaction Pattern is useful when the goal is clear, and starting details are missing.

Few-Shot Prompting

The easiest way to teach an AI model is to give some examples. Few-shot prompting occurs when the model learns by observing patterns in examples, rather than receiving lengthy instructions. Zero-shot prompting uses the AI’s existing knowledge, one-shot prompting uses a single example and few-shot prompting uses multiple examples for more clarity. The prompt below is an example of few-shot prompting.

Example for extracting key details from customer feedback:

Input: The app crashes whenever I try to upload photos. Please fix this urgently.
Output: Issue: App crash, Feature: Photo upload, Priority: High

Input: I love the new dark mode feature. Makes reading at night so much easier.
Output: Issue: None, Feature: Dark mode, Priority: Positive feedback

After observing this pattern, the AI model can now consistently process hundreds of feedback entries without any change in its style.

Chain of Thought Prompting

Some questions require explicit reasoning, especially the questions involving calculations or multi-step decisions. These problems can be approached using chain of thought prompting (CoT). The idea behind CoT is to ask the AI model to explain its steps before giving the final answer, and this improves the accuracy as the model is reasoning out the decision steps. The prompt below is an example of CoT prompting.

Solve the following problem step by step. Write out each reasoning step clearly and then provide the final answer.

ReAct Method

Some questions require reasoning, as well as gathering external information, such as current data or calculations. The Reason + Act (ReAct) prompt pattern enables the AI model to reason through the steps and decide whether to use a tool or request external information from the user. Adding the prompt given below to the actual prompt helps the AI model reason and ask for necessary details if needed, leading to a better and more precise output response.

If you need external or real-time data, ask me specific questions to obtain it, or you can use the available tools. Use my replies or the tool results to complete the reasoning and produce the final solution.

If asked about the current price of a stock, this prompt will prompt the AI model to search for the latest stock price using tools or ask the user directly.

Start Smarter Prompting Today

These practical prompting techniques will help guide the AI model to respond more effectively in our daily tasks. When these prompting techniques are combined with the 5C framework, they make the AI model a better assistant for us. Effective AI communication involves using the proper prompting technique in a given scenario. Start applying one prompt technique today, and you will notice how quickly the AI results improve.

Freedom Month Sale — Discounts That Set You Free!

  • Up to 80% OFF AWS Courses
  • Up to 30% OFF Microsoft Certs
  • Ends August 31
Act Fast!

About CloudThat

CloudThat is an award-winning company and the first in India to offer cloud training and consulting services worldwide. As a Microsoft Solutions Partner, AWS Advanced Tier Training Partner, and Google Cloud Platform Partner, CloudThat has empowered over 850,000 professionals through 600+ cloud certifications winning global recognition for its training excellence including 20 MCT Trainers in Microsoft’s Global Top 100 and an impressive 12 awards in the last 8 years. CloudThat specializes in Cloud Migration, Data Platforms, DevOps, IoT, and cutting-edge technologies like Gen AI & AI/ML. It has delivered over 500 consulting projects for 250+ organizations in 30+ countries as it continues to empower professionals and enterprises to thrive in the digital-first world.

WRITTEN BY Arun M

Arun M is a Senior Research Associate at CloudThat Technologies, specializing in artificial intelligence, machine learning, deep learning, computer vision, and embedded systems. With over 15 years of teaching and mentoring experience, he has helped students, early-career professionals and industry practitioners develop strong skills in AI, programming, data structures and embedded systems. He explains topics easily using simple real-life examples. Outside of work, he enjoys reading, music and traveling.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!