[v1.0.4] 最新 optim 「QPOLA」 公開 / Latest optim “QPOLA” Released

English translation (英訳版)
After completing the Emo-style optimizer, a new optimizer was born from various considerations.
※ Of course, schedulers such as cosine are also available (feel free to use them).
QPOLA (Kyupola) optimizer
QPOLARIS (Quantization n Polar-Aligned Resetting Instant Zero-Master Weight SGD)
A self-adaptive SGD designed for strong quantization tolerance, zero history, and spatial coordination (polar coordinates / QJL), Zero-Master Weight.
[ Currently at v1.0.4 ] https://github.com/muooon/QPOLA
|Reference LR| LoRA: around 1e-3, FT: around 1e-4, that’s the general feel.
(It works properly with the same LR values you’d use for AdamW — please give it a try.)
※ When training quantized models (int8, etc.), lowering the LR tends to improve stability.
You can confirm the correct behavior of QPOLA v1.0.4. Please check the numerical results of the Anima LoRA generated in the attachment of this article.
● VRAM load ━━► 0 (zero) (no moment buffer required)
● Compute load ━━► Equal or lower
● Scheduler ━━► Not required
paper:
[English] https://huggingface.co/muooon/QPOLA/raw/main/qpola-paper(ENG)260803.txt
It achieves complete moment-free operation while still performing accurate per‑parameter updates.
The mechanism is simply: look at many directions, look at a few directions, then determine the individual direction.
At that point, the per‑parameter LR is computed from the consistency rate, effectively acting as an automatic brake.
(This is executed as a smooth consistency value “1.0 to below 0.01 × user-specified LR”.)
(Even though the history buffer is empty, the loss function still operates over the entire past implicitly, so the model doesn’t collapse during training.)
It behaves as if it has autonomous long‑term memory and autonomous natural forgetting, which together induce generalization.
However, this is an experimental optimizer — if it stops working someday, please just laugh it off.
For reference, Anima FT (fine-tuning) for 8 hours has been completed, and 2048px training has been verified.
Naturally, LoRA works fine too. Being able to do this on an RTX 3060 12GB is pretty nice, isn’t it?
It’s a special optimizer, but I’ve designed it to be easy to use, so please give it a try.
Alternative to the First Moment (Direction / Inertia)
■ Traditional First Moment
In conventional optimization, the first moment is defined as follows:
mₜ: Exponential moving average of past gradients (along the time axis)
It represents inertia used to accumulate gradient history over time and estimate the “direction to move now” (trend).
■ QPOLA’s Alternative Approach
QPOLA estimates direction not through time, but through the spatial axis.
micro_direction_mean
macro_direction_mean
These compute the “average gradient direction” that occurs simultaneously within a warp /
within a block, extracting the collective consensus (the wave) of surrounding parameters on “which direction they are trying to move right now.”
By shifting the concept from temporal inertia → spatial simultaneity, these serve as a replacement for the traditional first moment.
Alternative to the Second Moment (Uncertainty / Learning‑Rate Scaling)
■ Traditional Second Moment
The traditional second moment is defined as:
vₜ: Time accumulation of squared (or absolute) gradients
This captures the intensity of past fluctuations (noise magnitude) and enables learning‑rate suppression according to uncertainty (1 ÷ √vₜ).
■ QPOLA’s Alternative Approach
QPOLA uses the following spatial indicators:
warp_p_scale
conflictwarp_p_scale
Through the “spatial mean of parameter absolute values,” these capture the “fundamental scale (dimension)” currently held by each layer/block.
Additionally, conflict (degree of misalignment) measures the “instantaneous noise / uncertainty magnitude,” applying a brake to the learning rate as an adaptation_factor.
This replaces the traditional second moment’s noise‑dependent learning‑rate adjustment with spatial indicators.
To explain QPOLA in a bit more detail:
1. Loss (Global Judgment Field) as an "Archive of All History"
In the machine learning training process, the Loss at the current step is not merely a scalar value; it is the "destination of results" that compresses and reflects the "entire parameter trajectory and gradient history" (the complete history) from the "initial state up to the present."
QPOLA does not have explicit optimizer states (buffer memory); instead, it always trusts only the "weights and distortions" of the entire past trajectory through the top-level global judgment field known as Loss.
In other words, rather than "discarding the past," QPOLA can be described as "instantly re-projecting (self-organizing) the entire history at every step through the 'gradients' descending from Loss, which is the complete past history."
2. "Spontaneous Inertia" Generated by Dynamic Adaptation via Local Judgment Fields and Spatial Coherence (Phase Synchronization)
The interaction between the "micro (warp/block) local alignment" and "macro (loss) global" levels in the QPOLA code, along with spatial-axis consensus (consensus building), generates "spontaneous inertia."
Local Judgment Fields (Conflicts and Alignment): Evaluates in real-time how individual parameters or local vectors align with the direction of surrounding gradients, dynamically altering fluctuations (jitter) and the adaptation factor.
Global Judgment Field (Loss / Overall Trend): Loss fluctuates as the aggregate result of these local behaviors, rewriting the very gradients that descend next.
Note: This mechanism extracts vectors and reflects differences using warps/blocks, and can be ported (mathematically equivalent) to other hardware by directly utilizing vectors, etc.
This self-contained feedback loop—governed by "lower-level local fluctuations and self-organization" and "upper-level global Loss gradient allocation"—possesses a novel mathematical structure that stabilizes systems by utilizing spatial phase alignment (coherence) instead of temporal history (momentum).
3. A Paradigm Shift: "Inertia Independent of Memory"
AdamW's Inertia: Saves past gradients in memory as "merely a history of numerical additions" (EMA), which is essentially an external mechanical storage (artificial inertia).
QPOLA's Spontaneous Inertia: A spontaneous inertia continuously generated dynamically by the system through the dynamics of the overall system's energy gradients (Loss) and local alignment conflicts, without relying on memory (history).
日本語(原文) original
Emo 系 optim 完成後、いろいろな考察から、新optimが生まれました
※ もちろん cos などの Scheduler も利用可能です (どうぞご自由に)
QPOLA (キュポラ) optimizer
QPOLARIS (Quantization n Polar-Aligned Resetting Instant Zero-Master Weight SGD)
量子化に強い、履歴ゼロ、空間協調(極座標・QJL)、Zero-Master Weight による自己適応型SGD
[ 現在 v1.0.4 です ] https://github.com/muooon/QPOLA
|基準LR| LoRA:1e-3 くらい、FT:1e-4 くらい、かなという感触です
(AdamWと同じLR指定値でちゃんとつかえます、ぜひお試しください)
※ 量子化モデルで(int8など)学習する場合は LR を低くすると安定的と思います
QPOLA v1.0.4 の正常動作をご確認頂けます
この記事の 添付ファイル で Anima LoRA の生成結果(数値)をご覧ください
● VRAM負荷 ━━► 0 (ゼロ) (モーメントバッファ不要)
● 計算負荷 ━━► 同等以下
● スケジューラ ━━► 不要
技術解説:
[日本語] https://huggingface.co/muooon/QPOLA/raw/main/qpola-paper(JPN)260803.txt
完全なモーメントフリー、を成し遂げ、かつ個別 p の正確な更新も行います
仕組みは、多数の方向を見る、少数の方向を見る、個別の方向を決定する、だけ
このとき、個別のLRを整合率から算出します、なので自動ブレーキになります
(これは整合率の滑らかな値「1.0~0.01以下 × ユーザー指定LR」として実行します)
(履歴はゼロだけど、lossが全履歴的に作用します、だから学習崩壊しない)
自律的長期記憶と自律的自然忘却をする、汎化誘導する、という感じです
ただこれ 実験的 optim です、もし動かなくなっても笑って済ませてください
一応、Anima で FT(微調整) 8時間学習完了、2048px学習を確認済みです
もちろん LoRA も大丈夫、RTX3060-12GB で、これができる、っていいでしょう?
特殊optimだけど、簡単に使えるように工夫してあるので、ぜひお試しください
1次モーメント(方向・慣性)の代替
■ 伝統的な1次モーメント
従来の最適化では1次モーメントは次のように定義されます。
mₜ:過去の勾配の指数平滑移動平均(時間軸)
時間方向に沿って勾配履歴を蓄積し「いま進むべき方向」(トレンド)を推定するための慣性です。
■ QPOLA の代替アプローチ
QPOLA は方向推定を時間ではなく 空間軸 によって行います。
micro_direction_mean
macro_direction_mean
これらは「ワープ内・ブロック内」で同時に発生した「勾配方向の平均」を取ることで、
周囲の p が "いまどちらへ向かおうとしているか" という集団的コンセンサス(うねり)を抽出します。
従来の 時間的慣性 → 空間的同時性 という発想転換により 1次モーメントの代替 として利用します。
2次モーメント(不確実性・学習率スケール)の代替
■ 伝統的な2次モーメント
従来の2次モーメントは次のように定義されます。
vₜ:勾配の平方(または絶対値)の時間蓄積
これにより過去の変動の激しさ(ノイズの大きさ)
不確実性に応じた学習率の抑制(1 ÷ √vₜ)が実現されます。
■ QPOLA の代替アプローチ
QPOLA では、以下の空間的指標を用います。
warp_p_scale
conflictwarp_p_scale
これらは「パラメータ絶対値の空間平均」によって、
レイヤー/ブロックが現在持つ「基礎的なスケール」(次元)を捉えます。
さらに conflict(アライメントの不一致度) によって、
「いまこの瞬間のノイズ・不確実性の大きさ」を測定し adaptation_factor として学習率にブレーキをかけます。
これは従来の2次モーメントが担っていたノイズに応じた学習率調整を空間的指標で置き換えたものです。
QPOLA について、もう少し詳しく説明すると、
1. Loss(大域的判定場)という「全履歴のアーカイブ」
機械学習の学習プロセスにおいて、現在のステップにおける Loss(損失) は、単なるスカラー値ではなく「初期状態から現在に至る」までの「すべてのパラメータ軌跡と勾配の歴史」(全履歴)を圧縮・反映した「結果の到達点」です。
QPOLA は、明示的なオプティマイザーステート(バッファ・メモリ)を持たず、最上位にある Loss という大域的判定場で過去の全軌跡の「重みと歪み」のみを常に信頼します。
つまり QPOLA は「過去を捨てる」のではなく「過去の全履歴である Loss から降りてくる"勾配"を通じ、毎ステップ全履歴を瞬時に再投影(自己組織化)している」と言えます。
2. 局所判定場と空間的コヒーレンス(位相整合)による動的適応が生む「自発的慣性」
QPOLA のコードにある「ミクロ(warp/block)局所アライメント」と「マクロ(loss)大域」の相互作用、空間軸のコンセンサス(合意形成)により「自発的慣性」を生み出します。
局所判定場(コンフリクトやアライメント):個々のパラメータや局所的なベクトルが、周囲の勾配の向きとどう整合しているかをリアルタイムに評価し、ゆらぎ(ジッター)や適応係数(adaptation_factor)を動的に変化させます。
大域的判定場(Loss / 全体トレンド):その局所的な挙動の総結果として Loss は変動し、次に降りてくる勾配そのものを書き換えます。
※ これは warp/block で「ベクトルを抽出し差分を反映」します、別ハードウェアではダイレクトにベクトルをつかう等で、この仕組みを移植可能(数学的に等価的)です。
この「下位の局所的なゆらぎ・自己組織化」と「上位の大域的なLossの勾配配分」により統御される自己完結したフィードバックループは、時間的な履歴(モメンタム)の代わりに空間的な位相の揃い具合(コヒーレンス)を利用し安定させる新しい数理構造を持ちます。
3. 「メモリに頼らない慣性」というパラダイムシフト
AdamWの慣性:過去の勾配を「ただの数値の足し算の履歴」(EMA)としてメモリに保存する、いわば機械的な外部記憶(人工的な慣性)です。
QPOLAの自発的慣性:メモリ(履歴)に頼らず、系全体のエネルギー勾配(Loss)と局所的なアライメントの衝突(Conflict)のダイナミクスを通じ、システムが動的に生み出し続ける自発的慣性です。