Retrieval High-Quality Demonstrations (RAD)
- RAD is a retrieval-conditioned methodology that selects task-relevant examples from a large corpus instead of using fixed prompts.
- It employs dual encoder, BM25, and cross-encoder techniques to optimize demonstration selection based on downstream conditional likelihood.
- Empirical evaluations in NLP, imitation learning, and reinforcement learning show that RAD efficiently improves performance with fewer high-quality examples.
Retrieval High-quAlity Demonstrations (RAD) denotes a retrieval-conditioned methodology in which a model selects demonstrations, examples, or analogous high-value conditioning items specifically for a query, target task, or current state, rather than using a fixed prompt or uniformly sampled support set. In the in-context learning formulation, RAD is defined over a query space , a retrieval corpus , and a parametric retrieval function , with the objective of choosing a subset of size that maximizes the probability of the correct answer under a frozen LLM: (Luo et al., 2024). Across the literature, the same acronym is instantiated in meta-training with dense demonstration retrieval (Mueller et al., 2023), passage re-ranking by difficulty-based prompt construction (Drozdov et al., 2023), textual-graph question answering with mixture-based demonstration selection (Wu et al., 23 Mar 2026), few-shot imitation via adaptive fusion of retrieved subsets (Kumar et al., 2 Aug 2025), and offline reinforcement learning with retrieval-guided planning toward high-return states (Guo et al., 21 Jul 2025). This suggests that RAD is best understood as a family of retrieval-and-conditioning designs rather than a single fixed algorithm.
1. Formal objective and conceptual scope
In the survey formulation, each candidate demonstration is a paired example in a corpus , and retrieval is query-conditioned: for each query , RAD ranks the corpus with and selects the top-0 elements as demonstrations. The central optimization target is not retrieval quality in isolation, but the downstream conditional likelihood assigned by the frozen in-context LLM. This formalization makes demonstration retrieval a task-coupled selection problem rather than a generic nearest-neighbor lookup problem (Luo et al., 2024).
The same general logic appears outside text-only in-context learning. In few-shot imitation, the target set is a small set of expert demonstrations 1 and the prior data source is a large offline dataset 2; the objective is to learn a policy 3 with high expected performance on the target task by combining 4 with only a relevant subset of 5 (Kumar et al., 2 Aug 2025). In offline reinforcement learning, the retrieved object is no longer an input-output demonstration pair but a high-return state together with its return estimate and trajectory position, which is then used as a waypoint for diffusion-based planning (Guo et al., 21 Jul 2025). A plausible implication is that the defining feature of RAD is not the datatype of the retrieved item, but the use of retrieval to construct a conditioning set that is more task-relevant than a static alternative.
The survey literature assigns several expected benefits to RAD: demonstrations tailored to each query reduce mismatch relative to fixed sets; automated retrieval can reduce manual selection bias; and sparse indexes or approximate nearest neighbor methods make retrieval scalable to large corpora. At the same time, the survey identifies efficiency trade-offs, corpus-maintenance burdens, and open questions about universal retriever training across domains (Luo et al., 2024).
2. Retrieval models and supervision signals
The canonical RAD retrieval stack in language tasks includes three architecture families. Embedding-based retrieval uses a dual encoder with 6 and 7, scoring candidates with cosine similarity or inner product, 8. Sparse retrieval uses term-based methods such as BM25. Cross-encoder re-ranking jointly encodes 9 and produces a scalar score 0, typically in a two-stage pipeline that first retrieves top 1 candidates and then reranks them to obtain the final top-2 demonstrations (Luo et al., 2024).
Training objectives in RAD are correspondingly heterogeneous. The survey enumerates contrastive InfoNCE losses, hard negative mining, list-wise ranking losses of the 3Rank style, KL-distillation from teacher language-model scores, and weighted combined objectives such as 4 (Luo et al., 2024). These objectives make explicit that the retriever is often trained against a notion of demonstration usefulness induced by another model rather than against raw semantic proximity alone.
A particularly explicit formulation of LM-supervised retrieval appears in Unified Demonstration Retriever (UDR). UDR uses a dual-encoder backbone initialized from BERT-base, prefixes each example with a task instruction 5, and scores a query-demo pair by inner product, 6. For supervision, it constructs candidate pools, lets the LLM compute 7 or the classification analogue 8, ranks the candidates by LM feedback, and trains with a list-wise contrastive loss plus an in-batch softmax loss. Multi-task sampling with probability proportional to 9 with 0, together with iterative candidate mining using top-1 nearest neighbors and re-scoring by the LLM, turns RAD into a unified retriever across 30+ tasks in 13 families (Li et al., 2023).
This body of work establishes a central distinction within RAD: retrieval can be optimized either for representational similarity or for estimated downstream utility. The latter view, which dominates the stronger formulations, treats retrieval as a learned proxy for task-specific helpfulness.
3. Meta-training with retrieved demonstrations
The paper that explicitly introduces RAD as “Retrieval of high-quality Demonstrations” couples dense retrieval with meta-training for few-shot learning. Its retriever is a Dense Passage Retriever with a 12-layer BERT\textsubscript{base} query encoder 2 and a second 12-layer BERT\textsubscript{base} demonstration encoder 3; both map text to 768-dimensional vectors and use inner-product similarity. Given an input 4, retrieval defines
5
and uses the top-6 highest-scoring demonstrations from a memory bank 7 (Mueller et al., 2023).
The meta-training objective couples this retriever to a seq2seq generator, BART\textsubscript{large}, over a set 8 of meta-training tasks: 9 The model also approximates the marginal likelihood over retrieved demonstrations with a “RAG-Token” style factorization,
0
thereby avoiding a single concatenated prompt and instead aggregating over separate forward passes (Mueller et al., 2023).
The demonstration bank is constructed from UnifiedQA training splits from 16 QA tasks, excluding tasks used for final evaluation, and each entry is formatted as plain text with question, answer, and context. The retriever is initialized from DPR pre-trained on Wikipedia and fine-tuned on NaturalQuestions, with no further fine-tuning during meta-training or task fine-tuning. Retrieval uses approximate maximum inner-product search, such as FAISS, to fetch 1 nearest neighbors; the paper reports experiments with 2 and states that performance saturates around 5–10 demonstrations (Mueller et al., 2023).
Empirically, this RAD formulation outperforms several few-shot baselines. On SQuAD 16-shot, RAD reaches 3 F4, compared with 5 for RAG-m and 6 for FewshotQA of Chada and Natarajan. On classification, the reported average accuracy is 7 for RAD, versus 8 for RAG-m and 9 for LM-BFF. An oracle-memory ablation raises SQuAD F0 from 1 to 2, which the paper interprets as headroom for better demonstration collection (Mueller et al., 2023).
4. Selection criteria beyond semantic proximity
A recurrent theme in RAD is that “high-quality” does not reduce to semantic similarity. PaRaDe, a passage re-ranking framework using demonstrations with LLMs, argues that difficulty can be a more informative selection principle than similarity. For each candidate demonstration 3, it defines a demonstration query likelihood
4
and ranks demonstrations in ascending order of DQL, so that lower DQL corresponds to greater difficulty. Candidate demos are first pre-filtered by BM25 to roughly 30 items and then rescored by the frozen LLM; no dense embeddings or dual-encoders are used in this formulation (Drozdov et al., 2023).
On passage re-ranking, PaRaDe reports that adding even one demonstration is significantly beneficial, and difficulty-based selection often surpasses zero-shot and semantic baselines. In nDCG@10, DBS 1-shot reaches 5 on TREC 2019 and 6 on TREC 2020, compared with 7 and 8 for the zero-shot baseline. The paper also reports that varying the number of demonstrations shows median benefit saturating by 9, and that grouping demonstrations by DQL percentile yields monotonic improvement as difficulty increases (Drozdov et al., 2023).
A second alternative to nearest-neighbor selection appears in MixDemo for textual graph understanding and question answering. MixDemo partitions a demonstration pool 0 into 1 experts by K-means over sentence-BERT embeddings of textualized subgraphs and queries, chooses 2 by minimizing within-cluster squared distance plus a complexity penalty, and computes a soft gating distribution
3
Training jointly optimizes a cross-entropy loss on gated cluster choice and a retrieval ranking loss that separates the correct expert centroid from the others (Wu et al., 23 Mar 2026).
MixDemo’s results support the claim that demonstration quality can depend on mixture structure and query-conditioned filtering rather than pure similarity. On the GraphQA benchmarks, MixDemo improves over G-Retriever from 4 to 5 on ExplaGraphs, from 6 to 7 on SceneGraphs, and from 8 to 9 on WebQSP, with all improvements reported as statistically significant at 0 via bootstrap resampling. Removing MoE gating reduces ExplaGraphs accuracy to 1, and replacing the query-aware encoder with vanilla GCN reduces it to 2 (Wu et al., 23 Mar 2026).
5. Cross-domain adaptations of the RAD pattern
RAD-style retrieval has been adapted to continuous-control and robotics settings in which the retrieved unit is not a text demonstration alone. COLLAGE, described as “Adaptive Fusion-based Retrieval for Augmented Policy Learning,” addresses few-shot imitation learning from a large offline dataset. It defines feature modalities 3 for visual, motion, shape, and language cues; segments target trajectories using a velocity-threshold heuristic; aligns target sub-trajectories to prior trajectories by subsequence-DTW with cost matrix 4; and collects the top-5 prior sub-trajectories with lowest S-DTW cost to form modality-specific retrieved sets 6 (Kumar et al., 2 Aug 2025).
COLLAGE then estimates adaptive fusion weights by training one reference behavior-cloning policy per modality and evaluating how well each reference policy explains the few-shot target data. Specifically, for each modality it minimizes the behavior-cloning loss on 7, computes the negative log-likelihood 8 on the target demonstrations, and converts these losses to normalized weights
9
The final policy is trained on the augmented dataset 0 by importance sampling, first sampling a modality according to 1 and then drawing uniformly from 2 (Kumar et al., 2 Aug 2025).
The experimental results show that adaptive fusion outperforms both single-feature retrieval and non-adaptive fusion. On LIBERO-10 5-shot simulation, COLLAGE reaches 3 average success versus 4 for the best single-feature baseline, STRAP [visual], a 5 absolute gain. On six real-world DROID tasks in the 5-shot setting, it reaches 6 success versus 7 for the best single-feature visual baseline and 8 for uniform fusion, a 9 gain. The paper also reports modality-specific ablations and practical guidance, including 0 in simulation and 1 in the real world, retrieval budget 2–3, roughly 4k behavior-cloning gradient steps in simulation and 5k in the real world, and reference-policy training for about 100 epochs, approximately 40 minutes each (Kumar et al., 2 Aug 2025).
The acronym RAD is also used in offline reinforcement learning in a distinct but related sense. In this setting, the environment is modeled as an MDP 6 with an offline dataset of trajectories, and RAD dynamically retrieves high-return states from the dataset based on cosine similarity and discounted return estimates. Each indexed state stores its feature vector, trajectory ID, timestep index, and discounted return 7. At decision time, the method retrieves top-8 similar states, filters them by proximity to the maximum retrieved return within 9, selects the target state 00 with the longest remaining trajectory segment, and uses a condition-guided diffusion model to plan from the current state 01 to 02 in 03 steps (Guo et al., 21 Jul 2025).
This offline RL variant reports an overall mean normalized return of 04 across the nine D4RL MuJoCo tasks, compared with 05 for Decision Diffuser, 06 for ReDiffuser, 07 for Trajectory Transformer, and 08 for Diffuser. The paper states that removing retrieval drops performance severely, that removing step estimation harms trajectory coherence, and that a hyperparameter study shows best performance at similarity threshold 09 and 10 (Guo et al., 21 Jul 2025). A plausible implication is that, in control settings, RAD generalizes from “retrieving demonstrations” to “retrieving strategically useful conditioning states.”
6. Empirical regularities, limitations, and recurrent misconceptions
Across the literature, several regularities recur. First, dynamic retrieval is repeatedly favored over fixed exemplars. The survey states that adaptivity reduces mismatch relative to fixed demonstration sets and improves robustness to demonstration order, formatting, and lexical gaps (Luo et al., 2024). UDR reports that its retrieved demonstrations show less than 1 point variance under random, ascending, or descending ordering, whereas random prompts can swing by tens of points, and that UDR with only 2 demonstrations still outperforms BM25 or EPR with 8 on generation tasks (Li et al., 2023).
Second, the literature repeatedly rejects the assumption that the best demonstrations are simply the most similar ones. COLLAGE explicitly identifies detrimental retrieval cases such as unrelated tasks with similar scene layouts and similar motions from tasks with divergent goals, and responds with adaptive late fusion over multiple cues (Kumar et al., 2 Aug 2025). PaRaDe replaces semantic similarity with hardness measured by low query likelihood (Drozdov et al., 2023). MixDemo uses expert clustering and query-conditioned gating to avoid irrelevant subgraph information (Wu et al., 23 Mar 2026). This suggests that RAD is increasingly characterized by relevance estimation under downstream objectives rather than by single-metric similarity.
Third, larger demonstration sets do not monotonically improve performance. The meta-training RAD paper reports marginal gains beyond 11 and saturation around 5–10 demonstrations (Mueller et al., 2023). PaRaDe reports that the median benefit saturates by 12 (Drozdov et al., 2023). In ExplaGraphs, MixDemo performs best at 2-shot, with accuracy dropping from 13 at 2-shot to 14 at 3-shot and 15 at 1-shot (Wu et al., 23 Mar 2026). The shared implication is that demonstration quality and interaction structure matter at least as much as raw prompt count.
Limitations are equally consistent. The survey emphasizes efficiency overhead from neural encoders and cross-encoders, training costs associated with mining positives and negatives, dependence on corpus currency and coverage, and failure modes on tasks such as commonsense reasoning where lexical similarity can mislead the model (Luo et al., 2024). The meta-training RAD paper notes the need for a large labeled demonstration bank and reduced effectiveness on very long, knowledge-intensive contexts such as TriviaQA and TextbookQA (Mueller et al., 2023). UDR identifies the dense retriever as a black box and notes that its training scores each demo in isolation even though inference uses a sequence of demos (Li et al., 2023). The offline RL RAD paper states that no formal convergence or optimality proofs are derived and that performance depends on the existence of reachable, high-value states in the dataset (Guo et al., 21 Jul 2025).
Open directions follow directly from these limitations. The survey identifies universal retriever training as an open challenge (Luo et al., 2024). The meta-training RAD paper proposes mixing Wikipedia-passage retrieval for knowledge tasks, dynamic bank expansion via generation, multilingual adaptation, and joint fine-tuning of DPR and BART (Mueller et al., 2023). PaRaDe suggests combining similarity and difficulty (Drozdov et al., 2023). UDR highlights modeling inter-demo interactions as a possible improvement (Li et al., 2023). In aggregate, these directions indicate that RAD remains an active research area centered on how retrieval, ranking, and conditioning should be optimized jointly for downstream reasoning, generation, and control.