通过使用Rollout算法为$n$-Gram、Transformers、HMMs和Markov Chains生成最可能的序列
Most Likely Sequence Generation for $n$-Grams, Transformers, HMMs, and Markov Chains, by Using Rollout Algorithms
AI总结:
针对transformer等模型中最优词序列计算棘手的问题,提出基于近似动态规划rollout算法的方法,在多项式时间内生成高可能性序列,适用于Markov chains和HMM推理。
摘要:
在本文中,我们考虑具有$n$-gram结构的transformer,例如ChatGPT底层的模型。该transformer提供下一个词的概率,可用于生成词序列。我们考虑基于这些概率计算高可能性的词序列的方法。计算从给定初始状态开始的最优(即最可能)词序列是一个棘手的问题,因此我们提出了一些方法,能够在与$N$和$n$-gram词汇表大小呈低阶多项式关系的时间内计算出$N$个词的高可能性序列。这些方法基于近似动态规划中的rollout方法,这是一种单策略迭代形式,能够提升任何给定启发式策略的性能。在我们的场景中,我们使用贪婪启发式策略,即生成概率最高的词作为下一个词。我们通过分析、示例和计算实验表明,我们的方法能够生成高可能性的序列,且相比贪婪启发式策略仅适度增加了计算量。虽然我们的分析和实验集中于transformer和类ChatGPT模型中出现的Markov chains类型,但我们的方法适用于一般有限状态Markov chains,以及广泛使用Viterbi解码的隐马尔可夫模型(HMM)的相关推理应用。
英文摘要:
In this paper we consider a transformer with an $n$-gram structure, such as the one underlying ChatGPT. The transformer provides next word probabilities, which can be used to generate word sequences. We consider methods for computing word sequences that are highly likely, based on these probabilities. Computing the optimal (i.e., most likely) word sequence starting with a given initial state is an intractable problem, so we propose methods to compute highly likely sequences of $N$ words in time that is a low order polynomial in $N$ and in the vocabulary size of the $n$-gram. These methods are based on the rollout approach from approximate dynamic programming, a form of single policy iteration, which can improve the performance of any given heuristic policy. In our case we use a greedy heuristic that generates as next word one that has the highest probability. We show with analysis, examples, and computational experimentation that our methods are capable of generating highly likely sequences with a modest increase in computation over the greedy heuristic. While our analysis and experiments are focused on Markov chains of the type arising in transformer and ChatGPT-like models, our methods apply to general finite-state Markov chains, and related inference applications of Hidden Markov Models (HMM), where Viterbi decoding is used extensively.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。