Activities: Learn Prompting
Basic programming techniques.
Designing effective prompts to instruct LLMS to generate a desired output is referred to as prompt engineering. This activity will guide you through the process of creating prompts for LLMs.
Prompting Guidelines
In this activity, you can explore various prompting guides for LLMs. They more or less all converge on the same set of techniques. You can then use these techniques to write your own prompts
OpenAI give a set of strategies for using their models.
These include:
- writing clear instructions
- providing reference texts
- splitting tasks into subtasks
- giving GPT ‘time to think’
- using external tools
Some general techniques are:
Numbered Steps:: For sequential tasks, use numbered steps. This helps the model understand the sequence of actions.
Use delimiters: To separate various parts of the prompt (e.g.
", `,,',|,#, …).Few-shot prompting: Provide a few examples for guidance.
Give the LLM a role: Make the model assume a role. For example, instruct the model to
act like a tutororyou are an expert programmer.Iterate and refine prompts: Often, you won’t get your desired result straight away. Improve your prompting strategy iteratively, and then once you are happy, choose your final prompt and use it in a new chat session.
Combining these techniques, a template prompt might look like this:
Remember to structure your prompt in a way that is clear and easy to understand. You can use markdown to format your prompt, and you instruct the mode to format its response using markdown.
Examples
Adopt a persona
Now let’s try a different persona:
Reference texts
Try asking a question that cannot be answered with the provided documents:
Structured output
You can also use prompts to instruct the model to produce structured output. For example, you can ask the model to give you a table.
Certainly! Here’s a table with Greek letters, their pronunciations, and examples of their usage:
| Greek Letter | Pronunciation | Example of Usage |
|---|---|---|
| α (Alpha) | AL-fuh | α particle, α decay in physics |
| β (Beta) | BAY-tuh | β sheet in biochemistry, β radiation |
| γ (Gamma) | GAM-uh | γ rays in physics, Γ function in mathematics |
| δ (Delta) | DEL-tuh | δ function in mathematics, Δ change in variables |
| ε (Epsilon) | EP-si-lon | ε in calculus for limits, ε-nets in computational geometry |
| θ (Theta) | THAY-tuh | θ angle in trigonometry, θ in spherical coordinates |
This table provides an introduction to some of the Greek letters, how they’re pronounced, and where they might commonly be found in scientific and mathematical contexts.
Exercises
- Write a prompt that will make ChatGPT or Copilot act as a writing critic.
You can use this as your starting point, and then iteratively improve it.
Your first step could be to translate this into German.
If you need an essay, you can use this one. There should be plenty to criticize.
- What role should the model assume?
- What is the task? Try to have the essay critiqued, and then ask for suggestions for improvement.
- Have the model provide an improved version of the essay.
- Instruct the model to show you the changes it made to the essay (you can use markdown to format the output).
- Instruct the model to list the changes it made to the essay in a table, and to explain why it made each change.
- Reflection: Did your prompting strategies work? What worked well? What didn’t work well?
Further Resources
- Explore these prompt guides. Use both/either ChatGPT and Copilot to try out new ideas.
Reuse
Citation
@online{ellis2024,
author = {Ellis, Andrew},
title = {Activities: {Learn} {Prompting}},
date = {2024-04-22},
url = {https://virtuelleakademie.github.io/promptly-literate/pages/activity-cas-hochschuldidaktik.html},
langid = {en}
}