arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.14160cs.LGcs.AI
收藏

递归推测解码:通过无放回采样加速大语言模型推理

Recursive Speculative Decoding: Accelerating LLM Inference via Sampling Without Replacement

Qualcomm AI Research(高通人工智能研究部门)

Wonseok Jeon, Mukul Gagrani, Raghavv Goel, Junyoung Park, Mingu Lee, Christopher Lott

AI总结:

针对现有基于树的推测解码未充分利用树多样性、缺乏固定计算预算下实证研究的问题,提出递归推测解码方法,通过无放回采样最大化草稿令牌树多样性,在Llama 2和OPT模型上验证了更优的推理加速效果。

摘要:

推测解码是一种大语言模型(LLM)推理加速方法,由小型语言模型生成草稿令牌序列,再由目标大语言模型并行验证。近期研究通过构建草稿令牌树改进了该方法,性能优于单序列推测解码。但这些工作在树的每一层独立生成令牌,未利用树的全部多样性。此外,它们仅在固定序列长度下验证了经验优势,这相当于隐性地为基于树的方法分配了更多大语言模型计算资源。尽管固定目标计算预算对资源受限设备至关重要,但现有研究均未在此条件下开展实证研究。我们提出递归推测解码(RSD),这是一种新型基于树的方法,采用无放回采样生成草稿令牌,最大化树的多样性。在RSD的草稿生成阶段,树的构建可通过两种方式实现:一是Gumbel-Top-$k$技巧,并行无放回采样令牌;二是随机波束搜索,无放回采样序列的同时提前截断可能性低的草稿序列,降低大语言模型的计算成本。我们使用Llama 2和OPT模型对RSD进行了实证评估,结果表明RSD优于基线方法,在固定草稿序列长度下表现一致,在固定大语言模型计算预算的多数场景下也更具优势。

英文摘要:

Speculative decoding is an inference-acceleration method for large language models (LLMs) where a small language model generates a draft-token sequence which is further verified by the target LLM in parallel. Recent works have advanced this method by establishing a draft-token tree, achieving superior performance over a single-sequence speculative decoding. However, those works independently generate tokens at each level of the tree, not leveraging the tree's entire diversifiability. Besides, their empirical superiority has been shown for fixed length of sequences, implicitly granting more computational resource to LLM for the tree-based methods. None of the existing works has conducted empirical studies with fixed target computational budgets despite its importance to resource-bounded devices. We present Recursive Speculative Decoding (RSD), a novel tree-based method that samples draft tokens without replacement and maximizes the diversity of the tree. During RSD's drafting, the tree is built by either Gumbel-Top-$k$ trick that draws tokens without replacement in parallel or Stochastic Beam Search that samples sequences without replacement while early-truncating unlikely draft sequences and reducing the computational cost of LLM. We empirically evaluate RSD with Llama 2 and OPT models, showing that RSD outperforms the baseline methods, consistently for fixed draft sequence length and in most cases for fixed computational budgets at LLM.

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

↑