Add prefixes
Prefixes are short phrases or labels you can attach to parts of a prompt to guide the model’s understanding and output. They serve different roles based on where they’re placed:- Input prefix: This helps the model interpret sections of the input by labeling them. For instance, using “English:” and “French:” can indicate that different languages are being used.
- Output prefix: Even though the model generates the output, you can lead with a prefix like “JSON:” to show that the response should follow a specific format.
- Example prefix: In few-shot prompts, labeling examples with prefixes makes it easier for the model to recognize patterns and generate consistent, easy-to-understand results.
Let the model complete partial input
Language models function similarly to powerful autocomplete systems. When you supply the beginning of a sentence, structure, or task, the model can predict and continue the rest based on that starting point. If your prompt includes examples or additional context, the model can use that information to generate a more relevant and accurate continuation. Example Prompt:Prompt the model to format its response
You can also guide the model to structure its output by using a completion-based approach. For example, the prompt below asks the model to generate an outline for an essay. Example Prompt:- When you provide the model with an incomplete input, it can finish it by recognizing patterns from any examples or context you’ve included.
- In many cases, letting the model complete a partially written prompt is simpler and more effective than explaining the task in full.
- By starting the answer yourself, you can guide the model to generate responses in the specific structure or style you want.