← All questions
RAGMedium· Prompt Engineering· Context Window· In-context Learning

What is the difference between few-shot prompting and r...

While both few-shot prompting and retrieval-augmented generation (RAG) serve to provide additional information to a model within its context window without updating the model’s parameters (θ), they differ fundamentally in their timing and selection process. In few-shot prompting, the examples or demonstrations are fixed and chosen before the specific user query is known. In contrast, RAG systems perform retrieval dynamically, where the documents are selected specifically in response to the user’s query.

Code playground (Python)