HyperAIHyperAI

Command Palette

Search for a command to run...

بولار إكسبرس: طرق مثلى لدالة الإشارة للمصفوفة وتطبيقها على خوارزمية مويون

Noah Amsel David Persson Christopher Musco Robert M. Gower

الملخص

يُعدّ حساب التحليل القطبي ودالة الإشارة المصفوفية المرتبطة به مشكلةً مدروسةً بعناية في التحليل العددي منذ عقود. وقد برزت مؤخرًا كإجراء فرعي أساسي داخل مُحسِّن مويون لتدريب الشبكات العصبية العميقة. غير أن متطلبات هذا التطبيق تختلف اختلافًا جوهريًا عن الإعدادات الكلاسيكية؛ إذ يتطلب التعلّم العميق خوارزميات صديقة لوحدة معالجة الرسوميات تُعطي الأولوية للإنتاجية العالية على حساب الدقة العالية. نقدّم بولار إكسبرس، وهو طريقة جديدة لحساب التحليل القطبي. على غرار طريقة نيوتن-شولتز وغيرها من الطرق متعددة الحدود الكلاسيكية، تعتمد طريقتنا على ضربات مصفوفة بمصفوفة فحسب، مما يجعلها فعّالة للغاية على وحدات معالجة الرسوميات. مستوحاةً من أعمال شين وشاو السابقة ومن عمل ناكاتسوكاسا وفرويد، تُكيّف بولار إكسبرس قاعدة التحديث عند كل تكرار من خلال حل مسألة تحسين مينماكس. نُبْرِه على أن هذه الاستراتيجية تُقلّل الخطأ بمعنى أسوأ حالة، مما يسمح لبولار إكسبرس بالتقارب بأسرع ما يمكن في التكرارات المبكرة وفي السلوك المقارب على حدٍّ سواء. كما نعالج مشكلات الدقة المحدودة، مما يجعلها عملية للاستخدام بدقة bfloat16. عند دمجها في مويون، تُحقق طريقتنا تحسّنات متسقة في دالة خسارة التحقق لنموذج GPT-2 مُدرَّب على ما بين مليار وعشرة مليارات رمز من مجموعة بيانات FineWeb، متجاوزةً البدائل الحديثة عبر نطاق واسع من معدلات التعلّم.

One-sentence Summary

Researchers at New York University and the Flatiron Institute propose Polar Express, a GPU-friendly polar decomposition method that solves a minimax optimization problem at each iteration to achieve provably optimal worst-case convergence in both early and asymptotic regimes, and demonstrate consistent validation loss improvements over recent alternatives when integrated into the Muon optimizer for GPT-2 training.

Key Contributions

  • Polar Express introduces a polar decomposition method that adapts polynomial updates at each iteration by solving a minimax problem and uses only matrix-matrix multiplications, making it efficient for GPU-based Muon optimizers.
  • The polynomial sequence is proved to give a worst-case optimal approximation to the sign function, with super-exponential convergence and rapid progress within just five to ten iterations.
  • An implementation compatible with bfloat16 is evaluated on synthetic matrices, GPT-2 gradient matrices, and Muon-trained GPT-2 models on one to ten billion FineWeb tokens, improving validation loss across learning rates and being adopted in the NanoGPT speedrun.

Introduction

Advanced linear algebra is increasingly central to deep learning, especially in optimizers like Muon, which replaces the usual momentum direction with the polar factor of a gradient-based matrix. This polar factor is equivalent to a matrix sign function for square matrices and gives a steepest-descent direction under the spectral norm. For large language model training, the computation must be fast, GPU-friendly, memory efficient, and mainly useful at low or moderate accuracy.

Prior methods face practical limitations. A direct SVD is too expensive on GPUs, and many classical polar-decomposition methods require matrix inverses, QR factorizations, or other operations that do not parallelize well. Newton-Schulz is attractive because it uses only matrix-matrix products, but it converges slowly at first. Recent heuristic polynomial iterations reach low-accuracy estimates quickly, but they do not converge to the true polar factor.

The authors introduce Polar Express, a new GPU-friendly iterative method for approximating the matrix polar factor. It adapts the polynomial update rule at each iteration, balancing fast early progress and later accuracy. The method uses polynomials designed to optimize the worst-case approximation of the sign function, converges super-exponentially, and can produce useful approximations within a small number of iterations. Applied inside Muon, Polar Express improves GPT-2 training validation loss across learning rates and has been adopted in optimized NanoGPT training workflows.

Method

The authors design the method to compute polar⁡(M)\operatorname{polar}(\boldsymbol M)polar(M) through operations that are efficient on GPUs: linear combinations of matrices and matrix-matrix products. Since matrix products are more expensive than linear combinations, the algorithm is structured to use as few matrix products as possible. For a matrix with singular value decomposition M=UΣV⊤\boldsymbol M=\boldsymbol U\boldsymbol \Sigma\boldsymbol V^{\top}M=UΣV⊤, odd powers can be written as

M2q+1=UΣ2q+1V⊤=M(M⊤M)q.\boldsymbol M^{2q+1}=\boldsymbol U\boldsymbol \Sigma^{2q+1}\boldsymbol V^{\top} =\boldsymbol M(\boldsymbol M^{\top}\boldsymbol M)^q.M2q+1=UΣ2q+1V⊤=M(M⊤M)q.

Therefore, for an odd polynomial

p(x)=a0x+a1x3+⋯+aqx2q+1,p(x)=a_0x+a_1x^3+\cdots+a_qx^{2q+1},p(x)=a0​x+a1​x3+⋯+aq​x2q+1,

the matrix polynomial can be evaluated as

p(M)=a0M+a1M(M⊤M)+⋯+aqM(M⊤M)q.p(\boldsymbol M) =a_0\boldsymbol M +a_1\boldsymbol M(\boldsymbol M^{\top}\boldsymbol M) +\cdots +a_q\boldsymbol M(\boldsymbol M^{\top}\boldsymbol M)^q.p(M)=a0​M+a1​M(M⊤M)+⋯+aq​M(M⊤M)q.

The central design choice is to approximate polar⁡(M)\operatorname{polar}(\boldsymbol M)polar(M) using a composition of lower-degree odd polynomials. The full approximation has the form

p=pT∘pT−1∘⋯∘p1,p=p_T\circ p_{T-1}\circ\cdots\circ p_1,p=pT​∘pT−1​∘⋯∘p1​,

and the matrix iterate is generated recursively by

X0=M,Xt=pt(Xt−1)for t=1,…,T.\boldsymbol X_0=\boldsymbol M,\qquad \boldsymbol X_t=p_t(\boldsymbol X_{t-1})\quad\text{for }t=1,\dots,T.X0​=M,Xt​=pt​(Xt−1​)for t=1,…,T.

The final matrix XT\boldsymbol X_TXT​ is the approximation to polar⁡(M)\operatorname{polar}(\boldsymbol M)polar(M). If each component polynomial has odd degree ddd, this composition requires only O(Td)O(Td)O(Td) matrix products. A standard Newton-Schulz iteration is a special case of this framework, but the authors choose the polynomials to minimize the worst-case approximation error.

Given known or estimated lower and upper bounds ℓ\ellℓ and uuu on the singular values of M\boldsymbol MM, the goal is to find the composition that minimizes the spectral norm error in the worst case. Because

polar⁡(M)−p(M)=U(I−p(Σ))V⊤,\operatorname{polar}(\boldsymbol M)-p(\boldsymbol M) =\boldsymbol U(I-p(\boldsymbol \Sigma))\boldsymbol V^{\top},polar(M)−p(M)=U(I−p(Σ))V⊤,

and the spectral norm is unitarily invariant, this reduces to a scalar uniform approximation problem: find a composed odd polynomial ppp such that p(x)p(x)p(x) stays as close as possible to 111 for all x∈[ℓ,u]x\in[\ell,u]x∈[ℓ,u]. Formally,

p⋆=arg⁡min⁡p=pT∘pT−1∘⋯∘p1pt∈Pdoddmax⁡x∈[ℓ,u]∣1−p(x)∣.p^\star = \arg\min_{\substack{p=p_T\circ p_{T-1}\circ\cdots\circ p_1\\ p_t\in\mathbb{P}_d^{\mathrm{odd}}}} \max_{x\in[\ell,u]}|1-p(x)|.p⋆=argp=pT​∘pT−1​∘⋯∘p1​pt​∈Pdodd​​min​x∈[ℓ,u]max​∣1−p(x)∣.

The method solves this problem greedily across iterations. For the current interval [ℓt,ut][\ell_t,u_t][ℓt​,ut​], one odd-degree-ddd polynomial is chosen to minimize

max⁡x∈[ℓt,ut]∣1−p(x)∣.\max_{x\in[\ell_t,u_t]}|1-p(x)|.x∈[ℓt​,ut​]max​∣1−p(x)∣.

This polynomial maps the current interval to a new interval

[ℓt+1,ut+1],[\ell_{t+1},u_{t+1}],[ℓt+1​,ut+1​],

which then becomes the target interval for the next polynomial. The bounds can be updated using

ℓt+1=pt(ℓt),ut+1=2−ℓt+1.\ell_{t+1}=p_t(\ell_t),\qquad u_{t+1}=2-\ell_{t+1}.ℓt+1​=pt​(ℓt​),ut+1​=2−ℓt+1​.

The resulting composition is optimal among all compositions of TTT odd polynomials of degree ddd. The final approximation satisfies

∥polar⁡(M)−XT∥2≤max⁡x∈[ℓ,u]∣1−p⋆(x)∣=1−ℓT+1.\|\operatorname{polar}(\boldsymbol M)-\boldsymbol X_T\|_2 \le \max_{x\in[\ell,u]}|1-p^\star(x)| = 1-\ell_{T+1}.∥polar(M)−XT​∥2​≤x∈[ℓ,u]max​∣1−p⋆(x)∣=1−ℓT+1​.

When the singular values are normalized so that σ(M)⊂[ℓ,1]\sigma(\boldsymbol M)\subset[\ell,1]σ(M)⊂[ℓ,1] and d=2q+1d=2q+1d=2q+1, the error bound takes the stronger form

∥polar⁡(M)−XT∥2≤∣1−ℓ2∣(q+1)T,\|\operatorname{polar}(\boldsymbol M)-\boldsymbol X_T\|_2 \le |1-\ell^2|^{(q+1)^T},∥polar(M)−XT​∥2​≤∣1−ℓ2∣(q+1)T,

which shows rapidly improving convergence as TTT grows.

As shown in the figure below:

The evolution of the intervals shows how each polynomial narrows the range of singular values that still deviate from 111. The first polynomial maps the original singular value interval into a new interval closer to 111, the second polynomial acts on that updated interval, and subsequent polynomials continue refining the approximation. This interval-based view is what makes the greedy construction optimal for the spectral norm error.

To find each polynomial ptp_tpt​, the method solves a minimax approximation problem: among all odd polynomials of the chosen degree, it selects the one that uniformly approximates the constant function 111 on the current interval [ℓt,ut][\ell_t,u_t][ℓt​,ut​]. For the low degrees used in practice, this can be done explicitly or with a simplified solver derived from the equioscillation property of minimax approximations. A full Remez-style procedure would also solve the problem, but because the target function is constant and the degree is small, the method uses a specialized low-degree construction that is simpler to implement and mathematically equivalent in the relevant setting.

The method also requires practical bounds on the singular values. A simple upper bound is ∥M∥F\|\boldsymbol M\|_{\mathrm F}∥M∥F​, the Frobenius norm of the matrix. In practice, the input matrix is rescaled by a quantity proportional to this norm, and the upper bound is set to u=1u=1u=1. The lower bound ℓ\ellℓ is harder to estimate efficiently, so the authors choose a small value such as ℓ=10−3\ell=10^{-3}ℓ=10−3 for floating-point workloads, particularly when operating in bfloat16. A poor lower-bound estimate does not destroy convergence; it mainly delays it by a small number of iterations.

There are also numerical safeguards for finite-precision arithmetic. If roundoff causes singular values to appear slightly above the current upper bound, each polynomial can be replaced by x↦pt(x/1.01)x\mapsto p_t(x/1.01)x↦pt​(x/1.01), which effectively enlarges the interval and avoids instability. Because some optimal polynomials can be non-monotone near the beginning of the process, the early iterations can also use slightly suboptimal but less oscillatory polynomials. These changes stabilize the offline coefficient computation with negligible loss of approximation quality.

The overall pipeline has an offline stage and an online stage. During the offline stage, the polynomials p1,…,pTp_1,\dots,p_Tp1​,…,pT​ are precomputed once for fixed bounds ℓ\ellℓ and uuu. During the online stage, these stored coefficients are reused for every matrix update. For a degree-5 polynomial

pt(x)=ax+bx3+cx5,p_t(x)=ax+bx^3+cx^5,pt​(x)=ax+bx3+cx5,

the matrix iteration can be evaluated efficiently with a Horner-like form. Setting

Yt−1=Xt−1⊤Xt−1,\boldsymbol Y_{t-1}=\boldsymbol X_{t-1}^{\top}\boldsymbol X_{t-1},Yt−1​=Xt−1⊤​Xt−1​,

the update is

Xt=Xt−1(aI+Yt−1(bI+cYt−1)).\boldsymbol X_t = \boldsymbol X_{t-1} \left( aI+\boldsymbol Y_{t-1}(bI+c\boldsymbol Y_{t-1}) \right).Xt​=Xt−1​(aI+Yt−1​(bI+cYt−1​)).

In the recommended implementation, the composition is applied to a normalized matrix of the form

M∥M∥F+10−2,\frac{\boldsymbol M}{\|\boldsymbol M\|_{\mathrm F}+10^{-2}},∥M∥F​+10−2M​,

and a small number of iterations, typically five or six, are sufficient for the deep learning use case.

Experiment

The experiments evaluate Polar Express both as an iterative polar-factor approximation and as the matrix sign subroutine in Muon, comparing it with Newton-Schulz, Jordan’s method, and You’s method. On synthetic and real matrix approximations, Polar Express converges more reliably and faster than the baselines when its lower singular value bound is reasonable, while remaining competitive when that bound is misestimated. In GPT-2 training, replacing these polar approximation subroutines with Polar Express consistently improves validation and training loss without extra cost, and ablations show that using only a few Polar Express iterations is sufficient, with further accuracy or exact SVD-based computation not helping optimization. The gains persist under weight decay and longer training, though the margin narrows.


بناء الذكاء الاصطناعي بالذكاء الاصطناعي

من الفكرة إلى الإطلاق — سرّع تطوير الذكاء الاصطناعي الخاص بك مع المساعدة البرمجية المجانية بالذكاء الاصطناعي، وبيئة جاهزة للاستخدام، وأفضل أسعار لوحدات معالجة الرسومات.

البرمجة التعاونية باستخدام الذكاء الاصطناعي
وحدات GPU جاهزة للعمل
أفضل الأسعار

HyperAI Newsletters

اشترك في آخر تحديثاتنا
سنرسل لك أحدث التحديثات الأسبوعية إلى بريدك الإلكتروني في الساعة التاسعة من صباح كل يوم اثنين
مدعوم بواسطة MailChimp