用生成式方法动态定制少样本推理示范,提升大模型效率与泛化能力。
GRAD: Generative Retrieval-Aligned Demonstration Sampler for Efficient Few-Shot Reasoning
- 训练模型生成针对输入的精炼示范,实现动态适配。
- 在有限令牌预算下,数学与跨学科任务表现优于基线。
- 小模型生成示范可指导大模型,降低训练成本。
大型语言模型(LLMs)在各类任务中表现优异,但其效果常依赖上下文质量。检索增强生成(RAG)通过外部信息丰富提示,但受限于静态数据库,易产生无关示范。本文提出生成式检索对齐示范生成器(GRAD),一种基于生成的动态示范方法:训练一个LLM为每个输入生成特定的简洁示范。通过适配输入,该方法比传统RAG提供更优的上下文支持。我们在令牌数受限条件下验证了GRAD的优势,即限制每条示范与最终输出的令牌数。仅在数学数据集上训练的GRAD,在Qwen2.5-14B上持续超越强基线,涵盖数学推理及物理、化学、计算机科学等分布外(OOD)领域,展现良好泛化性。此外,由小型模型生成的示范可有效引导大型目标模型,降低训练成本并保持竞争力。本工作首次推动资源受限环境下动态少样本学习范式的发展。代码已开源。
原文摘要 · Abstract (English)
Large Language Models (LLMs) achieve strong performance across diverse tasks, but their effectiveness often depends on the quality of the provided context. Retrieval-Augmented Generation (RAG) enriches prompts with external information, but its reliance on static databases constrains adaptability and can result in irrelevant demonstrations. In this work, we propose a Generative Retrieval-Aligned Demonstrator (GRAD), a dynamic demonstration-based approach where an LLM model is trained to generate input-specific concise demonstrations. By tailoring demonstrations to each input, our method offers better contextual support than traditional RAG approaches. We demonstrate the superiority of GRAD under budget constraints, where we limit both the number of tokens used per demonstration and the number of tokens used for the final output. Trained solely on a math dataset, GRAD consistently outperforms strong baselines on Qwen2.5-14B across mathematical reasoning and advanced STEM questions, highlighting GRAD's robust generalization to out-of-distribution (OOD) domains such as physics, chemistry, and computer science. Furthermore, we show that demonstrations generated by trained smaller models can effectively guide larger target models, reducing training costs while maintaining competitive accuracy. Overall, this work introduces a scalable demonstration generator model presenting the first step toward a dynamic few-shot learning paradigm in resource-constrained settings. We release the code used for the project.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。