Papers › Mesa: A Memory-saving Training Framework for Transformers

Mesa: A Memory-saving Training Framework for Transformers

22 Nov 2021arXiv:2111.11124archive 2025-07-28

Zizheng Pan, Peng Chen, Haoyu He, Jing Liu, Jianfei Cai, Bohan Zhuang

There has been an explosion of interest in designing high-performance Transformers. While Transformers have delivered significant performance improvements, training such networks is extremely memory intensive owing to storing all intermediate activations that are needed for gradient computation during backpropagation, especially for long sequences. To this end, we present Mesa, a memory-saving training framework for Transformers. Specifically, Mesa uses exact activations during forward pass while storing a low-precision version of activations to reduce memory consumption during training. The low-precision activations are then dequantized during back-propagation to compute gradients. Besides, to address the heterogeneous activation distributions in the multi-head self-attention layers, we propose a head-wise activation quantization strategy, which quantizes activations based on the statistics of each head to minimize the approximation error. To further boost training efficiency, we learn quantization parameters by running estimates. More importantly, by re-investing the saved memory in employing a larger batch size or scaling up model size, we may further improve the performance under constrained computational resources. Extensive experiments on ImageNet, CIFAR-100 and ADE20K demonstrate that Mesa can achieve flexible memory-savings (up to 50%) during training while achieving comparable or even better performance. Code is available at https://github.com/ziplab/Mesa.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2111.11124")

Code

Syntology Ran 0 of 8 code samples harvested from 1 repository linked to this paper; 8 have no recorded run.

By repository: official repository: 8 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

zhuang-group/mesa officialmentioned in papermentioned on GitHubpytorchApache-2.0 report
zip-group/mesa officialmentioned in papermentioned on GitHubpytorchApache-2.0 report
ziplab/mesa officialmentioned in papermentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

8 samples harvested; 0 ran; 0 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

8unverified

Licence: 0 of the 8 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from zhuang-group/mesa. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

SyncBatchNorm_backward zhuang-group/mesa/mesa/custom_bn.py official repository unverified Apache-2.0 (permissive) · 724a383048928079 · report
SyncBatchNorm_forward zhuang-group/mesa/mesa/custom_bn.py official repository unverified Apache-2.0 (permissive) · 11eee0d5bc362c59 · report
bn_pre_forward zhuang-group/mesa/mesa/custom_bn.py official repository unverified Apache-2.0 (permissive) · 380cb5808156c73f · report
depack_group zhuang-group/mesa/mesa/custom_quant.py official repository unverified Apache-2.0 (permissive) · 782cec8c727976e3 · report
pack_group zhuang-group/mesa/mesa/custom_quant.py official repository unverified Apache-2.0 (permissive) · 22072e90dd836a6f · report
packbits_padded zhuang-group/mesa/mesa/packbit.py official repository unverified Apache-2.0 (permissive) · 7f51844be422b72e · report
read_policy zhuang-group/mesa/mesa/policy.py official repository unverified Apache-2.0 (permissive) · 53a86e524b38795e · report
unpackbits_padded zhuang-group/mesa/mesa/packbit.py official repository unverified Apache-2.0 (permissive) · 4f56b09e80aef47e · report

Tasks

Quantization

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections