How to write an AI prompt – an instruction you give to an AI so it can respond with ‘generated’ answers or images.
Prompting guide for text generation
How to design prompts for Copilot
Since answers from Microsoft Copilot are essentially ‘generated’ based on your input prompts, in order to get back precise answers, we need to tailor effective prompts.
The techniques of designing effective prompts in a certain pattern is called “prompt engineering”.
The prompt formula
A formula for designing prompts for large language model (LLM)-based generative AIs is:
“persona + context + task + format + exemplar + tone”
This formula gives us an easy-to-follow structure when designing our prompts. Here we can break the formula down to three parts:
Mandatory to have: Task
Important to have: Context & Exemplar
Nice to have: Persona, Format, & Tone
This prompt builder website (hosted by Leopold Zhou) can help us structure prompts using the formula.
Tips to get better responses
- Include a specific length of output
- Make the inclusion and exclusion rule explicit. For example:
- Inclusion rule (say, you want to receive in-depth discussion in the response from AI): Do include [Analysis, synthesis, comparisons, etc, in the response.]
- Exclusion rule: Do not include [things that should be excluded]; such as evidence that has not been peer reviewed.
- Request references when theories, arguments, concepts are involved.
- Always include multiple distinct sources in your response. Use Precise mode to improve accuracy.
- Add to your prompt to change the format of the response, for example: “Organise responses to flow well, not by source or by citation. Ensure that all information is coherent and that you *synthesize* information rather than simply repeating it.”
If you are not happy with the output, experiment with your prompts to adjust the output.
How to design inclusive prompts
An important aspect of using Gen AI is inclusiveness. AI systems are trained on massive datasets, which can inherit biases or lack diversity. However, by carefully structuring our prompts, we can minimise these risks.
Here are key terms to incorporate when crafting your prompt:
- …using inclusive language…
- …in a gender-neutral and inclusive tone…
- Use unbiased content…
- Use “Everyone,” “All learners,” “Multiple perspectives” to acknowledge the diversity in your classroom and encourage considering different viewpoints.
Examples of inclusive prompts
- Traditional prompt (less inclusive): Write a short essay about the causes of the American Civil War.
More inclusive prompt: Explore the different factors that led to the outbreak of the American Civil War. Consider the perspectives of various groups, including the North, the South, and enslaved people. How did these differing viewpoints contribute to the conflict? - Traditional prompt (less inclusive): Explain the benefits of vaccinations and why they are important for public health.
More inclusive prompt: Explain the benefits of vaccinations and why they are important for public health. Consider the needs and concerns of diverse communities. Communicate this information in a clear, accessible, and culturally sensitive way. - Traditional prompt (less inclusive): Write a short essay about the causes of the American Civil War.
More inclusive prompt: Explore the different factors that led to the outbreak of the American Civil War. Consider the perspectives of various groups, including the North, the South, and enslaved people. How did these differing viewpoints contribute to the conflict? - Traditional prompt (less inclusive): Explain the benefits of vaccinations and why they are important for public health.
More inclusive prompt: Explain the benefits of vaccinations and why they are important for public health. Consider the needs and concerns of diverse communities. Communicate this information in a clear, accessible, and culturally sensitive way.
Prompting guide for image generation
A framework is developed to assist in creating prompts for image generation. Based on some initial testing, the framework can be helpful for DALL-E, Adobe Firefly, MidJourney, and Stable Diffusion.
Content prompts
Category | Examples |
---|---|
Character | 1 girl, solo, long hair, jewelry, blue gemstone, earrings, horns, crown, cyan satin strapless dress, white veil, neck ring, red hair, {green eyes) |
Scene | indoor, room, house, sofa, wooden floor, plant, flowers, trees, windows |
Environment | day, morning, sunlight, dappled sunlight, backlight, light rays, cloudy sky |
Angle of View | full body, wide angle shot, depth of field |
Other “Styles” | light particles, fantasy, wind blow, maple leaf, dusty |
Standardisation prompts
Category | Examples |
---|---|
Quality Control | {{masterpiece}}, {best quality}, {highres), original, reflection, unreal engine, body shadow, extremely detailed CG unity 8k wallpaper |
Style Control | (illustration), (painting), (sketch), anime coloring, fantasy |
Other requirements | exaggerated body proportions, greasy skin, realistic and delicate facial features |
More about AI prompting
For a technical, deeper dive into the underlying mechanisms of AI prompting – to understand how these “prompts” work – we recommend reading the following paper and video:
- The paper explains the transformer model, which is what GPT is based on – in fact, GPT stands for “General Pre-trained Transformer”.
Vaswani, Ashish, et al. Attention Is All You Need. arXiv:1706.03762, arXiv, 1 Aug. 2023. arXiv.org e-Print archive , Attention Is All You Need . - This video Attention mechanism: Overview presents the attention mechanism with illustrative visuals. The video shows you how the response is “generated” as a kind of “completion” of your prompts (hence the name “Generative AI”!).
In fact, we can build a GPT from scratch (Let’s build GPT: from scratch, in code, spelled out.).