SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.07837 · 2024

FRUGAL: Memory-Efficient Optimization by Reducing State Overhead for Scalable Training

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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; 8 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2411.07837.json · badge: /api/ran/2411.07837.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
fzmushko/frugal canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
apply_rotary_pos_emb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
fzmushko/frugal/utils/modeling_llama.py
code served (permissive licence) · get_code("f725bc2d76076485")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for q and k
# Shape: (batch_size=2, seq_len=3, hidden_dim=4)
q = torch.randn(2, 3, 4)
k = torch.randn(2, 3, 4)

# Create cos and sin tensors
# The function squeezes dimensions 1 and 0, then indexes by position_ids
# So we need shape that allows this: (1, 1, seq_len, hidden_dim)
cos = torch.randn(1, 1, 5, 4)
sin = torch.randn(1, 1, 5, 4)

# Create position_ids
# Shape: (batch_size=2, seq_len=3)
position_ids = torch.tensor([[0, 1, 2], [1, 2, 3]])

ARGS = {
    "q": q,
    "k": k,
    "cos": cos,
    "sin": sin,
    "position_ids": position_ids,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
check_args_torchrun_main Ran
ran; our contract draft was wrong, not the code
fzmushko/frugal/utils/args_utils.py
code served (permissive licence) · get_code("be7fc68fbf7d7bd7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Args. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import os

torch.manual_seed(0)

class Args:
    def __init__(self):
        self.optimizer = 'adamw'
        self.dtype = 'bf16'
        self.amp = True
        self.total_batch_size = 32
        self.batch_size = 16
        self.scheduler = 'cosine'
        self.weight_decay = 0.01
        self.lr = 0.001
        self.grad_clipping = 1.0
        self.seed = 42
        self.wandb_name_prefix = 'test'
        self.wandb_name = ''
        self.wandb_tags = []
        self.nesterov = False
        self.beta1 = 0.9
        self.sgd_sign_update = False
        self.reset_statistics = False
        self.proj_params_lr_scale = 1.0
        self.update_gap = 1
        self.density = 1.0
        self.inactive_update_rule = 'default'
        self.inactive_lr_scale = 1.0
        self.proj_type = 'std'
        self.proj_side = 'std'
        self.coord_choice = 'row'
        self.block_order = 'bst'
        self.proj_embeds = False
        self.proj_logits = False
        self.proj_norms = False
        self.tags = None
        self.gradient_accumulation = None
        self.max_train_tokens = None
        self.num_training_steps = None
        self.beta2 = None
        self.save_dir = None
        self.save_dir_prefix = None
        self.eval_batch_size = None

ARGS = {
    'args': Args()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
loguru, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Args — a Args output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Args output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
check_args_trainer_finetuning Ran
ran; our contract draft was wrong, not the code
fzmushko/frugal/utils/args_utils.py
code served (permissive licence) · get_code("96cffaa90db37d36")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from dataclasses import dataclass, field
from typing import Optional

torch.manual_seed(0)

@dataclass
class TrainingArgs:
    run_name: str = ''
    lr_scheduler_type: str = 'linear'
    bf16: bool = False
    fp16: bool = True
    per_device_train_batch_size: int = 4
    gradient_accumulation_steps: int = 2
    weight_decay: float = 0.01
    learning_rate: float = 1e-4
    max_grad_norm: float = 1.0
    seed: int = 42
    output_dir: str = '/tmp/output-'
    wandb_tags: list = field(default_factory=list)

@dataclass
class OptimizerArgs:
    optimizer: str = 'adamw'
    nesterov: bool = False
    beta1: float = 0.9
    beta2: Optional[float] = None
    sgd_sign_update: bool = False
    reset_statistics: bool = False
    proj_params_lr_scale: float = 1.0
    update_gap: int = 200
    rank: int = 256
    inactive_update_rule: str = 'copy'
    inactive_lr_scale: float = 1.0
    proj_type: str = 'std'
    proj_side: str = 'std'
    coord_choice: str = 'update'
    block_order: str = 'ascend'
    lora_enabled: bool = False
    lora_rank: int = 8
    lora_alpha: int = 16
    lora_dropout: float = 0.05
    lora_all_modules: bool = False
    freeze_embeddings: bool = False
    freeze_norms: bool = False
    lr: Optional[float] = None

training_args = TrainingArgs(
    run_name='',
    lr_scheduler_type='linear',
    bf16=False,
    fp16=True,
    per_device_train_batch_size=4,
    gradient_accumulation_steps=2,
    weight_decay=0.01,
    learning_rate=1e-4,
    max_grad_norm=1.0,
    seed=42,
    output_dir='/tmp/output-',
    wandb_tags=[]
)

optimizer_args = OptimizerArgs(
    optimizer='adamw',
    nesterov=False,
    beta1=0.9,
    beta2=None,
    sgd_sign_update=False,
    reset_statistics=False,
    proj_params_lr_scale=1.0,
    update_gap=200,
    rank=256,
    inactive_update_rule='copy',
    inactive_lr_scale=1.0,
    proj_type='std',
    proj_side='std',
    coord_choice='update',
    block_order='ascend',
    lora_enabled=False,
    lora_rank=8,
    lora_alpha=16,
    lora_dropout=0.05,
    lora_all_modules=False,
    freeze_embeddings=False,
    freeze_norms=False,
    lr=None
)

ARGS = {
    'training_args': training_args,
    'optimizer_args': optimizer_args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_cosine_schedule_with_multiple_warmups Ran
ran; our contract draft was wrong, not the code
fzmushko/frugal/utils/training_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from QiaoXiao7282/SMET, is pointer only (licence: NONE) · get_code("9abbd152ba303087")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from QiaoXiao7282/SMET, and GitHub detected no licence in that repository 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.

get_cyclical_cosine_schedule_with_min_lr Ran
ran; our contract draft was wrong, not the code
fzmushko/frugal/utils/training_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from QiaoXiao7282/SMET, is pointer only (licence: NONE) · get_code("f58a7fbb020fe7cd")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from QiaoXiao7282/SMET, and GitHub detected no licence in that repository 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.

get_scheduler Ran
ran; our contract draft was wrong, not the code
fzmushko/frugal/utils/training_utils.py
code served (permissive licence) · get_code("f9d92971ebcb2964")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned LambdaLR. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.optim import SGD

torch.manual_seed(0)

# Create a minimal model for the optimizer
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = SGD(model.parameters(), lr=0.1)

# Define arguments for get_scheduler
ARGS = {
    'optimizer': optimizer,
    'scheduler_type': 'cosine',
    'num_training_steps': 1000,
    'warmup_steps': 100,
    'min_lr_ratio': 0.1,
    'cycle_length': 1000,
    'restart_warmup_steps': None,
    'adjust_step': 0,
    'last_epoch': -1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
prepare_proj_params Ran
ran; our contract draft was wrong, not the code
fzmushko/frugal/frugal/proj_optimizer_templates.py
code served (permissive licence) · get_code("204c6ebe745d2795")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

# Create a small model with Linear modules and named parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        # Create modules with target names
        self.attn = nn.Linear(4, 3)
        self.mlp = nn.Linear(3, 4)
        self.q_proj = nn.Linear(4, 3)
        self.v_proj = nn.Linear(4, 3)
        self.norm = nn.LayerNorm(4)
        self.embed_tokens = nn.Embedding(10, 4)
        self.lm_head = nn.Linear(4, 5)
        # A non-target linear layer that should be in regular_params
        self.other_linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return x

# Instantiate the model
model = SimpleModel()

# Ensure all parameters require gradients
for param in model.parameters():
    param.requires_grad = True

ARGS = {
    'model': model,
    'target_modules_list': None,
    'proj_norms': False,
    'proj_embeds': False,
    'proj_logits': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rotate_half Ran
ran; our contract draft was wrong, not the code
fzmushko/frugal/utils/modeling_llama.py
code served (permissive licence) · get_code("b99eea6376d1e212")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function rotate_half takes a single parameter 'x' which is a tensor
# It accesses x.shape[-1] to get the last dimension
# It uses indexing with [..., :] slicing notation
# It calls torch.cat() to concatenate tensors

# Create a small tensor with shape (2, 4) - batch size 2, hidden dim 4
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 2 the same month, 4 later) and 4 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
210 dated earlier, 6 the same month, 135 later, 6 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
60 dated earlier, 2 the same month, 19 later, 2 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
get_cyclical_cosine_schedule_with_min_lr 7 other papers
4 dated earlier, 3 later
2307.05695 (2023-07)
ReLoRA: High-Rank Training Through Low-Rank Updates
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
and 4 more not named here
get_cosine_schedule_with_multiple_warmups 4 other papers
3 dated earlier, 1 later
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
and 1 more not named here

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-23.

Repositories linked to this paper

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

Abstract

With the increase in the number of parameters in large language models, the process of pre-training and fine-tuning increasingly demands larger volumes of GPU memory. A significant portion of this memory is typically consumed by the optimizer state. To overcome this challenge, recent approaches such as low-rank adaptation (LoRA (Hu et al., 2021)), low-rank gradient projection (GaLore (Zhao et al., 2024)), and blockwise optimization (BAdam (Luo et al., 2024)) have been proposed. However, in all these algorithms, the $\textit{effective rank of the weight updates remains low-rank}$, which can lead to a substantial loss of information from the gradient. This loss can be critically important, especially during the pre-training stage. In this paper, we introduce $\texttt{FRUGAL}$ ($\textbf{F}$ull-$\textbf{R}$ank $\textbf{U}$pdates with $\textbf{G}$r$\textbf{A}$dient sp$\textbf{L}$itting), a new memory-efficient optimization framework. $\texttt{FRUGAL}$ leverages gradient splitting to perform low-dimensional updates using advanced algorithms (such as Adam), while updates along the remaining directions are executed via state-free methods like SGD or signSGD (Bernstein et al., 2018). Our framework can be integrated with various low-rank update selection techniques, including GaLore and BAdam. We provide theoretical convergence guarantees for our framework when using SGDM for low-dimensional updates and SGD for state-free updates. Additionally, our method consistently outperforms concurrent approaches across various fixed memory budgets, achieving state-of-the-art results in pre-training and fine-tuning tasks while balancing memory efficiency and performance metrics.

For agents

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

get_harvested_code_for_paper("2411.07837")
get_code_for_paper("2411.07837")
have("2411.07837")

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

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

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

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

Connect an agent — have() is free.