Zero Shot Prompting - A guide

3 min read

Cover Image for Zero Shot Prompting - A guide

Zero shot prompting means asking an AI model a question without giving any examples of the kind of answer you are expecting. In this guide we understand this term in detail and what are the tradeoffs. One-Shot and Multi-Shot prompting are other techniques which we have covered in a separate article.

As you know the idea of prompt is the give an AI some question and expecting some kind of answer. Prompt engineering is an art and science of asking right questions to get good high quality answers.

AI models are trained on almost entire internet and publicly available information. When you ask AI a question it basically looks at all that information to come up with an answer. However real world is very complex and a question in different contexts can mean different things.

For example:

What is a check ?

This question will have completely different answer in financial context and in a chess context. So we need to provide sufficient context in the prompt as well.

Some of the prompts however involve you trying to analyze something based on the data you already have.

For example:

Classify the sentiment of the following sentences as positive, negative, or neutral:

Sentence 1: I love this new movie!
Sentiment: Positive

Sentence 2: The weather is terrible today.
Sentiment: Negative

Sentence 3: This is a pen.
Sentiment: Neutral

Sentence 4: This food does not taste good. 
Sentiment:

This is an example of multi-shot prompt where you provide detailed examples from your observation and ask AI model to understand that trend and provide an answer.

Zero-shot prompting

As the name suggests , in this case we simply do not have any examples to provide to the AI model. One of the reasons is that you may not have any examples to provide in first place. Second might be because you don't have time to provide a complex instruction (imagine you asking your car set directions to a local restaurant that you may like).

Zero-shot promoting is not a bad thing but an effective technique to be used in many cases. It works the best when :

The answer to your question is general knowledge and not something specific to your view of the world. For example, "What are some good highly rated restaurants in this area where I can eat ? " vs "What are some good highly rated restaurants in this area where I can eat but I don't eat Chinese and Indian food" .

If your food preferences are general then zero shot prompting works really well. Not so when your food preference is different from the average person.

Larger models do better in zero-shot prompting. Since in zero-shot prompting model relies on the general knowledge, more the knowledge better is the model and hence large models perform much better than smaller models in this case.

It is ideal when you are trying to generate text. If you are not really trying to ask a specific question but asking model to generate text, zero-shot prompting is a better choice. For example : "Write me a story that involves three little pigs and a bunny".

Research and Advanced Reading:

A Practical Survey on Zero-shot Prompt Design for In-context Learning: This paper provides a comprehensive review of in-context learning techniques, focusing on different types of prompts, including zero-shot prompts.

https://arxiv.org/abs/2309.13205

Zero-shot adaptive prompting of large language models: This blog post from Google Research discusses a method for zero-shot prompting that dynamically adapts to different tasks and contexts.