0% found this document useful (0 votes)
2 views13 pages

Ai Module 2 Notes

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)
2 views13 pages

Ai Module 2 Notes

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 2

Prompting Engineering
Introduction to Prompt Engineering
What is Prompt Engineering?
Prompt Engineering is the discipline of designing and refining the input (the prompt) given to
a Large Language Model (LLM) to guide its behaviour and optimize its output toward a
desired result.
It involves strategically intertwining instructions, context, and examples into the LLM's vast
knowledge network—like "whispering ideas into the ear of a gifted artist" to ignite their
creative spark without overwhelming their distinct voice.
Why is Prompt Engineering Vital?
Prompt engineering is crucial because it allows users to unlock the full potential of LLMs and
gain greater control over their powerful capabilities.
 Realizing Full Potential: Prompts help LLMs reach beyond their pre-programmed
limits, enabling them to use their extensive knowledge for complex tasks they weren't
explicitly made for (e.g., authoring novels or musical compositions).
 Increasing Precision and Management: By carefully crafting prompts, users can direct
the LLM toward pertinent and factually correct outcomes, which is essential for
applications like news reporting or scientific research where accuracy is critical.
 Increasing Uniqueness and Creativity: Prompts can ignite an LLM’s imagination,
leading to novel, surprising results, and helping to develop creative solutions or new
works of art and entertainment.
 Democratizing AI: Clear, user-friendly prompts and interfaces make LLMs more easily
accessible to a greater spectrum of users, including those without deep technical
knowledge, empowering everyone to leverage AI for creative and productive efforts.

The Evolution of Prompt Engineering

Milestone Key Words

ELIZA Chabot, pattern-matching, prompt-based interaction

AI reasoning, natural language commands, constrained virtual


SHRDLU
environment

Mad Hatter Dialogue


open-ended, humorous conversation, less structured
Systems
Template-based Approaches user input, predefined templates, structured prompt engineering

Transformer architecture, Large Language Models (LLMs),


The Transformer Revolution
prominence of prompt engineering

advanced techniques, few-shot learning, Chain-of-Thought,


Adjusting and Refining LLMs
precise control

Types of Prompts
1. Natural Language Prompts
 Description: These prompts use human-like directions or clues, allowing for a natural,
conversational engagement with the model.
 Purpose: To give the model commands that mimic human speech and natural thought
flow.
2. System Prompts
 Description: These are pre-written guidelines or templates supplied by developers.
 Purpose: To give the model clear, organized instructions on its behavior or the
intended output format. They set the operational constraints for the model.
3. Conditional Prompts
 Description: These prompts subject the model to particular limitations or contexts.
 Structure: They are based on conditional statements such as "If X, then Y" or "Given
A, generate B."
 Purpose: Developers use them to direct the model's behaviour based on specific
prerequisites.

How Does Prompt Engineering Work?


Prompt engineering is an intricate and recursive process aimed at guiding Large Language
Models (LLMs) to produce desired outputs. While there's no one-size-fits-all method, prompt
engineers typically adhere to the following broad principles:
Principles for Effective Prompting
 Thorough Comprehension of the Task: Start by clearly defining your expectations for
the LLM and the sort of results you are seeking. This firm grasp of the assignment is
the foundation for developing a successful prompt.
 Precise and Succinct Terminology: Make your request clear and unambiguous to the
LLM. Use straightforward language and refrain from using technical or jargon terms.
 Give Details (Specificity): The more specific your prompt, the higher the likelihood the
LLM will produce a pertinent and educational response. For example, instead of asking
the LLM to "write a poem," ask it to "write a poem about a lost love."
 Give Instances (Examples): If possible, provide the LLM with samples of the desired
output. This helps the LLM better comprehend your goals and produce more precise
outcomes.
 Try Something Out (Experimentation): Prompt engineering is not a "one-size-fits-all"
approach. The most effective way to discover what functions is by experimenting with
various prompts and observing the results.
The Future of Prompt Engineering
The field is expected to evolve with several key developments:
 Emergence of Specialist Prompting Languages: Dedicated languages may be
developed to make creating efficient prompts more accessible and intuitive, similar to
how programming languages guide computers.
 Control and Explain ability: As LLMs grow more complex, there will be an emphasis
on understanding how prompts affect their results. Explainable AI approaches will
provide insight into the inner workings of prompt engineering.
 Ethical Considerations: It will be crucial to address issues of bias, justice, and
manipulation to ensure the ability to influence LLM behavior is used ethically and
responsibly.
The Role of Prompt Engineering in Communication
Prompt engineering is poised to fundamentally transform human contact by enhancing the
capabilities of Large Language Models (LLMs) in communication. It acts as the bridge between
human intent and the LLM's output, impacting how effectively, creatively, and ethically we
interact with and through these models.
Core Communication Enhancements
 Improving Specificity and Clarity:
o Prompts act as a "beacon of light," guiding the LLM toward succinct and
transparent communication.
o By providing context, defining goals, and identifying desired tones, prompts
help avoid misconceptions and ensure the intended audience understands the
message.
 Increasing Creativity and Engagement:
o Prompts help LLMs reach their creative potential, resulting in stimulating and
thought-provoking dialogue.
o For example, storytelling prompts can produce engrossing narratives, while
debate ideas can start thought-provoking conversations, opening new avenues
for creative expression.
 Adapting Communication to Different Contexts:
o Prompting allows the LLM’s communication style to be modified for various
situations.
o Focused prompts enable the LLM to handle subtleties like shifting between a
formal email, a casual chat message, or a persuasive argument with the
appropriate tone and strategy.
 Overcoming Linguistic Barriers:
o Prompt engineering enables LLMs to translate languages precisely and
naturally, promoting cross-cultural communication.
o By including cultural allusions, nuanced interpretations, and intended
meanings in prompts, language difficulties can be overcome more effectively.
Ethical Considerations
Despite its immense potential, the use of prompt engineering in communication carries
ethical responsibilities:
 Bias in Communication: Prompts with built-in biases may unintentionally lead to
discriminatory communication.
 Manipulation: Malicious techniques could be applied to manipulate the LLM's output.
Therefore, appropriate prompt design and use are essential to ensure moral and helpful
communication across all applications.

The Advantages of Prompt Engineering


Prompt engineering is an effective method for raising LLM performance. Prompt engineers
can assist LLMs in producing more precise, consistent, and imaginative results by carefully
constructing prompts.
Several applications could benefit from this, 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

The Future of LLM Communication


As Large Language Model (LLM) technology and prompt engineering techniques become
more sophisticated, we can anticipate revolutionary shifts in communication.
Anticipated Communication Shifts
 AI-Powered Negotiation Tools: Tools that assist in achieving win-win agreements.
 Real-Time Language Translation: Translation with sophisticated understanding of
nuance and context.
 Customized News Updates: Personalized updates based entirely on your individual
preferences.
Future Research & Development Avenues
The field of prompt engineering is dynamic, with continuous research aiming to delve deeper
into its possibilities. Prospective avenues for development include:
 Automated Methods for Generating Prompts: AI systems that can automatically
create effective prompts.
 Adaptive Prompts: Prompts that adjust based on user interactions and the ongoing
conversational context.
 Tackling Subtle Cues: Addressing issues associated with subtle cues for intricate
activities to achieve higher fidelity results.
Role of Prompt Engineering in AI System Improvement
Prompt engineering is a critical technique for improving AI models and consistently getting
the desired results. By using efficient prompts, developers can:
 Control Biases: Direct the model away from producing biased output.
 Direct AI Model Behavior: Precisely guide the model's actions and responses.
 Enhance Overall Dependability and Performance: Improve the reliability and
effectiveness of AI systems.
Ongoing research into prompt engineering methods and best practices will make ever more
advanced and contextually aware AI models possible as the area develops.
Introduction to Prompt Engineering Techniques for Chatgpt
Introduction to Prompt Engineering Techniques
Prompt Engineering: Involves strategically designing input (prompts) to direct the AI model's
text generation process.
Pivotal Role: Highlights the importance of this technique in ensuring AI models like ChatGPT
produce relevant, accurate, and high-quality text responses.
Examples of Prompt Engineering Techniques

Technique Description Example Prompt

A straightforward, direct instruction "Explain the process of


Standard
requesting a specific output or answer. photosynthesis in simple terms for
Prompt
This is the most basic form of prompting. a middle school student."

"Act as a professional financial


Instructing the model to adopt a specific
Role advisor. Explain the pros and cons
persona, role, or identity to influence the
Prompting of investing in index funds versus
style, tone, and depth of its response.
individual stocks."

Providing the model with a starting word


"The secret to making great
Seed-Word or phrase (the "seed") to initiate the text
homemade bread is..." (Model
Prompting generation process, guiding the content's
continues the explanation)
focus or structure.

Instructions Prompt Technique

To provide the model with specific rules, constraints, or guidelines to ensure the generated
text aligns with the desired objectives and requirements of the task.

Characteristics

 Guidance: It directly tells the model how to behave or what criteria its output must
meet.
 Alignment: It ensures the output meets standards like professionalism, accuracy,
legal compliance, or unbiased tone.
 Combinability: It can be used with other techniques (like Role Prompting or Seed-
Word Prompting) for enhanced precision and control.
Examples from the Text

Task Specific Instruction Provided Goal

Customer Steers the response toward


"Responses should be professional
Service professionalism and factual
and provide accurate information."
Response correctness.

"The document should be in


Legal Document Ensures the document adheres to
compliance with relevant laws and
Generation necessary legal standards.
regulations."

"The review should be unbiased Dictates the required tone and


Product Review
and informative." content quality.

Zero, One, and Few Shot Prompting


This approach is particularly valuable for tasks that require a specific format, style, or
structure that the model wouldn't know from a simple instruction alone. The number of
examples ("shots") determines the level of contextual guidance the model receives.
Zero Shot Prompting
Zero Shot Prompting is a technique where the model is asked to perform a task without being
given any prior examples or demonstration of the task within the prompt itself. It relies
entirely on the model's pre-existing knowledge learned during its initial training.
Characteristics
 No Examples: The prompt contains only the instruction or question, not any examples
of the desired input/output format.
 Relies on Generalization: It forces the model to use its inherent knowledge and
general understanding of the language and world.
 Flexibility & Creativity: Useful for open-ended interactions, exploring the model's
creativity, and testing its generalization capabilities.
Example:
Prompt: "Write a poem about nature."
Output: A poem generated by the model based on its general knowledge.
Limitation
Since the model has no specific examples to guide the desired format or style, Zero Shot
Prompting may sometimes result in responses that are less accurate or relevant than those
achieved with techniques that include examples, like One Shot or Few Shot Prompting
One Shot Prompting
One Shot Prompting is a technique that involves providing the model with one specific
example or instance relevant to the desired task, and then asking the model to complete a
new, similar task.
Characteristics
 Single Example: Only one complete input-output example is included in the prompt.
 Contextual Guidance: The single example serves to establish the desired format,
tone, or relationship between the input and the output.
 Generalization from Limited Data: It allows the model to produce accurate and
relevant responses even when the user has very limited examples available, leveraging
the model's ability to generalize from just one instance.
 Purpose: Useful for tasks that require a specific output format or style that a simple
instruction might not fully convey.
Example:
Prompt: "Summarize the following paragraph: 'The sun rises in the east and sets in the west.'"
Output: "The sun moves across the sky from east to west."
The text notes that the effectiveness can vary. For complex tasks or if the single example is
poor, the results may be less accurate. In such cases, Few Shot Prompting (using multiple
examples) may be necessary to improve the model's performance.
Few Shot Prompting
Few Shot Prompting is the prompt engineering technique that provides the model with a
small number of relevant examples (instances) of the desired input and output before asking
for the final answer.
Characteristics
 Multiple Examples: Uses two or more complete input-output examples within the
prompt.
 Superior Context: By offering several examples, it provides additional context and
guidance beyond what a single example (One Shot) or no examples (Zero Shot) can
offer.
 Pattern Recognition: It enables the model to better understand the nuances and
underlying patterns of the task, leading to more accurate and relevant responses.
 Optimized Performance: Generally produces the most reliable output for complex
tasks compared to the other "Shot" techniques, provided the examples are high-
quality and representative.
Example:
Prompt: "Write a product review based on these features: Battery life: 10 hours Camera: 12
MP Screen: 6.5 inches"
Output: A detailed product review based on the provided features
Optimization Note
The text emphasizes that success still depends on the quality and relevance of the examples.
Users may need to experiment with both the number and type of examples to achieve
optimal performance for a given task.
In summary, the "Shot" techniques represent a spectrum of contextual guidance:
1. Zero-Shot: Pure instruction.
2. One-Shot: Instruction + 1 Example (to set format).
3. Few-Shot: Instruction + Multiple Examples (to teach a pattern/nuance).

Self-Consistency Prompt Technique


The Self-Consistency Prompt is an advanced technique designed to ensure the generated text
remains coherent and logically consistent with specific foundational information throughout
a conversation or generation task.
To anchor the model's entire generation process to a set of pre-defined facts, statements, or
constraints, thereby forcing the output to adhere to a consistent narrative or body of
knowledge.
Characteristics
 Foundation of Facts: The prompt includes key information, statements, facts,
opinions, or constraints that must be maintained.
 Guides Coherence: It goes beyond simple task instruction by including specific
elements that guide the model to maintain consistency and coherence over
potentially multiple turns or paragraphs.

 Anchoring: It prevents the model from "drifting" away from established context or
generating contradictory information.

High Value: Crucial for situations where logical consistency is non-negotiable, such as
educational content, technical discussions, or decision-making processes.

Trade-off: Users must balance the level of detail. Too much or overly restrictive information
can limit the model's flexibility and creativity, leading to repetitive or unnatural responses.
The goal is sufficient guidance without over-constriction

Example:
Topic: Climate Change
Prompt: "Climate change is driven by human activity, particularly the burning of fossil fuels.
Scientists agree that the Earth's average temperature has risen by 1.1°C since the late 19th
century. Based on this scientific consensus, explain the impact of rising global temperatures
on ecosystems."
Generated Response: The model, guided by the self-consistency prompt, would provide an
answer that aligns with the scientific consensus and remains consistent with the data about
climate change

Prompts for Creative Thinking


Concepts and Goals
 Prompts as Catalysts: Prompts are explored as tools that ignite imagination and spark
innovative ideas.
 Essential Skill: Creative thinking is framed as an essential skill valuable across various
professional and personal domains.
 Mindset Cultivation: The chapter aims to guide readers toward a creative mindset
that embraces curiosity, ambiguity, and exploration.

Unlocking Imagination and Innovation


Strategies for cultivating an innovative culture:
 Encouraging Brainstorming: Making structured, creative idea generation a regular
practice.
 Embracing Failure: Viewing mistakes as learning opportunities rather than setbacks.
 Fostering Culture: Promoting an environment of curiosity and experimentation
where challenging conventional norms is accepted.
 Collaboration: Emphasizing cross-disciplinary teamwork, diversity, and inclusion.
 Growth Mindset: Advocating for continuous learning and adaptation to emerging
trends.
 Empowerment: Providing employees with clear goal-setting, autonomy, and
recognition for their innovative contributions.
Top 10 Prompts for Imagination & Innovation
These prompts are designed to be used in discussions, brainstorming sessions, or personal
reflection to stimulate creative exploration:
1. How can unlocking creativity lead to breakthrough innovations?
2. The impact of a creative mindset on problem-solving and innovation.
3. Strategies for cultivating a culture of innovation through imagination.
4. The role of play and experimentation in stimulating imagination for innovation.
5. Inspiring a sense of wonder to fuel creative thinking in the workplace.
6. Can education systems enhance or inhibit imagination and innovation?
7. How embracing failure can foster a culture of innovation through imagination.
8. Integrating technology to amplify creative thinking and innovation.
9. The importance of interdisciplinary collaboration in unlocking innovation.
10. The role of leadership in fostering a culture of imagination and innovation.

Prompts for Effective Writing


A valuable resource designed to enhance writing skills, foster creative expression, and
provide inspiration for anyone looking to improve their written communication.
 Importance of Writing: Emphasizing the power of words to convey ideas, evoke
emotions, and engage readers across various domains.
 Creative Spark & Overcoming Blocks: Offering prompts specifically designed to spark
creativity and help writers overcome writer's block.
 Skill Development: Providing prompts and strategies to develop essential narrative
skills, covering a wide range of genres (fiction, non-fiction, poetry, descriptive,
persuasive).
Igniting the Writing Process with Prompts
This segment is presented as a comprehensive guide and treasure trove of inspiration
focused on using strategic prompts to invigorate and streamline the writing journey.
Objectives
 Fuel Creativity: Offer prompts designed to spark imagination.
 Overcome Obstacles: Provide strategies to banish writer's block.
 Refine Skills: Craft prompts intended to refine storytelling and enhance expression.
 Empower Writers: Enable writers to navigate the process with confidence and clarity,
ultimately crafting compelling narratives and forging deeper connections with their
audience.
Types of Writing Prompts
 Creative Writing Prompts: These encourage imagination and creativity, making them
perfect for writers working on fiction, poetry, or storytelling.
 Descriptive Writing Prompts: These focus on developing skills to describe people,
places, or objects in detail, using sensory language.
 Problem-Solving Writing Prompts: These help you tackle challenges or work through
critical thinking in your writing, often resulting in analytical or proposal-based pieces.
 Reflective Writing Prompts: These encourage you to explore your thoughts,
experiences, and feelings, typically used for journals or personal essays.
 Persuasive Writing Prompts: These help you practice convincing readers of your
viewpoint on a particular issue, essential for arguments or editorials.
10 Sample Prompts for Creativity
The provided sample prompts encourage writers to engage with imaginative, philosophical,
and personal themes:
1. Explore the concept of time travel in a short story or essay.
2. Write about a character who discovers a hidden world within everyday objects.
3. Describe a day in the life of someone living on a different planet.
4. Use a photograph as inspiration to craft a short story or poem.
5. Write about a moment of serendipity that changes a character’s life.
6. Imagine a world where emotions are tangible and can be exchanged between people.
7. Create a story inspired by a vivid dream you’ve had recently.
8. Write a letter from your present self to your future self.
9. Craft a dialogue between two characters who communicate without speaking.
10. Explore the concept of a forbidden library with magical books.
These prompts are intended to be used as starting points to jumpstart the writing process
and inspire the exploration of new ideas and perspectives.
Benefits of Using Writing Prompts
Writing prompts are powerful tools that offer distinct advantages for writers at all levels.
1. Encourages Creativity
Prompts inspire new ideas and spark imagination, serving as a valuable starting point when
you don't know where to begin.
Example: The prompt, "Write about a character who discovers a hidden door in their house,"
immediately generates ideas about mystery and adventure.
2. Overcomes Writer's Block
When struggling to write, prompts provide a clear direction for your writing, helping you
break through mental blocks.
Example: The prompt, "Describe a place where you feel most at peace," helps you focus on
generating a peaceful scene even when stuck on general ideas.
3. Refines Storytelling Skills
Prompts encourage you to actively think about different characters, settings, and conflicts,
thus developing your overall storytelling skills.
Example: The prompt, "Write a dialogue between two people who have just met for the first
time," forces you to focus on creating authentic characters and conversation, improving
dialogue-writing.
4. Enhances Expression
Prompts push you to express yourself in new ways, refining your use of language whether
you are writing fiction, essays, or poetry.
Example: The prompt, "Write a poem about a rainy day," encourages the exploration of
descriptive and creative language.
5. Provides Clear Pathways for Writing
Prompts act as guides that lead you through the writing process, making it simpler to organize
your thoughts and ideas toward a final product.
Example: The prompt, "Write an essay arguing why online education is the future," helps you
structure your argument logically for the essay format.
6. Builds Confidence
Using prompts allows for regular practice and provides a clear starting point, enabling writers
to gain confidence in expressing their thoughts and ideas.
Example: Writing something personal like "Write a letter to your future self" can make you
more comfortable with expressing deeper thoughts.

You might also like