š PROMPTING PRINCIPLE: Models See Bigger Things Easier. Try this on classification!
This is VERY IMPORTANT for classification. See what I did there?
Once you learn how LLM tokenization works, it may seem intuitive that when doing classification tasks with LLMs, you should take special care to make sure that each label is a single token, like āTrueā or āFalseā or āYesā or āNoā. Both because a single token will concisely contain any information about a concept you could want, and because itās pretty fast to generate a single token. Everywhere from bot RP guides on Rentry to research papers using LLMs as classifiers seem to favor single-token labels for classification.
What if I told you this approach ā which intuitively makes sense ā dramatically reduces the accuracy of your model when itās classifying large blocks of text?
I discovered this somewhat by accident, but let me explain the reasoning.
You can put LLMs through a benchmark that essentially tests their ability to āfind a needle in a haystackā. This is a difficult task because the thing itās searching for (some arbitrary key) is extremely small, relative to the overall prompt contents (the haystack). So a lot of non-key information is passed down to the next token, and the important details can easily get lost in the signal.
Now, note that if you have a very large input, with a small classification output, like this:
Example Input: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Output: B
Example Input: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Output: C
Example Input: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Output: D
when you have few-shot examples, the output makes up a tiny part of the overall prompt. And what does this mean? It means that the model essentially has to look for a needle in a haystack in order to actually find the thing itās supposed to be learning from.
The behavior I noticed in one of my prompts that was dealing with a task like this is that instead of classifying, the model would just write more input. It was essentially continuing the pattern of the input, being completely blind to the label it was actually supposed to be predicting.
The solution? If the model canāt see the output because itās too small, make the output bigger.
Example Input: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Output: The label is: BBB
Example Input: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Output: The label is: CCC
Example Input: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Output: The label is: DDD
Result? The model finally started classifying. Mission accomplished.
My assumption is that the presence of more tokens of output makes the pattern more āvisibleā to the LLM because more information from those parts of the example stream down to it. This has an interesting implication for writing parts of the prompt in ALL CAPS. I noticed way back in the day that, although writing in ALL CAPS was discouraged (because that way the model wouldnāt get the āmeaning vectorā from words that would otherwise be a single token) using ALL CAPS seemed to be able to draw a modelās attention to an area of a prompt better. I now believe this is precisely because ALL CAPS makes some text take up more tokens to express a single concept, meaning that more actual information gets sent down to the LLM. Iām sure this has a bunch of other applications as well ā things that were once thought special quirks that are now intuitively applications of this generalized principle.
I donāt know if this has much of an impact on classification tasks where the input is small. Theoretically it would be less important there, but it might still have a performance gain since the LLM can still āseeā the class better. If you happen to try this principle out on your own classification tasks, let me know in the comments if it also works for cases where the input is small!
This has been a relatively quick exploration of a relatively easy-to-grasp prompting principle, but honestly in terms of usefulness this one ranks pretty highly. The others deal with consistent behavior; this one deals with the information the model can use.
Hopefully, together, these prompting principles expand your prompt engineerās toolkit! They are entirely learned from my experience building AI tools: they are not what youāll find in any research paper, and as a result they probably wonāt appear in basically any other AI blog. Anyway, thatās it for me this week. I totally published this in time and not at all at 3 AM :)
Have a good one and Iāll see you next time!