[论文解读] DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models
DoLa 通过对比成熟层与早熟层的 logits,动态选择要 surface 的层以提供事实知识并减少幻觉,且无需外部检索或微调。它在多项任务上提升真实度,且额外延迟很小。
Despite their impressive capabilities, large language models (LLMs) are prone to hallucinations, i.e., generating content that deviates from facts seen during pretraining. We propose a simple decoding strategy for reducing hallucinations with pretrained LLMs that does not require conditioning on retrieved external knowledge nor additional fine-tuning. Our approach obtains the next-token distribution by contrasting the differences in logits obtained from projecting the later layers versus earlier layers to the vocabulary space, exploiting the fact that factual knowledge in an LLMs has generally been shown to be localized to particular transformer layers. We find that this Decoding by Contrasting Layers (DoLa) approach is able to better surface factual knowledge and reduce the generation of incorrect facts. DoLa consistently improves the truthfulness across multiple choices tasks and open-ended generation tasks, for example improving the performance of LLaMA family models on TruthfulQA by 12-17% absolute points, demonstrating its potential in making LLMs reliably generate truthful facts.
研究动机与目标
- 推动对大语言模型(LLMs)中的事实性与幻觉问题的挑战性认识,并寻求不依赖检索或微调的解码时解决方案。
- 提出一种动态的层对比解码方法(DoLa),增强嵌入在更高层的事实知识,同时弱化较低层的语言线索。
- 证明表层事实改进能在 LLaMA 家族模型的多项选择与开放式任务中带来更高的真实度,且延迟影响有限。
提出的方法
- 从最终(成熟)层和选定的更早(早熟)层使用模型的词汇表头计算下一个 token 的分布。
- 通过在候选早期层之间最大化 q_N(·|x_<t) 与 q_j(·|x_<t) 的 Jensen-Shannon 散度,动态选择早熟层 M。
- 通过一个对数组 q_N, q_M 的对数对比函数 F(q_N, q_M) 构造 DoLa 概率,该函数从成熟层 logits 中减去早熟层 logits,并对一个经过可能性筛选的词汇子集应用 softmax。
- 应用自适应的可信度约束,确保来自成熟层的高概率 token 仍然具备候选资格,并在解码时加入重复惩罚。
- 可选地与静态早熟层选项(DoLa-static)进行对比,以说明动态方法的鲁棒性。
- 在 TruthfulQA、FACTOR、StrategyQA、GSM8K、以及 GPT-4 评估过的 Vicuna 基准,在 LLaMA-7B、-13B、-33B、-65B 模型上进行实验验证。
实验结果
研究问题
- RQ1在没有外部知识或微调的情况下,通过对比层的解码是否能降低 LLM 的幻觉?
- RQ2通过逐层分布距离进行动态早熟层选择,是否能在多任务与不同模型规模上鲁棒地提升事实性?
- RQ3在事实性、推理任务与开放式生成方面,DoLa 与 Contrastive Decoding(CD)及静态层基线的相对表现如何?
主要发现
- DoLa 在多项选择与开放式任务上持续提升 LLaMA 模型的真实度,在 TruthfulQA 与 FACTOR 上尤其显著。
- 在开放式 TruthfulQA 中,DoLa 在四个 LLaMA 尺度上将 %Truth×%Info 提升了 12-17%,接近 ITI 的性能且无需监督标签。
- 动态早熟层选择(通过最大 JSD)在需要高事实的信息任务中选择更高的层,在更长句子完成任务中选择较低的层,在各数据集上带来鲁棒的增益。
- DoLa 实现了适度的解码延迟提升(约 1.01x 到 1.08x),并且对除 LLaMA 家族之外的模型(如 MPT-7B)也具有一定的泛化性,存在个别例外。
- 在推理任务(StrategyQA、GSM8K)上,DoLa 提升或维持了性能,而 CD 在某些设置下有时会损害推理能力。
- DoLa-static 在数据分布上的鲁棒性较差且需要更广泛的验证,而动态 DoLa 则降低了对分布内验证的需求。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。