Skip to main content

Overview

Select effective in-context examples by choosing those semantically closest to the query using KNN (k-Nearest Neighbors) with embeddings. Steps:
  1. Embed the candidate examples
  2. Embed the query to answer
  3. Find the k examples closest to the query
  4. Use chosen examples as context for the LLM

Example

References

  1. What Makes Good In-Context Examples for GPT-3? (https://arxiv.org/abs/2101.06804)
  2. The Prompt Report: A Systematic Survey of Prompting Techniques (https://arxiv.org/abs/2406.06608)