Skip to main content
QUICK REVIEW

[论文解读] Stay on topic with Classifier-Free Guidance

Guillaume Sanchez, Honglu Fan|arXiv (Cornell University)|Jun 30, 2023
Topic Modeling被引用 5
一句话总结

本文提出无需微调的推理阶段技术——无分类器引导(Classifier-Free Guidance, CFG),用于自回归语言模型。实验表明,增加引导权重 $γ$ 可显著提升提示遵循度、连贯性与事实一致性,适用于多种任务。在 LAMBADA 上,LLaMA-7B 搭配 CFG 达到当前最优性能,超越 PaLM-540B;同时,该方法使模型在推理阶段实现相当于两倍参数量模型的性能,且在复杂、格式驱动的提示中显著提升对齐效果。

ABSTRACT

Classifier-Free Guidance (CFG) has recently emerged in text-to-image generation as a lightweight technique to encourage prompt-adherence in generations. In this work, we demonstrate that CFG can be used broadly as an inference-time technique in pure language modeling. We show that CFG (1) improves the performance of Pythia, GPT-2 and LLaMA-family models across an array of tasks: Q\&A, reasoning, code generation, and machine translation, achieving SOTA on LAMBADA with LLaMA-7B over PaLM-540B; (2) brings improvements equivalent to a model with twice the parameter-count; (3) can stack alongside other inference-time methods like Chain-of-Thought and Self-Consistency, yielding further improvements in difficult tasks; (4) can be used to increase the faithfulness and coherence of assistants in challenging form-driven and content-driven prompts: in a human evaluation we show a 75\% preference for GPT4All using CFG over baseline.

研究动机与目标

  • 探究无分类器引导(CFG)是否可在无需微调的情况下,提升纯语言建模任务中的对齐性与性能。
  • 评估 CFG 在多种提示范式(包括零样本、思维链、长文本生成与聊天机器人式提示)中的有效性。
  • 确定 CFG 是否可实现相当于两倍参数量模型的性能,从而降低计算与数据成本。
  • 评估 CFG 与其他推理阶段方法(如思维链与自一致性)的兼容性。
  • 评估在复杂、内容驱动的助手交互场景中,人类对 CFG 引导生成结果的偏好程度。

提出的方法

  • 将 CFG 从文本到图像扩散模型迁移至自回归语言模型,通过模型自身的 logits 作为隐式分类器。
  • 在解码过程中引入引导权重 $\gamma$,对 logits 进行缩放,增强对提示相关 token 的关注。
  • 引入负向提示(negative prompt),实现对提示中特定方面强调程度的细粒度控制。
  • 在解码阶段应用 CFG,通过修改 logits 分布实现:$\text{logits}_{\text{guided}}} = \text{logits} + \gamma \cdot (\text{logits} - \text{logits}_{\text{uncond}})$,其中 $\text{logits}_{\text{uncond}}$ 表示无提示输入下的模型输出。
  • 在多个基准测试中评估 CFG 表现:LAMBADA、GSM8K、HumanEval、MMLU 以及机器翻译任务。
  • 通过人工评估对比 CFG 引导生成与原始采样结果,重点关注助手式生成与复杂提示场景下的表现。
Figure 1: A notional 2D projection of a textual latent space showing how increasing the guidance weight $\gamma$ increases the importance of the prompt “Today in France,”.
Figure 1: A notional 2D projection of a textual latent space showing how increasing the guidance weight $\gamma$ increases the importance of the prompt “Today in France,”.

实验结果

研究问题

  • RQ1CFG 是否可在无需微调或额外训练的情况下,提升自回归语言模型的提示遵循度与生成质量?
  • RQ2CFG 是否能在包括零样本、思维链与复杂助手式提示在内的多种提示风格中均提升性能?
  • RQ3CFG 相较于模型参数量的性能提升程度如何?是否可实现相当于两倍参数量模型的性能?
  • RQ4CFG 与其他推理阶段技术(如思维链与自一致性)的交互机制如何?
  • RQ5CFG 是否可提升人类在助手式生成中的偏好度与连贯性,特别是在格式驱动与内容驱动的提示中?

主要发现

  • 在 LAMBADA 基准测试中,LLaMA-7B 搭配 CFG 达到当前最优性能,超越 PaLM-540B。
  • CFG 在多项任务中均表现提升,包括问答、推理、代码生成与机器翻译,且收益稳定。
  • 在相同推理成本下,参数量减半但使用 CFG 的模型,其性能可与更大规模的无引导模型相媲美。
  • CFG 显著提升人类对助手式生成的偏好:75% 的人工评估者更偏好 GPT4All 模型在 CFG 引导下的输出,而非原始采样结果。
  • CFG 降低 token 采样分布的熵值,使生成结果更具聚焦性与连贯性。
  • 可视化结果表明,CFG 显著增强对提示相关词汇的关注,提升可解释性,并有助于提示工程优化。
Figure 3: CFG impact on chain-of-thought prompting with respect to GSM8K dataset. For small CFG values, using CFG increases the percentage of chains which end in a valid answer structure while increasing the model accuracy. For large values the invalid percentage remains small but the accuracy drop.
Figure 3: CFG impact on chain-of-thought prompting with respect to GSM8K dataset. For small CFG values, using CFG increases the percentage of chains which end in a valid answer structure while increasing the model accuracy. For large values the invalid percentage remains small but the accuracy drop.

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。