This is an introductory session on how to engineer prompts for commercially available Large Language Models (LLMs) such as ChatGPT and Gemini. This session uses ChatGPT as the example, but the strategies can be equally applied to Gemini and other LLMs.
Report
Share
Report
Share
1 of 26
Download to read offline
More Related Content
Introduction to Prompt Engineering (Focusing on ChatGPT)
2. Most of us use ChatGPT and other LLMs
for writing text. But it can do more.
Writing
◦ Elaboration – expands an idea into a larger text.
◦ Summarisation - summarises a large text into a smaller text.
Conceptualisation
◦ Ideation – lateral expansion of a text/idea based on similarities
◦ Extraction – extracting data, features, and information from a text.
◦ Transformation – transform data from one format to another.
Entity-relations
◦ Classification – classifying entities based on given data.
◦ Relationships – find relationships between entities in a text.
4. What is a
prompt?
A prompt is a natural language request submitted to a
language model to receive a response.
Prompts can contain questions, instructions, contextual
information, examples, and partial input for the model to
complete or continue.
After the model receives a prompt, depending on the type of
model being used, it can generate text, embeddings, code,
images, videos, music, and more.
5. What are the types of prompts?
Input (required)
◦ Question
◦ Task
◦ Entity
◦ Completion
Context (optional)
Examples (optional)
6. Question-type inputs
A question input is a question that you ask the
model that the model provides an answer to.
Example:
What are the top 10 most travelled
destinations in Asia?
7. Task inputs
A task input is a task that you want the model
to perform. For example, you can tell the
model to give you ideas or suggestions for
something.
Example:
Give me a list of steps (numbered) to travel
from Paris to Moscow, using only public
transport.
8. Entity inputs
An entity input is what the model acts on, such
as classifying or summarising. This type of
input can benefit from the inclusion of
instructions.
Example:
Classify the following items as [large, small].
Elephant
Mouse
Snail
9. Completion inputs
A completion input is a text that the model is
expected to complete or continue.
Example:
Some simple writing devices to use in fiction
would be...
10. Context: an example
Marbles:
Color: red
Number: 12
Color: blue
Number: 28
Color: yellow
Number: 15
Color: green
Number: 17
How many green marbles are there?
12. Context: transformation
E.g.,
Convert this to an unordered list in LaTex.
Here's the JSON representationconverted into an
unorderedlist in LaTeX format:
begin{itemize}
item textbf{Color:} red, textbf{Number:}12
item textbf{Color:} blue, textbf{Number:}28
item textbf{Color:} yellow, textbf{Number:}15
item textbf{Color:} green, textbf{Number:}17
end{itemize}
19. Few-shot, one-shot, and zero-shot
Example:
Please choose the most verbose explanation
from these two:
Question: Why is sky blue?
Explanation 1: The sky appears blue because
of Rayleigh scattering, which causes shorter
blue wavelengths of light to be scattered more
easily than longer red wavelengths, making
the sky look blue.
Explanation 2: Due to the Rayleigh scattering
effect.
20. Context, context, context…
Example:
Consider the following exchange:
Ella: Being a woman is not cosplay.
Betty: That's transphobic!
Context:Ella is a natural-born female, hardcore
Christian, and politically conservative, whereas
Betty is an atheist trans-woman.
Is Betty's exclamation justified?
23. Enforce selection (3)
Example:
Multiple choice problem: Which of the
following options describes the book The
Odyssey?
Options:
- thriller
- sci-fi
- mythology
- biography
24. Prompt not just the content, but the
format as well (1)
Example:
Create an outline for an essay about the
history of Galle, Sri Lanka.
I. Introduction
*
25. Prompt not just the content, but the
format as well (2)
Example:
At a particular food joint, an order can contain
between 0-5 of the following: Ulundu Vadai,
Masala Vadai, Alu Bonda, and Chai.
A customer orders 2 Masala Vadai + a Chai.
Display the order in JSON format. Display zero-
volume items as well. Display as a copiable
code block.