arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2311.13581cs.CL
收藏

PaSS:并行投机采样

PaSS: Parallel Speculative Sampling

EPFL(洛桑联邦理工学院);Apple(苹果公司)

Giovanni Monea, Armand Joulin, Edouard Grave

AI总结:

针对大规模语言模型自回归生成的内存瓶颈及传统投机采样需双模型的限制,提出 PaSS 方法,利用单模型并行解码起草多 token,实现最高 $30\%$ 加速且仅需 $O(d_{emb})$ 额外参数。

摘要:

将语言模型规模扩展至数百亿参数,在广泛任务上带来了令人印象深刻的性能。在生成时,这些模型以自回归方式使用,每个生成的 token 需要一次前向传递,从而从内存读取全部参数。这种内存访问构成生成的主要瓶颈,且随模型规模增加而恶化。此外,并行执行多个 token 的前向传递通常与仅一个 token 耗时几乎相同。这两点观察促成了投机采样的开发:用第二个较小模型起草若干 token,再用大模型的单次前向传递验证或拒绝。不幸的是,该方法需要两个共享同一 tokenizer 的模型,从而限制其采用。作为替代,我们提出使用并行解码,从单一模型起草多个 token,无额外计算成本,亦无需第二个模型。我们的方法仅需一个额外的输入 token,标记将同时生成的词。我们展示了有前景的性能(加速达 $30\%$),且仅需少至 $O(d_{emb})$ 的额外参数。

英文摘要:

Scaling the size of language models to tens of billions of parameters has led to impressive performance on a wide range of tasks. At generation, these models are used auto-regressively, requiring a forward pass for each generated token, and thus reading the full set of parameters from memory. This memory access forms the primary bottleneck for generation and it worsens as the model size increases. Moreover, executing a forward pass for multiple tokens in parallel often takes nearly the same time as it does for just one token. These two observations lead to the development of speculative sampling, where a second smaller model is used to draft a few tokens, that are then validated or rejected using a single forward pass of the large model. Unfortunately, this method requires two models that share the same tokenizer and thus limits its adoption. As an alternative, we propose to use parallel decoding as a way to draft multiple tokens from a single model with no computational cost, nor the need for a second model. Our approach only requires an additional input token that marks the words that will be generated simultaneously. We show promising performance (up to $30\%$ speed-up) while requiring only as few as $O(d_{emb})$ additional parameters.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑