プリンキピア

第11章注意機構とTransformer

11.3.6. Exercises11.3.6 練習問題

  1. Implement distance-based attention by modifying the DotProductAttention code. Note that you only need the squared norms of the keys ∥𝐤i∥2 for an efficient implementation.
    英語のヒント
    DotProductAttentionのコードを変えて、距離にもとづく注意を実装せよ。効率的な実装には、キーの2乗ノルム∥𝐤i∥2だけが必要であることに注意せよ。
  2. Modify the dot product attention to allow for queries and keys of different dimensionalities by employing a matrix to adjust dimensions.
    英語のヒント
    次元を合わせる行列を使って、クエリとキーの次元が異なっても扱えるように内積注意を変えよ。
  3. How does the computational cost scale with the dimensionality of the keys, queries, values, and their number? What about the memory bandwidth requirements?
    英語のヒント
    計算の費用は、キー、クエリ、バリューの次元とその数に応じてどう増えるか。メモリ帯域幅の要件はどうか。