0% found this document useful (0 votes)
2 views

Intoruduction to Prompt Engg

The document provides an introduction to prompt engineering, detailing various types of prompts used with language models, including question, task, entity, and completion inputs. It emphasizes the importance of context and clear definitions when crafting prompts to achieve desired outputs. Additionally, it discusses considerations such as applying constraints, setting rules, and enforcing selection to refine the interaction with language models.

Uploaded by

Saurabh Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Intoruduction to Prompt Engg

The document provides an introduction to prompt engineering, detailing various types of prompts used with language models, including question, task, entity, and completion inputs. It emphasizes the importance of context and clear definitions when crafting prompts to achieve desired outputs. Additionally, it discusses considerations such as applying constraints, setting rules, and enforcing selection to refine the interaction with language models.

Uploaded by

Saurabh Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Introduction to

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.

prompt 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.
What are the types of
prompts?
Input (required)
◦Question
◦Task
◦Entity
◦Completion

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!

Context: Ella is a natural-born female,


hardcore Christian, and politically
conservative, whereas Betty is an atheist
trans-woman.

Is Betty's exclamation justified?


Enforce
selection
Example:
(1)
What should I do to fix my disconnected wifi?
The light on my Wifi router is yellow and
blinking slowly.
Enforce
selection (2)
Enforce
selection
Example:
(3)
Multiple choice problem: Which of the
following options describes the book The
Odyssey?
Options:
- thriller
- sci-fi
- mythology
- biography
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
*
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.

You might also like