Adaptive Regularization for sparse embeddings — kernel + codegen#5949
Open
hdmeta wants to merge 1 commit into
Open
Adaptive Regularization for sparse embeddings — kernel + codegen#5949hdmeta wants to merge 1 commit into
hdmeta wants to merge 1 commit into
Conversation
Summary: X-link: facebookresearch/FBGEMM#2864 Backend (C++) half of the RMSprop-style Adaptive Regularization (AR) optimizer for sparse embeddings. This diff adds the CUDA/CPU kernel template, codegen registration, and BUCK entries — the backend half of a kernel/frontend split. The frontend (Python TBE dispatch, `EmbOptimType.ROWWISE_RMSPROP_AR`, `OptimizerArgs` fields, tests) lands separately. The split avoids `RuntimeError: No such operator` when the C++ op (`training_platform` fbpkg) and Python frontend (`ads_dper3` fbpkg) ship at different cadences. AR replaces static L2 weight decay with a lazy, staleness-aware shrink paid only when a row is touched: `weight ← max(min_shrinkage, 1 − min(1, lr·ar_alpha·I))·weight − mult·grad`, where `I` is the number of steps since the row was last updated. Design: - RMSprop-style EMA accumulator: `v ← ema_beta·v + (1−ema_beta)·mean(g²)`. Named `ROWWISE_RMSPROP_AR` (not `ROWWISE_ADAGRAD_AR`) since the accumulator is an EMA, not a cumulative Adagrad sum; this keeps the `lr/(√v+eps)` multiplier bounded on hot rows. - Linear-clipped decay `max(min_shrinkage, 1−λ)`. Default `min_shrinkage=0.1` retains ≥10% of a cold row's weight; `0.0` enables a full soft-reset. - `ar_alpha=0` reduces exactly to plain rowwise RMSprop (safe default). - Per-row state: `momentum1` (EMA of g²) + `prev_iter`, 2 floats/row. After landing: `torch.ops.fbgemm.split_embedding_backward_codegen_rowwise_rmsprop_ar_*` C++ ops exist; the Python-visible enum/args land with the frontend. Reference: Li & Lyu, "Adaptive Regularization for Large-Scale Sparse Feature Embedding Models" (ICLR 2026), Algorithm 2 (appendix G). Reviewed By: spcyppt, skarakulak Differential Revision: D105272960
Contributor
|
@hdmeta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105272960. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
X-link: https://github.com/facebookresearch/FBGEMM/pull/2864
Backend (C++) half of the RMSprop-style Adaptive Regularization (AR) optimizer for sparse embeddings.
This diff adds the CUDA/CPU kernel template, codegen registration, and BUCK entries — the backend half of a kernel/frontend split. The frontend (Python TBE dispatch,
EmbOptimType.ROWWISE_RMSPROP_AR,OptimizerArgsfields, tests) lands separately.AR replaces static L2 weight decay with a lazy, staleness-aware shrink paid only when a row is touched:
weight ← max(min_shrinkage, 1 − min(1, lr·ar_alpha·I))·weight − mult·grad, whereIis the number of steps since the row was last updated.Design:
v ← ema_beta·v + (1−ema_beta)·mean(g²). NamedROWWISE_RMSPROP_AR(notROWWISE_ADAGRAD_AR) since the accumulator is an EMA, not a cumulative Adagrad sum; this keeps thelr/(√v+eps)multiplier bounded on hot rows.max(min_shrinkage, 1−λ). Defaultmin_shrinkage=0.1retains ≥10% of a cold row's weight;0.0enables a full soft-reset.ar_alpha=0reduces exactly to plain rowwise RMSprop (safe default).momentum1(EMA of g²) +prev_iter, 2 floats/row.After landing:
torch.ops.fbgemm.split_embedding_backward_codegen_rowwise_rmsprop_ar_*C++ ops exist; the Python-visible enum/args land with the frontend.Reference: Li & Lyu, "Adaptive Regularization for Large-Scale Sparse Feature Embedding Models" (ICLR 2026), Algorithm 2 (appendix G).
Differential Revision: D105272960