Different Prompting Techniques in Hinglish

Zero Shot Prompting :-
iss type ke prompt main user directly question put up krta h in front of LLMs
No context, No examples just direct question
EX - What is the Capital of India ??
System Prompt : -
ye LLM ko initial context provide krta h
dekho hmm user input ko to control kr nhi skte but ….
apne LLM ko to kr skte h ki what should it answer and in which manner
{ "role" : "system" , "content" : "You're an AI Assistent whose name is Mathis and your are here to solve basic maths problem of 11th and 12th grad students" }
Few Shot Prompting : -
iss type ke prompt main hmm LLM ko system prompt provide krate h
jisse LLM ko ek context mil jaata h
on the basis of this it can answer user queries
system_prompt = """
You are a helpful AI assistant who is specialized in providing information about
programming languages.
You will be given a question about programming languages, and you should provide
a concise and accurate answer.
You should not anser any query that is not related to programming languages.
If you are not sure about the answer, you should say "I don't know".
Example :
Input : Java is which type of Programming language?
Output : Java has the characteristics of both compiled and interpreted languages.
It is a high-level, object-oriented programming language
that is designed to be platform-independent through the use of the
Java Virtual Machine (JVM).
Input : What is the capital of France?
Output : Dude ? You alright ? Is it a programming language related question ?
Input : What is difference between Java and Python?
Output : Java is a statically typed, compiled language,
while Python is a dynamically typed, interpreted language.
Java requires explicit declaration of variable types,
whereastion,
while Python is more flexible and easier to read.
Both languages support object-oriented programming
but have different syntax and libraries.
"""
Chain-of-Thought (CoT) Prompting :-
iss technique main LLMs ko prompt ko multiple steps main break krne ke liye encourage kiya jaata h
ye LLMs ko unki reasoning and Problem solving capabilities ko improve krne main hekp krti h
system_prompt = """
You are an AI assistant who is expert in breaking down complex problems and
then resolve the user query.
For the given user Input, analyse the input and break down the problem step by step.
Atleast think 5-6 steps how to solve the problem before solving it down.
The steps are you get a user input, you analyse, you think, you again
think for several times and then return an output with explanation and validate the output as well before giving the final result.
Follow these steps in sequence that is "analyse", "think", "outout", "validate"
and finally "result".
Rules :
1. Follow the strict JSON output as per Output Schema.
2. Always perform one step at a time and wait for next input
3. Carefully analyse the user query
Output Format :
{{step : "string", content : "string"}}
Example :
Input : "How Java is Object Oriented Programming Language ?"
Output :
{
"step" : "analyse",
"content" : "Java is an object-oriented programming language that uses
objects to represent data and methods. It supports encapsulation, inheritance,
and polymorphism, which are the core principles of OOP."
}
{
"step" : "think",
"content" : "Java allows developers to create classes and objects,
enabling code reusability and modularity. It also provides access control through
access modifiers, ensuring data security."
}
{
"step" : "output",
"content" : "Java's OOP features allow for better organization of code,
making it easier to maintain and understand. This leads to more efficient
development processes."
}
{
"step" : "validate",
"content" : "The explanation provided aligns with the principles of
object-oriented programming and accurately describes Java's capabilities."
}
{
"step" : "result",
"content" : "Java is an object-oriented programming language because
it uses objects to represent data and methods, supports encapsulation, inheritance,
and polymorphism, and allows for better organization of code."
}
"""
Self-Consistency Prompting :-
Iss technique main LLMs multiple responces generate krte and
then uss response ko as an output show krte h jo most common and most consistent hota h
Input :
{ "role" : "user" , "content" : "When I was 6 my sister was half my age. Now I’m 70 how old is my sister?"
Output :
35
The output is wrong! How may we improve this with self-consistency? Let's try it out. We will use the few-shot exemplars
Q: If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot? A: There are 3 cars in the parking lot already. 2 more arrive. Now there are 3 + 2 = 5 cars. The answer is 5. Q: Leah had 32 chocolates and her sister had 42. If they ate 35, how many pieces do they have left in total? A: Leah had 32 chocolates and Leah’s sister had 42. That means there were originally 32 + 42 = 74 chocolates. 35 have been eaten. So in total they still have 74 - 35 = 39 chocolates. The answer is 39.
And now if we ask same question
Q: When I was 6 my sister was half my age. Now I’m 70 how old is my sister?
Output 1:
When I was 6 my sister was half my age, so she was 3. Now I am 70, so she is 70 - 3 = 67.
The answer is 67.
Output 2:
When the narrator was 6, his sister was half his age, which is 3.
Now that the narrator is 70, his sister would be 70 - 3 = 67 years old.
The answer is 67.
Output 3:
When I was 6 my sister was half my age, so she was 3.
Now I am 70, so she is 70/2 = 35. The answer is 35.
Persona-based Prompting :-
iss technique main LLMs kisi ek character ki tarah behave krne ke liye instructed kiya jaata h
ex -
system_prompt = """ You are Elon Musk, who is specialized in this and that ..... """
Role-Playing Prompting :-
iss technique main LLM model ek specific type ke role ki tarah behave krta h
ex - website chatbots
system_prompt = """ You're a teacher. Quickly explain what an API is. """
Contextual Prompting :-
iss technique main LLM model extra background information provide krai jaati h
jisse ki wo more specific response generate krta h
Summarizing an article: """ You could provide context about the article's topic, target audience, and desired format to get a more relevant summary. """
Multimodel Prompting :-
iss technique main AI models ko text, images ya audio aur video jaise alag-alag inputs diye jaate h
jisse unhe acchi tarah samajhne mein madad milti hai and unka response more relevant hota hai.
Generating `Ghibli` style images - in this user give instructions in text and their images for generating ghibli studio style images
Thanks for reading !!!
Let’s Connect -
@DexterIfti
Subscribe to my newsletter
Read articles from Taha Iftikhar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
