Skip to main content
QUICK REVIEW

[论文解读] Contrastive Decoding Improves Reasoning in Large Language Models

Sean O’Brien|arXiv (Cornell University)|Sep 17, 2023
Natural Language Processing Techniques参考文献 6被引用 5
一句话总结

本文展示了对比解码(Contrastive Decoding)——一种无需训练、计算轻量的方法,通过最大化强专家模型与弱业余模型之间概率差异来提升性能——能显著改善大型语言模型的推理能力。该方法在 GSM8K 和 HellaSwag 基准测试中达到最先进水平,优于 LLaMA 2 和 GPT-3.5 等更大规模模型,且无需微调。

ABSTRACT

This record contains the camera-ready paper “LLM Inference in Normal Form: A TRoT-Based Unification.”We show that many inference-time methods for large language models (LLMs)—e.g., MBR/eMBR decoding, Conformal prediction gates, Verifier/Judge ensembles, Self-RAG, Chain/Tree/Graph-of-Thought, and Verifier-Sandwich (VS)—admit a single normal form derived from the Theory of Relativity of Theories (TRoT). Our formulation uses enriched category theory over the Lawvere cost quantale (tropical (min,+) semiring): left/right Kan extensions \Lan/\Ran\Lan/\Ran\Lan/\Ran, residuation (elementwise residuals), masking and nuclei (1-Lipschitz projectors). In this normal form, generation/lifts (K3), safety consolidation (K4), and auditing (K6–K10 RAVE) become GraphBLAS-style sparse operators with explicit stability and auditability contracts. Provable guarantees Implementation equivalence (normal form): common decoding “tricks” map to \Lan\Lan\Lan → Obs → \Ran\Ran\Ran with the same outputs under masking/nucleus conditions. Stability: \Lan\Lan\Lan and the residual are 1-Lipschitz in ℓ∞\ell_\inftyℓ∞. Approximation bounds: geometric truncation error q\*k+11−q\*\frac{q_\*^{k+1}}{1-q_\*}1−q\*q\*k+1; soft-min (log-sum-exp) gap k log⁡dmax⁡λcost\frac{k\,\log d_{\max}}{\lambda_{ ext{cost}}}λcostklogdmax (with join ≡ numeric infimum in Cost polarity). Auditing: a deterministic spending schedule ∑tαt≤αglobal\sum_t\alpha_t\le\alpha_{ ext{global}}∑tαt≤αglobal with test-(super)martingale e-processes gives time-uniform FWER control; LR/mixture-LR constructions yield valid e-values. Implementation blueprint (GPU/GraphBLAS-ready) \Lan\Lan\Lan: sparse SpMV/SpGEMM on (min,+); \Ran\Ran\Ran: elementwise residual → max-reduce; Numerics: log-domain + row-wise max-shift; masks send forbidden entries to +∞+\infty+∞. Reproducibility log (minimum fields): seed; model/revision; tokenizer; prompts; forward map JJJ; transport KKK; masks; λcost\lambda_{ ext{cost}}λcost; kkk; effective dmax⁡d_{\max}dmax; \Lan/\Ran\Lan/\Ran\Lan/\Ran kernel + build flags; hardware/BLAS; e-process updates (et,Mt)(e_t,M_t)(et,Mt); Conformal calibration snapshots.

研究动机与目标

  • 评估对比解码是否能在不微调的情况下提升大型语言模型的推理能力。
  • 研究对比解码在 GSM8K 和 HellaSwag 等标准推理基准上的有效性。
  • 分析该方法是否能减少思维链生成过程中常见的输入复制与步骤遗漏等错误。
  • 探索不同业余模型架构及其训练阶段对对比解码性能的影响。
  • 评估对比解码与思维链提示法及自一致性解码策略的兼容性。

提出的方法

  • 对比解码利用强专家模型与弱业余模型之间 logit 分数的加权差异来引导生成过程。
  • 通过 α-掩码过滤掉专家模型中低概率的词元,仅保留高置信度预测。
  • 最终 logits 计算公式为 $ s_{CD}^{(i)} = (1+\beta)s_e^{(i)} - \beta s_a^{(i)} $(对有效词元),无效词元被掩码为 $-\infty$。
  • 超参数 $\beta$ 控制对比惩罚强度,当 $\beta \to 0$ 时退化为贪婪解码,当 $\beta \to \infty$ 时收敛至比例 $p_e^{(i)}/p_a^{(i)}$ 的 argmax。
  • 该方法在 logit 空间中运行,实现高效推理,计算开销极小。
  • 其在提示生成后应用,尤其适用于思维链提示法,以提升推理轨迹质量。
Figure 1: Contrastive decoding improves reasoning across model scales and reasoning tasks.
Figure 1: Contrastive decoding improves reasoning across model scales and reasoning tasks.

实验结果

研究问题

  • RQ1对比解码是否能在 GSM8K 和 HellaSwag 等标准基准上提升大型语言模型的推理性能?
  • RQ2业余模型的选择(规模、训练阶段)如何影响对比解码的性能?
  • RQ3对比解码是否能减少思维链推理过程中对输入提示的表面级复制,并提升逻辑步骤的完整性?
  • RQ4与贪婪解码和核采样相比,对比解码在推理准确率与生成质量方面表现如何?
  • RQ5对比解码能否与自一致性或负向提示法有效结合,以进一步提升推理结果?

主要发现

  • 对比解码使 LLaMA-65B 在 GSM8K 上的性能最高提升 8 个百分点绝对值,超越 LLaMA 2、GPT-3.5 和 PaLM 2-L。
  • 在 HellaSwag 常识推理基准上,LLaMA-65B 搭载对比解码后,表现优于 LLaMA 2、GPT-3.5 和 PaLM 2-L,接近 GPT-4 水平。
  • 该方法减少了思维链推理中的输入复制与步骤遗漏,表明其能缓解常见的抽象推理错误。
  • 使用 7B 模型作为业余模型会损害 GSM8K 上的性能,但使用 7B 模型的早期训练检查点(如 130B 步骤)可提升结果,表明模型训练阶段至关重要。
  • 将负向提示与对比解码结合会降低性能,表明多种引导技术组合存在权衡。
  • 在长序列推理生成中,对比解码优于贪婪解码与核采样,确立其作为提升大模型输出质量的通用方法。
Figure 3: CD accentuates what the expert model has learned that the amateur model has not. Results are taken from greedy decoding with a 65B parameter expert, using $\alpha=0.1$ , $\beta=0.5$ for CD.
Figure 3: CD accentuates what the expert model has learned that the amateur model has not. Results are taken from greedy decoding with a 65B parameter expert, using $\alpha=0.1$ , $\beta=0.5$ for CD.

更好的研究,从现在开始

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

无需绑定信用卡

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