Kaijing Ma

PAPER NOTES / FULL TEXT / ENGLISH + 中文

论文全文中英对照,依据 arXiv:2411.01610v1。英文原文后紧接对应中文,保留正文、附录 A 至 E、公式、算法、图表、脚注和参考文献。参考文献保留完整英文记录,并附题名译文。

原文采用 CC BY 4.0。本页注明来源与改编;公式和表格数值两种语言共用,原图英文标注不改写。作者主张与译者说明分开呈现。

阅读原创笔记 · 笔记中英对照 · 原始 PDF · 译注

点击图表可放大。较宽的公式和数据表可在其区域内横向滚动。

作者:Haw-Shiuan Chang、Nanyun Peng、Mohit Bansal、Anil Ramakrishna、Tagyoung Chung。本工作主要在 Amazon 完成。机构包括 UMass Amherst CICS 与 Amazon AGI Foundations;英文姓名、机构和邮箱信息在下方按原文保留。

Explaining and Improving Contrastive Decoding
by Extrapolating the Probabilities of a Huge and Hypothetical LM

通过外推巨大假想语言模型的概率来解释并改进对比解码
Haw-Shiuan Chang     Nanyun Peng     Mohit Bansal ††thanks: The work was mostly done at Amazon.
† 致谢注:本工作主要在 Amazon 完成。
Affiliation: UMass Amherst CICS     Affiliation: Amazon AGI Foundations hschang@cs.umass.edu, {pengnany,mobansal,aniramak,tagyoung}@amazon.com
   Anil Ramakrishna     Tagyoung Chung Affiliation: Amazon AGI Foundations hschang@cs.umass.edu, {pengnany,mobansal,aniramak,tagyoung}@amazon.com
Abstract
摘要

Contrastive decoding (CD) (Li et al., 2023) improves the next-token distribution of a large expert language model (LM) using a small amateur LM. Although CD is applied to various LMs and domains to enhance open-ended text generation, it is still unclear why CD often works well, when it could fail, and how we can make it better. To deepen our understanding of CD, we first theoretically prove that CD could be viewed as linearly extrapolating the next-token logits from a huge and hypothetical LM. We also highlight that the linear extrapolation could make CD unable to output the most obvious answers that have already been assigned high probabilities by the amateur LM.

对比解码(CD)(Li 等,2023)利用一个小型业余语言模型(LM),改善大型专家语言模型的下一词分布。
尽管 CD 已被用于多种语言模型和领域,以增强开放式文本生成,但它为何通常有效、何时可能失败,以及如何进一步改进,仍不清楚。
为加深对 CD 的理解,我们首先从理论上证明,CD 可以被视为对一个巨大且假想的语言模型的下一词 logits 进行线性外推。
我们还指出,线性外推可能使 CD 无法输出最显而易见的答案,因为业余语言模型已经为这些答案赋予了较高概率。

To overcome CD’s limitation, we propose a new unsupervised decoding method called Asymptotic Probability Decoding (APD).11 1 The code will be released at https://github.com/amazon-science/llm-asymptotic-decoding

1 代码将发布于 https://github.com/amazon-science/llm-asymptotic-decoding
APD explicitly extrapolates the probability curves from the LMs of different sizes to infer the asymptotic probabilities from an infinitely large LM without inducing more inference costs than CD. In FactualityPrompts, an open-ended text generation benchmark, sampling using APD significantly boosts factuality in comparison to the CD sampling and its variants, and achieves state-of-the-art results for Pythia 6.9B and OPT 6.7B. Furthermore, in five commonsense QA datasets, APD is often significantly better than CD and achieves a similar effect of using a larger LLM. For example, the perplexity of APD on top of Pythia 6.9B is even lower than the perplexity of Pythia 12B in CommonsenseQA and LAMBADA.

为克服 CD 的局限,我们提出一种新的无监督解码方法,称为渐近概率解码(Asymptotic Probability Decoding,APD)。
APD 显式外推不同规模语言模型的概率曲线,推断无限大语言模型的渐近概率,同时不会带来比 CD 更多的推理成本。
在开放式文本生成基准 FactualityPrompts 上,与 CD 采样及其变体相比,使用 APD 采样显著提高了事实性,并在 Pythia 6.9B 和 OPT 6.7B 上取得了最先进的结果。
此外,在五个常识问答数据集上,APD 往往显著优于 CD,并达到了类似于使用更大语言模型的效果。
例如,在 CommonsenseQA 和 LAMBADA 上,基于 Pythia 6.9B 的 APD 的困惑度甚至低于 Pythia 12B 的困惑度。

1 Introduction

1 引言
原论文图表,详见相邻中英文图注
Figure 1: Given a simple question with clues for which a tiny amateur LM could provide a correct answer, contrastive decoding (CD) could have a “obvious blindness” (i.e., assigning a higher logit to an uncommon answer Invertebrate than the most obvious answer Bees). In contrast, the proposed asymptotic probability decoding (APD) correctly assigns the highest probability to Bees by leveraging the probabilities from multiple LMs of different sizes to extrapolate the probabilities from an infinitely large and hypothetical LM.
图 1:给定一个包含线索、微小业余语言模型即可正确作答的简单问题,对比解码(CD)可能出现“显然答案盲区”(即给不常见答案 Invertebrate 分配比最显然答案 Bees 更高的 logit)。相比之下,所提出的渐近概率解码(APD)利用多个不同规模语言模型的概率,外推一个无限大假想语言模型的概率,从而正确地为 Bees 分配最高概率。

Contrastive Decoding (Li et al., 2023) (CD) is a simple heuristic that uses the logit of a small LM (amateur LM) to improve the logit of a large LM (expert LM).22 2 Since the amateur LM is easier to fail, CD adjusts the logit of an expert LM by subtracting the logit of an amateur LM, so a lower amateur’s logit implies a higher output logit of CD. Using Figure 1 as an example, CD produces a large logit for Invertebrates because its amateur’s logit is low.

2 由于业余语言模型更容易失败,CD 通过从专家语言模型的 logit 中减去业余语言模型的 logit 来进行调整,因此业余模型的 logit 越低,CD 的输出 logit 越高。以图 1 为例,CD 为 Invertebrates 产生较大的 logit,是因为业余模型为它给出的 logit 较低。
The potential of CD has been demonstrated in various open-ended text generation tasks (Li et al., 2023) and reasoning tasks using the expert LMs up to 65B (O’Brien and Lewis, 2023). Several variants are also proposed to reduce toxicity (Liu et al., 2021), improve factuality in NLP tasks (Chuang et al., 2023; Zhang et al., 2023; Shi et al., 2024; Sanchez et al., 2024), text evaluation (Lu et al., 2024), and vision tasks (Wan et al., 2024). However, due to the insufficient theoretical understanding of CD, it is difficult to identify and overcome the failure modes of CD, which hinders its wide applications.

对比解码(Li 等,2023)(CD)是一种简单的启发式方法:利用小型语言模型(业余语言模型)的 logit 来改善大型语言模型(专家语言模型)的 logit。
CD 的潜力已在多种开放式文本生成任务(Li 等,2023)以及使用最高达 65B 专家语言模型的推理任务(O’Brien 和 Lewis,2023)中得到展示。
研究者还提出了若干变体,用于降低毒性(Liu 等,2021),改善自然语言处理任务中的事实性(Chuang 等,2023;Zhang 等,2023;Shi 等,2024;Sanchez 等,2024),以及文本评价(Lu 等,2024)和视觉任务(Wan 等,2024)。
然而,由于对 CD 的理论理解不足,识别并克服其失效模式仍然困难,这阻碍了它的广泛应用。

Scaling law demonstrates that language models (LMs) are able to generate more factual next tokens as their sizes increase (Kaplan et al., 2020; Lee et al., 2022). However, their growing energy consumption and costs limit their further applications (Strubell et al., 2019; Lacoste et al., 2019; Kaack et al., 2022), necessitating techniques that can reduce LM model sizes without compromising their superior performances. In this work, we theoretically demonstrate how contrastive decoding (CD) addresses this LM size-reduction challenge using a simple linear extrapolation. The theory also helps us to identify the limitations of CD and propose APD, a more factual decoding method.

缩放定律表明,随着规模增大,语言模型能够生成更符合事实的下一词(Kaplan 等,2020;Lee 等,2022)。
然而,不断增长的能耗和成本限制了它们的进一步应用(Strubell 等,2019;Lacoste 等,2019;Kaack 等,2022),因此需要能够在不损害优异性能的前提下减小语言模型规模的技术。
在本工作中,我们从理论上展示,对比解码如何利用简单的线性外推来应对这一语言模型规模缩减挑战。
这一理论还帮助我们识别 CD 的局限,并提出事实性更好的解码方法 APD。

First, we discover that CD actually uses the tiny amateur LM to help the large expert LM infer the logit of a huge and hypothetical LM. Specifically, the logits from CD could often be viewed as a linear extrapolation of the logit curves from the expert LM and amateur LM. The finding explains several prior empirical observations and also reveals weaknesses of CD. For example, CD tends to neglect the most obvious answer and overemphasize less likely answers in its output distribution instead. We call this tendency “obvious blindness”. The rare answers could sometimes degrade the generation’s factuality. For example, both amateur and expert LM in Figure 1 can identify that Bees is the most clear answer suggested by the clues but only the expert LM realizes that there are also some other possible answers such as Invertebrates. Then, the aggressive linear extrapolation of CD makes Invertebrates become the most probable next token. This is not a totally factual answer because many invertebrates cannot fly.

首先,我们发现,CD 实际上利用微小的业余语言模型,帮助大型专家语言模型推断一个巨大且假想的语言模型的 logit。
具体而言,CD 得到的 logits 往往可以被视为对专家语言模型与业余语言模型的 logit 曲线进行线性外推的结果。
这一发现解释了先前的若干经验观察,也揭示了 CD 的弱点。
例如,CD 往往忽略最显而易见的答案,转而在输出分布中过度强调可能性较低的答案。
我们将这种倾向称为“显然答案盲区”(obvious blindness)。
这些罕见答案有时会降低生成内容的事实性。
例如,图 1 中的业余语言模型和专家语言模型都能判断,Bees(蜜蜂)是线索最明确指向的答案,但只有专家语言模型意识到,还存在 Invertebrates(无脊椎动物)等其他可能答案。
随后,CD 激进的线性外推使 Invertebrates 成为概率最高的下一词。
这并不是一个完全符合事实的答案,因为许多无脊椎动物不会飞。

Motivated by this theoretical explanation, we propose a novel decoding method called Asymptotic Probability Decoding (APD). APD predicts the asymptotic probability from a hypothetical LM with an infinite size. By explicitly modeling the changes of the next-token probabilities as the size of LM increases, APD is able to output the correct probabilities for both easy/common and difficult/uncommon answers. For the example in Figure 1, the probabilities of Bees and Invertebrates are both increasing as the LM becomes larger. By leveraging the probabilities of mid-size LMs, we can reasonably infer that Bees should still receive a larger probability from a huge LM than Invertebrates. Finally, modeling the probability curves for many next tokens on the fly is too time-consuming, so we fine-tune an amateur LM such that the output probability of APD is close to asymptotic probability, which makes APD as efficient as CD.

受这一理论解释启发,我们提出了一种新的解码方法,称为渐近概率解码(APD)。
APD 预测一个规模无限大的假想语言模型的渐近概率。
通过显式建模语言模型规模增大时下一词概率的变化,APD 能够为简单或常见答案以及困难或罕见答案输出正确的概率。
在图 1 的例子中,随着语言模型增大,Bees 和 Invertebrates 的概率都在上升。
利用中等规模语言模型的概率,我们可以合理推断,巨大语言模型赋予 Bees 的概率仍应高于 Invertebrates。
最后,由于实时建模众多下一词的概率曲线过于耗时,我们对一个业余语言模型进行微调,使 APD 的输出概率接近渐近概率,从而让 APD 与 CD 一样高效。

The main goal of our experiments is to check if APD can further improve the factuality compared to CD. We choose our expert LMs and amateur LMs from the LLM families that provide smaller LMs, including Pythia (6.9B, 70M) (Biderman et al., 2023), OPT (6.7B, OPT 125M) (Zhang et al., 2022), and Qwen1.5 (4B, 0.5B) (Bai et al., 2023). By comparing different sampling methods in FactualityPrompts (Lee et al., 2022), we demonstrate that APD consistently and robustly outperforms CD with the best temperature and other state-of-the-art distribution modification methods such as DoLa (Chuang et al., 2023) and temperature sampling (Ficler and Goldberg, 2017). After being combined with dynamically adjusted top-p sampling (Chang et al., 2024), our method can help Pythia 6.9B to simultaneously achieve the factuality of top-p sampling (Holtzman et al., 2020) with p=0.4p=0.4 and diversity of top-p with p=0.7p=0.7.

我们的实验主要检验:与 CD 相比,APD 是否能够进一步提高事实性。
我们从提供小规模模型的大语言模型家族中选取专家模型和业余模型,包括 Pythia(6.9B、70M)(Biderman 等,2023)、OPT(6.7B、OPT 125M)(Zhang 等,2022)以及 Qwen1.5(4B、0.5B)(Bai 等,2023)。
通过在 FactualityPrompts(Lee 等,2022)上比较不同采样方法,我们表明,APD 能够持续且稳健地优于采用最佳温度的 CD,以及 DoLa(Chuang 等,2023)和温度采样(Ficler 和 Goldberg,2017)等其他最先进的分布修改方法。
与动态调整的 top-p 采样(Chang 等,2024)结合后,我们的方法可以帮助 Pythia 6.9B 同时达到 p=0.4 时 top-p 采样(Holtzman 等,2020)的事实性,以及 p=0.7 时 top-p 采样的多样性。

We also compare the perplexity of APD and CD using seven datasets. We found that the improvement gap is especially large when CD makes more mistakes on easier tasks. For example, in LAMBADA (Paperno et al., 2016) and CommonsenseQA (Talmor et al., 2019), APD on top of Pythia 6.9B could achieve a similar or better perplexity than Pythia 12B, while outperforming CD by a large margin. We plan to release our code to reproduce the results after our work is accepted.

我们还使用七个数据集比较 APD 和 CD 的困惑度。
我们发现,当 CD 在较简单的任务上犯更多错误时,改进幅度尤其大。
例如,在 LAMBADA(Paperno 等,2016)和 CommonsenseQA(Talmor 等,2019)上,基于 Pythia 6.9B 的 APD 可以达到与 Pythia 12B 相近或更好的困惑度,同时大幅优于 CD。
我们计划在论文被接收后发布代码,以便复现结果。

Our main contributions include

我们的主要贡献包括:
  • •

    We provide theoretical support for contrastive decoding (CD) and demonstrate that our theory can explain many prior findings from Li et al. (2023); O’Brien and Lewis (2023).

    我们为对比解码提供理论支持,并展示该理论能够解释 Li 等(2023)以及 O’Brien 和 Lewis(2023)中的许多既有发现。
  • •

    We propose a new distribution modification method, asymptotic probability decoding (APD), which addresses the “obvious blindness” of CD.

    我们提出新的分布修改方法,即渐近概率解码(APD),以解决 CD 的“显然答案盲区”问题。
  • •

    We conduct extensive experiments, which indicate that APD could significantly improve the generation factuality of CD.

    我们进行了广泛实验,结果表明 APD 可以显著改善 CD 的生成事实性。

2 Contrastive Decoding as Extrapolation

2 将对比解码视为外推

First, we review contrastive decoding (CD) and its justification. In CD, the probability of the next token ww for context cc is determined by

首先,我们回顾对比解码及其依据。
在 CD 中,给定上下文 c,下一词 w 的概率由下式确定:
PcC​D​(w)=exp⁡(LcC​D​(w))∑xexp⁡(LcC​D​(x)),P^{CD}_{c}(w)=\frac{\exp(L^{CD}_{c}(w))}{\sum_{x}\exp(L^{CD}_{c}(x))}, (1)

where xx is all the words in the vocabulary, and the logit for the token ww is

其中,x 遍历词表中的所有词,而词 w 的 logit 为:
LcC​D​(w)=LcE​L​M​(w)−1T​LcA​L​M​(w),L^{CD}_{c}(w)=L^{ELM}_{c}(w)-\frac{1}{T}L^{ALM}_{c}(w), (2)

where LcE​L​ML^{ELM}_{c} and LcA​L​ML^{ALM}_{c} are the logit of the expert LM (ELM) and amateur LM (ALM), respectively. TT is the softmax temperature of ALM. In the original paper (Li et al., 2023), the effectiveness of CD is mostly explained by removing the bad distribution of ALM from the ELM. The explanation is correct, but not specific enough to explain many prior empirical findings in Li et al. (2023); O’Brien and Lewis (2023).

其中,L^{ELM}_{c} 和 L^{ALM}_{c} 分别为专家语言模型(ELM)和业余语言模型(ALM)的 logits。
T 是 ALM 的 softmax 温度。
在原始论文(Li 等,2023)中,CD 的有效性主要被解释为从 ELM 中移除 ALM 的不良分布。
这一解释是正确的,但不够具体,无法解释 Li 等(2023)以及 O’Brien 和 Lewis(2023)中的许多既有经验发现。

Here, we provide another intuitive justification of Equation 2: ELM and ALM usually come from the same LLM family and they are trained on the same training corpus using similar hyperparameters, so their main difference is the model sizes. LcC​D​(w)L^{CD}_{c}(w) would be smaller when LcE​L​M​(w)L^{ELM}_{c}(w) is small and LcA​L​M​(w)L^{ALM}_{c}(w) is large. In this case, it means that the LMs’ logits are decreasing for the token ww as the LM’s model size increases. We can reasonably infer that the larger LM will output an even smaller logit if the trend continues. Thus, CD actually infers the logit of a larger LM by subtracting LcA​L​M​(w)L^{ALM}_{c}(w) from LcE​L​M​(w)L^{ELM}_{c}(w). We describe this intuition in a formal way next.

这里,我们为式(2)提供另一种直观解释:ELM 和 ALM 通常来自同一个大语言模型家族,并在相同训练语料上使用相近超参数训练,因此它们的主要区别是模型规模。
当 L^{ELM}_{c}(w) 较小而 L^{ALM}_{c}(w) 较大时,L^{CD}_{c}(w) 会更小。
在这种情况下,这意味着随着语言模型规模增大,模型赋予词 w 的 logits 在下降。
我们可以合理推断,如果这一趋势持续,更大的语言模型会输出更小的 logit。
因此,CD 实际上通过从 L^{ELM}_{c}(w) 中减去 L^{ALM}_{c}(w),推断更大语言模型的 logit。
接下来,我们形式化地描述这一直觉。
原论文图表,详见相邻中英文图注
Figure 2: Illustration of our proof for Theorem 1. Teal bars are original logits, and red bars are the logits scaled by 1−1T1-\frac{1}{T}. Ld=LA​L​M−LE​L​ML^{d}=L^{ALM}-L^{ELM}, SdS^{d} is the size difference of ELM and ALM in a logarithm space. We drop the word ww and the context cc in the notations of this figure for simplicity.
图 2:定理 1 证明的示意图。青绿色柱表示原始 logits,红色柱表示乘以 1−1/T 后的 logits。L^d=L^{ALM}−L^{ELM};S^d 是 ELM 与 ALM 在对数空间中的规模差。为简化图中记号,我们省略词 w 和上下文 c。

2.1 Theoretical Analysis

2.1 理论分析
Theorem 1.
定理 1

If
a) the ALM’s temperature T>1T>1, and
b) the logits of LMs and the logarithm of the LM sizes have a linear relationship, then
the logit of contrastive decoding (CD) for the token ww LcC​D​(w)=(1−1T)​LcH​L​M​(w)L^{CD}_{c}(w)=(1-\frac{1}{T})L^{HLM}_{c}(w), where LcH​L​M​(w)L^{HLM}_{c}(w) is the logit of a LM with size sH​L​M=((sE​L​M)TsA​L​M)1T−1s^{HLM}=\left(\frac{(s^{ELM})^{T}}{s^{ALM}}\right)^{\frac{1}{T-1}}.

如果:
a)ALM 的温度 T>1,并且
b)语言模型的 logits 与模型规模的对数之间存在线性关系,则对比解码对词 w 给出的 logit 满足 L^{CD}_{c}(w)=(1-\frac{1}{T})L^{HLM}_{c}(w),其中 L^{HLM}_{c}(w) 是规模为 s^{HLM}=\left(\frac{(s^{ELM})^{T}}{s^{ALM}}\right)^{\frac{1}{T-1}} 的语言模型的 logit。

Setting T>1T>1 for ALM is effective in various tasks (O’Brien and Lewis, 2023), so our first assumption often holds in practice. The linear relationship means we can always draw a line to connect all the logits from LMs with different sizes as in Figure 2. Since TT is a global hyperparameter, LcC​D​(w)L^{CD}_{c}(w) is the logit of HLM using the temperature TT−1\frac{T}{T-1}.

为 ALM 设置 T>1 在多种任务中均有效(O’Brien 和 Lewis,2023),因此我们的第一个假设在实践中经常成立。
线性关系意味着,如图 2 所示,我们总能画出一条直线,连接不同规模语言模型的所有 logits。
由于 T 是全局超参数,L^{CD}_{c}(w) 等于 HLM 在温度 \frac{T}{T-1} 下的 logit。
Proof.
证明
LcC​D​(w)=LcE​L​M​(w)−1T​LcA​L​M​(w)\displaystyle L^{CD}_{c}(w)=L^{ELM}_{c}(w)-\frac{1}{T}L^{ALM}_{c}(w)
=(1−1T)​LcE​L​M​(w)+1T​(LcE​L​M​(w)−LcA​L​M​(w))\displaystyle=(1-\frac{1}{T})L^{ELM}_{c}(w)+\frac{1}{T}(L^{ELM}_{c}(w)-L^{ALM}_{c}(w))
=(1−1T)​(LcE​L​M​(w)−1T1−1T​Lcd​(w))\displaystyle=(1-\frac{1}{T})(L^{ELM}_{c}(w)-\frac{\frac{1}{T}}{1-\frac{1}{T}}L^{d}_{c}(w)) (3)

From Figure 2, we can see that the size difference between HLM and ELM should be 1T1−1T​Sd\frac{\frac{1}{T}}{1-\frac{1}{T}}S^{d}.

从图 2 可以看出,HLM 与 ELM 的规模差应为 \frac{\frac{1}{T}}{1-\frac{1}{T}}S^{d}。
log⁡sH​L​M=log⁡sE​L​M+1T1−1T​Sd\displaystyle\log s^{HLM}=\log s^{ELM}+\frac{\frac{1}{T}}{1-\frac{1}{T}}S^{d}
=log⁡sE​L​M+1T−1​(log⁡sE​L​M−log⁡sA​L​M)\displaystyle=\log s^{ELM}+\frac{1}{T-1}(\log s^{ELM}-\log s^{ALM})
=TT−1​log⁡sE​L​M−1T−1​log⁡sA​L​M\displaystyle=\frac{T}{T-1}\log s^{ELM}-\frac{1}{T-1}\log s^{ALM}
=1T−1​log⁡((sE​L​M)TsA​L​M)\displaystyle=\frac{1}{T-1}\log(\frac{(s^{ELM})^{T}}{s^{ALM}}) (4)

∎

∎

2.2 Implications of the Theorem

2.2 定理的含义

Our theory explains several prior findings and provides insights into CD’s limitations.

我们的理论解释了先前的若干发现,也为理解 CD 的局限提供了线索。

Why does CD generally work well? Li et al. (2023); O’Brien and Lewis (2023) show the empirical success of CD across various domains and LMs. From the perspective of Theorem 1, the source of effectiveness relies on the validity of the linear extrapolation for the individual token logits.

为什么 CD 通常有效?
Li 等(2023)以及 O’Brien 和 Lewis(2023)展示了 CD 在多种领域和语言模型上的经验成功。
从定理 1 的角度看,其有效性来源取决于对各词 logit 进行线性外推是否成立。

Why is the best temperature task-dependent? The different downstream applications often have different optimal temperatures TT of ALM in the CD (O’Brien and Lewis, 2023). We hypothesize that the linear relationship assumption in Theorem 1 is often violated in some downstream tasks. For example, in the commonsense task of Figure 1, the LLM with the size of the HLM should not have a large logit for the word Invertebrates. Thus, it could be more appropriate to use a larger TT for these tasks, which makes the size of HLM closer to the ELM and thus reduces the aggressiveness of the extrapolation.

为什么最佳温度取决于任务?
不同下游应用中,CD 的 ALM 通常具有不同的最优温度 T(O’Brien 和 Lewis,2023)。
我们推测,在一些下游任务中,定理 1 的线性关系假设经常不成立。
例如,在图 1 的常识任务中,规模与 HLM 相同的大语言模型不应为 Invertebrates 这个词赋予较大的 logit。
因此,对这些任务使用较大的 T 可能更合适,因为这会让 HLM 的规模更接近 ELM,从而降低外推的激进程度。

Why does CD prefer a large size difference? The experiments in  Li et al. (2023); O’Brien and Lewis (2023) show that CD usually works better when the size difference between ALM and ELM is larger. Figure 2 provides one explanation: Given the same TT, a larger size difference SdS_{d} increases the size of HLM; the observations on a longer x-axis range could often support further extrapolation. Moreover, a smaller ALM is less likely to answer the simple questions correctly, so the problem in Figure 1 is less likely to happen.

为什么 CD 更偏好较大的规模差?
Li 等(2023)以及 O’Brien 和 Lewis(2023)的实验表明,当 ALM 与 ELM 的规模差更大时,CD 通常表现更好。
图 2 提供了一种解释:在 T 相同的情况下,更大的规模差 S_{d} 会增大 HLM 的规模;在更长横轴范围内取得的观测,往往能够支持更远的外推。
此外,更小的 ALM 正确回答简单问题的可能性更低,因此图 1 中的问题也更不容易出现。

Why does CD use LMs from the same family? Li et al. (2023); O’Brien and Lewis (2023) choose to use the smallest LM from the same LLM family as the ALM. Our theory supports the choice and suggests that when ALM and ELM are trained on different corpora, CD would reverse the tendency or bias of ALM. For example, if ALM is more much likely to mention Biden than Trump compared to ELM, CD would output more Trump than Biden, which might lead to the unfactual sentence like “In 2020-2024, the USA president is Trump”.

为什么 CD 使用同一家族的语言模型?
Li 等(2023)以及 O’Brien 和 Lewis(2023)选择同一大语言模型家族中最小的语言模型作为 ALM。
我们的理论支持这一选择,并表明:如果 ALM 和 ELM 在不同语料上训练,CD 会反转 ALM 的倾向或偏差。
例如,如果与 ELM 相比,ALM 提及 Biden 而非 Trump 的倾向强得多,那么 CD 会更多输出 Trump 而非 Biden,这可能导致“In 2020-2024, the USA president is Trump”(2020—2024 年,美国总统是 Trump)这样的不符合事实的句子。

When could CD fail? The simplicity of linear extrapolation in the logit space is both CD’s advantage and limitation. If LcA​L​M​(w)L^{ALM}_{c}(w) is very small in Equation 2, LcC​D​(w)L^{CD}_{c}(w) might become very large even if LcE​L​M​(w)L^{ELM}_{c}(w) is still not large. For example, in Figure 1, the ALM’s logit for Invertebrate might be very small because it is a rare word in general. The truncation/thresholding methods such as top-p or α\alpha-masking (Li et al., 2023) filter out the rare tokens with small LcE​L​M​(w)L^{ELM}_{c}(w), which alleviates, but does not completely solve the problem. After all, if the thresholding method filters out too many next tokens, the output would have a very low diversity. This motivates us to propose a more sophisticated extrapolation method to further improve CD.

CD 何时可能失败?
在 logit 空间进行线性外推的简单性,既是 CD 的优势,也是它的局限。
如果式(2)中的 L^{ALM}_{c}(w) 非常小,那么即使 L^{ELM}_{c}(w) 仍不大,L^{CD}_{c}(w) 也可能变得很大。
例如,在图 1 中,ALM 为 Invertebrate 给出的 logit 可能很小,因为它通常是一个罕见词。
top-p 或 α 掩码(Li 等,2023)等截断或阈值方法,会过滤 L^{ELM}_{c}(w) 较小的罕见词,从而缓解这一问题,但无法彻底解决它。
毕竟,如果阈值方法过滤掉过多下一词,输出的多样性就会很低。
这促使我们提出一种更精细的外推方法,以进一步改进 CD。
原论文图表,详见相邻中英文图注
Figure 3: Fine-tuning ALM to predict the asymptotic probability (PcA​PP_{c}^{AP}). During the training time, the predicted P^cA​P​(Kenya)\hat{P}_{c}^{AP}(\text{Kenya}) and the empirical probabilities from the LLM family {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} are inputted into an MLP. If P^cA​P​(Kenya)\hat{P}_{c}^{AP}(\text{Kenya}) is too high to model the empirical probabilities well, the probability curve outputted by MLP would be far away from the empirical probabilities and thus, incur a high loss 1 and loss 2. Then, the resulting gradients would be backpropagated through MLP and ALM and reduce P^cA​P​(Kenya)\hat{P}_{c}^{AP}(\text{Kenya}). Finally, we add a regularization loss 3 to control the changes in the ALM’s logit output.
图 3:微调 ALM 以预测渐近概率 P_c^{AP}。训练时,将预测值 \hat{P}_c^{AP}(Kenya) 与语言模型家族给出的经验概率集合 {p(w|c,θ_{s_i})}_{i=1}^N 输入 MLP。如果 \hat{P}_c^{AP}(Kenya) 过高而无法良好拟合经验概率,MLP 输出的概率曲线就会远离经验概率,从而产生较高的损失 1 和损失 2。所得梯度随后经由 MLP 与 ALM 反向传播,降低 \hat{P}_c^{AP}(Kenya)。最后加入正则损失 3,以控制 ALM 的 logit 输出变化。

3 Asymptotic Probability Decoding

3 渐近概率解码

We propose asymptotic probability decoding (APD) to overcome the limitations of CD. In an LLM family, there are often LMs with sizes between the sizes of the amateur LM (ALM) and expert LM (ELM). As shown in Figure 1, APD leverages them to improve the extrapolation and models the probability curves instead of the logit curves to avoid outputting a large probability based on a very small logit from ALM (e.g., Invertebrates). Furthermore, for those easy answers (e.g., Bees), LcE​L​M​(w)L^{ELM}_{c}(w) and LcA​L​M​(w)L^{ALM}_{c}(w) are both high. APD can extrapolate the high probability curve to output a desired high probability while based on Equation 2, the CD might output a low logit.

我们提出渐近概率解码(APD),以克服 CD 的局限。
在一个大语言模型家族中,往往存在规模介于业余语言模型(ALM)与专家语言模型(ELM)之间的语言模型。
如图 1 所示,APD 利用这些模型改善外推,并建模概率曲线而非 logit 曲线,以免因 ALM 的某个 logit 非常小而输出较大概率,例如 Invertebrates 的情况。
此外,对于那些简单答案,例如 Bees,L^{ELM}_{c}(w) 和 L^{ALM}_{c}(w) 都很高。
APD 可以外推这条高概率曲线,从而输出期望的高概率;而根据式(2),CD 可能输出较低的 logit。

To make APD as efficient as CD33 3 It demands too much extra computational overhead during inference to run a series of LM with different sizes and conducting extrapolation for each possible next token.

3 在推理时运行一系列不同规模的语言模型,并对每个可能的下一词执行外推,会带来过高的额外计算开销。
, APD requires us to fine-tune the ALM in CD such that the resulting output probabilities would be close to the asymptotic probabilities (AP) from an HLM with an infinite size. However, we cannot get the ground truth AP to supervise our model directly, so during training on an unsupervised text corpus, we first collect the predicted AP of the top likely next tokens and the empirical probabilities from the LMs with different sizes. Next, as illustrated in Figure 3, we use an MLP energy network (LeCun et al., 2006; Belanger et al., 2017) to output a curve that is close to the observed probabilities and would approach the predicted AP as LM’s size goes to infinity. After the training, the APD uses the updated amateur LM (ALM’) in the same way as the CD to produce the next-token distribution:

为了使 APD 与 CD 一样高效,我们需要微调 CD 中的 ALM,使得到的输出概率接近无限大 HLM 的渐近概率(AP)。
然而,我们无法获得真实的 AP 来直接监督模型,因此,在无监督文本语料上训练时,我们首先收集最可能的下一词的预测 AP,以及不同规模语言模型的经验概率。
接下来,如图 3 所示,我们使用 MLP 能量网络(LeCun 等,2006;Belanger 等,2017)输出一条曲线:它接近观测到的概率,并在语言模型规模趋于无穷时接近预测 AP。
训练完成后,APD 以与 CD 相同的方式使用更新后的业余语言模型(ALM′),生成下一词分布:
P^cA​P​(w)=exp⁡(LcE​L​M​(w)−1T​LcA​L​M′​(w))∑xexp⁡(LcE​L​M​(x)−1T​LcA​L​M′​(x)).\hat{P}^{AP}_{c}(w)=\frac{\exp(L^{ELM}_{c}(w)-\frac{1}{T}L^{ALM^{\prime}}_{c}(w))}{\sum_{x}\exp(L^{ELM}_{c}(x)-\frac{1}{T}L^{ALM^{\prime}}_{c}(x))}. (5)

We provide more details of our procedure of training ALM’ in the follow subsections.

在接下来的小节中,我们进一步说明训练 ALM′ 的过程。

3.1 Training Setup

3.1 训练设置

Given that we have a LLM family containing MM models with sizes s1,…,sMs_{1},...,s_{M} in a logarithmic scale, we use {θs1,θs2,…​θsM}\{\theta_{s_{1}},\theta_{s_{2}},...\theta_{s_{M}}\} to represent the (parameters of) LLMs. The largest LLM that can fit into our GPUs is θsN\theta_{s_{N}}, so we use θsN\theta_{s_{N}} as our ELM and θs1\theta_{s_{1}} as our ALM.

假设一个大语言模型家族包含 M 个模型,其对数尺度下的规模为 s_{1},...,s_{M},我们用 \{\theta_{s_{1}},\theta_{s_{2}},...\theta_{s_{M}}\} 表示这些大语言模型的参数。
能够放入我们的 GPU 的最大语言模型是 \theta_{s_{N}},因此我们将 \theta_{s_{N}} 用作 ELM,将 \theta_{s_{1}} 用作 ALM。

On our training text corpus, we run the LLMs in the family to collect their probabilities {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N}. Storing the probabilities of all possible tokens is not feasible, so for each context cc, we select a set of tokens AcA_{c}, including the 2020 tokens with the highest ELM probabilities and some randomly sampled tokens with smaller probabilities. We normalize the probabilities so that their summation within AcA_{c} is 11, and only keep their normalized probabilities for training. After all, most tokens with small ELM probabilities are often truncated during inference time by thresholding methods such as top-pp sampling.

我们在训练文本语料上运行该家族中的大语言模型,收集它们的概率 \{p(w|c,\theta_{s_{i}})\}_{i=1}^{N}。
存储所有可能词的概率不可行,因此,对每个上下文 c,我们选择一个词集合 A_{c},其中包含 ELM 概率最高的 20 个词,以及一些从较低概率词中随机抽取的词。
我们对概率进行归一化,使其在 A_{c} 内的总和为 1,并且只保留这些归一化概率用于训练。
毕竟,大多数 ELM 概率较小的词,在推理时往往会被 top-p 采样等阈值方法截断。

To reduce the training cost and avoid overfitting the training data, we choose to only update ALM. One simple but suboptimal approach is to first train a curve prediction model that extrapolates the AP using {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} and then train ALM to encourage the APD to output AP. Instead, we propose to merge the two training stages together and jointly optimize the ALM and curve prediction model in the next subsections.

为降低训练成本并避免对训练数据过拟合,我们选择只更新 ALM。
一种简单但非最优的方法是:先训练曲线预测模型,利用 \{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} 外推 AP,再训练 ALM,使 APD 尽可能输出 AP。
相反,在接下来的小节中,我们提出将这两个训练阶段合并,联合优化 ALM 与曲线预测模型。

3.2 Curve Parameterization

3.2 曲线参数化

To model both increasing or decreasing curves using the same parameterization way, we propose a preprocessing step R⁡(⋅)R(\cdot) that flips the probabilities if the probabilities increase as the model size increases. Specifically, we compute

为了用同一种参数化方式同时建模上升和下降曲线,我们提出一个预处理步骤 R(\cdot):如果概率随模型规模增大而上升,就将概率翻转。
具体而言,我们计算:
{P′^cA​P​(w)}∪{p′​(w|c,θsi)}i=1N=R⁡(Q)\displaystyle\{\hat{P^{\prime}}^{AP}_{c}(w)\}\cup\{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N}=R(Q)
={Q if ​p​(w|c,θs1)≥p⁡(w|c,θsN){1−p|p∈Q} o.w ,\displaystyle=\begin{cases}&Q\;\;\;\;\text{ if }p(w|c,\theta_{s_{1}})\geq p(w|c,\theta_{s_{N}})\\ &\{1-p|p\in Q\}\;\;\;\;\text{ o.w }\end{cases}, (6)

where Q={P^cA​P​(w)}∪{p⁡(w|c,θsi)}i=1NQ=\{\hat{P}^{AP}_{c}(w)\}\cup\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} and P^cA​P​(w)\hat{P}^{AP}_{c}(w) is the APD’s output from ELM and ALM’ using Equation 5 and T=1T=1.

其中,Q=\{\hat{P}^{AP}_{c}(w)\}\cup\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N},而 \hat{P}^{AP}_{c}(w) 是使用式(5)且令 T=1 时,由 ELM 和 ALM′ 得到的 APD 输出。

After flipping, we use a simple exponential function to model the decay trends from {p′​(w|c,θsi)}i=1N\{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N}:

完成翻转后,我们使用一个简单的指数函数,建模 \{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N} 的衰减趋势:
p^w,c​(s)=P′^cA​P​(w)+aw,c​e−max⁡(0,bw,c​(s−dw,c)),\hat{p}_{w,c}(s)=\hat{P^{\prime}}^{AP}_{c}(w)+a_{w,c}e^{-\max(0,b_{w,c}(s-d_{w,c}))}, (7)

where p^w,c​(s)\hat{p}_{w,c}(s) is the predicted probability given the model size ss in a logarithm scale, aw,ca_{w,c}, bw,cb_{w,c}, dw,cd_{w,c} are all positive parameters, and P′^cA​P​(w)\hat{P^{\prime}}^{AP}_{c}(w) is the (flipped) output probability from Equation 6. Besides, P′^cA​P​(w)\hat{P^{\prime}}^{AP}_{c}(w) is also an AP because lims→∞p^w,c​(s)=P′^cA​P​(w)\lim_{s\to\infty}\hat{p}_{w,c}(s)=\hat{P^{\prime}}^{AP}_{c}(w).

其中,\hat{p}_{w,c}(s) 是在对数尺度的模型规模 s 下预测的概率;a_{w,c}、b_{w,c}、d_{w,c} 均为正参数;\hat{P^{\prime}}^{AP}_{c}(w) 是式(6)得到的已翻转输出概率。
此外,\hat{P^{\prime}}^{AP}_{c}(w) 也是一个渐近概率,因为 \lim_{s\to\infty}\hat{p}_{w,c}(s)=\hat{P^{\prime}}^{AP}_{c}(w)。

We choose a simple feedforward neural network, a 4-layer MLP (multilayer perceptron), for modeling the probability curve for each token ww. The MLP takes the empirical probabilities and the predicted AP as the inputs, and outputs the parameters of the probability curves:

我们选择一个简单的前馈神经网络,即四层 MLP(多层感知机),为每个词 w 建模概率曲线。
MLP 以经验概率和预测的渐近概率为输入,输出概率曲线的参数:
aw,c,bw,c,dw,c=MLP​(P′^cA​P​(w),{p′​(w|c,θsi)}i=1N).a_{w,c},b_{w,c},d_{w,c}=\text{MLP}\left(\hat{P^{\prime}}^{AP}_{c}(w),\{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N}\right). (8)
Algorithm 1 Fine-tuning ALM’
算法 1:微调 ALM′
Input : LLMs ({θsi}i=1N\{\theta_{s_{i}}\}_{i=1}^{N}), including ALM (Amateur LM) and ELM (Expert LM), and Training Corpus DD
输入:语言模型集合 {θ_{s_i}}_{i=1}^N,包括 ALM(业余语言模型)与 ELM(专家语言模型),以及训练语料 D
Output : ALM’
输出:ALM′
1 Compute {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} (Probabilities of NN LLMs in DD), LcA​L​M​(w)L^{ALM}_{c}(w), and LcE​L​M​(w)L^{ELM}_{c}(w) (Logits of ALM and ELM in DD)
1 计算训练语料 D 上 N 个语言模型的概率 {p(w|c,θ_{s_i})}_{i=1}^N,以及 ALM 与 ELM 的 logits L_c^{ALM}(w) 和 L_c^{ELM}(w)
2 Initialize ALM’ ←\leftarrow ALM
2 初始化 ALM′ ← ALM
3 foreach batch BB in DD do
3 对 D 中的每个批次 B 执行
    4 foreach context cc in BB do
4 对 B 中的每个上下文 c 执行
       5 foreach ww in AcA_{c} (top tokens of ELM) do
5 对 A_c(ELM 的高概率词集合)中的每个 w 执行
          6 Predict asymptotic probability P^cA​P​(w)\hat{P}^{AP}_{c}(w) using ALM’ and Equation 5
6 使用 ALM′ 与式(5)预测渐近概率 \hat{P}_c^{AP}(w)
          7 {p^w,c​(si)}i=1N\{\hat{p}_{w,c}(s_{i})\}_{i=1}^{N} ←\leftarrow Fitting(MLP, P^cA​P​(w)\hat{P}^{AP}_{c}(w), {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} ) // Function below
7 {\hat{p}_{w,c}(s_i)}_{i=1}^N ← Fitting(MLP, \hat{P}_c^{AP}(w), {p(w|c,θ_{s_i})}_{i=1}^N) // 见下方函数
       8 end foreach
8 结束词循环
    9 end foreach
9 结束上下文循环
    10 Compare {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} with {p^w,c​(si)}i=1N\{\hat{p}_{w,c}(s_{i})\}_{i=1}^{N} using Equation 9 and (10)
10 使用式(9)和式(10)比较 {p(w|c,θ_{s_i})}_{i=1}^N 与 {\hat{p}_{w,c}(s_i)}_{i=1}^N
    11 Regularize ALM’ using ALM and Equation 11
11 使用 ALM 与式(11)对 ALM′ 进行正则化
    12 Update ALM’ and MLP to minimize the loss in Equation 12 using backpropogation
12 使用反向传播更新 ALM′ 与 MLP,使式(12)的损失最小
13 end foreach
13 结束批次循环
14 Function Fitting(MLP, P^cA​P​(w)\hat{P}^{AP}_{c}(w), {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} ):
14 函数 Fitting(MLP, \hat{P}_c^{AP}(w), {p(w|c,θ_{s_i})}_{i=1}^N):
    15 Reverse the increasing {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} and P^cA​P​(w)\hat{P}^{AP}_{c}(w) using Equation 6
15 使用式(6)翻转递增的 {p(w|c,θ_{s_i})}_{i=1}^N 与 \hat{P}_c^{AP}(w)
    16 Predict decay curve parameters using the (reversed) probabilities, MLP, and Equation 8
16 使用(翻转后的)概率、MLP 与式(8)预测衰减曲线参数
    17 Predict {p^w,c​(si)}i=1N\{\hat{p}_{w,c}(s_{i})\}_{i=1}^{N} of NN LLMs using the curve parameters, P′^cA​P​(w)\hat{P^{\prime}}^{AP}_{c}(w), and Equation 7
17 使用曲线参数、\hat{P′}_c^{AP}(w) 与式(7),预测 N 个语言模型的 {\hat{p}_{w,c}(s_i)}_{i=1}^N
    18 return {p^w,c​(si)}i=1N\{\hat{p}_{w,c}(s_{i})\}_{i=1}^{N}
18 返回 {\hat{p}_{w,c}(s_i)}_{i=1}^N

3.3 Loss Functions

3.3 损失函数

Our first loss computes the square root of the mean squared error (MSE) between the probability curves p^w,c​(s)\hat{p}_{w,c}(s) and the (flipped) empirical probability observations {p′​(w|c,θsi)}i=1N−1\{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N-1}:

我们的第一个损失计算概率曲线 \hat{p}_{w,c}(s) 与前 N-1 个已翻转经验概率观测 \{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N-1} 之间均方误差(MSE)的平方根:
L1=1Z⋅(N−1)​∑c∈B∑w∈Ac∑i=1N−1(p′​(w|c,θsi)−p^w,c​(si))2,L_{1}=\sqrt{\frac{1}{Z\cdot(N-1)}\sum_{c\in B}\sum_{w\in A_{c}}\sum_{i=1}^{N-1}\left(p^{\prime}(w|c,\theta_{s_{i}})-\hat{p}_{w,c}(s_{i})\right)^{2}}, (9)

where BB is the training batch, AcA_{c} is top token candidates of ELM, the normalization term Z=|B|​|Ac|Z=|B||A_{c}|. Notice that, unlike a typical regression model, the goal of MLP is not predicting {p′​(w|c,θsi)}i=1N−1\{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N-1}, which has been seen in its input. Instead, the MLP could be viewed as an energy network that checks the quality of APD’s output P^cA​P​(w)\hat{P}^{AP}_{c}(w). If P^cA​P​(w)\hat{P}^{AP}_{c}(w) is not good, MLP cannot output a good curve p^w,c​(s)\hat{p}_{w,c}(s) that is close to all the empirical probabilities {p′​(w|c,θsi)}i=1N−1\{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N-1}.

其中,B 是训练批次,A_{c} 是 ELM 的高概率候选词,归一化项 Z=|B||A_{c}|。
请注意,与典型回归模型不同,MLP 的目标并不是预测已在输入中出现的 \{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N-1}。
相反,可以将 MLP 看作一个能量网络,用来检查 APD 输出 \hat{P}^{AP}_{c}(w) 的质量。
如果 \hat{P}^{AP}_{c}(w) 不理想,MLP 就无法输出一条同时接近所有经验概率 \{p^{\prime}(w|c,\theta_{s_{i}})\}_{i=1}^{N-1} 的良好曲线 \hat{p}_{w,c}(s)。

We found that only using the MSE loss often leads to an overestimation of P^cA​P​(w)\hat{P}^{AP}_{c}(w) from a decay curve as illustrated in Figure 3. When the probabilities are decreasing, the AP should be smaller than the probability of ELM p′​(w|c,θsN)p^{\prime}(w|c,\theta_{s_{N}}). Thus, we impose the second loss that pushes down the curve when its predicted probability of ELM is higher than the ground truth:

我们发现,如图 3 所示,只使用 MSE 损失时,衰减曲线经常高估 \hat{P}^{AP}_{c}(w)。
当概率递减时,渐近概率应小于 ELM 的概率 p^{\prime}(w|c,\theta_{s_{N}})。
因此,我们加入第二个损失:当曲线对 ELM 的预测概率高于真实值时,将曲线向下推:
L2=1Z​∑c∈B∑w∈Acmax⁡(0,p^w,c​(sN)−p′​(w|c,θsN)).L_{2}=\sqrt{\frac{1}{Z}\sum_{c\in B}\sum_{w\in A_{c}}\max\left(0,\hat{p}_{w,c}(s_{N})-p^{\prime}(w|c,\theta_{s_{N}})\right)}. (10)

We also use the square root here to emphasize the small probability differences.

这里也使用平方根,以突出较小的概率差异。

Finally, we add a regularization term to control the logit changes of the ALM’.

最后,我们加入一个正则项,以控制 ALM′ 的 logit 变化。
L3=1Z​∑c∈B∑w∈Ac(LcA​L​M′​(w)−LcA​L​M​(w))2.L_{3}=\sqrt{\frac{1}{Z}\sum_{c\in B}\sum_{w\in A_{c}}\left(L^{ALM^{\prime}}_{c}(w)-L^{ALM}_{c}(w)\right)^{2}}. (11)

Without the regularization, we found APD tends to output a trivial solution, where LcA​L​M′​(w)=0L^{ALM^{\prime}}_{c}(w)=0 and P^cA​P​(w)=p′​(w|c,θsN)\hat{P}^{AP}_{c}(w)=p^{\prime}(w|c,\theta_{s_{N}}).

我们发现,如果没有这一正则项,APD 会倾向于输出一个平凡解,其中 L^{ALM^{\prime}}_{c}(w)=0,且 \hat{P}^{AP}_{c}(w)=p^{\prime}(w|c,\theta_{s_{N}})。

We combine all the terms as our final loss function for training ALM’ and MLP

我们把所有项组合为训练 ALM′ 与 MLP 的最终损失函数:
L​o​s​s=L1+λ2​L2+λ3​L3Loss=L_{1}+\lambda_{2}L_{2}+\lambda_{3}L_{3} (12)

We fix λ2\lambda_{2} to be a large number 1010. Different LM families have different logit value ranges, so their optimal λ3\lambda_{3} are different. We fix λ3\lambda_{3} to be 0.80.8 for Pythia, 0.40.4 for OPT, and 1.01.0 for Qwen in all our experiments except for the ablation study.

我们将 \lambda_{2} 固定为较大的数值 10。
不同语言模型家族的 logit 数值范围不同,因此其最优 \lambda_{3} 也不同。
除消融研究外,在所有实验中,我们将 Pythia、OPT 和 Qwen 的 \lambda_{3} 分别固定为 0.8、0.4 和 1.0。

In Figure 3, we show that the gradients would flow through MLP and ALM’ to make APD output the better asymptotic probability. Our training algorithm for 11 epoch is summarized at Algorithm 1. During testing, we just replace ALM in CD with ALM’ without running MLP. That is, APD can conduct a more sophisticated extrapolation than CD without increasing its inference cost.

图 3 展示了梯度如何流经 MLP 和 ALM′,推动 APD 输出更好的渐近概率。
算法 1 总结了训练一个 epoch 的算法。
测试时,我们只用 ALM′ 替换 CD 中的 ALM,而不运行 MLP。
也就是说,APD 可以在不增加 CD 推理成本的情况下,执行更精细的外推。
(a) Ours v.s. SOTA (Pythia)
(a) 本文方法与当前最佳方法比较(Pythia)
(b) With REAL Sampling (Pythia)
(b) 配合 REAL 采样(Pythia)
(c) Temperature Tuning of CD (Pythia)
(c) CD 温度调节(Pythia)
(d) Loss Term Ablation (Pythia)
(d) 损失项消融(Pythia)
(e) Mid-size LLM Ablation (Pythia)
(e) 中等规模语言模型消融(Pythia)
(f) Other Ablation (Pythia)
(f) 其他消融(Pythia)
(g) Ours v.s. SOTA (OPT)
(g) 本文方法与当前最佳方法比较(OPT)
(h) With REAL Sampling (OPT)
(h) 配合 REAL 采样(OPT)
(i) Temperature Tuning of CD (OPT)
(i) CD 温度调节(OPT)
Figure 4: Factuality evaluation of the open-ended text generation using FactualityPrompts. The x-axis is a diversity metric (dist-2) and the y-axis is a hallucination metric (NEER), the ratio of containing potential hallucinated entities in generation, so the curves closer to the lower right corner are better.
图 4:使用 FactualityPrompts 对开放式文本生成进行事实性评价。横轴为多样性指标 dist-2,纵轴为幻觉指标 NEER,即生成内容包含潜在幻觉实体的比例,因此曲线越接近右下角越好。

4 Experiments

4 实验

In many applications, factuality is arguably the most important aspect (Huang et al., 2023). It is especially difficult to improve factuality in general domains without increasing LM’s size, training LMs on more high-quality data, or adding more information into the context (Tonmoy et al., 2024).

在许多应用中,事实性可以说是最重要的方面(Huang 等,2023)。
在不增大语言模型规模、不使用更多高质量数据训练模型、也不向上下文加入更多信息的情况下,改善一般领域的事实性尤其困难(Tonmoy 等,2024)。

Figure 1 shows that CD might assign a lower probability to the most obvious answer. In open-ended generation tasks, this could cause suboptimal factuality and diversity. Furthermore, this could degrade the quality of answers in the question-answering tasks. Thus, we focus on these aspects in our evaluation.

图 1 表明,CD 可能为最显而易见的答案赋予较低概率。
在开放式生成任务中,这可能导致事实性与多样性欠佳。
此外,这还可能降低问答任务中的答案质量。
因此,我们在评价中关注这些方面。

In all experiments, APD is trained in a very small training corpus, just 1M lines (1.6%) in Wikipedia 2021, to test the generalization capability of our method. Pythia, OPT, and Qwen LLM families are the ideal test beds because they provide several smaller LMs of different sizes. Hence, we select de-duplicated Pythia 6.9B and OPT-6.7B as the ELM (θsN\theta_{s_{N}}) and Pythia 70M and OPT-125M as the ALM (θs1\theta_{s_{1}}). The results of Qwen-1.5 are presented in the appendix.

在所有实验中,APD 只在很小的训练语料上训练,即 Wikipedia 2021 的 100 万行文本(1.6%),以检验该方法的泛化能力。
Pythia、OPT 和 Qwen 大语言模型家族提供了多个不同规模的小模型,因此是理想的测试平台。
因此,我们选择去重版 Pythia 6.9B 和 OPT-6.7B 作为 ELM(\theta_{s_{N}}),选择 Pythia 70M 和 OPT-125M 作为 ALM(\theta_{s_{1}})。
Qwen-1.5 的结果见附录。

4.1 Open-ended Text Generation Evaluation using FactualityPrompts

4.1 使用 FactualityPrompts 评价开放式文本生成

FactualityPrompts (Lee et al., 2022) is an open-ended text generation benchmark that provides 8k factual sentences and 8k non-factual sentences from Wikipedia as prompts. Given a prompt, a good decoding method could output factual and diverse continuations.

FactualityPrompts(Lee 等,2022)是一个开放式文本生成基准,它从 Wikipedia 提供 8000 个事实句和 8000 个非事实句作为提示。
给定一个提示,良好的解码方法应生成符合事实且多样的续写。

Metrics: Evaluating the factuality of the generated text on a large scale is a challenging task. Lee et al. (2022) propose to measure the ratio of the named entities that are not mentioned in the relevant Wikipedia pages and call it named entity error (NEER). Besides, it also measures EntailR, which is the ratio of generated sentences that are supported/entailed by the sentences in the relevant pages. In addition to the automatic retrieval-based metrics, we also conduct expensive and small-scale human experiments in Section C.1.

评价指标:大规模评价生成文本的事实性是一项困难任务。
Lee 等(2022)提出,计算相关 Wikipedia 页面中未提及的命名实体比例,并将其称为命名实体错误率(NEER)。
此外,该基准还测量 EntailR,即生成句子受到相关页面中句子支持或蕴含的比例。
除了基于检索的自动指标,我们还在 C.1 节进行了成本较高的小规模人工实验。

Each decoding method would generate 8 different continuations given a prompt. Then, the generation diversity of the method is evaluated by the ratio of unique bi-gram (Dist-2) (Li et al., 2016) and the ratio of generating continuations with severe repetitions (Rep) (Holtzman et al., 2020).

给定一个提示,每种解码方法会生成 8 个不同的续写。
随后,通过唯一二元词组比例 Dist-2(Li 等,2016)和产生严重重复续写的比例 Rep(Holtzman 等,2020),评价方法的生成多样性。

Methods: To simplify our experiments, every method uses sampling as in O’Brien and Lewis (2023) rather than beam search. Every sampling method is denoted as “distribution modification + thresholding”. The distribution modification methods we tested include LLM (i.e., the probabilities from the ELM), CD, APD, DoLa (Chuang et al., 2023), and softmax temperature adjustment (Ficler and Goldberg, 2017). We fix the TT of ALM in APD to be 11 while select the best TT for CD from {1, 1.33, 2, 4, 10}.

方法:为简化实验,与 O’Brien 和 Lewis(2023)相同,每种方法均使用采样而非束搜索。
每种采样方法都记作“分布修改方法 + 阈值方法”。
我们测试的分布修改方法包括 LLM(即 ELM 的概率)、CD、APD、DoLa(Chuang 等,2023)以及 softmax 温度调整(Ficler 和 Goldberg,2017)。
在 APD 中,我们把 ALM 的 T 固定为 1;对 CD,则从 \{1, 1.33, 2, 4, 10\} 中选择最佳 T。

We conduct a series of ablation studies to verify our design choices. First, APD uses λ2=10\lambda_{2}=10 and λ3=0.8\lambda_{3}=0.8 by default in Equation 12 for Pythia. To verify the effectiveness of each loss term, we individually set λ2=0\lambda_{2}=0, λ3=0\lambda_{3}=0, λ3=1.6\lambda_{3}=1.6, and λ3=5\lambda_{3}=5. Second, to check if APD could still be applied to the LLM families without many different model sizes, we test four combinations of training Pythia (70M, 1B, and 6.9B). Finally, APD no rev removes the reverse function in Equation 6 and allows negative aw,ca_{w,c} in Equation 7, APD 0.5|D| uses only half of our training Wikipedia, and APD logit applies the exponential decay function in the logit space rather than the probability space in Equation 7.

我们进行了一系列消融研究,以验证设计选择。
首先,对于 Pythia,APD 默认在式(12)中使用 \lambda_{2}=10 和 \lambda_{3}=0.8。
为验证各损失项的有效性,我们分别设置 \lambda_{2}=0、\lambda_{3}=0、\lambda_{3}=1.6 和 \lambda_{3}=5。
其次,为检验 APD 是否仍适用于没有许多不同模型规模的大语言模型家族,我们测试了四种 Pythia 训练组合(70M、1B 和 6.9B)。
最后,“APD no rev” 移除式(6)的翻转函数,并允许式(7)中的 a_{w,c} 为负;“APD 0.5|D|” 只使用一半 Wikipedia 训练数据;“APD logit” 则在 logit 空间而非式(7)的概率空间中应用指数衰减函数。

The thresholding methods could increase the factuality by filtering out the unlikely tokens from the ELM at the cost of lower diversity. We test the following thresholding methods.

阈值方法可以过滤 ELM 中概率较低的词,从而以降低多样性为代价提高事实性。
我们测试以下阈值方法。
  • •

    NA: No filtering for temperature sampling.

    NA:温度采样不做过滤。
  • •

    α\alpha: The default filtering method used by CD (Li et al., 2023; O’Brien and Lewis, 2023).

    \alpha:CD 默认使用的过滤方法(Li 等,2023;O’Brien 和 Lewis,2023)。
  • •

    Top-pp: A widely-used method for controlling the generation diversity (Holtzman et al., 2020).

    Top-p:一种广泛使用的生成多样性控制方法(Holtzman 等,2020)。
  • •

    Top-pp kk20: Combination of top-p and top-k sampling (Fan et al., 2018). The kk is fixed to be 20.

    Top-p k20:top-p 与 top-k 采样的组合(Fan 等,2018)。
    其中 k 固定为 20。
  • •

    REAL: A method that dynamically adjusts the threshold in top-p sampling (Chang et al., 2024).

    REAL:一种动态调整 top-p 采样阈值的方法(Chang 等,2024)。

Results: Across the thresholding methods, LLM families, and the whole diversity spectrum, APD achieves consistent factuality improvement in Figures 4(a), 4(b), 4(g) and 4(h), and Table 1. Figures 4(c) and 4(i) indicate that the improvement cannot be achieved by tuning CD’s temperature. CD’s improvement in OPT over Top-pp sampling is much smaller compared to Pythia, which indicates the linear extrapolation assumption is less valid for OPT, while APD achieves larger improvements for OPT than Pythia by fixing the problems of CD.

结果:在不同阈值方法、语言模型家族以及完整的多样性范围上,APD 在图 4(a)、4(b)、4(g)、4(h) 与表 1 中均持续改善事实性。
图 4(c) 和图 4(i) 表明,这种改进无法仅通过调节 CD 的温度取得。
在 OPT 上,相比 top-p 采样,CD 的改进远小于其在 Pythia 上的改进,这说明线性外推假设对 OPT 更不成立;APD 修正了 CD 的问题,因此在 OPT 上取得了比在 Pythia 上更大的改进。

We report our loss ablation study results at Figure 4(d), which verify the importance of each term in Equation 12. The degradation of λ3=5\lambda_{3}=5 suggests that our improvements cannot be achieved by only using the regularization term and our improvements indeed come from modeling the probability decay. Figure 4(e) shows that APD performs better as we have more LMs with different model sizes in the LLM family. Nevertheless, APD 70M-7B is still better than CD using only ALM and ELM without any mid-size LMs, which makes APD even more practical. The worse performances of APD 1B-7B highlight the importance of having smaller LMs in modeling the exponential decay curves. In Figure 4(f), APD 0.5|D| performs slightly worse than APD, which suggests a small training corpus is sufficient but larger ones could further expand APD’s improvement. Finally, the worse factualities of APD logit and APD no rev verify our choice of modeling the decay curve in the probability space.

我们在图 4(d) 中报告损失消融研究结果,验证式(12)中每一项的重要性。
当 \lambda_{3}=5 时性能下降,这表明改进无法只靠正则项取得,确实来自对概率衰减的建模。
图 4(e) 表明,语言模型家族中不同规模的模型越多,APD 表现越好。
尽管如此,即使没有任何中等规模模型,只使用 ALM 和 ELM 的 APD 70M-7B 仍优于 CD,这也使 APD 更具实用性。
APD 1B-7B 表现较差,凸显了使用更小语言模型来建模指数衰减曲线的重要性。
在图 4(f) 中,APD 0.5|D| 的表现略差于 APD,这说明小规模训练语料已经足够,但扩大语料仍可能进一步增加 APD 的改进幅度。
最后,APD logit 与 APD no rev 的事实性更差,验证了我们选择在概率空间中建模衰减曲线的合理性。
Factuality
事实性
Diversity
多样性
NEER (↓\downarrow)
NEER(↓)
EntailR Dist-2 Rep (↓\downarrow)
重复率(↓)
Pythia p=0.8p=0.8
p=0.8
43.28 5.40 29.73 1.26
p=0.8p=0.8
p=0.8
CD 42.21 3.54 48.57 0.44
p=0.6p=0.6
p=0.6
CD 40.93 6.02 39.58 1.48
p=0.8p=0.8
p=0.8
APD 41.13 4.47 47.44 1.46
p=0.6p=0.6
p=0.6
APD 40.00 6.58 38.81 2.72
OPT p=1p=1
p=1
34.33 10.70 31.29 2.93
p=0.8p=0.8
p=0.8
CD 38.20 7.56 44.13 0.78
p=0.6p=0.6
p=0.6
CD 35.96 11.66 36.12 2.49
p=0.8p=0.8
p=0.8
APD 34.06 8.88 45.72 3.39
p=0.6p=0.6
p=0.6
APD 32.29 13.38 36.99 5.15
Table 1: Comparing different distributions for top-pp k20 sampling in FactualityPrompts. All numbers are percentages. APD is significantly more factual than CD while having similar diversity.
表 1:在 FactualityPrompts 上比较 top-p k20 采样所用的不同分布。所有数字均为百分比。APD 与 CD 具有相近多样性,但事实性显著更高。
LAMBADA CQA QASC ARC SocialIQA
Q+Fact
问题+事实
Q Only
仅问题
ppl (↓\downarrow)
困惑度(↓)
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
Pythia LLM 6.9B 2.264 8.380 0.658 5.702 0.856 8.127 0.621 4.433 0.692 8.441 0.662
CD 2.237 6.176 0.671 5.693 0.862 7.741 0.633 4.375 0.699 7.595 0.688
APD 2.132†\dagger
2.132†
5.882†\dagger
5.882†
0.685 5.020†\dagger
5.020†
0.874 7.766 0.632 4.310 0.698 7.378 0.691
APD on the fly 2.281 8.245 0.660 5.725 0.866 8.106 0.620 4.464 0.694 8.299 0.665
LLM 12B 2.188 8.140 0.660 4.783 0.845 7.612 0.630 4.058 0.719 7.898 0.691
APD vs CD
APD 与 CD 的相对改进
138.52% 122.34% 650.00% 73.30% NA
不适用
-4.86% -12.50% 17.34% -4.17% 39.92% 11.54%
APD vs LLM 6.9B
APD 与 LLM 6.9B 的相对改进
173.68% 1039.11% 1250.00% 74.26% NA
不适用
70.06% 125.00% 32.87% 20.83% 195.88% 100.00%
Table 2: Perplexity (ppl) and accuracy (acc) comparison of one-shot QA using different decoding methods. The LLM 6B and 12B use the original distribution from ELM, which is the most popular SOTA method. APD vs CD is (APD - CD) / (LLM 12B - LLM 6.9B) (i.e., the ratio of improvement against CD and against doubling the model size), and APD vs LLM 6.9B is (APD - LLM 6.9B) / (LLM 12B - LLM 6.9B). NA means LLM 12B is worse than LLM 6.9B. CQA refers to CommonsenseQA. A lower perplexity is better. We highlight the best score among the distributions from ELM, CD, APD, and APD on the fly. †\daggerAPD is significantly better than CD with p<0.05p<0.05.
表 2:比较不同解码方法在单样本问答中的困惑度(ppl)和准确率(acc)。LLM 6B 与 12B 使用 ELM 的原始分布,这是最常用的当前最佳方法。“APD vs CD”为 (APD−CD)/(LLM 12B−LLM 6.9B),即相对于 CD 的改进与将模型规模翻倍所带来改进的比值;“APD vs LLM 6.9B”为 (APD−LLM 6.9B)/(LLM 12B−LLM 6.9B)。NA 表示 LLM 12B 比 LLM 6.9B 更差。CQA 指 CommonsenseQA。困惑度越低越好。我们在 ELM、CD、APD 与 APD on the fly 的分布中突出显示最佳分数。† 表示 APD 显著优于 CD,p<0.05。

4.2 Distribution Evaluation using Question Answering Datasets

4.2 使用问答数据集评价分布

Another way to evaluate the factuality of the next-token distribution is through question answering and checking which distribution assigns a higher probability to the correct answer(s). The evaluation method allows us to analyze APD’s improvement gap in various domains and settings.

评价下一词分布事实性的另一种方式,是进行问答测试,并检查哪个分布为正确答案赋予更高概率。
这种评价方法使我们能够分析 APD 在不同领域和设置中的改进幅度。

We compare APD and CD using the following 5 popular commonsense QA datasets, including LAMBADA (Paperno et al., 2016), CommonsenseQA (Talmor et al., 2019), QASC (Khot et al., 2020), ARC (Clark et al., 2018), and SocialIQA (Sap et al., 2019). In QASC, we report two results. One setting inputs only the question (Q only) and another one also inputs facts (Q+Fact).

我们在以下五个常用常识问答数据集上比较 APD 与 CD:LAMBADA(Paperno 等,2016)、CommonsenseQA(Talmor 等,2019)、QASC(Khot 等,2020)、ARC(Clark 等,2018)以及 SocialIQA(Sap 等,2019)。
在 QASC 上,我们报告两组结果。
一种设置只输入问题(Q only),另一种还输入事实(Q+Fact)。

Evaluation Setup: The LLMs are evaluated using a one-shot in-context learning prompt. We use perplexity and accuracy of the correct answer(s) as our main metrics. The mean reciprocal rank (MRR) (Radev et al., 2002) scores will also be reported at Table 5 in Section B.4. In each task, the optimal TT is different. We report the performances of CD and APD using their best TT from Equation 1 and Equation 5, respectively.

评价设置:使用 one-shot 上下文学习提示评价这些大语言模型。
我们以正确答案的困惑度和准确率为主要指标。
表 5(B.4 节)还会报告平均倒数排名(MRR)(Radev 等,2002)。
每项任务的最优 T 不同。
我们分别报告 CD 和 APD 使用式(1)与式(5)所选最佳 T 时的表现。

CD and APD are applied to Pythia 6.9B and the results of OPT and Qwen are reported at Section B.4. We also report the performance of Pythia 6.9B (LLM 6.9B) and Pythia 12B (LLM 12B) to compare the APD’s improvement with the improvement of roughly doubling the LM size. APD on the fly is an ablation study that removes the fine-tuning step of ALM’. The decoding method first get {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} from the NN LLMs. Next, it extrapolates the probabilities to estimate the asymptotic probability and curve parameters in Equation 7 using gradient descent. More details can be found at Section E.2.

CD 与 APD 应用于 Pythia 6.9B;OPT 和 Qwen 的结果见 B.4 节。
我们还报告 Pythia 6.9B(LLM 6.9B)与 Pythia 12B(LLM 12B)的表现,以比较 APD 的改进与大致翻倍语言模型规模所带来的改进。
“APD on the fly” 是一项移除 ALM′ 微调步骤的消融研究。
该解码方法首先从 N 个大语言模型取得 \{p(w|c,\theta_{s_{i}})\}_{i=1}^{N}。
随后,它使用梯度下降外推概率,以估计式(7)中的渐近概率与曲线参数。
更多细节见 E.2 节。

To focus on the questions for which LLM is highly likely to provide the correct answer, we filter out the questions whose correct answers are not ranked in the top 2020 list of ELM (LLM 6.9B). We choose 2020 because ALM’ is mostly trained to predict the probabilities of the top 2020 tokens. To make the comparison fair, we repeat this filtering preprocessing using LLM 12B.

为了聚焦于语言模型极有可能正确回答的问题,我们过滤掉正确答案未进入 ELM(LLM 6.9B)前 20 名列表的问题。
之所以选择 20,是因为 ALM′ 的训练主要针对前 20 个词的概率预测。
为公平比较,我们使用 LLM 12B 重复执行这一过滤预处理。

Results: In Table 2, APD usually improves CD significantly even though ALM’ is not trained on commonsense question-answering datasets, which emphasizes the out-of-domain robustness of APD. APD performs similarly with CD if the prompt only contains a question from QASC. However, APD is drastically better than CD after we reduce the difficulty of the question by inserting the relevant facts into the prompt. Furthermore, our improvements on easier datasets such as LAMBDA and CommonsenseQA (CQA) are also larger. This also supports the recent findings that CD might not improve the commonsense questions answering (O’Brien and Lewis, 2023). Finally, the significantly worse performance of ADP on the fly suggests that fine-tuning ALM’ makes APD not only more efficient but also more effective.

结果:在表 2 中,尽管 ALM′ 并未在常识问答数据集上训练,APD 通常仍显著改善 CD,这凸显了 APD 的域外稳健性。
如果提示只包含 QASC 的问题,APD 与 CD 表现相近。
然而,在把相关事实插入提示、从而降低问题难度后,APD 大幅优于 CD。
此外,在 LAMBADA 和 CommonsenseQA(CQA)等较简单数据集上,我们的改进也更大。
这也支持了近期的一项发现:CD 可能无法改善常识问答(O’Brien 和 Lewis,2023)。
最后,“ADP on the fly”的表现显著更差,这说明微调 ALM′ 不仅让 APD 更高效,也让它更有效。〔原文此处写作 ADP。〕

5 Related Work

5 相关工作

Besides simulating a huge LM as CD, linear extrapolation could also be used to infer the output of an LM trained on less toxic data (Liu et al., 2021), an LM trained on more context (Shi et al., 2024; Sanchez et al., 2024), an LM trained on less hallucinated data (Zhang et al., 2023), an LM trained on more preference data (Zheng et al., 2024), and an LM with more hidden layers (Chuang et al., 2023; Das et al., 2024). APD shows that an exponential function can improve CD, so similarly, we might be able to use a sophisticated extrapolation function to improve these methods.

除了像 CD 那样模拟巨大语言模型,线性外推还可用于推断以下模型的输出:在毒性更低的数据上训练的模型(Liu 等,2021)、使用更多上下文训练的模型(Shi 等,2024;Sanchez 等,2024)、在幻觉更少的数据上训练的模型(Zhang 等,2023)、在更多偏好数据上训练的模型(Zheng 等,2024),以及具有更多隐藏层的模型(Chuang 等,2023;Das 等,2024)。
APD 表明,指数函数能够改善 CD;类似地,我们也许可以使用更精细的外推函数来改进这些方法。

Scaling law shows that the global perplexity of a larger LM could be accurately extrapolated by the perplexities of smaller LMs (Kaplan et al., 2020). For individual tasks, the performances of a larger LM are also predictable based on the performance of smaller LMs (Srivastava et al., 2023; Ruan et al., 2024; Owen, 2024). In our work, we show that it is possible to efficiently extrapolate the next-token probability distribution of a larger LM.

缩放定律表明,可以根据较小语言模型的困惑度,准确外推较大语言模型的总体困惑度(Kaplan 等,2020)。
对于单项任务,也可以根据较小语言模型的表现,预测较大语言模型的表现(Srivastava 等,2023;Ruan 等,2024;Owen,2024)。
在本工作中,我们表明,可以高效外推较大语言模型的下一词概率分布。

Chang et al. (2024) propose REAL sampling, which improves the factuality by extrapolating the entropy of an infinitely large LM. Similar to our work, Chang et al. (2024) conduct nonlinear extrapolation across LMs model sizes. Nevertheless, our motivations and methods are very different. Furthermore, REAL sampling is a thresholding method while our method is a distribution modification method, and our experiment shows that they are complementary.

Chang 等(2024)提出 REAL 采样,它通过外推无限大语言模型的熵来改善事实性。
与本工作类似,Chang 等(2024)也跨不同语言模型规模进行非线性外推。
然而,我们的动机和方法十分不同。
此外,REAL 采样是阈值方法,而我们的方法是分布修改方法;实验表明二者可以互补。

6 Conclusion

6 结论

Can a tiny amateur LM help a large expert LM infer the probabilities of a huge hypothetical LM? Yes, we first theoretically show that CD did that and then propose APD to do even better. Our theory for CD explains several prior empirical observations and motivates the proposed APD. On the other hand, the APD addresses the limitations of CD and further supports our theoretical explanation. In our experiments, we show that fine-tuning the amateur LM on only 1.6% text of Wikipedia is enough to boost the performances of seven QA datasets and the factuality in FactualityPrompts, judged by both retrieval-based metrics and Mturk workers, given the similar generation diversities.

一个微小的业余语言模型能否帮助大型专家语言模型推断一个巨大假想语言模型的概率?
可以。我们首先从理论上表明 CD 已经在做这件事,随后提出 APD,以取得更好的结果。
我们关于 CD 的理论解释了若干既有经验观察,并启发了 APD 的提出。
另一方面,APD 解决了 CD 的局限,也进一步支持了我们的理论解释。
实验表明,在只有 Wikipedia 1.6% 文本上微调业余语言模型,就足以改善七个问答数据集上的表现,并在生成多样性相近的条件下,提高 FactualityPrompts 上由检索指标与 MTurk 工作者共同评价的事实性。

7 Acknowledgement

7 致谢

This work was supported in part by the Center for Intelligent Information Retrieval. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect those of the sponsor.

本工作部分得到智能信息检索中心(Center for Intelligent Information Retrieval)的支持。
本材料中表达的任何观点、发现、结论或建议均属于作者,并不一定反映资助方的观点。

8 Limitations

8 局限

First, APD requires a series of LMs of different sizes that are trained in the same data for a similar amount of time. Due to the trade-off between efficiency and quality, many state-of-the-art LLMs have smaller counterparts, including GPT-4, Gemini 1.5, Claude 3, and LLaMA 3. However, the LLM families often lack the LMs smaller than 7B, which is close to the largest model we can fit into our GPUs. Thus, we are not able to test our methods on these powerful LLMs. Recently, Yang et al. (2024) show that simple n-gram LMs could also become good amateur models. This might alleviate the existence requirement of small pretrained LMs.

首先,APD 需要一系列不同规模的语言模型,这些模型须在相同数据上训练相近的时间。
由于效率与质量之间存在权衡,许多最先进的大语言模型都有较小版本,包括 GPT-4、Gemini 1.5、Claude 3 和 LLaMA 3。
然而,这些大语言模型家族通常缺少小于 7B 的模型;7B 已接近我们能够放入 GPU 的最大模型。
因此,我们无法在这些强大语言模型上测试方法。
最近,Yang 等(2024)表明,简单的 n-gram 语言模型也可以成为良好的业余模型。
这可能缓解必须存在小型预训练语言模型的要求。

Second, ideally, ALM’ should be fine-tuned for a long time on the same corpus for pretraining ALM and ELM. Our ablation studies in Figure 4(f) also show that a larger fine-tuning corpus indeed improves the performance. However, due to our limited GPU and CPU memory, we only fine-tune ALM’ on 1.6% text of Wikipedia. Although the limited amount of training is sufficient to make APD outperform CD significantly, this prevents us from comparing APD with CD on more tasks such as reasoning or summarization.

其次,理想情况下,应在用于预训练 ALM 和 ELM 的同一语料上长时间微调 ALM′。
图 4(f) 的消融研究也表明,更大的微调语料确实能改善性能。
然而,由于 GPU 和 CPU 内存有限,我们只在 Wikipedia 的 1.6% 文本上微调 ALM′。
尽管有限的训练量已足以让 APD 显著优于 CD,但这使我们无法在推理或摘要等更多任务上比较 APD 与 CD。

Third, our ablation studies in Figure 4(d) show that the performances of APD depend on the values of λ3\lambda_{3} and the optimal value is different for different LLMs. Fortunately, we find that APD still performs well in various QA datasets even though its λ3\lambda_{3} is tuned for the validation set of FactualityPrompts. This suggests that tuning the λ3\lambda_{3} is needed when applying the APD on a new LLM family but might not be necessary for new tasks.

第三,图 4(d) 的消融研究表明,APD 的表现取决于 \lambda_{3} 的取值,并且不同大语言模型的最优值不同。
令人欣慰的是,尽管 \lambda_{3} 是针对 FactualityPrompts 验证集调节的,APD 在多种问答数据集上仍表现良好。
这表明,把 APD 应用于新的大语言模型家族时需要调节 \lambda_{3},但面对新任务时可能无需重新调节。

Finally, our theory does not cover the case when the TT is larger than 11. Li et al. (2023) show that the smaller TT is beneficial to some creative writing tasks and this observation cannot be explained by our current theory.

最后,我们的理论不覆盖 T 大于 1 的情况。〔此句与定理 1 明确要求 T>1 相冲突;此处忠实保留原文。〕
Li 等(2023)表明,较小的 T 对某些创意写作任务有益,而我们当前的理论无法解释这一观察。

9 Impact Statement

9 影响声明

First, our work shows that it is possible to predict the probability distribution of a larger LLM well without extra training data or substantial computational cost. This finding suggests that the current cross-entropy loss during pretraining may not be optimal. We should be able to discover more efficient ways to train our LLMs and save more energy in the future (e.g., we might be able to train the ELM to directly predict the asymptotic probabilities).

首先,本工作表明,在没有额外训练数据或大量计算成本的情况下,也有可能良好预测更大语言模型的概率分布。
这一发现表明,目前预训练使用的交叉熵损失可能并非最优。
未来,我们应能找到更高效的大语言模型训练方法并节省更多能源,例如训练 ELM 直接预测渐近概率。

Second, our theory and empirical results (e.g., Figure 4(e)) indicate that the effectiveness of CD and APD depends on whether we have the LMs that are sufficiently small in the LLM family and trained using a similar setup. The result might encourage the LLM developers to train smaller LLMs and better control the training setup (e.g., using the same training text order as in Pythia).

其次,我们的理论与经验结果(例如图 4(e))表明,CD 与 APD 的有效性取决于大语言模型家族中是否存在足够小、且训练设置相近的语言模型。
这一结果可能鼓励大语言模型开发者训练更小的模型,并更好地控制训练设置,例如像 Pythia 那样采用相同的训练文本顺序。

Third, the x-axis is the model size in CD. In other variants of CD, the x-axis could be the amount of hallucinated data (Zhang et al., 2023), the amount of toxic data (Liu et al., 2021), or the amount of preference data (Zheng et al., 2024). We should be able to extend our theory and APD to these applications as well.

第三,在 CD 中,横轴是模型规模。
在 CD 的其他变体中,横轴可以是幻觉数据量(Zhang 等,2023)、有毒数据量(Liu 等,2021)或偏好数据量(Zheng 等,2024)。
我们也应当能够把理论与 APD 扩展到这些应用。

Finally, we are not certain about whether the exponential function could fit the probability curves of other LLMs, especially after SFT or RLHF (Ouyang et al., 2022). Besides, we haven’t scaled up the training of ALM’ and the evaluation of APD, so the out-of-domain generalization ability of APD remains unknown. If the LLM developers deployed our method without comprehensive testing, it might output strange or even unsafe results.

最后,我们尚不确定指数函数能否拟合其他大语言模型的概率曲线,尤其是在 SFT 或 RLHF 之后(Ouyang 等,2022)。
此外,我们尚未扩大 ALM′ 的训练规模和 APD 的评价规模,因此 APD 的域外泛化能力仍不明确。
如果大语言模型开发者未经全面测试就部署该方法,它可能输出奇怪、甚至不安全的结果。

References

参考文献
  • Bai et al. (2023) Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, Binyuan Hui, Luo Ji, Mei Li, Junyang Lin, Runji Lin, Dayiheng Liu, Gao Liu, Chengqiang Lu, Keming Lu, Jianxin Ma, Rui Men, Xingzhang Ren, Xuancheng Ren, Chuanqi Tan, Sinan Tan, Jianhong Tu, Peng Wang, Shijie Wang, Wei Wang, Shengguang Wu, Benfeng Xu, Jin Xu, An Yang, Hao Yang, Jian Yang, Shusheng Yang, Yang Yao, Bowen Yu, Hongyi Yuan, Zheng Yuan, Jianwei Zhang, Xingxuan Zhang, Yichang Zhang, Zhenru Zhang, Chang Zhou, Jingren Zhou, Xiaohuan Zhou, and Tianhang Zhu. 2023. Qwen technical report. ArXiv preprint, abs/2309.16609.
    题名译文:Qwen 技术报告
  • Belanger et al. (2017) David Belanger, Bishan Yang, and Andrew McCallum. 2017. End-to-end learning for structured prediction energy networks. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, volume 70 of Proceedings of Machine Learning Research, pages 429–439. PMLR.
    题名译文:面向结构化预测能量网络的端到端学习
  • Biderman et al. (2023) Stella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, Aviya Skowron, Lintang Sutawika, and Oskar van der Wal. 2023. Pythia: A suite for analyzing large language models across training and scaling. In International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pages 2397–2430. PMLR.
    题名译文:Pythia:用于跨训练过程与规模分析大语言模型的模型套件
  • Chang et al. (2024) Haw-Shiuan Chang, Nanyun Peng, Mohit Bansal, Anil Ramakrishna, and Tagyoung Chung. 2024. Real sampling: Boosting factuality and diversity of open-ended generation via asymptotic entropy. Preprint, arXiv:2406.07735.
    题名译文:REAL 采样:通过渐近熵提升开放式生成的事实性与多样性
  • Chang et al. (2020) Haw-Shiuan Chang, Shankar Vembu, Sunil Mohan, Rheeya Uppaal, and Andrew McCallum. 2020. Using error decay prediction to overcome practical issues of deep active learning for named entity recognition. Machine Learning, 109:1749–1778.
    题名译文:使用误差衰减预测克服命名实体识别深度主动学习中的实际问题
  • Chuang et al. (2023) Yung-Sung Chuang, Yujia Xie, Hongyin Luo, Yoon Kim, James Glass, and Pengcheng He. 2023. Dola: Decoding by contrasting layers improves factuality in large language models. ArXiv preprint, abs/2309.03883.
    题名译文:DoLa:通过对比不同层进行解码,提高大语言模型的事实性
  • Clark et al. (2018) Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. 2018. Think you have solved question answering? try arc, the ai2 reasoning challenge. ArXiv preprint, abs/1803.05457.
    题名译文:你以为问答已经解决了吗?试试 ARC:AI2 推理挑战
  • Das et al. (2024) Souvik Das, Lifeng Jin, Linfeng Song, Haitao Mi, Baolin Peng, and Dong Yu. 2024. Entropy guided extrapolative decoding to improve factuality in large language models. ArXiv preprint, abs/2404.09338.
    题名译文:熵引导的外推解码:提高大语言模型的事实性
  • Fan et al. (2018) Angela Fan, Mike Lewis, and Yann Dauphin. 2018. Hierarchical neural story generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 889–898, Melbourne, Australia. Association for Computational Linguistics.
    题名译文:层次化神经故事生成
  • Ficler and Goldberg (2017) Jessica Ficler and Yoav Goldberg. 2017. Controlling linguistic style aspects in neural language generation. In Proceedings of the Workshop on Stylistic Variation, pages 94–104, Copenhagen, Denmark. Association for Computational Linguistics.
    题名译文:控制神经语言生成中的语言风格属性
  • Hendrycks and Gimpel (2016) Dan Hendrycks and Kevin Gimpel. 2016. Gaussian error linear units (gelus). ArXiv preprint, abs/1606.08415.
    题名译文:高斯误差线性单元(GELU)
  • Holtzman et al. (2020) Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2020. The curious case of neural text degeneration. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net.
    题名译文:神经文本退化的奇特现象
  • Huang et al. (2023) Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qianglong Chen, Weihua Peng, Xiaocheng Feng, Bing Qin, et al. 2023. A survey on hallucination in large language models: Principles, taxonomy, challenges, and open questions. ArXiv preprint, abs/2311.05232.
    题名译文:大语言模型幻觉综述:原理、分类、挑战与开放问题
  • Kaack et al. (2022) Lynn H Kaack, Priya L Donti, Emma Strubell, George Kamiya, Felix Creutzig, and David Rolnick. 2022. Aligning artificial intelligence with climate change mitigation. Nature Climate Change, 12(6):518–527.
    题名译文:使人工智能与气候变化减缓目标保持一致
  • Kaplan et al. (2020) Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. 2020. Scaling laws for neural language models. ArXiv preprint, abs/2001.08361.
    题名译文:神经语言模型的缩放定律
  • Khashabi et al. (2018) Daniel Khashabi, Snigdha Chaturvedi, Michael Roth, Shyam Upadhyay, and Dan Roth. 2018. Looking beyond the surface: A challenge set for reading comprehension over multiple sentences. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 252–262, New Orleans, Louisiana. Association for Computational Linguistics.
    题名译文:超越表面:跨多句阅读理解的挑战集
  • Khot et al. (2020) Tushar Khot, Peter Clark, Michal Guerquin, Peter Jansen, and Ashish Sabharwal. 2020. QASC: A dataset for question answering via sentence composition. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 8082–8090. AAAI Press.
    题名译文:QASC:通过句子组合进行问答的数据集
  • Kingma and Ba (2015) Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings.
    题名译文:Adam:一种随机优化方法
  • Lacoste et al. (2019) Alexandre Lacoste, Alexandra Luccioni, Victor Schmidt, and Thomas Dandres. 2019. Quantifying the carbon emissions of machine learning. ArXiv preprint, abs/1910.09700.
    题名译文:量化机器学习的碳排放
  • LeCun et al. (2006) Yann LeCun, Sumit Chopra, Raia Hadsell, M Ranzato, and Fujie Huang. 2006. A tutorial on energy-based learning. Predicting structured data, 1(0).
    题名译文:基于能量的学习教程
  • Lee et al. (2022) Nayeon Lee, Wei Ping, Peng Xu, Mostofa Patwary, Pascale Fung, Mohammad Shoeybi, and Bryan Catanzaro. 2022. Factuality enhanced language models for open-ended text generation. In Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022, New Orleans, LA, USA, November 28 - December 9, 2022.
    题名译文:面向开放式文本生成的事实性增强语言模型
  • Li et al. (2016) Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. 2016. A diversity-promoting objective function for neural conversation models. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 110–119, San Diego, California. Association for Computational Linguistics.
    题名译文:神经对话模型的多样性促进目标函数
  • Li et al. (2023) Xiang Lisa Li, Ari Holtzman, Daniel Fried, Percy Liang, Jason Eisner, Tatsunori Hashimoto, Luke Zettlemoyer, and Mike Lewis. 2023. Contrastive decoding: Open-ended text generation as optimization. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 12286–12312, Toronto, Canada. Association for Computational Linguistics.
    题名译文:对比解码:将开放式文本生成视为优化
  • Lin (2004) Chin-Yew Lin. 2004. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, pages 74–81, Barcelona, Spain. Association for Computational Linguistics.
    题名译文:ROUGE:自动摘要评价工具包
  • Liu et al. (2021) Alisa Liu, Maarten Sap, Ximing Lu, Swabha Swayamdipta, Chandra Bhagavatula, Noah A. Smith, and Yejin Choi. 2021. DExperts: Decoding-time controlled text generation with experts and anti-experts. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 6691–6706, Online. Association for Computational Linguistics.
    题名译文:DExperts:使用专家与反专家在解码时控制文本生成
  • Loshchilov and Hutter (2019) Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net.
    题名译文:解耦权重衰减正则化
  • Lu et al. (2024) Sidi Lu, Asli Celikyilmaz, Tianlu Wang, and Nanyun Peng. 2024. Open-domain text evaluation via meta distribution modeling. In ICML.
    题名译文:通过元分布建模进行开放域文本评价
  • Mostafazadeh et al. (2016) Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James Allen. 2016. A corpus and evaluation framework for deeper understanding of commonsense stories. ArXiv preprint, abs/1604.01696.
    题名译文:用于更深入理解常识故事的语料库与评价框架
  • O’Brien and Lewis (2023) Sean O’Brien and Mike Lewis. 2023. Contrastive decoding improves reasoning in large language models. ArXiv preprint, abs/2309.09117.
    题名译文:对比解码改善大语言模型的推理能力
  • Ouyang et al. (2022) Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul F. Christiano, Jan Leike, and Ryan Lowe. 2022. Training language models to follow instructions with human feedback. In Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022, New Orleans, LA, USA, November 28 - December 9, 2022.
    题名译文:使用人类反馈训练语言模型遵循指令
  • Owen (2024) David Owen. 2024. How predictable is language model benchmark performance? ArXiv preprint, abs/2401.04757.
    题名译文:语言模型基准性能的可预测性有多强?
  • Paperno et al. (2016) Denis Paperno, Germán Kruszewski, Angeliki Lazaridou, Ngoc Quan Pham, Raffaella Bernardi, Sandro Pezzelle, Marco Baroni, Gemma Boleda, and Raquel Fernández. 2016. The LAMBADA dataset: Word prediction requiring a broad discourse context. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1525–1534, Berlin, Germany. Association for Computational Linguistics.
    题名译文:LAMBADA 数据集:需要广泛语篇上下文的词预测
  • Pillutla et al. (2021) Krishna Pillutla, Swabha Swayamdipta, Rowan Zellers, John Thickstun, Sean Welleck, Yejin Choi, and Zaïd Harchaoui. 2021. MAUVE: measuring the gap between neural text and human text using divergence frontiers. In Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pages 4816–4828.
    题名译文:MAUVE:使用散度前沿衡量神经文本与人类文本之间的差距
  • Radev et al. (2002) Dragomir R. Radev, Hong Qi, Harris Wu, and Weiguo Fan. 2002. Evaluating web-based question answering systems. In Proceedings of the Third International Conference on Language Resources and Evaluation (LREC’02), Las Palmas, Canary Islands - Spain. European Language Resources Association (ELRA).
    题名译文:评价基于网页的问答系统
  • Rajpurkar et al. (2016) Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. SQuAD: 100,000+ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383–2392, Austin, Texas. Association for Computational Linguistics.
    题名译文:SQuAD:包含十万余个问题的机器文本理解数据集
  • Reimers and Gurevych (2019) Nils Reimers and Iryna Gurevych. 2019. Sentence-BERT: Sentence embeddings using Siamese BERT-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3982–3992, Hong Kong, China. Association for Computational Linguistics.
    题名译文:Sentence-BERT:使用孪生 BERT 网络生成句子嵌入
  • Ruan et al. (2024) Yangjun Ruan, Chris J Maddison, and Tatsunori Hashimoto. 2024. Observational scaling laws and the predictability of language model performance. ArXiv preprint, abs/2405.10938.
    题名译文:观测缩放定律与语言模型性能的可预测性
  • Sanchez et al. (2024) Guillaume Sanchez, Alexander Spangher, Honglu Fan, Elad Levi, and Stella Biderman. 2024. Stay on topic with classifier-free guidance. In Forty-first International Conference on Machine Learning.
    题名译文:使用无分类器引导保持主题一致
  • Sap et al. (2019) Maarten Sap, Hannah Rashkin, Derek Chen, Ronan Le Bras, and Yejin Choi. 2019. Social IQa: Commonsense reasoning about social interactions. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4463–4473, Hong Kong, China. Association for Computational Linguistics.
    题名译文:Social IQa:关于社会互动的常识推理
  • Shi et al. (2024) Weijia Shi, Xiaochuang Han, Mike Lewis, Yulia Tsvetkov, Luke Zettlemoyer, and Wen-tau Yih. 2024. Trusting your evidence: Hallucinate less with context-aware decoding. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 2: Short Papers), pages 783–791, Mexico City, Mexico. Association for Computational Linguistics.
    题名译文:信任证据:使用上下文感知解码减少幻觉
  • Srivastava et al. (2023) Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, et al. 2023. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. Transactions on Machine Learning Research.
    题名译文:超越模仿游戏:量化并外推语言模型的能力
  • Strubell et al. (2019) Emma Strubell, Ananya Ganesh, and Andrew McCallum. 2019. Energy and policy considerations for deep learning in NLP. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3645–3650, Florence, Italy. Association for Computational Linguistics.
    题名译文:自然语言处理中深度学习的能源与政策考量
  • Talmor et al. (2019) Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. 2019. CommonsenseQA: A question answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4149–4158, Minneapolis, Minnesota. Association for Computational Linguistics.
    题名译文:CommonsenseQA:面向常识知识的问答挑战
  • Tonmoy et al. (2024) SM Tonmoy, SM Zaman, Vinija Jain, Anku Rani, Vipula Rawte, Aman Chadha, and Amitava Das. 2024. A comprehensive survey of hallucination mitigation techniques in large language models. ArXiv preprint, abs/2401.01313.
    题名译文:大语言模型幻觉缓解技术综合综述
  • Wan et al. (2024) David Wan, Jaemin Cho, Elias Stengel-Eskin, and Mohit Bansal. 2024. Contrastive region guidance: Improving grounding in vision-language models without training. ArXiv preprint, abs/2403.02325.
    题名译文:对比区域引导:无需训练即可改善视觉语言模型的定位能力
  • Yang et al. (2024) Haoran Yang, Deng Cai, Huayang Li, Wei Bi, Wai Lam, and Shuming Shi. 2024. A frustratingly simple decoding method for neural text generation. In Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024), pages 536–557, Torino, Italia. ELRA and ICCL.
    题名译文:一种令人沮丧地简单的神经文本生成解码方法
  • Yao et al. (2019) Lili Yao, Nanyun Peng, Ralph M. Weischedel, Kevin Knight, Dongyan Zhao, and Rui Yan. 2019. Plan-and-write: Towards better automatic storytelling. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pages 7378–7385. AAAI Press.
    题名译文:Plan-and-Write:迈向更好的自动故事创作
  • Zhang et al. (2022) Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. 2022. Opt: Open pre-trained transformer language models. Preprint, arXiv:2205.01068.
    题名译文:OPT:开放预训练 Transformer 语言模型
  • Zhang et al. (2023) Yue Zhang, Leyang Cui, Wei Bi, and Shuming Shi. 2023. Alleviating hallucinations of large language models through induced hallucinations. ArXiv preprint, abs/2312.15710.
    题名译文:通过诱导幻觉缓解大语言模型的幻觉
  • Zheng et al. (2024) Chujie Zheng, Ziqi Wang, Heng Ji, Minlie Huang, and Nanyun Peng. 2024. Weak-to-strong extrapolation expedites alignment. ArXiv preprint, abs/2404.16792.
    题名译文:弱到强外推加速对齐

Appendix A Appendix Overview

附录 A 附录概览

We first visualize the probability predicted by APD and compare more methods using more metrics in Appendix B. Then, we conduct a human experiment and evaluate the creative writing ability of APD in Appendix C. Finally, we provide the details of our methods in Appendix D and the details of our experiments in Appendix E.

我们首先在附录 B 中可视化 APD 预测的概率,并使用更多指标比较更多方法;随后在附录 C 中进行人工实验并评价 APD 的创意写作能力;最后在附录 D 中给出方法细节,在附录 E 中给出实验细节。

Appendix B More Metrics and Analyses

附录 B 更多指标与分析

Because of the page limit, we move visualization and some results of FactualityPrompts and question-answering datasets to this section.

由于篇幅限制,我们把可视化结果以及 FactualityPrompts 和问答数据集的部分结果移至本节。
原论文图表,详见相邻中英文图注
Figure 5: Comparison of empirical probability curves (blue) and probabilities predicted by APD (orange) and CD (green and red). The next token ww has the highest probability in ELM. The LLM family is Pythia.
图 5:经验概率曲线(蓝色)与 APD(橙色)及 CD(绿色和红色)预测概率的比较。下一词 w 在 ELM 中具有最高概率。语言模型家族为 Pythia。
(a) Ours v.s. SOTA (Pythia)
(a) 本文方法与当前最佳方法比较(Pythia)
(b) With REAL Sampling (Pythia)
(b) 配合 REAL 采样(Pythia)
(c) Loss Term Ablation (Pythia)
(c) 损失项消融(Pythia)
(d) Mid-size LLM Ablation (Pythia)
(d) 中等规模语言模型消融(Pythia)
(e) Function Ablation (Pythia)
(e) 函数消融(Pythia)
(f) Other Ablation (Pythia)
(f) 其他消融(Pythia)
(g) Temperature Tuning of CD (Pythia)
(g) CD 温度调节(Pythia)
(h) Layer Tuning of DoLa (Pythia)
(h) DoLa 层选择调节(Pythia)
(i) Ours v.s. SOTA (OPT)
(i) 本文方法与当前最佳方法比较(OPT)
(j) With REAL Sampling (OPT)
(j) 配合 REAL 采样(OPT)
(k) Temperature Tuning of CD (OPT)
(k) CD 温度调节(OPT)
(l) Layer Tuning of DoLa (OPT)
(l) DoLa 层选择调节(OPT)
(m) Ours v.s. CD (Qwen)
(m) 本文方法与 CD 比较(Qwen)
(n) Temperature Tuning of CD (Qwen)
(n) CD 温度调节(Qwen)
Figure 6: FactualityPrompts results. The x-axis is the diversity and y-axis is the factuality metrics from Chang et al. (2024). The curves closer to the upper right corner are better.
图 6:FactualityPrompts 结果。横轴为多样性,纵轴为 Chang 等(2024)的事实性指标。曲线越接近右上角越好。
(a) Ours v.s. SOTA (Pythia)
(a) 本文方法与当前最佳方法比较(Pythia)
(b) With REAL Sampling (Pythia)
(b) 配合 REAL 采样(Pythia)
(c) Loss Term Ablation (Pythia)
(c) 损失项消融(Pythia)
(d) Mid-size LLM Ablation (Pythia)
(d) 中等规模语言模型消融(Pythia)
(e) Function Ablation (Pythia)
(e) 函数消融(Pythia)
(f) Other Ablation (Pythia)
(f) 其他消融(Pythia)
(g) Temperature Tuning of CD (Pythia)
(g) CD 温度调节(Pythia)
(h) Layer Tuning of DoLa (Pythia)
(h) DoLa 层选择调节(Pythia)
(i) Ours v.s. SOTA (OPT)
(i) 本文方法与当前最佳方法比较(OPT)
(j) With REAL Sampling (OPT)
(j) 配合 REAL 采样(OPT)
(k) Temperature Tuning of CD (OPT)
(k) CD 温度调节(OPT)
(l) Layer Tuning of DoLa (OPT)
(l) DoLa 层选择调节(OPT)
(m) Ours v.s. CD (Qwen)
(m) 本文方法与 CD 比较(Qwen)
(n) Temperature Tuning of CD (Qwen)
(n) CD 温度调节(Qwen)
Figure 7: FactualityPrompts results using factual prompts. The curves closer to the lower right corner are better. The average standard error of NEER is 0.00380.0038 and the maximal one is 0.00950.0095.
图 7:使用事实性提示时的 FactualityPrompts 结果。曲线越接近右下角越好。NEER 的平均标准误为 0.0038,最大标准误为 0.0095。
(a) Ours v.s. SOTA (Pythia)
(a) 本文方法与当前最佳方法比较(Pythia)
(b) With REAL Sampling (Pythia)
(b) 配合 REAL 采样(Pythia)
(c) Loss Term Ablation (Pythia)
(c) 损失项消融(Pythia)
(d) Mid-size LLM Ablation (Pythia)
(d) 中等规模语言模型消融(Pythia)
(e) Function Ablation (Pythia)
(e) 函数消融(Pythia)
(f) Other Ablation (Pythia)
(f) 其他消融(Pythia)
(g) Temperature Tuning of CD (Pythia)
(g) CD 温度调节(Pythia)
(h) Layer Tuning of DoLa (Pythia)
(h) DoLa 层选择调节(Pythia)
(i) Ours v.s. SOTA (OPT)
(i) 本文方法与当前最佳方法比较(OPT)
(j) With REAL Sampling (OPT)
(j) 配合 REAL 采样(OPT)
(k) Temperature Tuning of CD (OPT)
(k) CD 温度调节(OPT)
(l) Layer Tuning of DoLa (OPT)
(l) DoLa 层选择调节(OPT)
(m) Ours v.s. CD (Qwen)
(m) 本文方法与 CD 比较(Qwen)
(n) Temperature Tuning of CD (Qwen)
(n) CD 温度调节(Qwen)
Figure 8: FactualityPrompts results using nonfactual prompts. The curves closer to the lower right corner are better. The average standard error of NEER is 0.00400.0040 and the maximal one is 0.01110.0111.
图 8:使用非事实性提示时的 FactualityPrompts 结果。曲线越接近右下角越好。NEER 的平均标准误为 0.0040,最大标准误为 0.0111。
(a) Ours v.s. SOTA (Pythia)
(a) 本文方法与当前最佳方法比较(Pythia)
(b) With REAL Sampling (Pythia)
(b) 配合 REAL 采样(Pythia)
(c) Loss Term Ablation (Pythia)
(c) 损失项消融(Pythia)
(d) Mid-size LLM Ablation (Pythia)
(d) 中等规模语言模型消融(Pythia)
(e) Function Ablation (Pythia)
(e) 函数消融(Pythia)
(f) Other Ablation (Pythia)
(f) 其他消融(Pythia)
(g) Temperature Tuning of CD (Pythia)
(g) CD 温度调节(Pythia)
(h) Layer Tuning of DoLa (Pythia)
(h) DoLa 层选择调节(Pythia)
(i) Ours v.s. SOTA (OPT)
(i) 本文方法与当前最佳方法比较(OPT)
(j) With REAL Sampling (OPT)
(j) 配合 REAL 采样(OPT)
(k) Temperature Tuning of CD (OPT)
(k) CD 温度调节(OPT)
(l) Layer Tuning of DoLa (OPT)
(l) DoLa 层选择调节(OPT)
(m) Ours v.s. CD (Qwen)
(m) 本文方法与 CD 比较(Qwen)
(n) Temperature Tuning of CD (Qwen)
(n) CD 温度调节(Qwen)
Figure 9: FactualityPrompts results using factual prompts. The curves closer to the upper left corner are better. The average standard error of EntailR is 0.00310.0031 and the maximal one is 0.00950.0095.
图 9:使用事实性提示时的 FactualityPrompts 结果。曲线越接近左上角越好。EntailR 的平均标准误为 0.0031,最大标准误为 0.0095。
(a) Ours v.s. SOTA (Pythia)
(a) 本文方法与当前最佳方法比较(Pythia)
(b) With REAL Sampling (Pythia)
(b) 配合 REAL 采样(Pythia)
(c) Loss Term Ablation (Pythia)
(c) 损失项消融(Pythia)
(d) Mid-size LLM Ablation (Pythia)
(d) 中等规模语言模型消融(Pythia)
(e) Function Ablation (Pythia)
(e) 函数消融(Pythia)
(f) Other Ablation (Pythia)
(f) 其他消融(Pythia)
(g) Temperature Tuning of CD (Pythia)
(g) CD 温度调节(Pythia)
(h) Layer Tuning of DoLa (Pythia)
(h) DoLa 层选择调节(Pythia)
(i) Ours v.s. SOTA (OPT)
(i) 本文方法与当前最佳方法比较(OPT)
(j) With REAL Sampling (OPT)
(j) 配合 REAL 采样(OPT)
(k) Temperature Tuning of CD (OPT)
(k) CD 温度调节(OPT)
(l) Layer Tuning of DoLa (OPT)
(l) DoLa 层选择调节(OPT)
(m) Ours v.s. CD (Qwen)
(m) 本文方法与 CD 比较(Qwen)
(n) Temperature Tuning of CD (Qwen)
(n) CD 温度调节(Qwen)
Figure 10: FactualityPrompts results using nonfactual prompts. The curves closer to the upper left corner are better. The average standard error of EntailR is 0.00280.0028 and the maximal one is 0.00860.0086.
图 10:使用非事实性提示时的 FactualityPrompts 结果。曲线越接近左上角越好。EntailR 的平均标准误为 0.0028,最大标准误为 0.0086。

B.1 Asymptotic Probability Visualization

B.1 渐近概率可视化

We visualize the top 1 token probabilities of the Pythia family up to 6.9B in Figure 5. The input text is President of the United States Joe Biden. We can see that probabilities of CD T=1 (red lines) are close to 00 at every position because amateur LM could also predict the next token in this phrase correctly. If we reduce the influence of amateur LM by setting T=2 (green lines), the probability is still far away from the actual empirical probability curves (blue curves). Instead, the asymptotic probabilities (orange lines) from APD could often be closer to blue curves but sometimes farther away if APD believes the probability is steadily decreasing as the LM’s size increases.

图 5 可视化了 Pythia 家族中最高至 6.9B 模型的 top-1 词概率。
输入文本是“President of the United States Joe Biden”。
可以看到,CD T=1(红线)在每个位置的概率都接近 0,因为业余语言模型也能正确预测该短语的下一词。
如果设置 T=2 以减弱业余语言模型的影响(绿线),所得概率仍与实际经验概率曲线(蓝线)相距很远。
相比之下,APD 的渐近概率(橙线)往往更接近蓝色曲线;但当 APD 认为概率会随语言模型规模增大而持续下降时,有时也会离蓝线更远。

B.2 More Results and Analyses from FactualityPrompts

B.2 FactualityPrompts 的更多结果与分析

FactualityPrompts provides four main metrics: NEER, EntailR, Dist-n, and Rep. Chang et al. (2024) combine NEER and EntailR as Agg. Factuality and combines Dist-n and Rep as Agg. Diversity. We plot the Agg. Factuality versus Agg. Diversity in Figure 6, NEER versus Dist-n in Figure 7 and Figure 8, and EntailR versus Rep in Figure 9 and Figure 10. We analyze the performances in Figure 6 below.

FactualityPrompts 提供四项主要指标:NEER、EntailR、Dist-n 和 Rep。Chang 等(2024)把 NEER 与 EntailR 合并为综合事实性指标(Agg. Factuality),把 Dist-n 与 Rep 合并为综合多样性指标(Agg. Diversity)。
我们在图 6 中绘制综合事实性指标与综合多样性指标的关系,在图 7 和图 8 中绘制 NEER 与 Dist-n 的关系,并在图 9 和图 10 中绘制 EntailR 与 Rep 的关系。
下面分析图 6 中的表现。

Qwen: Figure 6(m) shows that APD is better than CD when p≥0.4p\geq 0.4. The improvements are smaller than Pythia and OPT probably because we can only fine-tune ALM’ using Qwen-1.5 0.5B, 1.8B, and 4B44 4 Qwen has a larger vocabulary size compared to Pythia and OPT, so 4B is the largest size we can run.

4 与 Pythia 和 OPT 相比,Qwen 的词表更大,因此 4B 是我们能够运行的最大规模。
. The worse performances of APD 1B-7B in Figure 6(d) implies that smaller LM plays a crucial role in modeling the exponential decay and Qwen-1.5 does not have the LLM that is smaller than 0.5B.

Qwen:图 6(m) 表明,当 p\geq 0.4 时,APD 优于 CD。
改进小于 Pythia 和 OPT,可能是因为我们只能使用 Qwen-1.5 0.5B、1.8B 和 4B 来微调 ALM′。
图 6(d) 中 APD 1B-7B 表现较差,说明较小语言模型在指数衰减建模中起关键作用;而 Qwen-1.5 没有小于 0.5B 的大语言模型。

Ablation Studies: The similar performance of λ3=1.6\lambda_{3}=1.6 and the default value λ3=0.8\lambda_{3}=0.8 in Figure 6(c) suggests that our performances are not very sensitive to the hyperparameters. APD 70M-7B improves CD by only using ALM and ELM probably because of a better inductive bias (i.e., exponential decay in the probability space is a better assumption than the linear decay in the logit space).

消融研究:图 6(c) 中 \lambda_{3}=1.6 与默认值 \lambda_{3}=0.8 的表现相近,说明方法表现对该超参数并不十分敏感。
APD 70M-7B 仅使用 ALM 和 ELM 仍能改进 CD,可能是因为它具有更好的归纳偏置,即概率空间的指数衰减假设优于 logit 空间的线性衰减假设。

DoLa: In the original DoLa paper (Chuang et al., 2023), they recommend to get the amateur logits from two subsets of layers: 0,2,4,6,8,10,12,14,32 or 16,18,20,22,24,26,28,30,32. We call the DoLa using the subset that contains mostly the first half of layers as DoLa + α\alpha and the DoLa using the second subset as DoLa Last + α\alpha. Figure 6(h) and Figure 6(l) show that selecting amateur logits from the lower layers is much better but still worse than top-pp sampling.

DoLa:原始 DoLa 论文(Chuang 等,2023)建议从两组层中取得业余 logits:0、2、4、6、8、10、12、14、32,或者 16、18、20、22、24、26、28、30、32。
我们把主要包含前半部分层的子集所对应的 DoLa 称为 DoLa + \alpha,把使用第二个子集的版本称为 DoLa Last + \alpha。
图 6(h) 和图 6(l) 表明,从较低层选择业余 logits 的效果好得多,但仍不如 top-p 采样。

Thresholding Methods: Figure 6(a), Figure 6(b), Figure 6(i), and Figure 6(j) indicate that from best to the worst, thresholding methods could be ranked as REAL, top-pp kk20, top-pp, and α\alpha according to their performances in this benchmark. Hence, APD + REAL achieves the best results and the new state-of-the-art results according to Chang et al. (2024).

阈值方法:图 6(a)、6(b)、6(i) 和 6(j) 表明,按该基准上的表现,阈值方法从好到差依次为 REAL、top-p k20、top-p 和 α。
因此,根据 Chang 等(2024),APD + REAL 取得了最佳结果和新的最先进结果。

B.3 Decay Parameterization Comparison

B.3 衰减参数化比较

In Equation 7, we parameterize the decay curves using an exponential function. Following Chang et al. (2024), we also evaluate the logistic decay function (p^w,c​(s)=P′^cA​P​(w)+aw,c1+exp⁡(max⁡(0,bw,c​(s−dw,c)))\hat{p}_{w,c}(s)=\hat{P^{\prime}}^{AP}_{c}(w)+\frac{a_{w,c}}{1+\exp(\max(0,b_{w,c}(s-d_{w,c})))}) and factional polynomial (Chang et al., 2020) (p^w,c​(s)=P′^cA​P​(w)+aw,c​(dw,c,0.5xc​(s)0.5+∑k=1Kdw,c,kxc​(s)k)\hat{p}_{w,c}(s)=\hat{P^{\prime}}^{AP}_{c}(w)+a_{w,c}(\frac{d_{w,c,0.5}}{x_{c}(s)^{0.5}}+\sum_{k=1}^{K}\frac{d_{w,c,k}}{x_{c}(s)^{k}}) and xw,c​(s)=max⁡(1,bw,c​(s−dw,c))x_{w,c}(s)=\max(1,b_{w,c}(s-d_{w,c}))) whose parameters are all predicted by MLP.

在式(7)中,我们使用指数函数参数化衰减曲线。
按照 Chang 等(2024),我们还评价了逻辑衰减函数(\hat{p}_{w,c}(s)=\hat{P^{\prime}}^{AP}_{c}(w)+\frac{a_{w,c}}{1+\exp(\max(0,b_{w,c}(s-d_{w,c})))}))以及分数多项式(Chang 等,2020)(\hat{p}_{w,c}(s)=\hat{P^{\prime}}^{AP}_{c}(w)+a_{w,c}(\frac{d_{w,c,0.5}}{x_{c}(s)^{0.5}}+\sum_{k=1}^{K}\frac{d_{w,c,k}}{x_{c}(s)^{k}}),其中 x_{w,c}(s)=\max(1,b_{w,c}(s-d_{w,c})));它们的参数均由 MLP 预测。

In Figure 6(e), we report the APD using the logistic decay function (ADP logistic), APD using factional polynomial with K=1K=1 (ADP poly1) and K=3K=3 (ADP poly3). The results show that ADP logistic, ADP poly1, and ADP perform similarly well while ADP poly3 performs worse. This might indicate that the probability decay curves are noisy and using fewer parameters could mitigate this problem. The worse performances of APD on the fly in the QA experiments also support this hypothesis.

图 6(e) 报告了使用逻辑衰减函数的 APD(原文写作 ADP logistic),以及使用 K=1 和 K=3 的分数多项式版本(原文写作 ADP poly1、ADP poly3)。
结果表明,ADP logistic、ADP poly1 与 APD 的表现相近且较好,而 ADP poly3 表现较差。〔此处保留原文拼写。〕
这可能说明概率衰减曲线含有噪声,使用更少的参数可以缓解这一问题。
问答实验中 “APD on the fly” 表现更差,也支持这一假设。
LAMBADA CQA QASC ARC SocialIQA
Q+Fact
问题+事实
Q Only
仅问题
ppl (↓\downarrow)
困惑度(↓)
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
ppl (↓\downarrow)
困惑度(↓)
acc
准确率
OPT LLM 6.7B 2.388 9.117 0.664 4.994 0.851 8.094 0.604 4.739 0.660 7.259 0.665
CD 2.412 7.227 0.707 5.039 0.856 7.925 0.622 4.736 0.679 6.673 0.712
APD 2.396 7.335 0.695 4.985 0.860 7.911 0.622 4.701 0.676 6.691 0.690
APD on the fly 2.414 8.846 0.664 5.040 0.860 8.090 0.630 4.765 0.678 7.248 0.705
LLM 13B 2.295 9.308 0.660 6.458 0.822 8.319 0.634 4.757 0.678 9.139 0.636
Qwen1.5 LLM 4B 2.430 5.797 0.671 3.618 0.888 6.613 0.672 4.210 0.716 7.078 0.590
CD 2.474 5.890 0.675 3.648 0.888 6.721 0.674 4.279 0.726 7.150 0.636
APD 2.445 5.535 0.674 3.596 0.886 6.571 0.686 4.237 0.720 7.059 0.643
APD on the fly 2.459 5.840 0.676 3.657 0.889 6.670 0.671 4.258 0.725 7.131 0.613
LLM 7B 2.186 5.899 0.696 4.083 0.911 7.306 0.698 3.977 0.778 6.776 0.645
Table 3: Perplexity and accuracy comparison of one-shot QA using different decoding methods.
表 3:比较不同解码方法在单样本问答中的困惑度和准确率。
MultiRC SQuAD
Q+P
问题+段落
Q
问题
Pythia LLM 6.9B 3.620 2.360 5.426
CD 3.377 2.246 5.029
APD 3.349 2.231 5.018
APD on the fly 3.623 2.381 5.432
LLM 12B 3.336 2.289 4.978
OPT LLM 6.7B 3.900 2.450 5.654
CD 3.775 2.381 5.403
APD 3.840 2.391 5.437
APD on the fly 3.908 2.469 5.657
LLM 13B 3.741 2.310 5.268
Qwen1.5 LLM 4B 4.023 1.853 5.038
CD 3.985 1.841 5.152
APD 4.057 1.847 5.098
APD on the fly 4.033 1.872 5.106
LLM 7B 3.171 1.557 3.242
Table 4: Perplexity of MRC tasks. Smaller numbers are better.
表 4:机器阅读理解任务的困惑度。数值越小越好。
LAMBADA CQA QASC ARC SocialIQA MultiRC SQuAD
Q+Facts
问题+事实
Q only
仅问题
Q+P
问题+段落
Q only
仅问题
Pythia LLM 6.9B 0.841 0.483 0.564 0.491 0.660 0.475 0.696 0.820 0.591
CD 0.861 0.572 0.564 0.502 0.671 0.512 0.715 0.836 0.611
APD 0.867 0.582 0.612 0.501 0.673 0.518 0.715 0.835 0.611
APD on the fly 0.845 0.496 0.564 0.494 0.660 0.484 0.700 0.822 0.594
LLM 12B 0.853 0.494 0.629 0.514 0.684 0.493 0.708 0.825 0.618
|D| 5000 3343 6040 2181 1611 4783 3798 28890 10491
OPT LLM 6.7B 0.831 0.451 0.601 0.490 0.644 0.517 0.682 0.816 0.575
CD 0.833 0.534 0.599 0.499 0.648 0.559 0.688 0.831 0.594
APD 0.831 0.521 0.605 0.498 0.651 0.549 0.685 0.824 0.588
APD on the fly 0.832 0.470 0.601 0.494 0.648 0.527 0.685 0.819 0.582
LLM 13B 0.841 0.443 0.525 0.476 0.636 0.432 0.692 0.826 0.601
|D| 4985 2380 5827 1942 1477 3843 3401 28330 8763
Qwen1.5 LLM 4B 0.825 0.591 0.705 0.549 0.655 0.533 0.685 0.860 0.611
CD 0.825 0.590 0.703 0.546 0.652 0.530 0.685 0.866 0.606
APD 0.832 0.614 0.709 0.553 0.657 0.534 0.682 0.862 0.608
APD on the fly 0.826 0.591 0.705 0.549 0.656 0.532 0.684 0.860 0.610
LLM 7B 0.851 0.586 0.681 0.520 0.678 0.546 0.742 0.909 0.726
|D| 4925 5079 6718 2676 1856 8290 5071 31247 11690
Table 5: MRR Comparison for 7 QA datasets. |D| is the dataset size after filtering out the answers whose tokens are ranked below the top 20 by ELM.
表 5:七个问答数据集的 MRR 比较。|D| 是过滤掉正确答案词在 ELM 中排名低于前 20 的样本后得到的数据集大小。

B.4 More Results from QA Datasets

B.4 问答数据集的更多结果

In Table 3, we surprisingly find that the perplexity of LLM 13B is worse than the perplexity of LLM 7B at CQA, QASC, ARC, and SocialIQA. This suggests that some training detail differences (e.g., batch sizes or training data order) between OPT 7B and 13B affect their final performances. Since a larger model does not necessarily perform better, it is not surprising that APD sometimes do worse than CD or LLM 7B. For Qwen-1.5, the results are also mixed. CD and APD often perform similarly compared to LLM 4B probably because the size difference between ALM and ELM is too small (0.5B vs 4B).

在表 3 中,我们惊讶地发现,在 CQA、QASC、ARC 和 SocialIQA 上,LLM 13B 的困惑度比 LLM 7B 更差。
这说明 OPT 7B 与 13B 之间的某些训练细节差异,例如批大小或训练数据顺序,会影响最终表现。
由于更大的模型不一定表现更好,APD 有时比 CD 或 LLM 7B 更差也并不意外。
Qwen-1.5 的结果也有好有坏。
CD 和 APD 的表现往往与 LLM 4B 相近,可能是因为 ALM 与 ELM 的规模差太小,即 0.5B 对 4B。

Besides commonsense QA datasets, we also compare APD and CD using 2 reading comprehension datasets: MultiRC (Khashabi et al., 2018) and SQuAD (Rajpurkar et al., 2016). In SQuAD, we test the prompts with passage (Q+P) and without passage (Q only). Table 4 shows that in Pythia, APD is slightly better than CD, but CD is often slightly better than APD in OPT and Qwen.

除常识问答数据集外,我们还在两个阅读理解数据集上比较 APD 与 CD:MultiRC(Khashabi 等,2018)和 SQuAD(Rajpurkar 等,2016)。
在 SQuAD 上,我们分别测试包含文章(Q+P)和不包含文章(Q only)的提示。
表 4 表明,在 Pythia 上 APD 略优于 CD;但在 OPT 和 Qwen 上,CD 往往略优于 APD。

Table 5 reports the MRR (Mean Reciprocal Rank) results, which only consider the rank of the correct answer. The results are similar to perplexity and accuracy. APD is generally better than CD for Pythia and Qwen, while the results are mixed for OPT.

表 5 报告平均倒数排名(MRR)结果,该指标只考虑正确答案的排名。
结果与困惑度和准确率的结果相近。
在 Pythia 和 Qwen 上,APD 通常优于 CD;OPT 的结果则有好有坏。

Finally, compared to ELM LLM 6.9B/7B/4B, APD on the fly does worse in perplexity but sometimes better in MRR and accuracy. This seems to suggest that the estimated asymptotic probabilities could improve the rank of tokens while their absolute values are degraded by the noise in the empirical probability decay curve. Fine-tuning a small ALM’ and the regularization term in Equation 11 should be able to alleviate the problem by reducing the noise.

最后,与 ELM(LLM 6.9B/7B/4B)相比,“APD on the fly” 的困惑度更差,但其 MRR 和准确率有时更好。
这似乎表明,估计的渐近概率可以改善词的排名,但经验概率衰减曲线中的噪声会损害其绝对数值。
微调一个小型 ALM′,并使用式(11)的正则项,应能通过减少噪声缓解这一问题。
Human Experiments (150 continuations)
人工实验(150 个续写)
Automatic Metrics (28k continuations) (%)
自动指标(2.8 万个续写)(%)
Factuality
事实性
Informativeness
信息量
Fluency
流畅性
Overall
总体
Dist-2 Rep (↓\downarrow)
重复率(↓)
NEER (↓\downarrow)
NEER(↓)
EntailR
LLM + Top-pp (p=1.0p=1.0)
LLM + top-p(p=1.0)
1.82 3.67 3.88 2.41 40.0 0.2 47.9 3.2
CD T=2 + Top-pp k20 (p=0.8p=0.8)
CD T=2 + top-p k20(p=0.8)
2.00 4.05 4.12 2.58 48.3 0.5 40.3 4.2
APD + Top-pp k20 (p=0.8p=0.8)
APD + top-p k20(p=0.8)
2.07 3.97 4.11 2.58 47.1 1.6 39.2 5.3
CD T=2 + REAL (Tr=4.0T_{r}=4.0)
CD T=2 + REAL(T_r=4.0)
2.16 4.04 4.18 2.62 43.3 0.5 39.3 5.9
APD + REAL (Tr=4.0T_{r}=4.0)
APD + REAL(T_r=4.0)
2.31 4.02 4.14 2.73 42.0 1.6 37.5 7.0
Table 6: Evaluation the generated responses in FactualityPrompts using MTurk workers and automatic metrics. The questionaires for humans use 1 to 5 Likert scale.
表 6:使用 MTurk 人工评价者和自动指标评价 FactualityPrompts 中生成的回答。人工问卷采用 1 至 5 的李克特量表。

Appendix C More Experiments

附录 C 更多实验

To make our results more complete, we also test APD using human evaluation and story-writing tasks.

为使结果更完整,我们还使用人工评价和故事写作任务测试 APD。

C.1 Human Evaluation for FactualityPrompts

C.1 FactualityPrompts 人工评价

We adopt the Amazon Mechanical Turk (MTurk) tasks from Chang et al. (2024), which ask the workers to evaluate the factuality of the generated continuation in FactualityPrompts using search engines. The workers also need to label the informativeness, fluency, and overall. We collect the annotations for 150 prompts and each task is labeled by 2 workers. The Pearson correlation between the two workers for factuality, informativeness, fluency, and overall are 38.8%, 33.0%, 31.6%, and 33.5%, respectively.

我们采用 Chang 等(2024)的 Amazon Mechanical Turk(MTurk)任务,要求工作者借助搜索引擎评价 FactualityPrompts 生成续写的事实性。
工作者还需要标注信息量、流畅性和总体质量。
我们收集了 150 个提示的标注,每项任务由 2 名工作者标注。
两名工作者在事实性、信息量、流畅性和总体质量上的 Pearson 相关系数分别为 38.8%、33.0%、31.6% 和 33.5%。

First, Table 6 demonstrates that APD indeed improves the factuality of the continuations, which makes APD particularly suitable for high-stake domains such as medicine and laws. CD T=2 + Top-pp k20 has a higher informativeness score compared to APD + Top-pp k20 probably because CD tends to ignore the most obvious next token as shown in Figure 1. Overall, APD + REAL achieves the best performance and improves the factuality of the top-p sampling by 27%27\%.

首先,表 6 表明 APD 确实改善了续写的事实性,这使 APD 尤其适合医学和法律等高风险领域。〔这是作者的原文判断;表中有限人工样本本身不足以证明可安全部署于这些领域。〕
与 APD + Top-p k20 相比,CD T=2 + Top-p k20 的信息量得分更高,可能是因为图 1 所示的 CD 倾向于忽略最显而易见的下一词。
总体而言,APD + REAL 表现最好,并将 top-p 采样的事实性提高了 27%。

Notice that the current results might not be very stable because the sampling process involves lots of randomnesses, annotators might disagree with each other, and we can only afford 150 continuations, whose annotations cost us 875 dollars. Nevertheless, we can see that the methods that achieve higher factual scores in automatic evaluation are indeed more factual from humans’ perspective.

请注意,当前结果可能并不十分稳定,因为采样过程包含大量随机性,标注者之间可能存在分歧,而且我们只能负担 150 个续写的评价,其标注成本为 875 美元。
尽管如此,可以看到,在自动评价中事实性得分更高的方法,从人类视角看也确实更符合事实。
GPT3.5 Turbo Evaluation (500 continuations)
GPT-3.5 Turbo 评价(500 个续写)
Automatic Evaluation (8k continuations)
自动评价(8000 个续写)
Fluency
流畅性
Coherency
连贯性
Likability
受喜爱程度
Overall
总体
Dist-2 MAUVE ROUGE-2 Sim
相似度
Pythia CD T=2 0.563 0.575 0.575 0.573 0.364 0.048 2.595 0.513
APD 0.526 0.546 0.548 0.546 0.384 0.044 2.634 0.510
OPT CD T=4 0.520 0.522 0.524 0.526 0.301 0.485 3.115 0.526
APD 0.546 0.538 0.540 0.546 0.337 0.442 2.919 0.526
Table 7: Short Story Writing Experiment. Every method uses top-p k20 (p=0.8p=0.8). We report the winning rate against top-pp sampling (p=0.95p=0.95) that is judged by GPT3.5 Turbo.
表 7:短篇故事写作实验。每种方法均使用 top-p k20(p=0.8)。我们报告相对于 top-p 采样(p=0.95)的胜率,由 GPT-3.5 Turbo 判定。

C.2 Story Writing Experiments

C.2 故事写作实验

In Figure 1, we show that CD tends to ignore the most obvious next token. Although this behavior could degrade the factuality as shown in the main paper, it might not be an issue in story writing because the nonfactuality of a story is often not an issue and the surprising next tokens might make the stories more interesting and likable. Nevertheless, for completeness, we compare CD with APD in terms of completing ROC stories (Mostafazadeh et al., 2016), which are often used in the story generation literature (Yao et al., 2019).

图 1 表明,CD 倾向于忽略最显而易见的下一词。
尽管正文表明这种行为可能降低事实性,但在故事写作中它可能不是问题,因为故事不符合事实通常并无妨,而意外的下一词可能让故事更有趣、更受喜欢。
不过,为完整起见,我们比较了 CD 与 APD 补写 ROC 故事(Mostafazadeh 等,2016)的表现;ROC 故事常用于故事生成研究(Yao 等,2019)。

We use the same experiment setup and metrics of Chang et al. (2024). A prompt includes 3 shot examples and the first two sentences of the final ROC story. Each decoding method generates 8 different completions of the final story. Finally, the generated completions are first compared with top-pp sampling (p=0.95p=0.95) using GPT3.5 Turbo Evaluation and then compared with human reference story using MAUVE (Pillutla et al., 2021), ROUGE-2 F1 (Lin, 2004), and similarity (Sim) from sBERT (Reimers and Gurevych, 2019), all-mpnet-base-v2. All the metrics use their default hyperparameters. We use the best hyperparameters of CD and APD from the FactualityPrompts experiments.

我们使用 Chang 等(2024)相同的实验设置和指标。
一个提示包含 3 个示例,以及最后一个 ROC 故事的前两句话。
每种解码方法为最后一个故事生成 8 个不同的续写。
最后,先用 GPT-3.5 Turbo Evaluation 将生成续写与 top-p 采样(p=0.95)比较,再使用 MAUVE(Pillutla 等,2021)、ROUGE-2 F1(Lin,2004)以及 sBERT 模型 all-mpnet-base-v2 的相似度(Sim)(Reimers 和 Gurevych,2019),将其与人工参考故事比较。
所有指标均使用默认超参数。
我们使用 FactualityPrompts 实验中 CD 与 APD 的最佳超参数。

The results in Table 7 indicate that APD performs comparably to CD. It is worth mentioning that our ALM’ is trained only on a small subset of Wikipedia, so this experiment confirms a certain degree of generalization ability of APD.

表 7 的结果表明,APD 的表现与 CD 相当。
值得一提的是,我们的 ALM′ 只在 Wikipedia 的一个小子集上训练,因此该实验确认了 APD 具有一定程度的泛化能力。

Appendix D Method Details

附录 D 方法细节

By default, the ALM’ is trained by 70m, 160m, 410m, 1B, 1.4B, 2.8B, and 6.9B de-duplicated Pythia. For OPT, the ALM’ is trained by 125m, 350m, 1.3B, 2.7B, and 6.7B LMs. For Qwen-1.5, the ALM’ is trained by only 3 LMs (0.5B, 1.8B, and 4B). During training, we construct the set AcA_{c} by subsampling the next tokens according to their probabilities of ELM. Besides the 2020 tokens with the highest probabilities, we randomly sample 55 tokens between top 2020 and top 100100 tokens. The smaller NN in OPT and Qwen allow us to sample a little bit more tokens (N=7N=7 in Pythia, N=5N=5 in OPT, and N=3N=3 in Qwen-1.5). Hence, after the top 100100, we sample 55 tokens for Pythia and 1010 tokens for OPT.

默认情况下,ALM′ 使用去重版 Pythia 70M、160M、410M、1B、1.4B、2.8B 和 6.9B 进行训练。
对于 OPT,ALM′ 使用 125M、350M、1.3B、2.7B 和 6.7B 语言模型进行训练。
对于 Qwen-1.5,ALM′ 只使用 3 个语言模型(0.5B、1.8B 和 4B)进行训练。
训练期间,我们依据 ELM 的下一词概率进行子采样,从而构造集合 A_{c}。
除概率最高的 20 个词外,我们还从第 21 至第 100 名中随机采样 5 个词。
OPT 和 Qwen 的 N 较小,因此我们可以多采样一些词(Pythia 的 N=7,OPT 的 N=5,Qwen-1.5 的 N=3)。
因此,在前 100 名之外,我们为 Pythia 采样 5 个词,为 OPT 采样 10 个词。

From Figure 6(g) and Figure 6(k), we can see that APD + Top-pp k20 is slightly better than APD + Top-pp and we observe that the improvement gap increases a lot when p=0.9p=0.9 in a preliminary study. This is because the probabilities of the top 20 tokens are always used to train ALM’. It seems to suggest that more training data could improve the performance and stability of ALM’.

从图 6(g) 和图 6(k) 可见,APD + Top-p k20 略优于 APD + Top-p;在初步研究中,我们还观察到 p=0.9 时二者的差距大幅增加。
这是因为概率最高的 20 个词总会用于训练 ALM′。
这似乎表明,更多训练数据可以改善 ALM′ 的表现与稳定性。

Before being inputted into the MLP, {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} and P^cA​P​(w)\hat{P}^{AP}_{c}(w) are normalized such that ∑w∈Acp⁡(w|c,θsi)=1​∀i\sum_{w\in A_{c}}p(w|c,\theta_{s_{i}})=1\;\forall i and ∑w∈AcP^cA​P​(w)=1\sum_{w\in A_{c}}\hat{P}^{AP}_{c}(w)=1. We choose to model the normalized probabilities because computing the unnormalized probabilities requires all the logits of ELM and storing the logits of all the tokens is not feasible to us.

输入 MLP 前,\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} 与 \hat{P}^{AP}_{c}(w) 会被归一化,使得 \sum_{w\in A_{c}}p(w|c,\theta_{s_{i}})=1\;\forall i,且 \sum_{w\in A_{c}}\hat{P}^{AP}_{c}(w)=1。
我们选择建模归一化概率,因为计算未归一化概率需要 ELM 的全部 logits,而存储所有词的 logits 对我们而言不可行。

When checking the asymptotic probability prediction, we use a four-layer MLP with hidden state size 100. We first use a dropout layer that has 0.50.5 probability to mask the probabilities from θ3\theta_{3} to θN−1\theta_{N-1}. Between layers, we insert the nonlinear layer GELU (Hendrycks and Gimpel, 2016). The final layer projects the hidden state to 33 values and we take the exponential of these 33 values as aw,c,bw,c,dw,ca_{w,c},b_{w,c},d_{w,c} to ensure their positivity. Before the training starts, we initialize the weights and bias of the final layer to be 00 to prevent the exponential layer output too large values.

检查渐近概率预测时,我们使用隐藏状态维度为 100 的四层 MLP。
首先使用一个 dropout 层,以 0.5 的概率掩盖来自 \theta_{3} 至 \theta_{N-1} 的概率。
我们在各层之间插入非线性层 GELU(Hendrycks 和 Gimpel,2016)。
最后一层将隐藏状态投影为 3 个数值;我们对这 3 个数值取指数,得到 a_{w,c}、b_{w,c}、d_{w,c},以确保它们为正。
训练开始前,我们把最后一层的权重和偏置初始化为 0,以防指数层输出过大的数值。

Our ALM’ is trained for 5 epochs using learning rate 1e-4 and AdamW (Loshchilov and Hutter, 2019). The batch size is set to 64 and the warmup step is 100. We plan to release code to reveal more method details.

我们的 ALM′ 使用 AdamW(Loshchilov 和 Hutter,2019)训练 5 个 epoch,学习率为 1e-4。
批大小设为 64,预热步数为 100。
我们计划发布代码,披露更多方法细节。

Appendix E Experiment Details

附录 E 实验细节

We run all of our experiments using 5 servers. Each server has 8 32G V100. To reduce the hyperparameters in our experiments, we keep the ELM’s temperature to be 11 as in  Li et al. (2023) and input the full context to the amateur LM.

我们的全部实验使用 5 台服务器运行。
每台服务器配有 8 块 32GB V100。
为减少实验中的超参数数量,我们像 Li 等(2023)一样,将 ELM 的温度保持为 1,并把完整上下文输入业余语言模型。

E.1 FactualityPrompts Experiment Details

E.1 FactualityPrompts 实验细节

We choose to evaluate APD using FactualityPrompts because of the high quality of its automatic factuality metrics. The human studies in Lee et al. (2022) demonstrate that the retrieval-based metrics, NEER and EntailR, have strong correlations (−0.8-0.8) with the factuality judgments from human experts. Our experiment settings are the same as the setting of Chang et al. (2024) to make the results comparable. We use the validation/testing split from Chang et al. (2024), where there are 2k prompts in the validation set and 14k prompts in the testing set.

我们选择用 FactualityPrompts 评价 APD,是因为它的自动事实性指标质量较高。
Lee 等(2022)的人工研究表明,基于检索的指标 NEER 和 EntailR 与人类专家的事实性判断具有较强相关性(-0.8)。
为使结果可比,我们采用与 Chang 等(2024)相同的实验设置。
我们使用 Chang 等(2024)的验证/测试划分,其中验证集有 2000 个提示,测试集有 14000 个提示。

We tune the hyperparameter λ3\lambda_{3} from the option set {0.2,0.4,0.6,0.8,1.0,1.2} using the validation set. The REAL sampling model for OPT is trained using the Pythia LLM family as in (Chang et al., 2024). The results of LLM + Top-p, Temperature + NA, DoLa + α\alpha, and CD T=1 + α\alpha are copied from (Chang et al., 2024).

我们使用验证集,从候选集合 \{0.2,0.4,0.6,0.8,1.0,1.2\} 中调节超参数 \lambda_{3}。
按照 Chang 等(2024),OPT 的 REAL 采样模型使用 Pythia 大语言模型家族训练。
LLM + Top-p、Temperature + NA、DoLa + \alpha 和 CD T=1 + \alpha 的结果复制自 Chang 等(2024)。

E.2 APD on the Fly Baseline

E.2 APD on the fly 基线

The APD on the fly baseline simplifies the proposed APD by conducting extrapolation and estimating the asymptotic probabilities during the inference time. While we skip the step of fine-tuning ALM’, the baseline is much more time-consuming because it needs to run the inference of all NN LMs to get {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} during the testing time.

“APD on the fly” 基线通过在推理时执行外推并估计渐近概率,对所提出的 APD 进行简化。
虽然跳过了微调 ALM′ 的步骤,但该基线耗时更多,因为测试时需要运行全部 N 个语言模型的推理,取得 \{p(w|c,\theta_{s_{i}})\}_{i=1}^{N}。

The baseline tries to use the same loss function of APD except that the regularization term is not applicable because it does not fine-tune ALM’. It first reverses the increasing {p⁡(w|c,θsi)}i=1N\{p(w|c,\theta_{s_{i}})\}_{i=1}^{N} using Equation 6 and estimates the asymptotic probability (AP), aw,ca_{w,c}, bw,cb_{w,c}, and dw,cd_{w,c} in Equation 7 using a simple gradient descent. We set λ2=10\lambda_{2}=10 and λ3=0\lambda_{3}=0 in Equation 12. The optimization is done by Adam (Kingma and Ba, 2015) using 400 iterations and the initial learning rate 1e-2. Every parameter is clamped to 0 if its value is negative. If we encounter nan after the optimization, we divide the learning rate by 2 and redo the optimization until the nan problem is solved.

该基线尝试使用与 APD 相同的损失函数,但由于它不微调 ALM′,正则项不适用。
它先用式(6)翻转随模型规模上升的 \{p(w|c,\theta_{s_{i}})\}_{i=1}^{N},再使用简单的梯度下降,估计式(7)中的渐近概率(AP)以及 a_{w,c}、b_{w,c}、d_{w,c}。
我们在式(12)中设置 \lambda_{2}=10、\lambda_{3}=0。
优化使用 Adam(Kingma 和 Ba,2015),迭代 400 次,初始学习率为 1e-2。
任何参数若为负值,都会被截断为 0。
如果优化后出现 NaN,我们将学习率减半并重新优化,直至解决 NaN 问题。

After the optimization, we flip back the asymptotic probability if necessary, normalize the probability of the top 20 tokens as pw,ca​cp^{ac}_{w,c} and output (1−1/T)​p​(w|c,θsN)+1/T⋅pw,ca​c(1-1/T)p(w|c,\theta_{s_{N}})+1/T\cdot p^{ac}_{w,c} using the best global weight 1/T1/T in {0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.8, 1.0}.

优化完成后,我们在必要时把渐近概率翻转回来,将前 20 个词的概率归一化为 p^{ac}_{w,c},并输出 (1-1/T)p(w|c,\theta_{s_{N}})+1/T\cdot p^{ac}_{w,c};全局权重 1/T 从 \{0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.8, 1.0\} 中选择最佳值。

E.3 QA Experiment Details

E.3 问答实验细节

Our method is unsupervised, so we can choose any subset of the datasets. We choose to use SQuAD validation set and the training set of all the other datasets because training datasets are usually larger and the validation set of SQuAD is large enough. To simplify our experiments, we compute the performances of CD and APD using different 1/T1/T values and directly report the best performance. 1/T1/T is chosen from the following options: {0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0}.

我们的方法是无监督的,因此可以选择这些数据集的任意子集。
我们选择 SQuAD 验证集和其他所有数据集的训练集,因为训练集通常更大,而 SQuAD 验证集已经足够大。
为简化实验,我们计算 CD 与 APD 在不同 1/T 取值下的表现,并直接报告最佳表现。
1/T 从以下候选值中选择:\{0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0\}。

Before computing the perplexity, we renormalize the probabilities of the top 2020 tokens for all the methods. All probabilities are added by 0.010.01 to prevent few extreme low probabilities influence the probability too much. When measuring accuracy, we make sure that all tokens of the correct answer and all tokens of at least one incorrect answer are within the top 20 token of ELM, and filter out the questions that do not have such the answers. After filtering, the sizes of CommonsenseQA, QASC (Q+Fact), QASC (Q only), ARC, and SocialIQA are 911911, 11381138, 956956, 899899, and 879879 for Pythia, and 491491, 982982, 845845, 780780, and 549549 for OPT.

计算困惑度之前,我们对所有方法的前 20 个词概率重新归一化。
所有概率均加上 0.01,以免少数极低概率对结果产生过大影响。
测量准确率时,我们确保正确答案的所有词以及至少一个错误答案的所有词都位于 ELM 的前 20 个词中,并过滤不满足此条件的问题。
过滤后,对于 Pythia,CommonsenseQA、QASC(Q+Fact)、QASC(Q only)、ARC 和 SocialIQA 的样本量分别为 911、1138、956、899 和 879;对于 OPT,分别为 491、982、845、780 和 549。

In Table 2, we use two-sample t-test on the negative log likelihoods of every answer to check the statistical significance. To run LLM 12/13B, we reduce the weight precision to fp16 during inference time in the QA experiments.

在表 2 中,我们对每个答案的负对数似然进行双样本 t 检验,以检查统计显著性。
在问答实验中运行 LLM 12/13B 时,我们在推理期间将权重精度降低至 fp16。

E.4 One-shot Prompt Templates

E.4 单样本提示模板

Template for ARC, CommonsenseQA, and QASC (Q only): {myprop} Question: Which kind of animals can fly?
Answer: bird.

Question: {Question}
Answer:

ARC、CommonsenseQA 与 QASC(仅问题)模板:{myprop} 问题:哪种动物会飞?
答案:鸟。
问题:{Question} 答案:

Template for QASC (Q+Facts): {myprop} Question: Which kind of animals can fly?
Fact 1: a bird is an animal.
Fact 2: birds can fly.
Answer: bird.

Question: {Question}
Fact 1: {Fact 1}
Fact 2: {Fact 2}
Answer:

QASC(问题+事实)模板:{myprop} 问题:哪种动物会飞?
事实 1:鸟是一种动物。
事实 2:鸟会飞。
答案:鸟。
问题:{Question} 事实 1:{Fact 1} 事实 2:{Fact 2} 答案:

Template for SocialIQA: {myprop} Passage: John likes to go hiking, and his wife likes to cook.
Question: Who likes to cook?
Answer: his wife

Passage: {Passage}
Question: {Question}
Answer:

SocialIQA 模板:{myprop} 段落:John 喜欢徒步,他的妻子喜欢烹饪。
问题:谁喜欢烹饪?
答案:他的妻子 段落:{Passage} 问题:{Question} 答案:

Template for MultiRC: {myprop} Passage: Sent 1: John likes to go hiking, and his wife likes to cook.
Sent 2: His wife likes to cook.
Here is a question: Who likes to cook?
The answer is his wife

Passage: {Passage}
Here is a question: {Question}
The answer is

MultiRC 模板:{myprop} 段落:句子 1:John 喜欢徒步,他的妻子喜欢烹饪。
句子 2:他的妻子喜欢烹饪。
这里有一个问题:谁喜欢烹饪?
答案是他的妻子 段落:{Passage} 这里有一个问题:{Question} 答案是

Template for SQuAD (Q+P): {myprop} Passage: John likes to go hiking, and his wife likes to cook.
Question: Who likes to cook?
The answer is his wife

Passage: {Passage}
Question: {Question}
The answer is

SQuAD(问题+段落)模板:{myprop} 段落:John 喜欢徒步,他的妻子喜欢烹饪。
问题:谁喜欢烹饪?
答案是他的妻子 段落:{Passage} 问题:{Question} 答案是

Template for SQuAD (Q only): {myprop} Here is a question: What is the birthplace of Barack Obama?
The answer is Honolulu, Hawaii.

Here is a question: {Question}
The answer is

SQuAD(仅问题)模板:{myprop} 这里有一个问题:Barack Obama 的出生地是哪里?
答案是 Honolulu, Hawaii。
这里有一个问题:{Question} 答案是

译注与阅读提示

以下说明不属于论文原文。

  1. 定理 1 以业余模型温度 T>1 为条件;局限部分出现“理论不覆盖 T larger than 1”的原文表述,与此前条件表面冲突。本页保留两处原文,不擅自改写结论。
  2. 损失 L2 的印刷公式没有显式平方项,而邻近文字称其为均方误差。本页保留公式,并把该差异视为需要作者代码或勘误确认的问题。
  3. 问答困惑度实验过滤掉正确答案未进入 ELM 前 20 的样本,因此这里的结果不能直接理解为完整词表、未筛选数据上的困惑度。
  4. 原 HTML 在若干图号与 “Agg.” 缩写处错误拆句。本页把这些版面片段合并为一个中英对照单元,并在相应中文后标注。
  5. 文中偶见 APD/ADP 字母顺序不一致;译文按上下文保留 APD,并不把印刷差异当作新方法。
  6. 影响声明中的医疗、法律和高风险示例是作者对潜在用途的讨论,不构成安全部署验证。
  7. 本页完成原文结构与译文覆盖审核,但不表示已经独立复现所有实验或核验全部被引文献。

术语对照

contrastive decoding · 对比解码
expert language model · 专家语言模型
amateur language model · 业余语言模型
logit extrapolation · logit 外推
asymptotic probability · 渐近概率
obvious blindness · 显然答案盲区
decay curve · 衰减曲线
FactualityPrompts · 事实性提示基准
named-entity error ratio · 命名实体错误率
entailment ratio · 蕴含率
perplexity · 困惑度
mean reciprocal rank · 平均倒数排名
论文原图放大