Prompt Engineering in 30 Seconds

Prompt Engineering in 30 Seconds

Category: Software
Tags: Problem Solving, Artificial Intelligence

At the most basic level, here is the bare minimum information you need to construct an effective prompt.

  • Who: Inform AI about the role it should take: a writer, a teacher, an interviewer, etc.
  • What: Be clear about the task you want to perform. This could be answering a question, writing text, or automating a task.
  • How: Give instructions on the manner in which AI should perform the task. Be as specific as you can.

That was about 30 seconds, right? But wait, aren't there a dozen prompt engineering techniques you can use? What about step-back prompting, chain-of-thought, and others?

The Fall of Prompt Engineering

What people today call Prompt Engineering is actually ideas and information.

The field of Prompt Engineering may potentially have a short-lived existence due to several factors:

  • With each passing day, AI chatbots are becoming increasingly proficient at answering questions. While certain prompting techniques may currently be more effective than others, continuous improvements in AI will lead to enhanced performance overall.
  • Companies such as OpenAI and Google are motivated to simplify the user experience and eliminate the need for customers to learn new prompting languages. They aim to streamline the adoption of AI products, making them as user-friendly as possible.
  • For instance, OpenAI recently introduced GPT Builders, which automate the process of constructing prompts and chatbots. This development suggests that prompt engineering will likely become obsolete in the near future.
  • The primary concern lies not in the structure of prompts, but rather in the amount and clarity of instruction provided to AI models. Large Language Models (LLMs) are built upon extensive training from natural language text. Consequently, the more information and context you provide, the more accurate the model’s responses will be.
  • Notably, there is no need to learn specific languages or techniques to effectively prompt AI systems. Since LLMs are grounded in human-written text, clarity in communication is crucial. Therefore, reframing the problem in a clear and concise manner is vital to obtain accurate answers. It is advisable to consider the questions you ask from the outset, retraining your brain to proactively address the desired information during your interactions with AI, much like when conversing with humans.

AI possesses significant potential, but it is not fully autonomous – not yet, at least. Its functionality begins with a prompt. In the field of Prompt Engineering, experts focus on determining the most effective methods of formulating questions for AI. However, this technology is still new and not completely understood, even by its creators.

You may have come across advertisements for "expert sets of 1,000 ChatGPT prompts", claiming that you are using ChatGPT incorrectly and missing out on these supposedly "special" prompts. In reality, there is nothing special about them. They are essentially just a compilation of ideas in the form of questions. Without a specific goal in mind, they can serve as a guide for brainstorming, but not much more.

Pre-packaged lists of prompt are unlikely to be of much assistance.

To leverage AI effectively, you must have a clear understanding of the problem you are trying to solve.

The prompts that you need should arise from identifying a specific need and including the who/what/how aspects noted at the beginning of this article.

However, this is not as simple as it seems. Do you truly understand the problem you are trying to solve or achieve? You need to be as specific as possible. In order to provide this detail, you need to have an understanding of what you want. This is the part where AI can only assist, not decide for you. This is why it is a human-AI collaboration.

The specific manner in which you ask questions to an AI is of lesser significance than comprehending the problem itself. This understanding enables you to effectively provide context and formulate relevant questions.

The importance of Who/What/How

Here are some examples of role-based prompts:

  • You are a world-class writer for a popular culture magazine. Write an article on (insert topic)
  • You are a job interviewer at Amazon. I will be a software engineer candidate. Ask me interview questions for the Software Development Engineer III position.

What is noteworthy about these prompts? They provide some specific instructions or context. The first prompt could have just said, you are a world-class writer. However, there are many types of writing. If the prompt did not include the reference to a pop-culture magazine, you might have gotten a literary work in the style of Charles Dickens.

The British writer C. S. Lewis was a versatile author, venturing into various genres throughout his career. While he is most renowned for his fantasy series The Chronicles of Narnia, it is worth noting that he also excelled in science fiction and penned the influential non-fiction work Mere Christianity. This particular book encompasses a powerful defense of the existence of God and explores our relationship with Him. It holds significant value as Lewis wrote it subsequent to his conversion back to Christianity following a period of atheism. When prompting an AI to assume the role of C. S. Lewis, providing this key background information becomes crucial in refining the AI’s understanding. Precision regarding the specific sub-genre you are interested in would be particularly helpful. The more context you provide, the better equipped the AI will be to accurately predict your intentions.

Likewise, in the second example, there are many types of interviews. An interview with a fashion magazine will be quite different than an interview at Amazon. These bits of information are far more important for the AI than the particular wording of the question. All of this reflects a problem that has existed for 40+ years.

The oldest problem in computer science

The problem of aligning human intent with computer performance has persisted since the early days of computing. Users often have a specific task or outcome in mind, but computers cannot comprehend thoughts directly (at least not yet). Without explicit instructions, computers lack the ability to discern our intentions. It is therefore imperative to explicitly communicate our ideas and concepts to achieve the desired results. Only by providing clear instructions can AI systems perform tasks precisely as envisioned.

Many of the techniques employed in prompting are aimed at addressing this fundamental challenge. They serve as methods to bridge the gap between human understanding and machine capabilities. By leveraging these techniques, we can effectively convey our intentions and improve the alignment between human expectations and AI performance.

Ok, now you understand the problem and are ready to ask AI some questions. Let's discuss a few helpful approaches.

One step at a time

For non-trivial problems, a step-by-step approach works best when conversing with an AI. In my book Rapid Software Engineering with ChatGPT, I use a similar step-by-step approach. Initial prompts are used to generate an overall software design. A top-down problem-solving approach is then used to incrementally build the software components. Follow-up prompts are used at each step. The generated code is continually incorporated into the overall software product. Testing and refinement occur all throughout the process. You will see this type of pattern used in almost any domain when problem-solving with AI.

A common misconception about AI is you only need to ask it for the one thing you want. If people don’t get what they are expecting, they may stop. They may think AI is just a novelty. It is true that AI can’t do everything all at once, but it is getting better each day. At the moment, AI has context limitations. It can only remember so much at a given time. It can only take in so much information at once. Likewise, AI gives you shorter, sometimes incomplete answers right now.

All of this is perfectly fine, as long as you understand that you solve problems over a series of prompts. Iteration is used to refine the output until it meets our requirements. Initial responses may not be exactly what you are looking for. You need to refine and iterate on your prompts. You can build on the model’s responses to guide it in the desired direction.

For example, you may start with the prompt, “Can you explain the basics of climate change?” Whether you agree with the premise of climate change or not, you can ask AI for relevant studies that show any measurable changes in the climate. You can follow that up by asking for details and studies that discuss the relationship between human activities and any claimed changes in the climate.

Note that bias can still exist in an AI. You should use multiple AI chatbots to get multiple viewpoints. Notably, Elon Musk has marketed Grok, X’s AI chatbot, as having a different viewpoint or bias from other AI products.

Iterative, step back, and guided thinking prompting

The Iterative Prompting technique involves gradually refining and clarifying prompts based on the responses received. By incrementally guiding the conversation, users can effectively shape the chatbot’s understanding of their queries and preferences. This iterative approach helps users to receive more accurate and tailored information. An example of this is as follows:

    User: I’m interested in learning about space exploration.
    Chatbot: Space exploration involves the use of astronomy and space technologies to explore outer space. It encompasses both hu- man and robotic missions, satellite launches, and scientific research about celestial bodies.
    User: Tell me more about robotic missions in space exploration.
    Chatbot: Robotic missions are unmanned spacecraft designed to explore space. They can include orbiters, landers, and rovers. For instance, the Mars rovers like Spirit and Opportunity were sent to explore the Martian surface and conduct experiments.
    User: Can you provide details on the Mars rover Opportunity?

You continue asking questions until you get to the answers you need or the requisite level of understanding.

The opposite approach is called Step back prompting. You will likely alternate between these two techniques. Iterative prompting is used to dive into the detail. Step back prompting allows you to generalize or zoom out to see the bigger picture. Instead of a detailed question, you use a more open-ended question. Instead of asking "Thomas Edison was born in what country?", you can ask "What is Thomas Edison’s personal history?"

Note that AI can help automate each of these techniques. If you are using ChatGPT, you can create your own GPT Builder to automate this process. The builder instructions can include the following:

    You are an expert at world knowledge. 
    Your task is to step back and paraphrase a question to a more generic step-back question.

Another useful technique is Guided Thinking Prompting. The main idea is that you ask the AI to break down the overall process into steps. You can then follow exactly what is going on as the AI is "thinking". You can also guide the problem-solving methodology over a series of prompts.

Structure your interaction with AI by providing specific instructions or cues to guide the thought process. You lead the conversation by offering explicit directives or steps for the AI to follow. This shapes the direction and content of the responses. For example, the following problem allows you to use the Guided Thinking technique.

Consider a garden with the following features:

  • A rectangular flower bed with dimensions 5 meters by 8 meters.
  • Two circular ponds with a radius of 3 meters each.
  • A triangular grassy area with a base of 6 meters and a height of 4 meters.

Calculate the total area of the garden by finding the individual areas of each component and summing them up.

A prompt to start on this problem is as follows:

    List the steps used to calculate the total area of the garden as defined by
    (provide the detail on the geometry of the garden)

Make sure you understand the algorithm that it provides. You can ask it to change or modify the algorithm as needed. If everything looks good (and this is a very simple example, so it should), you can then use a follow-up prompt.

    Apply this approach to the garden problem above.

Here is what you might get.

AI Geometry Answer

ChatGPT's solution for the garden problem Provide an example in your prompts A helpful prompting technique is one-shot prompting. Each "shot" is an example. If you can provide more than one example, it is called few-shot prompting. If you don’t provide any examples at all, this is called zero-shot prompting. Extending the geometry class scenario, you can provide an example to give the AI a better idea of what you are looking for. This can help you come up with a second class project.

Consider a scenario where you want AI to assist you with writing. You don’t want the text to sound dry, and you certainly don’t want it to sound like it was written by AI. Thus, you include your own writing sample in the prompt. The AI can learn your writing style, even from a single example (a one shot approach). The resulting text will be written closer to your personal writing style.

A Brainstorming Prompt Example

Consider a scenario where you are a high-school math teacher responsible for teaching a geometry class. However, your students appear disengaged and uninterested. They often seem bored and struggle to pay attention during lessons. It is evident that they fail to recognize the practical value of the subject matter, choosing instead to focus on activities such as using their phones, socializing with friends, or even dozing off. As an enthusiastic educator who truly appreciates the topic, you are determined to instill your students with the same level of passion and conviction. Ultimately, you aspire for them to grasp the benefits that geometry can offer, empowering them to become well-rounded individuals.

In order to address this problem, you login to ChatGPT or your favorite AI chatbot and use the following prompt.

    As an expert coach on math education, provide a list of 5 potential solutions to address
    the problem of teaching geometry to my high school students so that it is not boring,
    but engaging and useful in their lives. For each potential solution,
    provide actionable steps that I can take.

Examine the three elements of this prompt.

  1. Who: The AI is taking the role of an expert coach, specifically in math education.
  2. What: The prompt asks for 5 potential solutions to teaching geometry in an engaging and useful way.
  3. How: Instruction is given to provide actionable steps, rather than philosophical approaches.

For brevity, here is just the first high-level idea ChatGPT provided.

    Certainly! Making geometry engaging for high school students requires creativity and a focus on real-world applications.
    Here are five potential solutions along with actionable steps:

    1. Real-World Applications:
    * Identify practical examples of geometry in everyday life, such as architecture, art, and design.
    * Incorporate field trips or virtual tours to places where geometry is evident, like museums or construction sites.
    * Assign projects that require students to apply geometric concepts in real-world scenarios, such as designing a building or creating geometric art.

At a high level, this idea is decent, as are other four (interactive technology, project-based learning, incorporate storytelling, and gamification). Emphasizing the real-world applications of geometry is crucial to demonstrate its relevance and dispel any notion that it is a futile endeavor. Utilizing gamification as a means to generate interest and engagement among students is also a promising approach. However, before embarking on project-based learning or incorporating storytelling, it is essential to capture students’ attention and pique their curiosity.

Now, let’s delve further into the concept of real-world applications and flush out more details on how to integrate real-life examples into the lesson. Specifically, how would you showcase the practicality of geometry skills in scenarios such as architecture, navigation, or even personal finance? By elaborating on this aspect, we can gain a better understanding of your teaching plan and its potential impact on students’ comprehension and appreciation of the subject.

Below is a follow-up prompt on real-world applications. It asks for more detail, and echoes back some of the examples given in the initial response. This is done to provide the specific context we care about.

    Provide more detail with three specific project examples that apply geometric concepts 
    in real-world scenarios, such as designing a building or creating geometric art.

Here is one of the detailed ideas provided by ChatGPT in response to this prompt.

Designing a Sustainable Eco-Friendly Building: In this project, students will delve into the world of architecture and sustainable design by creating a blueprint for an eco-friendly building. They will apply geometric principles such as symmetry, proportion, and spatial relationships to design a structure that maximizes natural light, minimizes energy consumption, and incorporates renewable resources. Students can explore the use of geometric shapes in architectural elements, such as incorporating triangles for stability or utilizing circular designs for efficient space usage. Additionally, they can calculate areas and volumes to optimize the building’s functionality. This project not only reinforces geometric concepts but also instills an understanding of the practical applications of math in creating a sustainable environment.

This seems like a cool idea! We could definitely create a lesson plan and a specific assignment based on this. This idea allows students to use their creativity in designing a building layout. They are required to consider the use of geometric shapes in their design. They need to perform area calculations based on that geometry. The design also requires students to consider topical concepts such as the sustainable nature of the structure.

After teaching a lecture on the fundamental principles, students could work on this project, either individually or in pairs. They could present their ideas to the class. Thus, we ended up with project-based learning even though we initially dismissed the idea.

The Curiosity Rule

The key to solving any problem is to ask questions relentlessly. While humans get tired of this, AI chatbots do not. In our next article, we take a deep dive into the art of reframing the problem to ask the right questions.


5 star reviews on Amazon

"The author provides a pathway to using the new Artificial Intelligence tools (with specific examples) to approach and systematically frame and achieve solutions."



5 star reviews on Amazon

"The author provides a pathway to using the new Artificial Intelligence tools (with specific examples) to approach and systematically frame and achieve solutions."