注意機構 のNormalizeの部分がSoftmaxではなく「Softmaxの結果からサンプリングしてone-hot表現を返す関数」になってるもの。

  • 微分できなくなるというとても大きなデメリットがあるが、どういうメリットがあるのだろう?

  • Valuesの空間がベクトル空間でない場合に応用できる

    • ソフト注意をするためにはValuesの空間はスカラー倍と加算ができなければならない
    • 例えばシンボルの空間はベクトル空間ではない
    • 「Softmaxの結果からサンプリングしてone-hot表現を返す関数」
      • one-hot表現xについて
    • 単語を出力する系のNNで|V|のベクトルからサンプリングしてるのハード注意機構だと解釈できる
      • 単語がValueで単語のone-hot表現がKey
      • 単語が分散表現になっている場合はもっとわかりやすい。内積とってSoftmaxしてそこからサンプリング=ハード注意

https://jhui.github.io/2017/03/15/Soft-and-hard-attention/

Hard attention replaces a deterministic method with a stochastic sampling model. To calculate the gradient descent correctly in the backpropagation, we perform samplings and average our results using the Monte Carlo method. Monte Carlo performs end-to-end episodes to compute an average for all sampling results. The accuracy is subject to how many samplings are performed and how well it is sampled. On the other hand, soft attention follows the regular and easier backpropagation method to compute the gradient. However, the accuracy is subject to the assumption that the weighted average is a good representation for the area of attention. Both have their shortcomings. Currently, soft attention is more popular.