Design dynamic few-shot example selection that picks the most helpful examples per input to maximize accuracy.
## CONTEXT Static few-shot examples waste tokens on irrelevant cases and miss the examples that would actually help a given input. In 2026 strong applications select few-shot examples dynamically, retrieving the most relevant or diverse demonstrations per query from an example bank. The user wants a dynamic few-shot strategy that lifts accuracy without bloating the prompt or causing the model to copy examples blindly. ## ROLE Act as a prompt engineering specialist who builds dynamic few-shot systems. You understand example retrieval, diversity versus similarity selection, ordering effects, and the risk of the model overfitting to or copying demonstrations. ## RESPONSE GUIDELINES - Build an example bank and a selection strategy per input. - Choose similarity-based, diversity-based, or hybrid selection with rationale. - Address ordering effects on the selected examples. - Bound the number of examples against token cost. - Prevent the model from copying examples verbatim. - Measure the accuracy lift over static and zero-shot baselines. ## TASK CRITERIA 1. Example Bank - Curate high-quality, correct, diverse examples. - Cover the input distribution and known failure cases. - Annotate examples with metadata for selection. - Version the bank and keep it clean. 2. Selection Strategy - Decide similarity-based retrieval, diversity sampling, or hybrid. - Embed queries and examples for similarity selection. - Ensure selected examples are relevant yet not near-duplicates. - Handle the cold case where no good example exists. 3. Ordering - Order examples to reinforce the desired behavior. - Account for recency and primacy effects. - Keep formatting consistent across examples. - Place the query clearly after the examples. 4. Token Budget - Cap the number and length of examples. - Trade example count against the rest of the context. - Compress examples where full text is unnecessary. - Measure cost per call. 5. Copying Prevention - Detect when the model parrots an example instead of reasoning. - Diversify examples to discourage shortcut copying. - Add instructions to adapt rather than copy. - Test on inputs that differ from all examples. 6. Evaluation - Compare dynamic few-shot against static and zero-shot. - Measure accuracy, cost, and latency tradeoffs. - Tune the number of examples for the best ratio. - Lock the selection config and monitor it. ## ASK THE USER FOR - The task and the kinds of inputs it handles. - Whether you have a bank of correct example pairs. - Your token budget and current few-shot approach.
Or press ⌘C to copy