PitchHut logo
Revolutionize MoE training with a memory-efficient optimizer.
Pitch

SkewAdam offers a novel approach to optimize state allocation in Mixture-of-Experts training, achieving a remarkable 97.4% reduction in optimizer memory usage. Designed to fit large models on limited resources, it surpasses traditional optimizers like AdamW, Muon, and Lion, proving effective in reducing both memory overhead and validation perplexity.

Description

SkewAdam is an innovative tiered optimizer specifically designed for memory-efficient Mixture-of-Experts (MoE) training. This optimizer significantly reduces memory usage, slashing the typical optimizer state required for large models by 97.4%, which facilitates training a 6.78B-parameter model on a single 40GB GPU.

Key Features

  • Memory Efficiency: While traditional optimizers like AdamW allocate approximately 50.6 GB of optimizer state, SkewAdam minimizes this to just 1.29 GB. This remarkable reduction enables peak training memory to drop from 81.4 GB to 31.3 GB, making large-scale training feasible with limited GPU resources.
  • Improved Performance: Under matched conditions, SkewAdam outperforms AdamW, Muon, and Lion optimizers in terms of lower validation perplexity. This advantage persists even when subjected to various learning rate settings.

Mechanism of Operation

The principle behind SkewAdam is rooted in the non-homogeneous nature of MoE architectures. By strategically allocating optimizer state to different tiers of parameters, it optimizes both memory usage and model performance:

TierShare of ParametersMomentumSecond MomentState Cost
Backbone (embeddings, attention, dense FFN)5.0%fp32factored1.27 GB
Experts (128 SwiGLU experts)95.0%nonefactored12.6 MB
Router (top-2 gate)0.008%nonefull fp322.1 MB

Momentum is retained for the backbone, which processes all tokens, while expert parameters, which are less frequently accessed, utilize a factored second moment, leading to substantial memory savings. The router, although small, maintains critical second moments to effectively manage traffic.

Performance Results

The optimizer's efficiency is highlighted in the following comparative metrics, derived from training a 6.78B-parameter MoE model:

OptimizerState (GB)Peak VRAM (GB)Tokens/sVal. PPL ↓Balance Loss
SkewAdam1.2931.35,000108.40.0505
AdamW50.5581.44,692126.80.0502
Muon25.2757.63,409120.20.0608
Lion25.2756.65,075393.70.0537

SkewAdam not only achieves superior validation perplexity but also balances routing effectively during training, ensuring optimal resource utilization.

Quick Usage

To utilize SkewAdam within a training loop, it can be easily integrated following the example below:

from skewadam import SkewAdam

optimizer = SkewAdam([
    {"params": dense_params,  "use_momentum": True,  "use_factored": True,  "weight_decay": 0.05},
    {"params": expert_params, "use_momentum": False, "use_factored": True,  "weight_decay": 0.05},
    {"params": router_params, "use_momentum": False, "use_factored": False, "weight_decay": 0.0},
], lr=3e-4)

Conclusion

SkewAdam presents a pioneering approach to optimizer state management, optimizing both memory efficiency and training performance in Mixture-of-Experts architectures. This project significantly extends the capability of large model training on constrained hardware, making it an essential tool for researchers and practitioners in the field of machine learning.

0 comments

No comments yet.

Sign in to be the first to comment.