K12 Prompt Engineering
- Education
Meagan Ali
What is Prompt Engineering
Prompt Engineering is designing your inputs for Artificial Intelligence (AI) to generate the desired responses. AI cannot think in the way humans do, so we must craft our requests (prompts) in a particular way for the AI to understand.
Chapter 1: Basics of Prompt Design
Crafting Clear and Concise Prompts
While writing your prompts, use clear and straightforward language. Avoid using ambiguous wording, as this can lead to confusion and affect the accuracy of the responses. Always keep it as simple as possible.
Provide Context
An important thing to remember is that the AI model cannot read your mind. It relies heavily on the information that you provide in your prompt. Could you write everything relevant to your request and include it at the beginning of your prompt? The more context the AI has, the better; this is necessary for an accurate and relevant response. If you’re having trouble creating the context for your request, remember the five W’s and how. Who is the target audience? What is the topic? Where will this information be applied? If relevant, when is the timeframe? Why is this information needed? How would you like the response written (simple, complex, bullet points, paragraphs, etc.)?
Defining Objectives and Goals
After providing sufficient context, tell the AI precisely what you want it to accomplish. Clearly outline the questions you want to be answered or requests that you want to be fulfilled. Give the AI as much detail as possible in this section. Consider breaking down larger requests into smaller, more manageable tasks. If the AI is asked for too much at once, there is a chance that the response won’t be as accurate or detailed as you want. Think of this as dividing a complex project into smaller segments.
Understanding Your Model's Capabilities and Limitations
While AI models can accomplish a lot, it is essential to acknowledge their limitations. They cannot provide information beyond what is available from their training data (information given to the AI model to reinforce its learning). When you write your prompts, please understand that the responses you are getting are generated from an existing knowledge base.
Chapter 2: Evaluating Prompt Effectiveness
Continuous Improvement Cycle
If the AI doesn’t respond as desired, try asking differently—experiment with providing more details and refining your techniques. Different language variations and prompt structures can also help you receive more sufficient answers. Tweak your prompts and then send them to the AI again and see how the responses change.
Feedback
Another way to improve the AI’s responses is to provide feedback, such as “good” or “bad.” Often, the input needs to be more detailed than just a single word; for example, “I wanted a longer response. Please add a few more sentences and make sure you answer the questions I asked you.” This will allow the AI to understand where it went wrong and improve how it answers your prompts. This is usually faster than tweaking the prompt each time. However, it can be slower and take multiple attempts to get the desired output.
Analyzing and Interpreting Model Outputs
Assess the output’s accuracy and relevance to your initial request. This can help you understand how the AI model interprets your prompts, allowing you to improve how you write them. Notice how the answer changes based on the details you provide and your word choice. Keep improving and analyzing until the output fits your needs.
Chapter 3: Prompt Engineering Examples
Original Prompt: Write a short story about a character discovering a mysterious portal in their backyard.
Improved Prompt: Write a one-paragraph short story, 4-5 sentences, about a young character discovering a mysterious green portal in their backyard.
Original Prompt: Explain the process of photosynthesis.
Improved Prompt: Explain the process of photosynthesis in a bullet point format separated by the different methods, explaining the importance of each step.