← Latest papers
🤖 machine learning

FOAM: Blocked State Folding for Memory-Efficient LLM Training

The paper introduces FOAM, a memory-efficient optimizer that compresses optimizer states via block-wise gradient means with residual correction, achieving convergence rates equivalent to vanilla Adam while eliminating up to 90% of optimizer memory overhead and accelerating training without degrading performance.

Original authors: Ziqing Wen, Jiahuan Wang, Ping Luo, Dongsheng Li, Tao Sun

Published 2026-05-14
📖 5 min read🧠 Deep dive

Original authors: Ziqing Wen, Jiahuan Wang, Ping Luo, Dongsheng Li, Tao Sun

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 trying to teach a giant, super-smart robot (a Large Language Model) how to write, chat, and reason. To do this, you show it a massive library of books (training data). The robot learns by making mistakes, checking its work, and adjusting its internal "brain settings" (parameters) to get better.

The standard way to do this adjustment is like a very careful accountant named Adam. Adam keeps a detailed ledger for every single brain setting, tracking not just the current mistake, but also the history of past mistakes to decide how much to change things.

The Problem: The Accountant is Too Heavy
The problem is that this "accountant" (the optimizer) is incredibly heavy. For a robot with billions of brain settings, the accountant's ledger takes up twice as much memory as the robot's brain itself.

  • Analogy: Imagine trying to move a house. The furniture (the model) is big, but the moving truck (the optimizer states) is even bigger. If you only have a small truck (limited computer memory), you can't move the house at all, no matter how good the house is. This is the "memory bottleneck" that stops researchers from training bigger, smarter robots.

The Old Solutions: Cutting Corners
Previous attempts to shrink the moving truck had flaws:

  1. Freezing parts of the house: You stop moving some furniture and only adjust a few small boxes. This saves space but makes the house less flexible (lower performance).
  2. Taking blurry photos: Instead of moving the actual furniture, you take low-resolution photos of it to save space. But calculating these photos takes a lot of time and energy (computational overhead).
  3. Sharing ledgers: You make different rooms share the same notebook. This saves space but makes the adjustments less precise.

The New Solution: FOAM (The Smart Folding Method)
The paper introduces FOAM (Folded Optimizer with Approximate Moment). Think of FOAM as a master packer who uses a clever "folding" technique to fit the massive moving truck into a tiny van, without losing any important details.

Here is how FOAM works, using simple metaphors:

1. The "Block Folding" (Compression)

Instead of tracking every single brain setting individually, FOAM groups them into small blocks (like a grid of 8 or 16 settings).

  • The Metaphor: Imagine you have a long line of 100 people, and you need to remember their average height. Instead of writing down 100 separate numbers, you group them into 10 teams of 10. You write down just one number: the average height of each team.
  • The Result: This shrinks the memory needed for the "ledger" by a huge amount (up to 90% less).

2. The "Residual Correction" (The Safety Net)

If you only used the averages, you'd lose the unique details of each person. Maybe one person in a team is very tall, and another is very short. The average hides that.

  • The Metaphor: FOAM is smart. After it writes down the "team average," it quickly calculates the difference (the error) between the real people and the average. It calls this the "Residual."
  • The Trick: It doesn't keep this difference forever. It calculates it, uses it to fix the update for that specific moment, and then throws it away. It's like a chef tasting a soup, adjusting the salt, and then forgetting the exact taste of the spoonful, rather than keeping a record of every spoonful ever tasted.
  • Why it matters: This ensures the robot still learns the unique details of every single brain setting, even though the memory is compressed.

3. The "Unfolding" (Restoration)

When it's time to actually update the robot's brain, FOAM takes those compressed "team averages" and expands them back out to the full size, adding the "Residual" corrections on top.

  • The Result: The robot gets a precise update, just like it would with the heavy accountant, but the computer only had to carry the tiny folded version.

What the Paper Claims (The Results)
The authors tested FOAM on training various robot models (from small 60-million-parameter models to large 7-billion-parameter models). Here is what they found:

  • Massive Memory Savings: FOAM cuts the memory needed for the optimizer by up to 90%. In total, it reduces the memory footprint of training by about 50%. This means you can train bigger models on the same hardware, or train the same models much faster.
  • No Performance Loss: Despite the heavy compression, the models trained with FOAM perform just as well (or sometimes even better) than models trained with the standard heavy accountant. They learn faster and reach higher accuracy.
  • Speed: Because it doesn't have to carry a heavy load, the training process is faster.
  • Versatility: It works on different types of robot architectures (like LLaMA, Qwen, and others) and can even be combined with other memory-saving tricks.

In a Nutshell
FOAM is like a magic suitcase. It allows you to pack a massive amount of information (the optimizer's memory) into a tiny space by folding it up neatly and adding a quick "correction note" to ensure nothing is lost. This lets researchers build smarter, larger AI models without needing super-expensive, massive computers.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →