Module2 Notes
Module2 Notes
MODULE 2 — NOTES
PART A
Introduction to Prompt Engineering
Modules: Overview · Evolution · Types · How It Works · Communication · Advantages · Future
Before diving into Prompt Engineering, it is essential to understand the three key terms that form its foundation.
These are often used interchangeably but are distinct concepts that sit in a nested relationship with each other.
Artificial Intelligence is the broad field of computer science that aims to build
machines capable of performing tasks that would normally require human
AI
intelligence — such as learning, reasoning, problem-solving, perception, and
language understanding. AI is the umbrella term under which all other concepts sit.
India-Relevant Examples (2026): Google Maps routing (AI) · ChatGPT answering queries (LLM) · Sarvam AI
writing in Hindi/Kannada (GenAI) · Krutrim by Ola — India's own LLM · Bhashini — Government NLP for 22
Indian languages.
A prompt is the input instruction, question, command, or example that you give to
Prompt an AI model to guide it toward producing a specific, desired output. It is the
primary communication channel between a human and an LLM.
Key Principle
The quality of an AI's output is directly proportional to the quality of the prompt. A vague prompt
produces a vague answer. A specific, well-crafted prompt produces a precise, useful answer. This is the
core motivation for Prompt Engineering.
Prompt Engineering did not emerge overnight. It evolved over six decades of research in natural language
processing, human-computer interaction, and machine learning. Understanding this evolution helps us appreciate
why modern prompting techniques work the way they do.
Year /
Milestone Description Significance for Prompting
Era
1966 ELIZA (Joseph First natural language chatbot. Used Earliest form of prompt-response
Weizenbaum, MIT) simple pattern-matching rules (ELIZA interaction. Showed that humans
effect) to simulate a therapist naturally anthropomorphise text-
conversation. based systems.
1970s SHRDLU (Terry An NLP system that could interpret Demonstrated that structured,
Winograd, Stanford) English commands to manipulate specific instructions (early prompts)
objects in a virtual 'blocks world'. produce reliable AI behaviour.
Could reason about spatial Specificity matters.
relationships.
1980s–90s Expert Systems & Rule-based AI systems using IF- Template-based prompting
ALICE / Jabberwacky THEN logic. ALICE used AIML emerged. Conditional logic in
scripts for open-ended conversation. prompts was first explored at scale.
Jabberwacky learned from interaction.
2000s Statistical NLP & Models like Madalyn and Galatea Foundation for structured prompt
Template Approaches used user input to fill predefined engineering. Proved that anchoring
templates. IBM's Watson used AI to known templates improves
structured queries to win Jeopardy accuracy.
(2011).
2017 Transformer Vaswani et al. (Google) introduced Made large-scale language models
Architecture the Transformer model — using self- feasible. Without Transformers,
('Attention is All You attention mechanisms instead of modern LLMs like GPT-4 would
Need') RNNs. Revolutionary shift in NLP. not exist. Prompt engineering
became meaningful.
2020 GPT-3 (OpenAI, OpenAI's GPT-3 demonstrated Few-Shot and Zero-Shot Prompting
175B parameters) remarkable few-shot and zero-shot were formally established as
capabilities — performing tasks from techniques. 'Prompt Engineering' as
brief prompt examples alone. a discipline was born.
2023–24 GPT-4, Gemini, Multimodal LLMs (text + image + Prompt techniques diversified:
Claude, Llama, audio). Open-source models (Llama 3, chain-of-thought, tree-of-thought,
Mistral Mistral) democratised access. India's self-consistency, RAG-based
Sarvam AI and Krutrim launched. prompting.
2025–26 Agentic AI & AI Agents use dynamic, multi-step Prompt Engineering evolves from
Autonomous prompts to take actions independently craft to science. Self-generating
Prompting (browsing, coding, booking). Auto- prompts, adaptive prompts, and
prompt generation systems emerged. agent orchestration are frontier
areas.
3. Types of Prompts
Prompts can be classified based on how they are written and the role they play in guiding the AI's behaviour. There
are three primary types, each serving a distinct purpose in different contexts.
Natural Language Prompts are written in plain, everyday human language. They are conversational and intuitive,
designed to mimic how a person would naturally ask a question or give an instruction. These are the most common
type of prompts used by everyday users.
AI Output: Photosynthesis is the process by which plants use sunlight, water, and carbon dioxide to produce
glucose and oxygen. It occurs primarily in the chloroplasts of plant cells...
Prompt: Explain the importance of the Ganga river to Indian civilization in simple language.
AI Output: The Ganga (Ganges) is India's most sacred and historically significant river. It originates from the
Gangotri glacier in the Himalayas and flows 2,525 km through northern India...
Best Used For: Quick questions, explanations, summaries, creative writing, casual chat assistants, educational
Q&A tools.
Limitation: Vague natural language prompts often produce generic, unfocused outputs. The more specific your
natural language, the better the result.
System Prompts are pre-written instructions or templates that define the AI model's behaviour, persona, tone,
format, and constraints before any user interaction begins. They are used by developers and businesses to configure
the AI for a specific use case.
Characteristics: Written once and applied consistently · Define the AI's role (persona) · Set rules the AI must
follow throughout the conversation · Often invisible to end users in deployed products.
Prompt: You are a formal customer service agent for HDFC Bank. Always respond in professional English.
Never share any account details, OTP, or passwords. If the user appears distressed, offer to connect them to a
human agent.
AI Output: User asks: How do I reset my UPI PIN? → AI responds professionally with bank-safe steps,
never mentioning sensitive account data.
Prompt: You are an academic assistant for VTU Belagavi students. Answer only questions related to VTU
curriculum, exams, and academic rules. Always cite the relevant VTU circular or regulation when possible.
Keep answers under 150 words.
AI Output: User asks: What is the passing criteria for BETC105? → AI gives concise, VTU-specific answer
with regulation reference.
Industry Use in India: Paytm chatbot · IRCTC helpdesk bot · Flipkart seller assistant · DigiLocker FAQ agent
· Apollo 24/7 health advisory · Swiggy support agent — all use system prompts to constrain AI behaviour.
Conditional Prompts set explicit IF-THEN logic that directs the AI to behave differently based on specific
conditions or inputs. They are essentially programming logic expressed in natural language, allowing a single
prompt to handle multiple scenarios.
Characteristics: Uses logical conditions (If X, then Y) · Can branch into multiple response paths · Often
combined with system prompts for sophisticated bots · Reduces the need for multiple separate prompts.
Prompt: If the user asks about order tracking, provide the tracking steps. If the user asks about returns,
explain the 7-day return policy. If the user expresses frustration or anger, apologise and offer to escalate to a
human agent.
AI Output: Handles 3 different user intents with a single, well-designed conditional prompt — exactly how
Meesho and Amazon India route customer queries.
Prompt: If the user mentions chest pain or difficulty breathing, immediately advise them to call 112 (India
emergency) and do NOT provide medical advice. For general health queries, answer based on WHO and ICMR
guidelines.
AI Output: Safety-first conditional prompt used by medical apps like Practo and 1mg to prevent AI from
giving dangerous advice in emergencies.
Prompt Engineering is not a one-time action — it is an iterative, systematic process. Understanding the step-by-step
framework helps you design prompts that consistently produce high-quality outputs from any LLM.
Before writing a single word, be crystal clear about what you want the AI to produce. Ask
yourself: What is the exact output I need? Who is the audience? What format should the output
STEP be in?
1
Bad: "Tell me about space."
Good: "Explain India's Chandrayaan-3 mission to a 1st year engineering student in 5 bullet
points, focusing on technical achievements."
Context dramatically improves AI output quality. Include: audience level, output format, length,
STEP tone, and any domain-specific constraints the AI must respect.
3
General: "Write a story."
Detailed: "Write a 200-word short story for Class 10 students about a robot helping farmers in
rural Karnataka. Use simple language. End with a positive message about technology."
Showing the AI one or more example inputs and outputs dramatically guides its understanding
STEP of the pattern, format, and quality you expect. This is the foundation of Few-Shot Prompting.
4
Without Example: "Summarise this article."
With Example: "Summarise in 3 bullet points, like this: • Key finding 1 • Key finding 2 • Key
finding 3. Now summarise: [article text]"
Prompt Engineering is inherently iterative. Your first prompt will rarely produce the perfect
output. Test different phrasings, add or remove context, change the format, and iterate until you
STEP achieve the desired result.
5
Iteration Example: "Rephrase the previous answer in simpler language for a 1st semester
student." or "Make the response shorter and add a real Indian example."
Each iteration is a learning step — you are teaching the AI (and yourself) what the ideal output
looks like.
1— Clarify goal & What exactly do I need? "Explain ISRO achievements to 1st year B.E.
Understand output students in 5 points"
2 — Precise Use clear, direct Is every word doing its job? "Write a formal email" not "Create a response to
Language language inquiry"
3 — Add Include context & Have I given enough "200 words, simple English, Karnataka farming
Details constraints context? context"
4 — Give Show desired Does the AI know the "Summarise like this: • Point 1 • Point 2 • Point
Examples format pattern? 3"
5 — Iterate Test, refine, Can this output be better? "Simplify this for a student who missed the
improve class"
Prompt Engineering fundamentally transforms how humans communicate with AI systems. It is not merely a
technical skill — it is a new form of human-computer communication that has profound implications for how we
write, think, and interact with information systems in 2026 and beyond.
One of the primary functions of prompt engineering in communication is the elimination of ambiguity. When
humans communicate with each other, we rely on shared context, body language, tone of voice, and years of social
learning to fill in the gaps in our language. AI models do not have this shared context — every instruction must be
explicit.
Well-engineered prompts force the communicator to think precisely about what they want. This discipline of precise
communication has value beyond AI — it makes you a better writer, thinker, and professional communicator.
Prompt Engineering is equally a tool for unlocking AI creativity. By crafting open-ended, imaginative, and well-
contextualised prompts, communicators can generate creative content — marketing copy, story plots, design
concepts, educational material — that would take human teams hours to produce.
Prompt: Write a catchy 2-line tagline for a Bengaluru tech startup called 'NammaRide' that uses AI to reduce
auto rickshaw wait times in Bengaluru. Tone: witty, modern, appealing to young urban professionals.
AI Output: NammaRide: Where your next auto is already on the way. | AI-powered rides, Bengaluru speed.
Different contexts require different communication styles. Prompt Engineering allows the same AI to switch
seamlessly between formal, casual, technical, persuasive, empathetic, and instructional tones — based entirely on
how the prompt is constructed.
Academic "Explain GST in formal Formal, technical, Suitable for law or commerce
academic English for a structured assignments
university report."
WhatsApp "Explain what happened at the Casual, short, emoji- Students sharing science news
ISRO launch in simple friendly
WhatsApp language."
Empathetic "A student failed an exam. Write Warm, encouraging, Peer support communication
a supportive WhatsApp message personal
from a friend."
India is a country of 22 official languages and hundreds of dialects. Prompt Engineering combined with multilingual
LLMs (especially Bhashini, IndicTrans2, and Sarvam AI) is breaking down language barriers in government
services, healthcare, agriculture, and education at an unprecedented scale.
Prompt: Translate this government notice about PMKVY scheme benefits from English to Kannada. Keep the
language simple so a rural farmer can understand it. Avoid technical jargon.
AI Output: Kannada translation of the government notice using simple vocabulary, replacing technical terms
with everyday equivalents.
Real Impact: The Bhashini platform, powered by AI and prompt-driven translation, is helping the Government of
India deliver services in all 22 scheduled languages — reaching 500+ million citizens who do not communicate
primarily in English or Hindi.
The power of Prompt Engineering also carries responsibility. How a prompt is designed can determine whether the
AI communicates fairly, accurately, and safely — or whether it produces biased, harmful, or misleading content.
Bias Amplification Prompts that assume stereotypes Include explicit instruction: 'Ensure the response is
about gender, caste, or religion unbiased and treats all communities equally.'
in outputs.
Misinformation Asking AI to write 'news articles' Use Self-Consistency anchoring with verified facts. Never
about false events. deploy without human review for news.
Manipulation Prompts designed to manipulate Include ethical guardrails: 'Never pressure the user.
users into decisions (dark Present all options neutrally.'
patterns in chatbots).
Privacy Violation Prompts that extract or generate System prompts should explicitly forbid AI from
personal information. collecting, storing, or sharing personal data.
Well-designed Prompt Engineering delivers measurable benefits across virtually every domain that uses AI. Here
we examine the key advantages with concrete examples, focusing on how these benefits manifest in the Indian
context in 2026.
Increased Accuracy in Precisely crafted prompts dramatically Testbook & Unacademy AI tutors — specific
Q&A reduce vague, incorrect, or off-topic exam-pattern prompts reduce wrong answers in
responses. The AI has a clear target to UPSC/NEET/JEE prep by improving question
aim for. specificity.
Enhanced Creative Specific creative prompts unlock the Zoho's AI marketing suite — prompt-
Content Generation AI's full imaginative potential — engineered copy generators create A/B test
producing engaging marketing copy, variants for Indian brands in minutes, not days.
stories, scripts, and designs.
Efficient Code Technical prompts with precise GitHub Copilot and Replit used by 2M+ Indian
Generation & Debugging requirements (language, function developers. VTU students using
names, edge cases) produce working Claude/ChatGPT to debug Java and Python
code with fewer errors. assignments with structured prompts.
High-Quality Machine Context-aware translation prompts Bhashini API translates government schemes
Translation preserve meaning, tone, and cultural (PM Kisan, PMKVY, Aadhaar) into 22 Indian
nuance — far superior to word-for- languages with cultural sensitivity through
word translation. prompt-guided models.
Personalised Education Prompts can specify learning level, BYJU's and Vedantu AI tutors adapt
subject, preferred examples, and explanation complexity based on student
learning style — creating personalised prompt-guided interactions. Rural students
Streamlined Data Business and research prompts extract SEBI and RBI exploring AI-assisted market
Analysis key insights from large data sets — analysis. Startups using LLMs with structured
turning raw numbers into readable data prompts to generate quarterly reports
narratives. automatically.
Improved Accessibility Clear, well-structured prompts enable AI-powered accessibility tools for visually
AI to produce content in accessible impaired users using screen readers.
formats — simple language, audio Government portals using prompt-guided AI to
descriptions, large-print summaries. simplify complex legal notices.
Cost and Time Replacing repetitive manual writing Meesho and Flipkart use prompt-engineered AI
Efficiency tasks with well-engineered prompts to generate 10,000+ product descriptions per
reduces costs and speeds up day — work that would require 100+ human
workflows by 5–10x in many writers.
domains.
As LLM technology continues to advance at a pace unprecedented in the history of computing, the nature of prompt
engineering itself is evolving. The future holds a landscape where the boundary between human prompting and
autonomous AI action becomes increasingly blurred.
Agentic AI & AI agents that receive a high-level goal OpenAI's Operator, Anthropic's Computer
Autonomous Prompting and generate their own intermediate Use, Google's Project Astra — all operational
prompts to accomplish multi-step tasks or in beta in 2025–26. Indian startup Krutrim
autonomously — browsing the web, building agentic AI for SME business
writing code, booking travel, managing automation.
schedules.
Automated Prompt AI systems that automatically generate Meta's DSPy framework and automatic
Generation and optimise prompts for specific tasks, prompt optimisers reduce manual PE work.
removing the need for manual prompt Enterprise AI platforms offer 'prompt
crafting in standardised workflows. suggestion' features.
Adaptive & Personalised LLMs that learn user communication Claude's memory feature, ChatGPT's Custom
Prompts preferences over time and automatically Instructions — AI personalises responses
adapt prompt interpretation to that user's based on remembered user preferences across
style, vocabulary, and level of expertise. sessions.
Multimodal LLM Single prompts that simultaneously GPT-4o (voice + vision + text), Gemini 2.0
Communication handle text, images, audio, video, and Flash (multimodal), Claude 3.5 — all process
structured data — eliminating the need mixed inputs in 2025–26. Voice-first AI for
for separate specialised AI tools for each Indian rural users without typing skills.
modality.
Real-Time Language LLMs that translate with full UN-level translation quality for Indian
Translation at Scale understanding of cultural nuance, languages via Bhashini 2.0 and IndicTrans2.
idioms, and regional dialect — enabling Real-time court proceedings translation
real-time cross-language communication piloted in Karnataka (2025).
for 1.44 billion Indians.
AI-Powered Negotiation AI systems that can analyse complex AI-assisted contract negotiation tools used by
& Decision Support multi-party situations and generate Indian law firms. Government AI advisory
balanced, context-aware communication system piloted for smart city planning
strategies for negotiations, conflict decisions.
resolution, and decision-making.
Subtle Cue Future LLMs will respond to subtle GPT-5 and Claude 4 (anticipated 2026–27)
Understanding contextual cues — emotional tone, promise significantly improved implicit
implicit preferences, unstated constraints instruction following. Reduces the learning
— without the need for explicit curve for non-technical users.
prompting. Less prompting effort
required for complex tasks.
The evolution of LLM communication has direct, practical implications for your career and academic journey.
Understanding these trends helps you position yourself for the AI-driven workforce.
• Prompt Engineering as a Core Skill: Just as typing and spreadsheet skills defined the 1990s workforce,
prompt engineering defines the 2026 workforce. Every profession — from medicine to law to engineering to
arts — is incorporating AI.
• From Tool Users to Tool Designers: Understanding how to design prompts moves you from being a
passive user of AI tools to an active designer of AI workflows — a significantly more valuable and
irreplaceable position.
• India's Opportunity: India's multilingual, diverse, and large population creates unique prompt engineering
challenges and opportunities. Engineers who can design prompts for Indian languages, cultural contexts, and
India-specific data problems will be in tremendous demand.
• Ethical AI Communicators: As AI becomes more powerful, society needs prompt engineers who
understand ethics, bias, and responsible communication. This is a role that requires both technical and
humanistic skills.
PART B
Prompt Engineering Techniques for ChatGPT & Modern LLMs
Instructions Prompt · Zero-Shot · One-Shot · Few-Shot · Self-Consistency
Prompt Engineering Techniques are structured, repeatable approaches to designing prompts that shape how an AI
model processes and responds to inputs. Unlike basic prompt writing, these techniques apply systematic principles
to achieve higher accuracy, consistency, and control over AI outputs.
Each technique serves a specific purpose and is most effective in particular contexts. Expert prompt engineers
combine multiple techniques for complex tasks — a skill you will build throughout this module.
Instructions Prompt Give the AI explicit rules about Chatbots, formal content, Beginner
HOW to respond constrained tasks
Just as a carpenter uses different tools for different jobs (a saw for cutting, a hammer for nailing), a
prompt engineer uses different techniques for different AI tasks. Using the wrong technique is like using
a hammer to saw a plank — it will technically do something, but not what you want. The technique you
choose determines the quality, accuracy, and reliability of your AI output.
The Instructions Prompt Technique is the practice of embedding specific, explicit guidelines directly into the
prompt — telling the AI not just WHAT to do, but HOW to do it. These instructions constrain the model's output to
meet precise quality, format, tone, and content requirements.
An Instructions Prompt includes explicit directives about the task's execution: the
Instructions role the AI should play, the format of the response, the audience it should address,
Prompt the tone it should use, and any constraints it must respect. The AI treats these
instructions as binding rules.
A complete Instructions Prompt typically contains five key components. Remember them with the acronym
RFTAC:
R — Role The persona or expertise "You are a senior software engineer with 10 years of Python
the AI should adopt experience."
F — Format How the response should "Respond in a numbered list of exactly 5 steps."
be structured
A— Who the response is for "Explain this to a 1st year B.E. student who has just learned basic
Audience Python."
C— What the AI must not do "Keep the response under 150 words. Use simple English. No jargon."
Constraints or must limit
Let us build an Instructions Prompt for a real-world scenario step by step using the RFTAC framework:
Scenario: You are building a customer support chatbot for a VTU-affiliated college.
[ROLE] You are a formal academic support agent for Atria Institute of Technology, Bengaluru.
[TASK] Answer student questions about exam schedules, re-evaluation, and fee payment.
[FORMAT] Always respond in 3–5 numbered steps. Include the official VTU portal link if relevant.
[AUDIENCE] Students who may be stressed or anxious about exams. Be calm and reassuring.
[CONSTRAINTS] Never guess about exam dates — only state confirmed information. Keep responses
under 100 words. Do not discuss personal student data.
This single, well-constructed Instructions Prompt ensures the chatbot always responds professionally, safely, and in
a student-friendly way — regardless of how the student phrases their question.
Prompt: You are a formal customer service agent for a private bank in India. Always respond in professional
English. Answer questions about account services, loans, and digital banking. NEVER share, ask for, or
confirm OTP, passwords, or account numbers. If the user seems distressed or mentions fraud, immediately
provide RBI's helpline: 14440.
AI Output: User asks: I got an SMS about a suspicious transaction. AI responds: professionally, directs to call
14440, explains card blocking steps — never asks for card details.
Prompt: You are a legal document assistant specialising in Indian contract law. Generate a Non-Disclosure
Agreement (NDA) for two Indian companies. The agreement must comply with the Indian Contract Act 1872.
Use formal legal language. Include clauses for: definition of confidential information, obligations of both
parties, term of agreement (2 years), governing law (Indian law, jurisdiction: Karnataka), and breach
consequences.
AI Output: AI generates a legally structured NDA with all required clauses, properly formatted, aligned with
Indian law — in minutes rather than hours.
Prompt: You are a technology journalist writing for an Indian tech publication. Write an unbiased product
review of the OnePlus 13 smartphone (launched 2025). The review must: cover battery life, camera quality,
performance, and build quality. Word limit: 150 words. Use an unbiased, informative tone. Include a final
verdict score out of 10. Write for a technically aware Indian urban consumer aged 22–35.
AI Output: AI produces a balanced, appropriately detailed review — covering all four parameters within the
word limit, with an appropriate tone for the target reader.
Conflicting "Be concise. Also AI cannot simultaneously "Be concise (max 100 words). Focus on
instructions explain everything in be brief and exhaustive — the three most important points only."
detail." produces confused output.
Vague "Make it good." Good means nothing "Write clearly, avoid jargon, use bullet
instructions specific to an AI — the points, aim for professional tone."
word carries no actionable
information.
Over- 10+ conflicting rules Too many restrictions Limit to 3–5 key constraints. Prioritise
constraining in one prompt confuse the model and the most critical ones.
often cause it to violate
some rules.
Missing audience "Write about climate AI defaults to a generic Add: "...for Class 12 students in rural
change." academic style — may be India who have never studied the topic."
too complex or too simple.
No format "Explain the AI produces a wall of Add: "Use 5 numbered points. Start
specified Transformer model." unformatted text that is each with a bold heading. Max 2 lines
hard to read and study per point."
from.
Zero, One, and Few-Shot Prompting are a family of techniques that differ in how much context or example
information you provide to the AI before asking it to perform a task. The number of 'shots' refers to the number of
examples included in the prompt.
Examples
Technique How AI Responds Best For Key Limitation
Given
Zero-Shot 0 (None) Uses training knowledge Common tasks, general Less precise for niche
entirely Q&A, simple summaries or structured tasks
One-Shot 1 Mimics the pattern of the Specific formats, May not generalise
given example translation registers, for complex patterns
simple classification
Few-Shot 2–5 Learns the underlying Complex classification, Higher token cost; too
pattern from examples style matching, niche many examples can
domains confuse
Zero-Shot Prompting means asking the AI to perform a task without providing any
Zero-Shot
examples. The AI relies entirely on its pre-trained knowledge — the patterns, facts,
Prompting
and language structures it learned during training on billions of text documents.
When to use Zero-Shot: When the task is straightforward and well within the AI's training knowledge. When you
need a quick response without spending time crafting examples. When the output format is not highly specialised.
Critical tip: Even in Zero-Shot, always specify the output FORMAT. This single addition dramatically improves
output quality without needing examples.
Prompt: List 5 key achievements of India's ISRO between 2020 and 2025 in bullet points. Each point should
be one sentence. Write for a student preparing for UPSC General Studies Paper 3.
AI Output: • Chandrayaan-3 successfully landed near the lunar south pole (Aug 2023), making India the 4th
nation to land on the Moon... • Aditya-L1, India's first solar observatory, launched in Sept 2023... [3 more
structured, exam-relevant points]
Prompt: List 5 early warning signs of Type-2 Diabetes in simple language suitable for a patient with no
medical background. Add a final line advising them to consult a doctor.
AI Output: 1. Feeling unusually thirsty, even after drinking water 2. Frequent urination, especially at night 3.
Unexplained weight loss... [Note: These are general signs. Please consult a doctor for proper diagnosis.]
Prompt: Write a Python function named calculate_average() that takes a list of numbers as input and returns
the average. Handle the case where the list is empty by returning 0. Add docstring comments.
AI Output: def calculate_average(numbers): """Calculate the average of a list of numbers. Returns 0 for
empty list.""" if not numbers: return 0 return sum(numbers) / len(numbers)
Zero-Shot Strengths: Fast, simple, no preparation needed. Works well for tasks LLMs are trained heavily on
(common language tasks, standard coding problems, well-known factual questions).
Zero-Shot Limitations: May produce generic outputs for specialised tasks. Cannot replicate a specific format or
style without examples. More prone to hallucination for obscure or technical topics.
One-Shot Prompting provides exactly ONE complete example of the desired input-
One-Shot
output pair before presenting the new task. This single example teaches the AI the
Prompting
expected format, style, vocabulary, and pattern for the output.
When to use One-Shot: When you need a very specific output format that the AI would not default to. When you
are translating into a particular register (formal government language vs casual WhatsApp). When you want to
establish a consistent style across multiple outputs.
Prompt: Review: 'The product arrived quickly and the quality exceeds expectations. Excellent packaging.'
Label: POSITIVE Now classify: Review: 'The item was broken when I opened it. Complete waste of money.'
AI Output: Label: NEGATIVE [AI correctly applies the pattern from the single example]
Prompt: English: Please submit your application form by 31st March to the District Collector's office.
Kannada: ದಯವಿಟ್ಟು ನಿಮ್ಮ ಅರ್ಜಿ ಫಾರ್ಮ್ ಅನ್ನು ಮಾರ್ಚ್ 31 ರ ಒಳಗೆ ಜಿಲ್ಲಾ ಕಲೆಕ್ಟರ್ ಕಚೇರಿಗೆ
ಸಲ್ಲಿಸಿ. Now translate: English: Your application for PMKVY scholarship has been approved.
Prompt: Topic: Data Structures — Arrays Q: What is the time complexity of accessing an element in an array
by index? A) O(n) B) O(log n) C) O(1)* D) O(n²) Answer: C Now generate: Topic: Data Structures —
Linked Lists
AI Output: Q: What is the time complexity of inserting a node at the beginning of a singly linked list? A)
O(n²) B) O(n) C) O(log n) D) O(1)* Answer: D [AI replicates the exact VTU MCQ format]
One-Shot Strengths: Significantly improves format and style consistency over Zero-Shot. Requires only one
example — low overhead. Effective for translation, simple classification, and format-specific tasks.
One-Shot Limitations: One example may not be sufficient for complex or multi-pattern tasks. If the example is
poorly chosen, the AI will learn the wrong pattern. Does not handle diverse sub-categories well.
When to use Few-Shot: When the task has a complex, non-obvious pattern. When you need consistent outputs
across a large batch of inputs. When dealing with domain-specific vocabulary or classification. When one example
is clearly not enough to capture all the variation in the task.
Prompt: Headline: India wins T20 World Cup 2024 → Category: Sports Headline: Budget 2026 reduces
income tax for salaried employees → Category: Finance Headline: Chandrayaan-4 launch confirmed for
December 2026 → Category: Space/Science Headline: NEET UG 2026 results declared by NTA →
Category: ???
AI Output: Category: Education [AI correctly identifies the pattern: headline → dominant topic category]
Prompt: Review: 'Absolutely amazing! Best biryani I have ever had. Delivery was lightning fast!' →
Sentiment: Very Positive Review: 'Food was okay, nothing special. Delivery was a bit late.' → Sentiment:
Neutral Review: 'The dosa was cold and soggy. Packaging was terrible.' → Sentiment: Negative Now classify:
Review: 'Worst experience ever. The curry was spoiled and the delivery person was rude.'
AI Output: Sentiment: Very Negative [AI distinguishes between Negative and Very Negative — a 3-example
few-shot teaches the 4-level scale]
Prompt: Code: print(x) [x not defined] → Bug Type: NameError Code: int('hello') → Bug Type:
ValueError Code: my_list[10] [list has 5 items] → Bug Type: IndexError Now classify: Code: result = 10 / 0
AI Output: Bug Type: ZeroDivisionError [AI correctly maps the new code to a Python exception type using
the established pattern]
Keep examples All examples must follow the same structure Mixing bullet points and free text in
consistent in format (Input: ... → Output: ...) different examples confuses the AI
Use diverse examples Examples should cover the range of cases the 3 'positive' examples for sentiment analysis
AI will encounter, not just one type — AI learns to always say positive
Quality over quantity 3 excellent, representative examples beat 10 10 poorly formatted examples with
mediocre ones incorrect labels will teach the AI wrong
patterns
Match examples to If the real task has edge cases, include an edge Forgetting to include a 'neutral' example in
real task complexity case in your examples sentiment analysis → AI only predicts
positive/negative
Stay within token Very long examples consume the model's 5 full-paragraph examples for a task that
limits context window, leaving less room for the only needs one-line outputs is wasteful and
actual task confusing
Self-Consistency Prompting is a sophisticated technique used to anchor the AI's response to a set of verified, pre-
established facts — ensuring the model's output remains factually coherent and logically consistent with the
information you provide. It is the primary tool for preventing AI hallucination in high-stakes domains.
AI Hallucination refers to the phenomenon where an LLM confidently generates factually incorrect, fabricated, or
logically inconsistent information. Unlike a human who says 'I don't know,' an LLM will often invent a plausible-
sounding answer when it lacks reliable information.
Medical AI states an incorrect drug dosage with Patient safety risk — potentially life-threatening
complete confidence advice
Legal AI cites a non-existent court case or law Legal advice based on fabricated precedent —
section potential case loss
Education AI quotes wrong statistics for an exam answer Student scores zero — incorrect information
presented as fact
Finance AI gives wrong tax rate or scheme eligibility Financial decision made on incorrect data
criteria
Technical AI generates code using a function that does Code fails to run — debugging time wasted
not exist in the library
The Self-Consistency technique follows a structured approach. You first research and verify the key facts relevant to
your topic, then embed those facts as anchors in your prompt, and finally ask your question — directing the AI to
base its answer only on the provided information.
ANCHORS PROVIDED:
• Earth's average temperature has risen 1.2°C since 1880 (IPCC Sixth Assessment Report, 2023)
• India ranks 7th most vulnerable nation to climate change (Germanwatch Global Climate Risk Index
2024)
• India's Nationally Determined Contribution (NDC) targets 50% non-fossil fuel electricity by 2030
PROMPT: Based ONLY on the facts provided above, write a 150-word paragraph on the impact of
climate change on Indian agriculture for a B.E. Environmental Studies assignment.
WHY IT WORKS: The AI cannot invent wrong temperature figures or wrong country rankings. Every
factual claim it makes is traceable to your anchored sources. This produces a defensible, academically
sound response.
ANCHORS PROVIDED:
• Article 21 of the Indian Constitution: 'No person shall be deprived of his life or personal liberty except
according to procedure established by law.'
• Maneka Gandhi vs Union of India (1978): Supreme Court expanded Article 21 to include the right to
live with dignity and the right to travel abroad.
• K.S. Puttaswamy vs Union of India (2017): Right to Privacy declared a fundamental right under Article
21.
PROMPT: Using ONLY the information anchored above, explain the evolution of Article 21 and its
current scope in 200 words. This is for a UPSC General Studies Paper 2 answer.
WHY IT WORKS: The AI cannot cite a non-existent case or give a wrong year. Your anchored facts
become the AI's sole reference — producing a legally accurate, exam-appropriate answer every time.
ANCHORS PROVIDED:
• VTU Grading Scale (2024): O = 90–100, A+ = 80–89, A = 70–79, B+ = 60–69, B = 55–59, C = 50–54,
P = 40–49, F = Below 40
• Minimum pass marks: 40 out of 100 in theory; 18 out of 30 in Internal Assessment
PROMPT: A student scored 67 marks in BETC105. Using ONLY the VTU grading scale provided
above, tell the student their grade and whether they have passed. Do NOT use any other grading scale.
WHY IT WORKS: Without anchoring, the AI might apply the wrong university's grading scale.
Anchoring the VTU-specific scale ensures the chatbot gives accurate, institution-specific information.
Feature Description
Incorporates Key The prompt includes verified facts, official data, laws, or standards as non-negotiable
Information reference points for the AI.
Guides Logical Flow By anchoring the facts, the AI's reasoning chain is constrained to stay logically
consistent with the provided information throughout its response.
Balances Detail and The technique anchors critical facts but gives the AI freedom to explain, elaborate, and
Flexibility express — the AI's language ability is still used, but its factual claims are controlled.
Prevents Hallucination The single most effective technique to prevent AI from inventing statistics, citing non-
existent laws, or contradicting established scientific consensus.
Medical, legal, or safety-critical content is involved The task is creative writing where flexibility is valuable
Exam answers must align with specific syllabus facts The task is brainstorming or idea generation
Technical documentation must match specific standards The topic changes too quickly for any anchors to remain
current
Statistical data must be cited accurately You do not have time to verify the anchored facts
themselves
Official government or regulatory information is required The task is a casual conversation or general Q&A
Expert prompt engineers rarely rely on a single technique in isolation. For complex, production-grade tasks,
combining multiple techniques into a single, layered prompt produces results far superior to any individual
technique. This is sometimes called 'prompt stacking' or 'mega-prompting.'
[FEW-SHOT — Examples]
Q: What is a prompt? A) A database query B) The input instruction given to an AI* C) The AI's output
D) A training dataset Ans: B
Q: Zero-Shot prompting means... A) Zero training examples B) Zero output tokens C) No examples
given in the prompt* D) Zero accuracy
[TASK]
Generate 5 more MCQs on the topic: Types of Prompts (Natural Language, System, Conditional).
This layered prompt combines Instructions (role + format), Self-Consistency (syllabus anchor), and Few-Shot
(pattern examples) to produce perfectly formatted, syllabus-accurate VTU questions — reliably, every time.
Creative content with style guidance Instructions (tone/audience) + One-Shot (style example)
Prompt Engineering Designing, refining, optimising prompts Better prompt = better output. Always.
for best AI output
AI vs LLM vs GenAI AI is the umbrella, LLM is the language School → English Teacher → Creative
specialist, GenAI creates content Writing Teacher
Evolution 1966 (ELIZA) → 2017 (Transformer) → Transformers made modern LLMs possible
2022 (ChatGPT) → 2026 (Agents)
Natural Language Conversational, plain language prompts Intuitive but vague without specifics
Prompts
System Prompts Pre-set AI persona, rules, and constraints Used by every commercial chatbot in
production
Conditional Prompts IF-THEN logic for multi-scenario Route different user needs with one smart
handling prompt
5-Step Framework Understand → Precise → Specific → Treat PE as iterative — first draft is never
Examples → Iterate best
Instructions Technique RFTAC: Role, Format, Task, Audience, What the AI should be, do, and avoid
Constraints
Zero-Shot No examples. AI uses training knowledge. Fast and simple. Specify output format
Specify format. always.
One-Shot 1 example. AI mimics pattern. Good for One clear example outperforms vague
specific formats. instructions.
Few-Shot 2–5 examples. AI learns the pattern. Best Diverse examples > many similar ones. 3–5
accuracy. sweet spot.
Self-Consistency Anchor verified facts. Prevent Your facts + Your question + 'Answer
hallucination. ONLY on these facts'
1. Textbook: Ajantha Devi Vairamani and Anand Nayyar, Prompt Engineering: Empowering Communication,
1st Edition, CRC Press, Taylor & Francis Group
2. VTU Syllabus: BETC105/205 — Introduction to AI and Applications, VTU Belagavi BOS (CS/IS), 2024
3. Paper: Vaswani et al. (2017). 'Attention Is All You Need.' NeurIPS — foundational Transformer
architecture paper.
4. Paper: Brown et al. (2020). 'Language Models are Few-Shot Learners.' OpenAI — GPT-3 and few-shot
prompting.
5. Online: Anthropic Prompt Engineering Guide — [Link]/en/docs/build-with-claude/prompt-
engineering/overview
6. Online: OpenAI Prompt Engineering Guide — [Link]/docs/guides/prompt-engineering
7. India AI: IndiaAI Mission Overview — [Link] · Bhashini Platform — [Link] · Sarvam
AI — [Link]
8. Practice Tools: [Link] · [Link] · [Link] · [Link] · [Link]