arXiv:2607.03453cs.LGcs.AI2026-07

用检索重写提升大模型生成质量,让少样本也能出好答案

Best-of-Better-$N$: Generating Pre-Aligned Responses with In-Context Learning

论文配图:Best-of-Better-$N$: Generating Pre-Aligned Responses with In-Context Learning
图 1 · 摘自论文原文
  • 从高奖励样本中检索并重写,引导模型生成更优回答
  • 在固定生成数量下,性能显著优于传统方法
  • 适合对生成质量要求高、样本有限的场景

推理时对齐方法(如 Best-of-N)通过奖励模型筛选高质量输出,但受限于基础模型生成能力。若高奖励回复概率极低,任何选择策略均无效。本文提出 Best-of-Better-N(BoBN),一种基于上下文学习的生成框架:从与输入相关的高奖励样本中检索,并由参考大模型重写为符合目标任务格式和风格的示例;这些重写示例作为上下文,引导采样分布向高奖励区域偏移。我们分析了上下文学习如何将预训练模型输出分布推向高奖励区域,实现可证明的优势。在多个参考 LLM 上评估了 BoBN 在安全对齐与数学推理任务上的表现,结果表明:在固定 $N$ 时性能更优,或以更小的 $N$ 达到目标性能。

原文摘要 · Abstract (English)

Inference-time alignment methods, such as Best-of-$N$, offer a flexible alternative to training-based alignment by using reward models to select high-quality responses generated by a reference LLM. However, the efficacy of these methods is inherently limited by the response quality: if the reference LLM assigns negligible probability to high-reward responses, no selection strategy will succeed in finding aligned outputs. In this work, we propose Best-of-Better-$N$ (BoBN), an in context learning-based generation framework to address this challenge. Our method utilizes retrieval from high-reward examples relevant to the input query and task. Crucially, we introduce a restyling step where retrieved responses are rewritten by the reference LLM to align with the target task's format and style. These restyled examples are used in-context to shift the sampling distribution toward the high-reward region. We analytically characterize how in-context learning shifts the output distribution of pretrained transformers toward the high-reward region, resulting in provable benefits on the target task. We then evaluate BoBN on safety alignment and mathematical reasoning benchmarks across several reference LLMs. BoBN's higher-quality responses enable better performance to be achieved when the number of responses $N$ is fixed, and smaller $N$ required to achieve a target performance.

大模型对齐上下文学习生成优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。