Skip to content

Shots! Shots! Shots!

Shots

array of shot glasses filled with a vibrant green drink

Have you ever heard the sound "shots! shots! shots!" before? Well, in the world of Large Language Models, "shots" refer to the number of examples provided to the model during training or finetuning. Unlike alcohol shots, which can impair human cognitive performance, more shots for Large Language Models can actually improve their performance. Let's break down the different types of shots:

Zero shot learning

Zero shot learning refers to a model's ability to perform a task without having seen any examples of that task during training. The model relies solely on its pre-trained knowledge to complete the task. For example, let's say you have a pre-trained language model that has been trained on a large corpus of text. You can use this model to perform a task like sentiment analysis on a new piece of text without providing any examples of sentiment analysis during training. The model will use its pre-trained knowledge of language to perform the task.

zero shot learning prompt

Review: Food is very bad
Sentiment:

completion

Negative

One shot learning

One shot learning involves providing the model with a single example of the task during training or finetuning. The model then uses this example to generalize and perform the task on new, unseen data. For example, let's say you want to train a language model to generate poetry. You can provide the model with a single example of a poem during training, and the model will use this example to generate new poems.

one shot learning prompt

Review: Food is very bad
Sentiment: Negative
Review: I liked the taste of every dish
Sentiment:

completion

Positive

Two shot learning

Two shot learning is similar to one shot learning, but the model is provided with two examples of the task during training or finetuning. This can help the model better understand the task and improve its performance. For example, let's say you want to train a language model to summarize news articles. You can provide the model with two examples of news article summaries during training, and the model will use these examples to generate new summaries.

two shot learning prompt

Review: Food is very bad
Sentiment: Negative
Review: I liked the taste of every dish
Sentiment: Positive
Review: The service was slow and the staff was rude
Sentiment:

completion

Negative

Few shot learning

Few shot learning refers to providing the model with a small number of examples (typically less than 10) during training or finetuning. This can further improve the model's performance on the task, as it has more examples to learn from. For example, let's say you want to train a language model to translate between two languages. You can provide the model with a few examples of translated sentences during training, and the model will use these examples to generate new translations.

few shot learning prompt

Review: Food is very bad
Sentiment: Negative
Review: I liked the taste of every dish
Sentiment: Positive
Review: The service was slow and the staff was rude
Sentiment: Negative
Review: The ambiance was cozy and the music was soothing
Sentiment: Positive
Review: The portions were small and the prices were high
Sentiment: Negative
Review: The food was average, nothing special but not bad either
Sentiment: Neutral
Review: The restaurant was clean and well-maintained
Sentiment: Positive
Review: The menu had limited options, but the food was decent
Sentiment: Neutral
Review: The wait time for our food was too long, but the taste made up for it
Sentiment:

completion

Neutral

Adding Instruction

Adding an instruction to the above methods will improve the performance of the Language Learning Model (LLM) by providing more context and guidance on what the model is expected to do. This helps the model to better understand the task and generate more accurate and relevant responses.

For example, the original zero shot learning prompt is:

Review: Food is very bad
Sentiment:

By adding an instruction, the prompt becomes:

Determine the sentiment of the given review (Positive, Negative, or Neutral)
Review: Food is very bad
Sentiment:

This added instruction explicitly asks the model to determine the sentiment of the review, making it clearer what the desired output should be. As a result, the LLM is more likely to generate the correct response, which in this case is "Negative". Providing clear instructions helps the model to focus on the specific task and reduces the chances of generating unrelated or ambiguous responses.