用小对齐模型在推理时引导大模型,零训练实现高效对齐。
Nudging: Inference-time Alignment of LLMs via Guided Decoding
- 通过小对齐模型生成引导词,在大模型高不确定性时干预输出。
- 7-14倍小的对齐模型可达到与大对齐模型相当甚至更优的零样本性能。
- 适用于跨模型家族协作,适合资源有限但需对齐的场景。
大型语言模型(LLMs)需对齐以有效且安全地遵循用户指令。传统方法需为每个基础模型训练专属对齐版本,计算开销巨大。本文提出 NUDGING,一种无需训练的推理时对齐算法,利用小型对齐模型引导任意基础模型。该方法基于最新发现:对齐主要影响少数风格化标记(如话语标记)的生成行为。我们发现基础模型在生成这些标记时不确定性显著更高。NUDGING 利用小对齐模型在基础模型高不确定性时生成引导词,仅引入轻微额外推理开销。我们在三个模型家族上评估了 NUDGING 在多样化开放指令任务上的表现。无需训练,使用7-14倍小的对齐模型即可实现与大型对齐模型相当甚至更优的零样本性能。由于在词元层面操作,NUDGING 支持不同模型家族的即插即用协作。例如,用 Llama-27b-chat 引导 Gemma-2-27b 优于 Llama-2-70b-chat 在多项任务上的表现。整体而言,本工作提供了一种模块化、低成本的 LLM 对齐方案。代码与演示见:https://fywalter.github.io/nudging/
原文摘要 · Abstract (English)
Large language models (LLMs) require alignment to effectively and safely follow user instructions. This process necessitates training an aligned version for every base model, resulting in significant computational overhead. In this work, we propose NUDGING, a simple, training-free algorithm that aligns any base model at inference time using a small aligned model. NUDGING is motivated by recent findings that alignment primarily alters the model's behavior on a small subset of stylistic tokens (e.g., discourse markers). We find that base models are significantly more uncertain when generating these tokens. Building on this insight, NUDGING employs a small aligned model to generate nudging tokens to guide the base model's output during decoding when the base model's uncertainty is high, with only a minor additional inference overhead. We evaluate NUDGING across 3 model families on a diverse range of open-instruction tasks. Without any training, nudging a large base model with a 7x-14x smaller aligned model achieves zero-shot performance comparable to, and sometimes surpassing, that of large aligned models. By operating at the token level, NUDGING enables off-the-shelf collaboration between model families. For instance, nudging Gemma-2-27b with Llama-27b-chat outperforms Llama-2-70b-chat on various tasks. Overall, our work offers a modular and cost-efficient solution to LLM alignment. Our code and demo are available at: https://fywalter.github.io/nudging/ .
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。