プリンキピア

第12章最適化アルゴリズム

12.7.1. Sparse Features and Learning Rates12.7.1 疎な特徴と学習率

Imagine that we are training a language model. To get good accuracy we typically want to decrease the learning rate as we keep on training, usually at a rate of 𝒪(t−12) or slower. Now consider a model training on sparse features, i.e., features that occur only infrequently. This is common for natural language, e.g., it is a lot less likely that we will see the word preconditioning than learning. However, it is also common in other areas such as computational advertising and personalized collaborative filtering. After all, there are many things that are of interest only for a small number of people.
英語のヒント
言語モデルを訓練しているところを想像してほしい。よい正解率を得るには、ふつう、訓練を続けるにつれて学習率を下げたい。たいていは𝒪(t−12)かそれより遅い速さで下げる。ここで、疎な特徴、つまりまれにしか現れない特徴で訓練するモデルを考えよう。これは自然言語ではよくあることで、たとえば、preconditioning(前条件づけ)という語はlearning(学習)という語よりずっと見かけにくい。しかし、計算広告や個人に合わせた協調フィルタリングのようなほかの分野でもよくある。結局のところ、少数の人にしか関心のないものはたくさんある。
Parameters associated with infrequent features only receive meaningful updates whenever these features occur. Given a decreasing learning rate we might end up in a situation where the parameters for common features converge rather quickly to their optimal values, whereas for infrequent features we are still short of observing them sufficiently frequently before their optimal values can be determined. In other words, the learning rate either decreases too slowly for frequent features or too quickly for infrequent ones.
英語のヒント
まれな特徴に結びついたパラメータは、それらの特徴が現れるときにしか意味のある更新を受けない。学習率が下がっていくと、よくある特徴のパラメータはかなり速く最適な値に収束するのに、まれな特徴については、最適な値が決まる前に十分な頻度で観察するに至らない、という状況に陥るかもしれない。言い換えると、学習率は、頻繁な特徴には下がるのが遅すぎるか、まれな特徴には速すぎるかのどちらかになる。
A possible hack to redress this issue would be to count the number of times we see a particular feature and to use this as a clock for adjusting learning rates. That is, rather than choosing a learning rate of the form η=η0t+c we could use ηi=η0s(i,t)+c. Here s(i,t) counts the number of nonzeros for feature i that we have observed up to time t. This is actually quite easy to implement at no meaningful overhead. However, it fails whenever we do not quite have sparsity but rather just data where the gradients are often very small and only rarely large. After all, it is unclear where one would draw the line between something that qualifies as an observed feature or not.
英語のヒント
この問題を正すありうる小技は、特定の特徴を見た回数を数え、それを学習率を調整するための時計として使うことだろう。つまり、η=η0t+cという形の学習率を選ぶ代わりに、ηi=η0s(i,t)+cを使える。ここでs(i,t)は、時刻tまでに観察した特徴iの非ゼロの数を数える。これは実際、意味のあるオーバーヘッドなしにとても簡単に実装できる。しかし、疎とまでは言えず、勾配がしばしばとても小さく、まれにしか大きくならないようなデータの場合には、これはうまくいかない。結局のところ、観察された特徴とみなせるものとそうでないものとのあいだに、どこで線を引くかがはっきりしない。
Adagrad by Duchi et al. (2011) addresses this by replacing the rather crude counter s(i,t) by an aggregate of the squares of previously observed gradients. In particular, it uses s(i,t+1)=s(i,t)+(∂if(𝐱))2 as a means to adjust the learning rate. This has two benefits: first, we no longer need to decide just when a gradient is large enough. Second, it scales automatically with the magnitude of the gradients. Coordinates that routinely correspond to large gradients are scaled down significantly, whereas others with small gradients receive a much more gentle treatment. In practice this leads to a very effective optimization procedure for computational advertising and related problems. But this hides some of the additional benefits inherent in Adagrad that are best understood in the context of preconditioning.
英語のヒント
Duchi et al. (2011)のAdagradは、かなり粗いカウンターs(i,t)を、以前に観察した勾配の2乗を集めたものに置き換えることで、これに対処する。特に、学習率を調整する手段としてs(i,t+1)=s(i,t)+(∂if(𝐱))2を使う。これには二つの利点がある。第一に、勾配が十分大きいのはいつかをもはや決める必要がない。第二に、勾配の大きさに応じて自動的にスケールする。決まって大きな勾配に対応する座標は大きくスケールダウンされ、勾配が小さいほかの座標はずっと穏やかに扱われる。実際には、これは計算広告やそれに関連する問題にとても効果的な最適化の手続きにつながる。しかし、これは、前条件づけの文脈で最もよく理解できる、Adagradに本来備わったほかの利点のいくつかを隠している。