Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Nudging: Inference-time Alignment of LLMs via Guided Decoding

About

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/ .

Yu Fei, Yasaman Razeghi, Sameer Singh• 2024

Related benchmarks

TaskDatasetResultRank
Commonsense ReasoningARC Challenge
Accuracy89.6
259
Math ReasoningGSM8K
Accuracy79.5
254
Mathematical ReasoningMATH 500
Accuracy (pass@1)57.8
134
Commonsense ReasoningCommonsenseQA
Accuracy (pass@1)79.3
108
Math ReasoningSVAMP
Accuracy87.3
89
Math ReasoningMATH (test)
Accuracy13.6
59
Safety EvaluationXSTest (test)--
36
Mathematical ReasoningGSM8K
Accuracy67
30
Truthful Question AnsweringTruthfulQA
Accuracy51
30
Safety EvaluationXSTest
Accuracy12
30
Showing 10 of 17 rows

Other info

Follow for update