Gefen: Optimized Stochastic Optimizer
The paper introduces Gefen, a memory-efficient optimizer that reduces AdamW's memory footprint by approximately 8x through automatic second-moment sharing and learned first-moment quantization, enabling larger batch sizes and improved throughput while maintaining equivalent performance.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are training a giant robot (a deep learning model) to learn a new skill. To do this, the robot needs a "coach" (an optimizer) that tells it how to adjust its internal settings after every practice session. The most popular coach right now is called AdamW.
AdamW is a great coach, but it has a heavy backpack. For every single setting the robot has, AdamW carries two extra notebooks (called "first and second moment states") to remember past mistakes and how fast things are changing. If your robot has 1 billion settings, AdamW's backpack adds another 2 billion settings' worth of weight. This makes the backpack so heavy that you can't fit a big robot on a standard training computer, or you have to make the robot practice in tiny, slow steps.
The paper introduces a new coach named Gefen. Gefen is a "memory-efficient" optimizer that shrinks that heavy backpack by 8 times while keeping the robot's learning speed and quality exactly the same as AdamW.
Here is how Gefen does it, using some simple analogies:
1. The "Group Hug" Strategy (Sharing Notes)
The Problem: AdamW writes a separate note for every single number in the robot's brain.
Gefen's Solution: Gefen realizes that many of these numbers are actually "best friends." They react to the world in very similar ways. Instead of writing a unique note for every single friend, Gefen groups them into teams (blocks) and gives the whole team one shared notebook.
- How does it know who to group? Usually, you'd need a super-complex map (called a Hessian matrix) to see who is friends with whom, but that map is too big to draw for giant robots.
- Gefen's Trick: Gefen looks at the robot's very first practice session. It sees which numbers moved together in a similar pattern. It assumes, "If you moved together at the start, you'll probably move together later." It then groups these numbers automatically. No human needs to tell it which groups to make; it figures it out on its own.
2. The "Sketch Artist" Strategy (Quantization)
The Problem: Even with shared notebooks, the numbers inside are still written with high precision (like 10 decimal places), which takes up space.
Gefen's Solution: Gefen uses a "sketch artist" approach. Instead of writing down the exact number (e.g., 0.123456789), it rounds it to the nearest "standard value" from a pre-made list (a codebook).
- The Smart List: Most optimizers use a generic, fixed list of values (like a ruler with fixed marks). Gefen, however, looks at the specific robot it is coaching and learns the perfect list of marks just for that robot. It uses a smart mathematical method (Dynamic Programming) to create a custom ruler that fits the data perfectly, minimizing errors.
- Stability: Once it learns this list at the very beginning, it keeps using the same list the whole time. It doesn't need to redraw the ruler every day, which saves time and keeps things stable.
The Results: A Lighter Backpack, Same Performance
The authors tested Gefen on various models, from small image classifiers to large language models (like Llama 3).
- Memory: Gefen reduced the memory needed for the optimizer by about 8 times compared to AdamW. For a 13-billion parameter model, this saves about 97 GB of memory down to just 1.5 GB.
- Speed: Because the backpack is lighter, the robot can carry a bigger "micro-batch" (practice group) at once. In tests using multiple computers (FSDP and DDP), this allowed the training to run 56% faster because the computers weren't waiting for memory to clear up.
- Quality: Despite the heavy compression and sharing, the robot learned just as well as it did with the heavy AdamW backpack. The final performance (accuracy or loss) was identical.
Why This Matters
Think of it like packing for a trip. AdamW is like packing a suitcase where every single sock gets its own individual box. Gefen is like realizing you can roll all your socks into one tight bundle and put them in a single small pouch. You save massive space, but you still have all your socks, and you can still get to your destination just as fast.
The paper claims Gefen is a "drop-in replacement," meaning you can swap it into your existing training code without changing any settings, and it will immediately save you memory and potentially speed up your training.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.