プリンキピア

第10章現代のリカレントニューラルネットワーク

10.8. Beam Search10.8 ビームサーチ

In Section 10.7, we introduced the encoder–decoder architecture, and the standard techniques for training them end-to-end. However, when it came to test-time prediction, we mentioned only the greedy strategy, where we select at each time step the token given the highest predicted probability of coming next, until, at some time step, we find that we have predicted the special end-of-sequence “<eos>” token. In this section, we will begin by formalizing this greedy search strategy and identifying some problems that practitioners tend to run into. Subsequently, we compare this strategy with two alternatives: exhaustive search (illustrative but not practical) and beam search (the standard method in practice).
英語のヒント
10.7節では、エンコーダ・デコーダ構造と、それをエンドツーエンドで訓練する標準的な手法を紹介した。しかし、テスト時の予測については、貪欲な戦略だけを述べた。そこでは、各時間ステップで次に来る予測確率が最も高いトークンを選び、ある時間ステップで特別な系列の終わりを表す「<eos>」トークンを予測したとわかるまで続ける。この節では、まずこの貪欲探索の戦略を定式化し、実践者がぶつかりがちないくつかの問題を明らかにする。続いて、この戦略を二つの代わりのものと比べる。全探索(説明には役立つが実用的でない)とビームサーチ(実際の標準的な方法)である。
Let’s begin by setting up our mathematical notation, borrowing conventions from Section 10.7. At any time step t′, the decoder outputs predictions representing the probability of each token in the vocabulary coming next in the sequence (the likely value of yt′+1), conditioned on the previous tokens y1,…,yt′ and the context variable 𝐜, produced by the encoder to represent the input sequence. To quantify computational cost, denote by 𝒴 the output vocabulary (including the special end-of-sequence token “<eos>”). Let’s also specify the maximum number of tokens of an output sequence as T′. Our goal is to search for an ideal output from all 𝒪(|𝒴|T′) possible output sequences. Note that this slightly overestimates the number of distinct outputs because there are no subsequent tokens once the “<eos>” token occurs. However, for our purposes, this number roughly captures the size of the search space.
英語のヒント
まず、10.7節の慣習を借りて、数学的な表記を整えよう。任意の時間ステップt′で、デコーダは、それまでのトークンy1,…,yt′と、入力系列を表すためにエンコーダが生み出した文脈変数𝐜を条件として、語彙の各トークンが系列の次に来る確率(yt′+1のありそうな値)を表す予測を出力する。計算の費用を定量化するため、出力の語彙(特別な系列の終わりを表すトークン「<eos>」を含む)を𝒴と表す。また、出力系列のトークンの最大数をT′と指定しよう。目標は、ありうるすべての𝒪(|𝒴|T′)個の出力系列から理想的な出力を探すことである。いったん「<eos>」トークンが現れると後に続くトークンはないので、これは異なる出力の数を少し多めに見積もっていることに注意してほしい。しかし、ここでの目的には、この数は探索空間の大きさをおおよそとらえている。