Prompt engineering is the systematic design and search of prompts or prompt templates that guide a language model toward better task results. A strong template states the task clearly and supplies relevant context. section 1.5.3 section 9.5
Use prompt engineering to improve results by:
- Defining the requested task and the required answer format explicitly. section 1.5.3
- Testing alternative templates rather than assuming the first wording is best. section 1.5.3 section 9.5
- Adding a few labeled examples when the task is difficult to communicate through instructions alone. section 9.5
- Improving the performance of cheaper models when an optimized template is sufficient for the task. section 1.5.3
Few-shot sentiment classification
A classification prompt can show a review, its label, and then a new review to classify. For example: "[Sample Review] Is the sentiment positive or negative? Answer (\"pos\"/\"neg\"): [Sample Solution] [Review to Classify] Is the sentiment positive or negative? Answer (\"pos\"/\"neg\"):". Repeating this structure with labeled samples helps specify both the task and the expected output. section 9.5
[Sample Review]
Is the sentiment positive or negative?
Answer ("pos"/"neg"):[Sample Solution]
[Review to Classify]
Is the sentiment positive or negative?
Answer ("pos"/"neg"):
Inspect the compact sample-review template to see how an example, reference answer, target input, and constrained output format fit together. section 9.5





































