From a learning theoretic standpoint, explain why in context learning (ICL) in a RAG pipeline is functionally equivalent to approximate Bayesian inference, yet performs no parameter update. Reference at least one of the key papers (Xie et al. 2022 or Akyürek et al. 2023) and articulate how this equivalence is achieved purely in the forward pass over fixed weights.
Fixed-weight LLMs behave as if running Bayesian inference over a latent task: retrieved context concentrates an implicit posterior, doing fine-tune like work entirely in the forward pass; no parameter update.
Imagine a chef who already knows thousands of recipes but doesn't know which dish you want tonight. You don't reteach them how to cook. You just show them a few photos of similar dishes. From those hints, the chef quietly narrows down which style you mean and cooks accordingly. Nobody rewired the chef's brain; the photos just steered choices they already had. In-context learning works the same way. The model's weights stay frozen, but the examples and retrieved documents in the prompt act as evidence that sharpens its guess about which task you're really asking for. It looks like the model learned something new on the spot, but really it is selecting among abilities it already had, guided by what you placed in front of it.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
This question sits at the intersection of learning theory and systems design, and it trips up strong candidates because the word 'learning' in 'in-context learning' is misleading. Nothing is learned in the parameter sense. The interviewer wants to hear that you can hold two ideas at once: the model's behavior changes with the prompt, and yet the weights are bit-for-bit identical before and after.
The resolution is to characterize the behavior, not the parameters. An LLM at inference is a fixed conditional distribution; in-context learning is best understood as approximate Bayesian inference over a hidden task variable, with the prompt and any retrieved chunks acting as evidence. The remainder of this walkthrough builds that picture carefully, names the two theoretical results that anchor it, and connects the theory to why retrieval-augmented prompts can do fine-tune shaped work without a training loop.
Frozen weights: the formal starting point
Start where every rigorous answer should start. After pretraining, the parameter vector θ is fixed. Serving a request runs a forward pass; a forward pass reads θ and produces activations, but it never writes θ. So the object you are reasoning about is a fixed conditional distribution.
The puzzle is now sharp. If θ does not move, how can showing the model a few examples, or pasting in retrieved documents, change what it does? It clearly does change: few-shot accuracy beats zero-shot, and a RAG prompt answers questions the bare model cannot. The honest answer is that the change is in the conditioning, the part of the input to the right of the semicolon, not in the weights to the left. Everything 'learned' lives in the prompt, and it lives there only for the duration of that one forward pass.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
| Aspect | In-context learning (ICL) | Fine-tuning |
|---|---|---|
| Parameters θ | Frozen, never updated | Updated by gradient descent |
| Where adaptation lives | Activations in the forward pass | Persisted in weights |
| Mechanism | Posterior concentration over latent task | Real optimization on a loss |
| Persistence | Vanishes when prompt changes | Permanent until retrained |
| RAG relevance | Retrieved chunks are the evidence | Training data baked in offline |
Real products, models, and research that use this idea.
- A RAG support bot adapts tone and facts per retrieved ticket without any retraining; the chunks concentrate the implicit task posterior at query time.
- Few-shot prompting a frozen GPT-class model to do classification matches a small fine-tune's behavior, yet θ never changes between prompts.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat structural assumption about the pretraining distribution does the implicit-Bayesian-inference result require, and what breaks without it?
Discuss the mixture of latent concepts assumption; without coherent latent tasks the posterior is mis specified, so prompts out-of-distribution for the mixture degrade ICL and the equivalence stops holding.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Claiming the model literally updates weights during ICL. It does not; θ is frozen. The equivalence is functional, not a real gradient step on parameters.
60 second bullets to scan on the way to the call.
The inference time model as P(y|prompt;θ) with θ fixed
The Bayesian marginalization over a latent task variable
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.