TokenPad
Prompts

Few-Shot Example Formatter

Turn a list of pairs into properly formatted examples, four ways.

Your input

99 characters3 lines0 tokensor drop a file

Few-Shot FormatterExact
0Token change
Token change0no change
Input tokens0what you pasted
Output tokens0what you would send
Token cost of this result
Output tokens0
As input$0.00
× 100K requests$0.00

Everything on this page runs in your browser. Nothing you paste is transmitted, because there is no server here to transmit it to.

Result
 

Why examples beat instructions

Two or three well-chosen examples routinely outperform several paragraphs of instruction, particularly for output format compliance. Showing the shape is more reliable than describing it.

They are also the most expensive part of a prompt per unit of instruction, and they are resent on every request. That trade-off is worth making deliberately rather than by accident, which is why the token count is shown as you format.

Choosing a format

XML example blocks are the most explicit and the most expensive. Best for complex outputs where the boundary between one example and the next could be ambiguous.

Labelled pairs are the cheapest and work well for short, simple mappings such as classification.

Alternating chat turns place examples as prior conversation, which some models follow more closely than examples embedded in a system prompt. Worth testing against the alternatives on your task.

Choosing the examples themselves

Cover the boundaries, not the middle. Three examples of the obvious case teach less than one obvious, one ambiguous and one that should be refused.

Keep them consistent in format. Examples that disagree with each other about capitalisation, punctuation or structure teach the model that the format is optional, and it will treat it accordingly.

Frequently asked questions

How many examples should I use?
Two or three for most tasks. Beyond five the return usually flattens while the cost keeps rising, and past that point the examples are competing with each other for attention.
Should examples go before or after the instruction?
After the instruction and before the input. The model needs to know what it is being asked before the examples mean anything.

More prompts tools