モジュラー多様体
ジェレミー・バーンスタインによる記事で、数学の幾何学と数論の分野におけるモジュラー多様体の概念について解説しています。
キーポイント
ニューラルネットワークの重み行列を正規化する手法としてモジュラーマニフォールドを提案
重み行列の正規化により学習アルゴリズムの設計が容易になり、ネットワークの安定性が向上
Stiefel多様体に制約をかけたMuonオプティマイザの改良版を例示
大規模ニューラルネットワークの学習における数値的安定性問題への新たなアプローチ
影響分析・編集コメントを表示
影響分析
この記事は大規模ニューラルネットワークの学習安定性という根本的な課題に対して、重み行列の多様体制約という数学的アプローチを提案している。研究段階の概念ではあるが、実装されれば学習アルゴリズムの設計簡素化やハイパーパラメータチューニングの効率化に寄与する可能性がある。
編集コメント
基礎研究として興味深いが、実用化にはさらなる検証が必要。重み行列の正規化が実際の大規模学習でどの程度効果を発揮するかが今後の焦点。
モジュラーマニフォールド:ニューラルネットワークの重み行列を制約する新たなアプローチ
大規模ニューラルネットワークの訓練においては、ネットワーク内のテンソル(重み、活性化、勾配)が大きすぎたり小さすぎたりしないよう、健全な状態を保つ必要がある。テンソルのサイズが極端になると、数値的アンダーフローやオーバーフローに限らず、様々な問題を引き起こす。例えば、重み行列のサイズが訓練中に変化すると、重み更新の相対的な大きさが学習速度に大きく影響するため、訓練アルゴリズムの設計が難しくなる。
テンソルを健全に保つための標準的な手法は正規化である。活性化ベクトルに対しては、レイヤーノームなどの技術を用いて、次の層に渡す前に適切なスケールに調整することが一般的だ。また、勾配更新の正規化も広く行われており、Muonオプティマイザのような高速な訓練アルゴリズムは、更新をスペクトル正規化していると解釈できる。正規化は、ネットワーク内部のテンソルサイズについて確実性をもたらし、多くの相互作用するコンポーネントからなる大規模ネットワークの訓練においては、この確実性が非常に価値がある。
一方、重み行列への正規化は、全く聞かないわけではないが、より稀である。例えば、EDM2拡散モデルのコードベースでは重み制約が用いられ、論文ではその利点が報告されている。また、BiTでは重み標準化が採用されている。他にも様々な手法が提案されてはいるが、現代の大規模訓練では一般的な慣行にはなっていない。重み行列を正規化することには、いくつかの利点が考えられる。重み制約は、最適化更新の相対的なサイズを理解しやすくし、重みノルムが爆発する問題を除去する。また、サイズが最も重要なテンソルにハイパーパラメータ調整の努力を集中させることができ、条件数を小さく保つことで行列の挙動をより予測可能にする。関連して、摂動に対するロバスト性のためのリプシッツ保証を容易にする。
本記事では、ニューラルネットワークの重み行列を制約する一つの魅力的な方法として、各層でテンソルを部分多様体上に制限するアプローチを紹介する。これにより、多様体制約と最適化アルゴリズムを共同設計するという、最適化の考え方そのものを再構築する道が開ける。具体例として、重みが単位条件数を持つ行列の多様体であるシュティーフェル多様体に制約された、Muonオプティマイザの多様体版を提案する。最後に、モジュラーマニフォールドの概念を定義する。これは、大規模ネットワークのスケールアップと訓練を容易にすることを目指した、構成可能な多様体である。
要約すると、重み行列を多様体に制約することは、ネットワークの挙動をより予測可能かつ安定させ、最適化プロセスを改善する有望な研究領域である。このアプローチは、大規模ニューラルネットワークの訓練の信頼性
原文を表示
Modular Manifolds - Thinking Machines Lab Modular Manifolds
When we train large neural networks, we need to keep them healthy. We do not want the tensors in the network—either the weights, activations or gradients—to grow too large or too small. Very small and very large tensors cause a variety of problems not just limited to numerical underflow and overflow. For example, weight matrices changing size during training makes it harder to design training algorithms—since the relative size of updates to weights has a significant impact on the speed of learning.
The gold standard for keeping tensors healthy is to normalize them. Normalization is commonplace for activation vectors, where we use techniques like layer norm to put the activations on a good scale before passing them to the next layer. It is also commonplace to normalize gradient updates, where we can interpret fast training algorithms like the Muon optimizer as spectrally normalizing the updates. Normalization provides us with certainty about the sizes of tensors—without needing to check Wandb!—and when training large neural networks with many interacting components, having certainty about the network internals is valuable.
Normalization is less commonly applied to weight matrices, although it is not unheard of. For example, the EDM2 diffusion model codebase uses weight constraints and the authors report benefits in their paper. And BiT uses weight standardization. Various other techniques have been proposed but are not common practice in modern large-scale training.For some more examples, see Salimans et al, 2016, Miyato et al, 2018 and our paper Liu et al, 2021. Normalizing the weight matrices might be a good idea for a few reasons. Weight constraints make understanding the relative size of optimization updates easier. They remove the problem of weight norms exploding. They allow us to focus hyperparameter tuning effort on tensors whose size matters most. They can force matrices to have a small condition number, making their behaviour more predictable. And relatedly, weight constraints facilitate Lipschitz guarantees for robustness to perturbations.
This post covers one appealing way to constrain the weight matrices of a neural network—by keeping the tensors constrained to submanifolds at each layer. This opens the door to re-thinking optimization, as we can co-design optimization algorithms with these manifold constraints. As an example, we proposeThis algorithm builds on work from Jianlin Su and Franz Louis Cesista, as discussed further below. a manifold version of the Muon optimizer whose weights are constrained to the Stiefel manifold: the manifold of matrices with unit condition number. We conclude the post by defining the idea of a modular manifold, which is a composable manifold that attempts to make it easier to scale up and train large networks.
Our goal in writing this post is to provide an introduction to a research area that we are excited about, and highlight many directions for future work. We would love to see more work from the community on the topics mentioned at the end of the post!
The shape of a manifold optimizer
This section works through the simplest example of learning on a manifold: a vector parameter constrained to a hypersphere in $\mathbb{R}^d$. The vector parameter is trained to minimize a loss function defined over the full space $\mathbb{R}^d$. This setup might be useful for, say, individual embedding vectors in a transformer model. This section will be a good warmup for the following section on manifold Muon that considers matrix parameters.
We will not be too formal about the definition of a manifold here: it is enough to understand that a manifold is a curved surface that looks flat when you zoom in close enough. The locally flat approximation at a point on the manifold is called the tangent space to the manifold, as visualized in Figure :
We can characterize the hypersphere in $d$ dimensions as the set of points $w \in \mathbb{R}^d$ of unit Euclidean norm. And the tangent space at a point $w$ on the hypersphere is the set of all vectors $a \in \mathbb{R}^d$ that are orthogonal to $w$.
To keep the weights constrained to the manifold, we could use a non-manifold optimizer and just project the weights back to the manifold after each step. Instead, we are interested in designing methods that take steps in the tangent space. The reason is that we would like to be able to equate the learning rate of our optimizer with the actual length of the optimization step. But if the optimization steps are pointing significantly off manifold and then being projected back, this nice property does not hold. Similar motivation is given in Section 2.3 of the EDM2 paper.
Before we can design a training algorithm for this manifold, something important we need to decide on is how to measure distanceFor a manifold to be “Riemannian”, the distance measure must be induced by an inner
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み