Intoruduction to Prompt Engg
Intoruduction to Prompt Engg
Prompt
Engineering
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.
Part I: Introduction
to Prompts
A prompt is a natural language request submitted to a
language model to receive a response.
Prompts can contain questions, instructions, contextual
What information, examples, and partial input for the model to
is a complete or continue.
Context (optional)
Examples (optional)
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?
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.
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
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...
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?
Context:
transformation
E.g.,
Transform this data into JSON format.
Context:
transformation
E.g.,
Convert this to an unordered list in
Here's the JSON representation converted into
an
unordered list in LaTeX format:
LaTex.
\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}
Part II: General
Considerations
Clear definition of
the
Example:
task
Give me a paragraph arguing that Large
Language Models can help humans discover
new, unseen connections.
Applying
constraints
Example:
This paragraph was a bit too long. Give me a
50-word paragraph.
Setting
rules
Example:
Expand the above paragraph to a 100-word
paragraph. The word "inevitable" must be
there. Mark that word with a bold text.
Setting the
tone
Example:
Rewrite the same paragraph in a playful tone.
Define the
format
Example:
Transform the same to a bullet list. Preserve
the tone.
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.
Context, context,
context…
Example:
Consider the following exchange:
Ella: Being a woman is not cosplay.
Betty: That's transphobic!