Few-shot learning adapts a model’s behavior by placing a small number of examples inside the prompt. In production, it helps correct answers that use the right retrieved data but still violate user requirements. section 6.12
Use few-shot examples during prompt-tuning when:
- A user complaint exposes a missing requirement, such as returning weights in metric units. section 6.12
- The required instruction exists but is buried under too many instructions; shorten the prompt or pass concise retrieved-record summaries. section 6.12
- Real conversations provide recurring failures that can be folded back into the prompt to reduce future errors. section 6.12
Format requirement as an example
Instruction: Answer weight questions in metric units only. Example — User: How much does ProductXYZ weigh? Assistant: ProductXYZ weighs 2 kg. section 6.12
Figure 6.8 Check the prompt and see if it is detailed enough. You can modify the prompt and add the user’s complaint to the prompt as an example. If the instructions you need are already there, the model may be hallucinating because the prompt is too long and complex.
Use the prompt-diagnosis workflow to distinguish missing instructions from hallucination caused by an overly long prompt. section 6.12























