メインコンテンツまでスキップ

🟢 What's in a Prompt?

We have gone through a few different prompting strategies in the previous pages. This page will offer some general advice about what is actually important in a prompt.

"Ground Truth Matters Little"

Surprisingly, when providing few shot exemplars in prompts, the actual answers (gold) in the exemplars are not important. As shown in the figure below, providing random labels in the exemplars barely hurts performance1. "Demo" is synonymous with exemplar in this image.

Labelspace Matters

Even though the gold labels in the exemplars are not important, the labelspace is. Even providing random labels from the labelspace helps the LLM get a better understanding of the labelspace, and improves results. Additionally, properly representing the distribution of the labelspace in the exemplars is important. Rather than uniformly sampling from the labelspace in the exemplars, it is better to sample according to the true distribution of the labels.

Format Matters

Perhaps the most important part of exemplars is how they are formatted. This format instructs the LLM on how to properly format its answer to the prompt.

For example, consider the below exemplars. They use all capital words as answers. Even though the answers are completely wrong (2+2 is not 50), GPT-3 correctly answer the last question, and follows the format of the others.

What is 2+2? 
FIFTY
What is 20+5?
FORTY-THREE
What is 12+9?
TWENTY-ONE

Notes

Between 4-8 exemplars is a good number to use for few shot prompts1, but it can often be helpful to put as many as possible.


  1. Min, S., Lyu, X., Holtzman, A., Artetxe, M., Lewis, M., Hajishirzi, H., & Zettlemoyer, L. (2022). Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?