SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2512.07112 · ICML · 2026

FOAM: Blocked State Folding for Memory-Efficient LLM Training

Ping Luo, Tao Sun, Dongsheng Li, Jiahuan Wang, Ziqing Wen

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 1 no recorded run), measured 2026-11-22; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2512.07112.json · badge: /api/ran/2512.07112.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
zqOuO/FOAM canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
apply_rotary_pos_emb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zqOuO/FOAM/peft_pretraining/modeling_llama.py
pointer only (licence: NONE) · get_code("f725bc2d76076485")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zqOuO/FOAM when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

check_args_torchrun_main Ran
ran; our contract draft was wrong, not the code
zqOuO/FOAM/peft_pretraining/args_utils.py
pointer only (licence: NONE) · get_code("c233d4777fc58003")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zqOuO/FOAM when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

fold_tensor Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zqOuO/FOAM/foam_torch/foam_adam.py
pointer only (licence: NONE) · get_code("c748e413d94d4656")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zqOuO/FOAM when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

rotate_half Ran
ran; our contract draft was wrong, not the code
zqOuO/FOAM/peft_pretraining/modeling_llama.py
pointer only (licence: NONE) · get_code("b99eea6376d1e212")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zqOuO/FOAM when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

unfold_tensor Ran
ran; our contract draft was wrong, not the code
zqOuO/FOAM/foam_torch/foam_adam.py
pointer only (licence: NONE) · get_code("05b30f7a91b94d98")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zqOuO/FOAM when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

zeropower_via_newtonschulz5 Not yet run
unverified (harvested, no recorded run)
zqOuO/FOAM/foam_torch/muon.py
pointer only (licence: NONE) · get_code("c6cbb0406b3d2e05")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zqOuO/FOAM when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 3 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
rotate_half 360 other papers
310 dated earlier, 42 later, 5 same year, order not determinable, 3 undated · 30 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
2203.08913 (2022-03)
Memorizing Transformers
2302.13971 (2023-02)
LLaMA: Open and Efficient Foundation Language Models
and 357 more not named here
apply_rotary_pos_emb 83 other papers
73 dated earlier, 7 later, 3 same year, order not determinable · 6 only as an assembly brick
2306.15595 (2023-06)
Extending Context Window of Large Language Models via Positional Interpolation
2307.05695 (2023-07)
ReLoRA: High-Rank Training Through Low-Rank Updates
2307.06945 (2023-07)
In-context Autoencoder for Context Compression in a Large Language Model
and 80 more not named here
check_args_torchrun_main 3 other papers
3 dated earlier
2406.02214 (2024-06)
SLTrain: a sparse plus low-rank approach for parameter and memory efficient pretraining
2407.08296 (2024-07)
Q-GaLore: Quantized GaLore with INT4 Projection and Layer-Adaptive Low-Rank Gradients
2408.12857 (2024-08)
Memory-Efficient LLM Training with Online Subspace Descent
zeropower_via_newtonschulz5 2 other papers
1 dated earlier, 1 later
2411.16085 (2024-11)
Cautious Optimizers: Improving Training with One Line of Code
2602.17080 (2026-02)
Adam Improves Muon Adam Improves Muon: Adaptive Moment Estimation with Orthogonalized Momentum

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large language models (LLMs) have demonstrated remarkable performance due to their large parameter counts and extensive training data. However, their scale leads to significant memory bottlenecks during training, especially when using memory-intensive optimizers like Adam. Existing memory-efficient approaches often rely on techniques such as singular value decomposition (SVD), projections, or weight freezing, which can introduce substantial computational overhead, require additional memory for projections, or degrade model performance. In this paper, we propose Folded Optimizer with Approximate Moment (FOAM), a method that compresses optimizer states by computing block-wise gradient means and incorporates a residual correction to recover lost information. Theoretically, FOAM achieves convergence rates equivalent to vanilla Adam under standard non-convex optimization settings. Empirically, FOAM eliminates up to 90% of the memory overhead of optimizer states and accelerates convergence. Furthermore, FOAM is compatible with other memory-efficient optimizers, delivering performance and throughput that match or surpass both full-rank and existing memory-efficient baselines. Code is available at https://github.com/zqOuO/FOAM.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2512.07112")
get_code_for_paper("2512.07112")
have("2512.07112")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2512.07112.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2512.07112.svg)](https://syntology.ai/paper/2512.07112)

Connect an agent — have() is free.