第10章現代のリカレントニューラルネットワーク
10.8.1. Greedy Search10.8.1 貪欲探索
Consider the simple greedy search strategy from Section 10.7. Here, at any time step , we simply select the token with the highest conditional probability from , i.e.,
英語のヒント
10.7節の単純な貪欲探索の戦略を考えよう。ここでは、任意の時間ステップで、から条件付き確率が最も高いトークンを単に選ぶ。つまり、次のとおりである。
(10.8.1)
Once our model outputs “<eos>” (or we reach the maximum length ) the output sequence is completed.
英語のヒント
モデルが「<eos>」を出力するか、最大の長さに達すると、出力系列は完成する。
This strategy might look reasonable, and in fact it is not so bad! Considering how computationally undemanding it is, you’d be hard pressed to get more bang for your buck. However, if we put aside efficiency for a minute, it might seem more reasonable to search for the most likely sequence, not the sequence of (greedily selected) most likely tokens. It turns out that these two objects can be quite different. The most likely sequence is the one that maximizes the expression . In our machine translation example, if the decoder truly recovered the probabilities of the underlying generative process, then this would give us the most likely translation. Unfortunately, there is no guarantee that greedy search will give us this sequence.
英語のヒント
この戦略は理にかなって見えるかもしれず、実際それほど悪くはない!計算の負荷がいかに小さいかを考えれば、これ以上の費用対効果を得るのは難しいだろう。しかし、効率をしばらく脇に置けば、(貪欲に選んだ)最もありそうなトークンの系列ではなく、最もありそうな系列を探すほうが、もっと理にかなっているように思えるかもしれない。この二つは、かなり違いうることがわかる。最もありそうな系列とは、式を最大にするものである。機械翻訳の例では、デコーダがもとの生成過程の確率を本当に再現していれば、これが最もありそうな翻訳を与えるだろう。残念ながら、貪欲探索がこの系列を与えてくれる保証はない。
Let’s illustrate it with an example. Suppose that there are four tokens “A”, “B”, “C”, and “<eos>” in the output dictionary. In Fig. 10.8.1, the four numbers under each time step represent the conditional probabilities of generating “A”, “B”, “C”, and “<eos>” respectively, at that time step.
英語のヒント
例で示そう。出力の辞書に四つのトークン「A」「B」「C」「<eos>」があるとする。図10.8.1では、各時間ステップの下の四つの数は、その時間ステップでそれぞれ「A」「B」「C」「<eos>」を生成する条件付き確率を表す。
Fig. 10.8.1図10.8.1
At each time step, greedy search selects the token with the highest conditional probability.
英語のヒント
各時間ステップで、貪欲探索は条件付き確率が最も高いトークンを選ぶ。
At each time step, greedy search selects the token with the highest conditional probability. Therefore, the output sequence “A”, “B”, “C”, and “<eos>” will be predicted (Fig. 10.8.1). The conditional probability of this output sequence is .
英語のヒント
各時間ステップで、貪欲探索は条件付き確率が最も高いトークンを選ぶ。したがって、出力系列「A」「B」「C」「<eos>」が予測される(図10.8.1)。この出力系列の条件付き確率はである。
Next, let’s look at another example in Fig. 10.8.2. Unlike in Fig. 10.8.1, at time step 2 we select the token “C”, which has the second highest conditional probability.
英語のヒント
Fig. 10.8.2図10.8.2
The four numbers under each time step represent the conditional probabilities of generating “A”, “B”, “C”, and “<eos>” at that time step. At time step 2, the token “C”, which has the second highest conditional probability, is selected.
英語のヒント
各時間ステップの下の四つの数は、その時間ステップで「A」「B」「C」「<eos>」を生成する条件付き確率を表す。時間ステップ2では、条件付き確率が2番目に高いトークン「C」が選ばれる。
Since the output subsequences at time steps 1 and 2, on which time step 3 is based, have changed from “A” and “B” in Fig. 10.8.1 to “A” and “C” in Fig. 10.8.2, the conditional probability of each token at time step 3 has also changed in Fig. 10.8.2. Suppose that we choose the token “B” at time step 3. Now time step 4 is conditional on the output subsequence at the first three time steps “A”, “C”, and “B”, which has changed from “A”, “B”, and “C” in Fig. 10.8.1. Therefore, the conditional probability of generating each token at time step 4 in Fig. 10.8.2 is also different from that in Fig. 10.8.1. As a result, the conditional probability of the output sequence “A”, “C”, “B”, and “<eos>” in Fig. 10.8.2 is , which is greater than that of greedy search in Fig. 10.8.1. In this example, the output sequence “A”, “B”, “C”, and “<eos>” obtained by the greedy search is not optimal.
英語のヒント
時間ステップ3のもととなる時間ステップ1と2の出力の部分系列が、図10.8.1の「A」と「B」から図10.8.2の「A」と「C」に変わったので、図10.8.2の時間ステップ3での各トークンの条件付き確率も変わった。時間ステップ3でトークン「B」を選ぶとしよう。すると、時間ステップ4は、最初の三つの時間ステップの出力の部分系列「A」「C」「B」を条件とし、これは図10.8.1の「A」「B」「C」から変わっている。したがって、図10.8.2の時間ステップ4で各トークンを生成する条件付き確率も、図10.8.1のものとは異なる。その結果、図10.8.2の出力系列「A」「C」「B」「<eos>」の条件付き確率はであり、これは図10.8.1の貪欲探索のものより大きい。この例では、貪欲探索で得られた出力系列「A」「B」「C」「<eos>」は最適ではない。