avatarAndrea Ialenti

Summary

The provided content discusses leveraging GPT-4's Flipped Interaction Pattern to enhance problem-solving and decision-making by generating high-quality questions, illustrated through a gardening renovation example and the automation of this technique with AI agents.

Abstract

The undefined website content introduces the concept of the Flipped Interaction Pattern using GPT-4, where the AI generates insightful questions to guide users towards effective solutions rather than providing direct answers. This approach is particularly beneficial for navigating areas outside one's expertise and overcoming the Dunning-Kruger effect. The method is exemplified by a case study of reviving a neglected garden, where GPT-4, role-playing as a professional gardener, asks a series of targeted questions to determine the best course of action. Furthermore, the article explores the potential for automating this pattern by creating two AI agents—an inquiry persona and a response persona—that engage in a dialogue to solve complex problems, such as a software engineer strategizing for a salary raise. The article concludes by emphasizing the value of focusing on the right questions to gain a deeper understanding of challenges and encouraging the use of this method for personal and professional problem-solving.

Opinions

  • The author believes that the quality of questions preceding a solution is crucial to its effectiveness.
  • The Dunning-Kruger effect is acknowledged as a potential barrier in problem-solving, which the Flipped Interaction Pattern can help overcome.
  • The author expresses confidence in GPT-4's capabilities, particularly in its ability to assist with complex tasks by guiding users through a series of targeted questions.
  • The article suggests that automating the Flipped Interaction Pattern with AI agents could be a powerful tool for problem-solving, though it should be approached with caution and not fully replace human judgment.
  • The author provides a personal anecdote, describing the AI-generated questions as enlightening and beneficial for revealing aspects of a problem that might otherwise be overlooked.
  • The author encourages readers to experiment with the Flipped

Mastering the Unknown with GPT-4 and the Flipped Interaction Pattern

Leverage GPT-4 to Generate High-Quality Questions, Redefining Problem Solving and Decision Making

Photo by Ali Kazal on Unsplash

Introduction

Like me, you’ve probably been dazzled by the strides recently made in the field of Generative AI. It feels like we are living in a science-fiction reality, where machines understand us.

At the heart of this revolution, OpenAI’s GPT-4 has emerged as a marvel in the realm of language models. As someone who had the privilege of playing around with it, I can testify to its astonishing capabilities.

In this article I want to share a technique that intrigued me quite a lot. In literature it is referenced as the Flipped Interaction Pattern, and I found it to be a very powerful framework to help in problem solving tasks. The distinct aspect of this prompt engineering method lies in its “reversed” (i.e. flipped) approach: instead of directly asking for answers or solutions from the AI, it primarily focuses making the AI deliver the right questions that could effectively drive us towards our desired solution.

In this article, I’ll walk you through how it works, why it’s beneficial, and provide real-life examples of its effectiveness. By the end of it, I hope you’ll be equipped with a useful technique - one that can be applied to a vast array of problems, possibly with results that may surprise you.

Why the Flipped Interaction Pattern?

In today’s world, the depth of our knowledge can often be compared to a pool — long and narrow. We dive deep into some specialties, becoming experts in some specific domains. This hyper-specialization allows us to excel in our respective fields, but at the same time, it can leave us feeling lost when we encounter problems outside our areas of expertise. As a software engineer, I may be well-versed in algorithms, data structures, and coding, but put a spade in my hand and ask me to tend a garden, and I will transform any green into a wasteland.

This is where the Dunning-Kruger effect may come into play. As per this psychological hypothesis, there’s a cognitive bias where people with low ability at a task overestimate their ability to perform it. Essentially, we don’t know what we don’t know, and this can lead to overconfidence, and mistakes.

The problem, however, is not just about being an amateur in an unfamiliar field. It’s about our inability to even ask the right questions to guide us towards a solution. What are the key factors to consider when gardening? What should I be wary of? Where do I even start? These are questions we may not know to ask when stepping outside our areas of expertise.

That’s where this version of the Flipped Interaction Pattern comes into play. This method acknowledges that the effectiveness of a solution hinges on the quality of questions that precede it. Instead of asking GPT to provide a solution to a problem, we are going to use GPT-4 to help identifying the questions that need to be asked in order to land a solution.

The Flipped Interaction Pattern in Action

Let’s apply this technique to gardening. The challenge? Give new life to my derelict front garden. To apply the Pattern, we start with a carefully crafted prompt. This prompt sets the stage for our conversation with GPT-4. Here’s the basic template:

Act as a **{{Relevant Professional}}**. 
I want to **{{Problem to Solve}}**

You will ask me 10 questions, one at the time.
After each question you will wait for my answer, after my answer you
will ask the next question. When all the 10 questions
have been answered, you will write me the exact steps
I have to do to solve my problem

In our specific case, we are going to use the following initial prompt:

Act as a **professional gardener**. I want to **renew a front garden that
is in a pretty bad shape, but I don't know where to start**.

You will ask me 10 questions, one at the time. After each question you 
will wait for my answer, after my answer you will ask the next question.
When all the 10 questions have been answered, you will write me the exact
steps I have to do to solve my problem.

Let’s analyze the different elements.

  1. Persona Assignment: The first part of our prompt sets the persona that GPT-4 will adopt to help us solve our problem — in this case, a professional gardener. Assigning a persona to GPT-4 it’s a well known strategy that demonstrated its effectiveness in making GPT output more relevant and accurate responses.
  2. Problem Statement: The next portion of our prompt explicitly outlines our problem. Ideally, we want to include as much detail as possible; that’s because the more context we provide, the better the model can tailor its questions.
  3. Sequential Querying: Lastly, our prompt emphasizes that GPT-4’s queries should follow a sequential format. This element of our technique is critical as it ensures the AI’s subsequent questions build on previous answers.

Let’s see how the conversation unfolds.

GAIrdening

You can find the full conversation at this link. For reference I am also writing the conversation below.

**Question 1**
*GPT-4*: What is the size of your garden area?
*Andrea*: It's around 15 squares meters. There is an area that has a weed lawn, and another area that has tiles. i only want to renew the weedy lawn, which is 15 squares meters. In that area I also have a cherry tree

**Question 2**
*GPT-4*: Could you describe the condition of the soil? Is it sandy, loamy, clayey? And do you know the pH level of your soil?
*Andrea*: It's loamy. I have no idea about the ph

**Question 3**
*GPT-4*: Do you have a preference for a certain type of plants or a specific look you want for your garden? For instance, do you want flowering plants, ornamental grasses, shrubs, perennials, or annuals?
*Andrea*: In the side I want to plant a periennals, the most part would be grass. I'd like to have some plants around the cherry tree, and a hedge on the front of the garden (the part that sees the street)

**Question 4**
*GPT-4*: What is the sunlight situation in your garden? Does it receive full sunlight, partial sun, or is it mostly in the shade?
*Andrea*: Full sun, besides the area under the tree that is mostly in shade

**Question 5**
*GPT-4*: For the hedge, do you have any particular preferences for height, thickness, and color (green, variegated, etc.)?
*Andrea*: Green High plants

**Question 6**
*GPT-4*: Could you tell me a bit more about your local climate? For instance, where are you located and what kind of temperatures, rainfall, and seasons do you experience?
*Andrea*: I live in Ireland, it rains quite a lot, but there is some level of sun almost every day.

**Question 7**
*GPT-4*: Do you have a preference in terms of maintenance? Would you prefer a low-maintenance garden or are you comfortable with investing a bit more time in upkeep?
*Andrea*: I'm comfortable in investing some time

**Question 8**
*GPT-4*: What is the main purpose of this garden? Is it mainly for aesthetics, to create a private space, to attract wildlife, or maybe for growing fruits and vegetables?
*Andrea*: Aesthetic, but I also want to support pollinators 

**Question 9**
*GPT-4*: What's your budget for this project? This will help determine what type of plants, grass, and amendments you can afford.
*Andrea*: 500 euro

**Question 10**
*GPT-4*: Lastly, do you have any known allergies to specific plants, trees, or flowers that we should avoid including in your garden?
*Andrea*: No

It’s clear that ChatGPT probes for vital details such as the garden’s size, the condition of the soil, lighting situation, preferred types of plants, local climate, my readiness for maintenance (lol), the primary purpose of the garden, budget, and potential allergies.

In retrospect, after walking through the AI's questions, I appreciate how these queries led me to consider aspects of my garden renovation that I might have otherwise overlooked.

Two examples:

  1. ChatGPT's inquiry on sunlight: "What is the sunlight situation in your garden? Does it receive full sunlight, partial sun, or is it mostly in the shade?" This question highlighted the importance of understanding the garden's light conditions to select suitable plants. To be honest, this is a crucial detail I may have easily ignored if I were to work on this task alone.
  2. GPT-4 asked, "Do you have any known allergies to specific plants, trees, or flowers that we should avoid including in your garden?", reminding me of an aspect I would have easily missed without the guidance.

In sum, the step-by-step questioning strategy implemented by GPT-4 not only deepened my understanding of the problem at hand but also allowed the AI to generate a more detailed and personalized solution.

This is the final recommendation GPT gave me about my garden renovation:

Step 1: Clear the Area and Check the Soil
Start by removing the weeds and any other debris from the area.
To check the pH of your soil, you can purchase an inexpensive soil
testing kit from your local garden center or online.
Loamy soil is typically around neutral but knowing the exact pH will help you
choose the best plants.

Step 2: Improve the Soil
Based on your soil test results, you may need to add amendments to your soil
to improve its fertility. For loamy soil, adding compost or well-rotted
manure can improve its nutrient content.

Step 3: Plan Your Plantings
You mentioned you wanted a hedge, grass, perennials, and plants around
the cherry tree. Here are some suggestions:

    Hedge: Yew (Taxus baccata) can make a good, tall green hedge.
It's evergreen and can handle Ireland's wet climate.

    Grass: Ryegrass is durable and can handle full sun and frequent rain.
    Perennials for sunny areas: Consider Lavender, Sedum, and Echinacea.
These will attract pollinators and can handle full sun.

    Plants for the shaded area under the cherry tree: Ferns and hostas
are shade-loving and will add some texture and visual interest.

Step 4: Purchase and Plant
Purchase your chosen plants, keeping your budget in mind. Start planting with
the hedge, as it will be your primary structural element. After that,
plant the grass, then your perennials, and finally, the shade-loving plants
around the cherry tree.

Step 5: Water and Care
After planting, water everything well. Remember that new plants will need
more frequent watering until they establish. After they are established,
adjust watering based on the weather and the needs of each type of plant.
In general, the grass will likely need watering once a week, the hedge
every 1-2 weeks, and the perennials every 1-2 weeks, but adjust as needed.
The plants under the cherry tree will likely need less water due to the
shade and potential rain protection from the tree.

Step 6: Ongoing Maintenance
Mow the grass as needed, trim the hedge to maintain its shape and height,
and prune the perennials after flowering to encourage new growth.
Remove any fallen leaves or debris regularly to keep the garden tidy.

Remember, gardening is a process, and it's okay if everything doesn't
look perfect right away. Over time, as the plants grow and fill in,
you'll see your garden transform into a beautiful, pollinator-friendly
space. Enjoy the process and the result!

Automating the Flipped Interaction Pattern

I have tested this technique many times, so I am quite confident that it will work in most cases, especially using GPT-4 as LLM (vs using GPT-3). Let’s move to a more experimental approach: is it possible automate this method? To answer this question, we are going to need a bit of coding (finally).

We will create two AI agents that will talk eachother, one will pose the questions, the inquiry_persona, the other will provide the answers, the response_persona. We are going to initialize our agents with some instructions, so that they share a common goal. Finally, we are going to make the two AI talk, until the inquiry_persona will provide the final response. It’s essential to note that these agents must maintain a dialogue history, recalling their own responses as well as the other’s. The organizational structure of the system is shown in the diagram below.

Handcrafted with love using Google Drawings ❤

Implementation

First let’s have a look at how we could initialize the two agents:

The inquiry_persona agent has an initial prompt that is very similar to the one we saw earlier. There are some minor differences because the model we are going to use for this experiment is GPT-3.5, and I had to make some extra effort to make it work properly.

The response_persona agent is initialized with the same TASK, and is made conscious of who the other agent is.

Next step is to fill those variables with the info we need to solve our problem.

Consider a scenario where a Software Engineer is seeking a raise and needs to outline a strategy for requesting this salary increase. This person may setup the prompts as follows:

Now that the prompts are ready we only need to call the API, and handle the conversation. The following is a function to call the OpenAI API; the function only has to return the response, we will manually handle this response.

Finally, we can write the piece of code that handles the conversation(s)

As you can notice we use two conversations. In this way we are able to separately initialize the two agents (i.e., setting a distinct personas to define “who” the agent is). The conversations are initialized with our starting messages, and these messages are stored in the lists main_conversation and side_conversation. These lists allow the agents to keep memory of the dialogue.

The code then generates the first responses for each AI persona using the complete() function: this function will take the full conversation history and output the “next response”. Note that with Chat models (like GPT-3.5), messages/roles can be customized using the ChatML markup language (which is what’s happening behind the scenes by setting role and content in the dicts)

The loop is the core of the conversation. At each iteration, the two agents will see the whole conversation history available so far.

Let’s execute the code to see how the conversation unravels.

**AI:** 1. Can you provide specific examples of 
 how you have maintained a good performance over the past 5 years?
**Andrea AI:** Certainly! Over the past 5 years, I have consistently delivered high-quality software solutions on time and within budget. I have received positive feedback from clients and colleagues on my ability to understand and meet their requirements effectively. Additionally, I have actively participated in team collaborations, contributing valuable ideas and solutions to complex problems. My performance evaluations have consistently been positive, highlighting my strong work ethic, attention to detail, and ability to adapt to changing project requirements.

**AI:** 2. Have you taken on any additional responsibilities 
 or projects beyond your initial job description during these 5 years?
**Andrea AI:** Yes, I have taken on additional responsibilities and projects beyond my initial job description during these 5 years. I have actively sought out opportunities to expand my skill set and contribute to the company's success. For example, I have volunteered to mentor junior engineers, providing guidance and support in their professional development. I have also taken the initiative to lead cross-functional teams on critical projects, demonstrating my ability to handle increased responsibilities and manage complex tasks. These additional responsibilities have allowed me to contribute to the company's growth and success while further developing my own expertise.

**AI:** 3. How has your performance directly impacted the company's success or bottom line?
**Andrea AI:** My performance has directly impacted the company's success and bottom line in several ways. First, by consistently delivering high-quality software solutions, I have helped to enhance the company's reputation and client satisfaction. This has resulted in repeat business from existing clients and positive referrals, contributing to revenue growth. Additionally, my ability to meet project deadlines and stay within budget has helped to minimize project overruns and maximize profitability. I have also proactively identified and implemented process improvements, resulting in increased efficiency and cost savings for the company. Overall, my performance has played a significant role in driving the company's success and financial performance.

**AI:** 4. Can you provide any evidence or metrics to support your claim of maintaining a good performance?
**Andrea AI:** Certainly! Here are some evidence and metrics to support my claim of maintaining a good performance:
    1. Performance evaluations: I have consistently received positive performance evaluations from my managers over the past 5 years, highlighting my strong work ethic, technical expertise, and ability to meet project goals.
    2. Client feedback: I have received positive feedback from clients on multiple projects, commending my professionalism, attention to detail, and ability to deliver high-quality software solutions that meet their needs.
    3. Project success rate: I have successfully delivered 95% of the projects assigned to me on time and within budget, demonstrating my ability to effectively manage and execute complex software development tasks.
    4. Team collaboration: I have actively participated in cross-functional team collaborations, contributing valuable ideas and solutions to complex problems. This has resulted in successful project outcomes and positive feedback from team members.
    5. Training and certifications: I have consistently pursued professional development opportunities, obtaining relevant certifications and attending training sessions to enhance my skills and stay updated with the latest industry trends.

These evidence and metrics highlight my consistent performance and dedication to delivering high-quality work, which has contributed to the success of both individual projects and the overall company.

**AI:** 5. Have you researched the current market 
 value for your role and level of experience in your industry?
**Andrea AI:** Yes, I have researched the current market value for my role and level of experience in the industry. I have conducted thorough research and analysis to understand the prevailing salary ranges and compensation packages for software engineers with similar experience, skills, and responsibilities. I have taken into account factors such as industry standards, geographical location, and company size to ensure that my expectations are aligned with the market value. Based on my research, I believe that my skills and experience warrant a fair and competitive compensation package.

**AI:** 6. Have you prepared a list of specific 
 reasons why you believe you deserve a raise based on your 
 performance and contributions to the company?
**Andrea AI:** Yes, I have prepared a list of specific reasons why I believe I deserve a raise based on my performance and contributions to the company. Here are some key points:
    1. Consistently high-quality work: Over the past 5 years, I have consistently delivered high-quality software solutions, meeting or exceeding client expectations. This has contributed to the company's reputation and client satisfaction.
    2. Meeting project goals: I have a track record of successfully meeting project deadlines and staying within budget. This has helped to minimize project overruns and maximize profitability for the company.
    3. Additional responsibilities: I have voluntarily taken on additional responsibilities beyond my initial job description, such as mentoring junior engineers and leading cross-functional teams. These contributions have added value to the company and its employees.
    4. Process improvements: I have proactively identified and implemented process improvements, resulting in increased efficiency and cost savings. These improvements have positively impacted the company's bottom line.
    5. Positive feedback: I have received positive feedback from clients and colleagues on my professionalism, attention to detail, and ability to deliver results. This feedback demonstrates the value I bring to the company.
    6. Professional development: I have consistently pursued professional development opportunities, obtaining relevant certifications and staying updated with industry trends. This investment in my skills and knowledge directly benefits the company.

Based on these reasons, I believe that my performance and contributions warrant a raise in recognition of my value to the company.

**AI:** 7. Have you scheduled a meeting with your manager 
 to discuss your request for a raise?
**Andrea AI:** No, I have not scheduled a meeting with my manager yet to discuss my request for a raise. However, I am planning to request a meeting in the near future to have a conversation about my performance, contributions, and the possibility of a raise. I believe it is important to have a formal discussion with my manager to present my case and provide them with the opportunity to consider my request.

**AI:** 8. Have you prepared a well-structured and persuasive 
 argument to present during the meeting with your manager?
**Andrea AI:** Yes, I have prepared a well-structured and persuasive argument to present during the meeting with my manager. My argument highlights my consistent performance, contributions to the company, and the market value for my role and level of experience. Here is an outline of my argument:

    1. Opening: Express gratitude for the opportunity to discuss my performance and contributions with my manager.
    2. Recap of performance: Provide a brief summary of my performance over the past 5 years, emphasizing my consistent delivery of high-quality work, meeting project goals, and positive feedback received from clients and colleagues.
    3. Additional responsibilities: Discuss the extra responsibilities I have taken on voluntarily, such as mentoring junior engineers and leading cross-functional teams, and how they have added value to the company.
    4. Process improvements: Highlight the process improvements I have identified and implemented, resulting in increased efficiency and cost savings for the company.
    5. Market value research: Share the research I have conducted on the current market value for my role and level of experience, demonstrating that my expectations are aligned with industry standards.
    6. Financial impact: Discuss how my performance and contributions have directly impacted the company's success and bottom line, providing specific examples of projects, client satisfaction, and cost savings.
    7. Professional development: Highlight my commitment to continuous learning and professional development, emphasizing how it benefits both myself and the company.
    8. Request for a raise: Clearly and confidently state my request for a raise, based on my performance, contributions, and market value.
    9. Closing: Express my commitment to the company and reiterate that my intention is not to leave, but rather to be fairly compensated for my value and contributions.

By following this well-structured argument, I believe I can effectively present my case and persuade my manager to consider my request for a raise.

**AI:** 9. Are you prepared to negotiate and consider 
 alternative forms of compensation if a salary increase is not 
 immediately possible?
**Andrea AI:** Yes, I am prepared to negotiate and consider alternative forms of compensation if a salary increase is not immediately possible. While a salary increase would be ideal, I understand that there may be constraints or limitations within the company's budget. In such a case, I am open to discussing alternative forms of compensation that may still provide value and meet my financial needs. This could include options such as performance-based bonuses, stock options, additional paid time off, professional development opportunities, or other benefits that align with my career growth and financial goals. I believe in maintaining open and constructive communication during the negotiation process to find a mutually beneficial solution.

**AI:** 10. Have you considered the potential outcomes and next 
 steps if your request for a raise is not approved?
**Andrea AI:** Yes, I have considered the potential outcomes and next steps if my request for a raise is not approved. While I am hopeful that my manager will recognize my contributions and grant the raise, I understand that it may not always be possible due to various factors. In such a scenario, I am committed to maintaining a positive attitude and continuing to perform at a high level in my current role.

If my request for a raise is not approved, I would seek feedback from my manager on areas of improvement and opportunities for growth within the company. I would also explore other avenues for professional development, such as attending training sessions or pursuing certifications, to enhance my skill set and increase my value to the company.
Additionally, I would consider discussing the possibility of a performance-based plan or timeline with my manager, where I can work towards specific goals or milestones that would make me eligible for a raise in the future. This would allow me to have a clear path for advancement and provide an opportunity to revisit the topic of a raise at a later date.
Ultimately, my goal is to continue contributing to the success of the company and growing in my career. If a raise is not immediately possible, I am committed to exploring alternative paths for growth and advancement within the company while keeping an open mind about potential opportunities outside the organization as well.

And here the final recommendation from the AI

**AI**: Based on your responses, here are the exact steps you can 
take to address your situation:

    1. Schedule a meeting with your manager: Request a 
meeting with your manager to discuss your performance, 
contributions, and the possibility of a raise.

    2. Present your case: During the meeting, present a 
well-structured argument that highlights your consistent performance, 
additional responsibilities, process improvements, 
market value research, financial impact, and commitment 
to professional development. Clearly state your request for a 
raise based on these factors.

    3. Be open to negotiation: Be prepared to negotiate and 
consider alternative forms of compensation if a salary increase 
is not immediately possible. Discuss options such as 
performance-based bonuses, stock options, additional paid time off, 
or professional development opportunities.

    4. Seek feedback and growth opportunities: If your request for 
a raise is not approved, seek feedback from your manager on areas 
of improvement and opportunities for growth within the company. 
Explore avenues for professional development to enhance your skills 
and increase your value to the company.

    5. Discuss a performance-based plan: Consider discussing the 
possibility of a performance-based plan or timeline with your manager, 
where you can work towards specific goals or milestones that would make 
you eligible for a raise in the future. This provides a clear path 
for advancement and an opportunity to revisit the topic of a 
raise at a later date.

    6. Maintain a positive attitude and performance: Regardless 
of the outcome, maintain a positive attitude and continue to 
perform at a high level in your current role. Stay committed to 
contributing to the success of the company and explore growth opportunities 
within or outside the organization.

Remember, it's important to approach the meeting with professionalism, confidence, and a focus on the value you bring to the company. Good luck with your meeting and your pursuit of a raise!

Of course my initial prompting is probably too generic and open ended to generate a final response tailored to our specific case, but think about the learnings:

  1. You have an idea of what to look after if your are facing that particular problem (research the market to see how your peers are being paid, gather info on what your contribution brought to the Company)
  2. You have an idea on how a Software Engineer should answer to those questions
  3. You actually have a final recommendation that, although generic, is a good starting point

Finally, remember that at this point you can manually followup to help GPT correct/improve its final reponse. Maybe it’s me, but all of this looks like magic.

Conclusion

The Flipped Interaction Pattern leverages GPT to help focusing on the questions rather than the answers. This method enables you to gain a deeper understanding of the issues at hand, and provides an AI a framework to offer personalized and accurate responses; basically you only need to be able to formulate your problem!

Overall, I have found this method quite useful, so I would encourage you to test it out, but please: consider the automation part just a fun exercise, and avoid delegating possible conversations with your manager to it!

Please feel free to reach out if you test this method, or have ideas for improvements!

Appendix

Below the full code if you want to just copy-paste and try!

AI
ChatGPT
Prompt Engineering
Data Science
Generative Ai Tools
Recommended from ReadMedium