You are currently viewing What You and Your Students Need to Know About AI Prompt Engineering

What You and Your Students Need to Know About AI Prompt Engineering

Instructors and students waste many hours struggling to get what they want out of an AI chatbot due to a lack of understanding of prompt engineering. With AI playing an increasingly important role in work, prompt engineering is one of the most important skills our students need when entering the job market today, yet it’s not one that most instructors teach. You could take Google’s six-hour prompt engineering course, but I’ll save you that time by providing the five-step process here.

Task

The first step to prompt engineering is giving the system a task. A task can be as simple as a question: “What are good Mother’s Day gifts for an 80-year-old woman?” But the real power of AI is in having it create something, such as “a 10-question self-test on students’ knowledge of the Roman empire” to open a class on the topic or “a simulation that guides students through the process of determining the genre of a painting.”

There are two things to add to the question or directive prompt to improve the results. The first is a persona for the system to adopt. This gives the system the information it needs to narrow the results to what you want. For instance, my wife and I are fairly serious bikers who, when in a new area, like to spend a day exploring it by bike. These rides could be 50 miles long. If we want to explore the San Francisco area on bike, we don’t just want a tour of the waterfront that an AI system might suggest to the average user. I want it thinking like a serious biker, like us. Thus, I would begin my AI query, “You are a serious biker who rides all over San Francisco and the surrounding area.” That would ensure that the system does not restrict itself to rides within the city. Similarly, if I were a geography teacher in Madison, Wisconsin, creating an AI tutor on class topics, I might include in my prompt, “You are a geography teacher in Madison, Wisconsin. Feel free to use examples from around the Madison area to illustrate your points.” That would tailor the results to my student demographic.

Second, you’ll often want to include instructions about the format of the output. People tend to default to text output, but AI can produce output in a variety of formats. For instance, if I’m creating a lesson on a certain type of bridge for a civil engineering class, I might want to have the system include images of that type of bridge from different angles. If I also want to compare the bridge type with others, I might ask the system to include a table comparing different bridge types in X, Y, and Z terms.

Context

Contextis information you add to help the system understand what you want, and many people say that it is the most important element of prompt engineering. For instance, I asked the Mother’s Day gift question about my own mother and included that “she lives alone in a retirement home in Detroit, loves reading, is a huge Green Bay Packers fan, and gets cold easily.” The system’s first recommendation was a heated blanket. For the geography AI tutor example, I might indicate in my prompt that “it is a high school course, so use analogies and nontechnical language that a high schooler would understand.” Remember that AI systems serve people from around the world, and so you can’t expect them to tailor their responses to your demographic, location, or other factors without the necessary information.

References

The third thing that is helpful for guiding AI systems is references, which are exemplars of what you want. If I really like the format of a particular lesson I found online, I can give the system that lesson as a file and tell it to use the same format for the lesson it creates. I can also give the system chat examples to help tailor the interaction. If I like how a particular chatbot interacted with me, I can copy that interaction and provide it to a system as an exemplar of how I want it to interact with students. If I ask a system to create images of students in a chemistry lab, and I find some good ones online, I can upload those with my prompt and tell the system to match their format. Much of what we learn is by example, and AI systems are built to learn from their users, so give them examples of what you want to improve the results.

Evaluation and iteration

Once you get the first result, you will evaluate it and then are likely to modify the results by iterating with more information. There are some basic iteration strategies that will more quickly get you what you want. One is breaking up your request into smaller sentences. It’s important to avoid complex sentences as they can confuse the AI. Instead, separate each element of the prompt into a short sentence without conditions to avoid confusing the system.

Another trick is to ask the system for a different type of output. For instance, if you are unhappy about the introduction it creates for a lesson, you can ask it to start with a story instead. A good lesson, after all, begins with a hook that captures students’ interest. For instance, our civil engineering instructor might tell a system to start a lesson with a story about a footbridge on campus that collapses, dropping students into a muddy creek, because it was designed wrong, then have the system describe the design problems in terms of the principles that the lesson will cover.

It can also be helpful to provide the system with constraints to narrow the focus. For instance, if you’re having it create a soundtrack to back a video you plan to use in a lesson, you might want to specify a genre, like country western, so the system doesn’t pick music (gangsta rap or death metal, say) that’s not right for the topic.

Once you get multiple iterations, you’ll want to be clear on which of those to build on with new requests. If the last iteration went in the wrong direction, then you’ll want to tell the system to use the prior iteration but modify it in X way to get it back on track. You also want to be clear on what you want to keep when iterating. If you want to keep some part of an output fixed in the next iteration, you need to say so, or it might change what you already like.

Another helpful iteration technique is the “tree of thought” rather than the linear method. Instead of asking for a new version, ask the system for five different outputs and pick the one you like the best to iterate on. Just as the military might put out a request for a new missile in hopes of getting multiple designs to choose from, you’ll often do better by asking for multiple options. Note that if you want to use this technique with media such as images or videos, you’ll normally need to use a dedicated AI media builder, like Leonardo.ai or Canva’s Dream Lab, because general AI systems like ChatGPT are usually too overloaded to do so. (Tech companies are budgeting literally trillions of dollars to building out AI capacity in the coming years, including for data centers in space, so the situation should eventually improve.)

Finally, a good way to have a heart-to-heart with the system is to ask it to explain its thinking, just as you might a student. Simply saying “explain your reasoning” after a result can reveal where it’s making assumptions that you want to fix or change how it is approaching the task.

When giving students an assignment that uses AI, make sure to provide them with the basics of prompt engineering and use the principles yourself to save time and produce better results.


John Orlando is a professor of philosophy at Colorado Technical University and an educational consultant who leads workshops for faculty on how to use AI and other technologies to improve their teaching: jorlando2001@gmail.com.

The post What You and Your Students Need to Know About AI Prompt Engineering appeared first on The Teaching Professor.