Introduction

Welcome to the first lesson of this course. In this lesson, we will explore how iterative prompting can enhance your interactions with language models. Iterative prompting is a technique that involves refining and improving the output of LLMs through multiple iterations. This approach is crucial for generating more accurate and relevant responses, especially when dealing with complex topics or tasks. By the end of this lesson, you will understand how to effectively use iterative prompting to achieve your desired outcomes.

Understanding Iterative Prompting

Iterative prompting is a process where you interact with an LLM by providing initial prompts and then refining the output through feedback and further prompts. This method allows you to guide the LLM towards more specific and accurate responses. The benefits of iterative prompting include improved specificity, alignment with desired outcomes, and the ability to refine ideas through multiple iterations.

For example, when preparing a quiz for a 5th-grade science class on "The Water Cycle," you might start with a broad prompt to brainstorm potential question topics. As you receive responses, you can provide feedback to narrow down the topics and make them more specific, ensuring they align with the quiz's format and objectives.

Initial Prompting Techniques

The initial prompt sets the foundation for the iterative process. It should be clear and concise, providing enough context for the LLM to generate relevant responses. Let's look at an example of an initial prompt:

Context:

I am preparing a quiz for my 5th grade science class. The topic is "The Water Cycle".

Ask:

Please brainstorm a list of possible question topics or angles I could use for this quiz.

In this example, the context is clearly defined, and the ask is straightforward. The LLM is prompted to generate a list of potential question topics related to "The Water Cycle." This initial prompt serves as the starting point for further refinement.

The Output Example

Here is an example of LLM's answer:

Certainly! Here are some possible question topics and angles you could use for your 5th grade science quiz on "The Water Cycle":

1. **Stages of the Water Cycle**: 
   - Describe the main stages of the water cycle.
   - What happens during evaporation, condensation, and precipitation?

2. **Processes and Definitions**:
   - Define evaporation and give an example.
   - What is condensation and where can you observe it in daily life?
   - Explain precipitation and list different forms it can take.

3. **Water Cycle Diagram**:
   - Label the parts of a water cycle diagram.
   - Identify the stage of the water cycle shown in a given diagram.

4. **Role of the Sun**:
   - How does the sun influence the water cycle?
   - Why is the sun important for evaporation?

... omitted for brevity

11. **Vocabulary Matching**:
    - Match terms like "evaporation," "condensation," "precipitation," and "transpiration" with their definitions.

12. **Critical Thinking**:
    - Why is the water cycle considered a "cycle"?
    - How does the water cycle connect with other Earth systems, like the carbon cycle?

These topics should help create a comprehensive and engaging quiz for your students.

It includes a lot of topics, and they are pretty broad.

Incorporating Feedback for Refinement

Once you receive the initial output from the LLM, it's essential to provide feedback to refine and improve the responses. Feedback helps the LLM understand your preferences and adjust its output accordingly. Let's see how feedback can be incorporated with the next message:

Here is my feedback on these topics:

- Let's avoid covering human impact
- This will be a quiz with answer options, so suggested topics must be more specific

Update your list based on this feedback

In this example, the feedback specifies that topics related to human impact should be avoided and that the topics need to be more specific to fit a quiz format with answer options. By providing this feedback, you guide the LLM to generate a more refined list of question topics.

Example of a Better Answer

Here is an example of the next LLM's answer:

Certainly! Here’s an updated list of more specific question topics for a multiple-choice quiz on "The Water Cycle," excluding human impact:

1. **Stages of the Water Cycle**:
   - Which stage of the water cycle involves water turning into vapor? 
     a) Condensation 
     b) Evaporation 
     c) Precipitation 
     d) Collection

2. **Processes and Definitions**:
   - What is the process called when water vapor cools and changes back into liquid droplets?
     a) Evaporation 
     b) Condensation 
     c) Precipitation 
     d) Transpiration

... omitted for brevity

Note that now LLM suggested specific questions. Also, it didn't include the human factor-related questions. However, LLM made a mistake: we asked for the list of topics, not the quiz questions themselves. A proper next step would be to point out this mistake and ask the LLM to answer again.

This way, you can continue improving the LLM's answers until you get a satisfying result.

Summary and Preparation for Practice

In this lesson, we explored the concept of iterative prompting and its role in enhancing interactions with LLMs. We discussed the importance of initial prompts, the incorporation of feedback, and various strategies for refining outputs. As you move on to the practice exercises, you'll have the opportunity to apply these techniques by crafting initial prompts and providing effective feedback for iteration. This hands-on practice will solidify your understanding of iterative prompting and prepare you for more complex interactions with LLMs.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal