0% found this document useful (0 votes)
5 views8 pages

Module - 4

Module 4 introduces Prompt Engineering, detailing its evolution, types, and its role in enhancing communication with large language models (LLMs). It emphasizes the importance of crafting effective prompts to guide LLM outputs, improve accuracy, and foster creativity. The module also discusses ethical considerations and the advantages of prompt engineering in various applications, including chatbots and creative writing.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

Module - 4

Module 4 introduces Prompt Engineering, detailing its evolution, types, and its role in enhancing communication with large language models (LLMs). It emphasizes the importance of crafting effective prompts to guide LLM outputs, improve accuracy, and foster creativity. The module also discusses ethical considerations and the advantages of prompt engineering in various applications, including chatbots and creative writing.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 4- Introduction to Prompt Engineering

DAYANANDA SAGAR COLLEGE OF ENGINEERING


Shavige Malleshwara Hills, Kumaraswamy Layout, Bengaluru-560078
(An Autonomous Institution affiliated to VTU, Belagavi)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


Module - 4
Syllabus Content: Introduction to Prompt Engineering: Introduction to Prompt Engineering, The Evolution
of Prompt Engineering, Types of Prompts, How Does Prompt Engineering Work?, Comprehending Prompt
Engineering's Function in Communication, The Advantages of Prompt Engineering.

Referring Textbook: Ajantha Devi Vairamani and Anand Nayyar, Prompt Engineering: Empowering
Communication, 1st Edition

Notes:
5.1 What is Prompt Engineering? Consider an LLM as a huge, intricate network of creativity and
information. The goal of prompt engineering is to intertwine instructions and information into this web in a
way that gently nudges the LLM toward the intended result.

A prompt is the query, directive, or example given to an LLM. It establishes the background, clarifies the
assignment, and provides the LLM answer framework. Prompts are input instructions or cues that influence
the model’s reaction to AI models. These prompts can be presented as conditional restrictions, system-
defined instructions, or instructions in natural language.
We can adjust the language, provide particulars, and apply different strategies to make the LLM’s output
creative, convincing, educational, or anything else we desire.

Prompts are input instructions or cues that influence the model’s reaction to AI models. These prompts can
be presented as conditional restrictions, system-defined instructions, or instructions in natural language.

● A brief passage of text known as a prompt serves as a roadmap for an LLM’s answer. It might be as
straightforward as one sentence or as intricate as several clauses and directives.

DSCE Page 1
Module 4- Introduction to Prompt Engineering

Fig. 1 Prompt input

● The purpose of a prompt is to give the LLM just enough details to compred the question asked of it and to
produce an insightful and pertinent response.

Fig. 2 Components of Prompt


Through the provision of unambiguous and explicit cues, developers can direct the behavior of the model
and impact the output produced.

5.2 The Evolution of Prompt Engineering


Although prompt engineering is a relatively new topic, its origins can be found in the early stages of artificial
intelligence. Let’s go back in time and examine how this fascinating art form has changed over the years:

1.2.1 Antecedents
ELIZA (1966) [1]: Many people believe that Joseph Weizenbaum’s chatbot, ELIZA, is the original instance
of what can be referred to as basic prompt engineering. ELIZA imitated therapeutic discussion by deftly

DSCE Page 2
Module 4- Introduction to Prompt Engineering

adjusting keywords and patterns in user input, setting the stage for dialogue systems to come.

In the 1970s, Terry Winograd [2] developed SHRDLU, a natural language system that was mostly dependent
on human orders and instructions. SHRDLU could reason about blocks in a virtual environment.
This demonstrated how language may direct AI behavior in particular situations.

1.2.2 Early Emergence


Mad Hatter dialogue systems (1990s) [3]: These systems, such as Jabberwacky and ALICE, placed a strong
emphasis on the use of hilarious responses and open-ended questions, pushing the limits of natural language
interaction and opening the door for more inventive uses of prompts.

Template-based approaches [4]: In the 2000s, systems such as Madalyn and Galatea gained popularity. These
systems used user-provided data to fill in predefined templates and slots to generate stories. The groundwork
for organized prompting methods was therefore established.

1.2.3 The Rise of Large Language Models


The Transformer revolution (2017) [5]: With the introduction of the Transformer architecture, NLP
underwent a revolution that produced some of the most potent LLMs ever, like GPT-3 and Jurassic-1 Jumbo.
These models made prompt engineering shine because of their enormous knowledge bases and capacity to
produce writing that is of human caliber.

Adjusting and adjusting (2020s) [6]: Modern times are marked by quick progress in optimizing LLMs for
certain activities and enabling prompt based context adaptation. Even more sophisticated control of LLM
outputs is possible with the use of techniques like few-shot learning and conditional generation.

5.3 Types of Prompts


The following are various types of prompts:
● Natural Language Prompts: These prompts mimic human-like directions, offering direction in the form
of clues found in natural language. They make it possible for developers to engage with the model more
naturally by providing commands that mimic human speech.

● System Prompts: These are pre-written guidelines or templates that developers supply to direct the output
of the model. They give the model clear instructions on how to express the intended output format or behavior
in an organized manner.

DSCE Page 3
Module 4- Introduction to Prompt Engineering

● Conditional Prompts: Conditional prompts [7] entail subjecting the model to particular limitations or
contexts. Developers can direct the behavior of the model by implementing conditional prompts, which are
based on conditional statements like “If X, then Y” or “Given A, generate B.”

5.4 How Does Prompt Engineering Work?


The process of prompt engineering is intricate and recursive. The optimal strategy will differ based on the
particular LLM and the work at hand; there is no one-size-fits-all method for developing effective prompts.
Nonetheless, prompt engineers might adhere to the following broad principles:

Begin with a thorough comprehension of the task. What are your expectations for the LLM? What sort of
results are you seeking? After you have a firm grasp of the assignment, you can begin to develop a prompt
that will assist the LLM in accomplishing your objectives.

● Make your terminology precise [8] and succinct. There should be no doubt in the LLM’s understanding of
your request. Make use of straightforward language and refrain from using technical or jargon terms.

● Give details [9]. The likelihood that the LLM will produce a pertinent and educational response increases
with the level of specificity in your prompt. To get the LLM to “write a poem,” for instance, you may ask it
to “write a poem about a lost love.”

● Give instances. Give the LLM samples of the kind of output you are hoping to achieve, if at all feasible.
This will make it easier for the LLM to comprehend your goals and produce more precise outcomes.

● Try something out. Prompt engineering [10] cannot be approached in a one-size-fits-all manner.
Experimenting with various prompts and seeing the outcomes is the most effective approach to discovering
what functions.
The field of quick engineering has a bright future ahead of it. What to anticipate is: The emergence of
specialist prompting languages: Just as computers are guided by programming languages, creating efficient
prompts may
become even more accessible and intuitive with the help of specialized prompting languages.
Pay close attention to control and explainability. As LLMs get more complicated, it will be important to
know how prompts affect their results. Explainable AI approaches will provide insight into prompt
engineering’s inner workings.

DSCE Page 4
Module 4- Introduction to Prompt Engineering

Ethical considerations: Using the ability to influence LLM behaviour ethically is a duty. It will be crucial to
address problems with bias, justice, and manipulation if rapid engineering is to be developed responsibly.

5.5 Comprehending Prompt Engineering’s Function in Communication

Human contact is fundamentally based on communication, and quick engineering has the potential to
completely transform communication as LLMs become more and more common. Now let’s explore the
intriguing interaction between these two domains:

Improving Specificity and Clarity: Prompts can serve as beacons of light, pointing the LLM in the direction
of succinct and transparent communication. We may avoid misconceptions and make sure the
intended audience understands the LLM’s message by giving context, defining goals, and identifying desired
tones.

Increasing Creativity and Engagement: Prompts can help the LLM reach their creative potential, resulting
in stimulating and thought-provoking dialogue. Debate ideas can start thought-provoking conversations, but
storytelling prompts can produce engrossing stories. This creates opportunities for creative expression and
new kinds of communication.

Adapting Communication to Different Contexts: The LLM’s communication style can be modified by
prompts to meet a variety of situations. A persuasive argument, a casual chat message, or a formal email all
need a different tone and strategy. Creating focused questions enables the LLM to handle these subtleties
with ease. Overcoming Linguistic Barriers: By empowering LLMs to translate languages precisely and
naturally, prompt engineering can promote cross cultural communication. Language difficulties can be
overcome with more ease and effectiveness when prompts are used to provide cultural allusions, nuanced
interpretations, and intended meanings.

Ethical Issues: Despite the enormous potential of prompt engineering in communication, ethical issues need
to be taken into account. Prompts with built-in biases may cause discriminatory communication and
manipulation techniques may be applied maliciously. Appropriate prompt design and use are essential to
ensuring moral and helpful communication.

DSCE Page 5
Module 4- Introduction to Prompt Engineering

5.6 The Advantages of Prompt Engineering


One effective method for raising LLM performance is prompt engineering. Prompt engineers can assist
LLMs in producing more precise, consistent, and imaginative results by carefully constructing prompts.
Several uses
or this could be advantageous, including:

● Question answering: By using prompt engineering, LLMs can respond to factual queries with greater
accuracy.

● Creative writing: LLMs can produce more imaginative and captivating material, including stories, poetry,
and scripts, by using prompt engineering.

● Machine translation: The precision of LLMs’ language translations can be increased through prompt
engineering.

● Coding: LLMs can produce more precise and effective code by using prompt engineering.

Fig. 3 Question answering

DSCE Page 6
Module 4- Introduction to Prompt Engineering

Fig. 4 Coding

Application: Chatbots for Customer Support

1. Introduction to Prompt Engineering – Chatbots use prompt engineering to generate accurate and
helpful responses when interacting with customers.
2. The Evolution of Prompt Engineering – Early chatbots relied on simple keyword-based replies, but
with modern prompt engineering, they now provide context-aware, human-like responses.
3. Types of Prompts –
o Instruction Prompts → “Reset my password.”
o Zero-shot Prompts → Chatbot handles queries without prior examples.
o Few-shot Prompts → Uses examples to improve accuracy in responses.
o Conversational Prompts → Maintains flow in multi-turn customer conversations.
4. How Does Prompt Engineering Work? – The chatbot processes user input, applies well-structured
prompts to guide the AI model, and generates precise answers tailored to customer queries.
5. Comprehending Prompt Engineering’s Function in Communication – Effective prompts ensure that
chatbot responses are clear, polite, and aligned with the company’s communication style, improving
customer satisfaction.
6. The Advantages of Prompt Engineering –
o Increases accuracy of chatbot replies.
o Reduces customer wait time.
o Provides consistent and scalable support 24/7.
o Enhances personalization by adapting to different customer needs.

DSCE Page 7
Module 4- Introduction to Prompt Engineering

DSCE Page 8

You might also like