SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.02827 · 2024

BAdam: A Memory Efficient Full Parameter Optimization Method for Large Language Models

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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-22; 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/2404.02827.json · badge: /api/ran/2404.02827.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
ledzy/badam canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
clip_grad_norm_old_version Ran
ran, honoured the contract we drafted
ledzy/badam/src/badam/utils.py
code served (permissive licence) · get_code("faa2fc6a07909c54")
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 Tensor, ndim 0, dtype family float, shape () 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
import torch.nn as nn
from types import MethodType

torch.manual_seed(0)

# Create a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create a minimal accelerator mock that has the required attributes and methods
class MockAccelerator:
    def __init__(self):
        self.distributed_type = None
        self._models = []
    
    def unscale_gradients(self):
        pass
    
    def clip_grad_norm_(self, max_norm, norm_type=2):
        pass

# Create model and parameters
model = SimpleModel()

# Create some gradients for testing
x = torch.randn(2, 4)
y = torch.randn(2, 3)
loss = nn.MSELoss()

# Forward pass and backward to create gradients
output = model(x)
l = loss(output, y)
l.backward()

# Get parameters with gradients
parameters = list(model.parameters())

# Create mock accelerator instance
accelerator = MockAccelerator()

ARGS = {
    'self': accelerator,
    'parameters': parameters,
    'max_norm': 1.0,
    'norm_type': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
accelerate, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () 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
flat_collate_fn Ran
ran, honoured the contract we drafted
ledzy/badam/roberta-superglue/jiant/tasks/core.py
code served (permissive licence) · get_code("8f7619b2828926ea")
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 Tensor, ndim 2, dtype family int, shape (2, 3) 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 numpy as np
import torch.utils.data.dataloader as dataloader

torch_seed = 0

# Test case 1: numpy array batch
batch_numpy = [np.array([1, 2, 3]), np.array([4, 5, 6])]

# Test case 2: int batch
batch_int = [1, 2, 3]

# Test case 3: float batch
batch_float = [1.5, 2.5, 3.5]

# Test case 4: string batch
batch_str = ["hello", "world"]

# Test case 5: list batch (should return as-is)
batch_list = [[1, 2], [3, 4]]

# Test case 6: dict batch (should return as-is)
batch_dict = [{"a": 1}, {"b": 2}]

# Test case 7: set batch (should return as-is)
batch_set = [{"x", "y"}, {"z"}]

# We'll use the numpy array batch as the primary test
ARGS = {
    "batch": batch_numpy
}
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 Tensor, ndim 2, dtype family int, shape (2, 3) — shape (2, 3) 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
metadata_collate_fn Ran
ran; our contract draft was wrong, not the code
ledzy/badam/roberta-superglue/jiant/tasks/core.py
code served (permissive licence) · get_code("61ffc5549a75fe3c")
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 dict. 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 numpy as np

torch.manual_seed(0)

# The function takes a list of dictionaries and collates them by grouping
# values for each key. We need to create a list of metadata dictionaries.

metadata = [
    {
        "id": 1,
        "name": "sample_1",
        "tensor": torch.randn(2, 4),
        "score": 0.95
    },
    {
        "id": 2,
        "name": "sample_2",
        "tensor": torch.randn(2, 4),
        "score": 0.87
    }
]

ARGS = {
    "metadata": metadata
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
resolve_is_lower_case Ran
ran, violated the contract we drafted
ledzy/badam/roberta-superglue/jiant/shared/model_resolution.py
code served (permissive licence) · get_code("e17e83a5650fd73c")
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 bool, ndim 0, dtype family float, shape () 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
import transformers
from transformers import BertTokenizer, AlbertTokenizer
from unittest.mock import MagicMock

torch.manual_seed(0)

# Create a mock BertTokenizer with the required attributes
bert_tokenizer = MagicMock(spec=BertTokenizer)
bert_tokenizer.basic_tokenizer = MagicMock()
bert_tokenizer.basic_tokenizer.do_lower_case = True

# Test with different tokenizer types
ARGS = {
    "tokenizer": bert_tokenizer
}
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 bool, ndim 0, dtype family float, shape () — shape () 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
resolve_warmup_steps Ran
ran, honoured the contract we drafted
ledzy/badam/roberta-superglue/jiant/shared/model_setup.py
code served (permissive licence) · get_code("36c8a80131f2e20a")
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 int, ndim 0, dtype family int, shape () 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
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - t_total: used in multiplication with warmup_proportion, so needs to be numeric
# - warmup_steps: can be None or a numeric value
# - warmup_proportion: can be None or a numeric value between 0 and 1
# The function validates that exactly one of warmup_steps or warmup_proportion is provided

# Test case 1: warmup_steps is provided, warmup_proportion is None
ARGS = {
    "t_total": 1000,
    "warmup_steps": 100,
    "warmup_proportion": None
}
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 int, ndim 0, dtype family int, shape () — shape () 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
gradient_checkpointing_enable_for_bcd Not yet run
unverified (harvested, no recorded run)
ledzy/badam/src/badam/utils.py
code served (permissive licence) · get_code("e4c92e390b814bfa")
How it ran

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, 0 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
metadata_collate_fn 4 other papers
4 dated earlier
1804.07461 (2018-04)
GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding
2003.02249 (2020-03)
jiant: A Software Toolkit for Research on General-Purpose Text Understanding Models
2010.04762 (2020-10)
Counterfactually-Augmented SNLI Training Data Does Not Yield Better Generalization Than Unaugmented Data
and 1 more not named here
flat_collate_fn 3 other papers
3 dated earlier
1804.07461 (2018-04)
GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding
2003.02249 (2020-03)
jiant: A Software Toolkit for Research on General-Purpose Text Understanding Models
2112.01753 (2021-12)
Probing Linguistic Information For Logical Inference In Pre-trained Language Models
resolve_is_lower_case 2 other papers
2 dated earlier
1804.07461 (2018-04)
GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding
2112.01753 (2021-12)
Probing Linguistic Information For Logical Inference In Pre-trained Language Models
resolve_warmup_steps 2 other papers
2 dated earlier
1804.07461 (2018-04)
GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding
2112.01753 (2021-12)
Probing Linguistic Information For Logical Inference In Pre-trained Language Models

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

This work presents BAdam, an optimization method that leverages the block coordinate descent (BCD) framework with Adam's update rule. BAdam offers a memory efficient approach to the full parameter finetuning of large language models. We conduct a theoretical convergence analysis for BAdam in the deterministic case. Experimentally, we apply BAdam to finetune the Llama 3-8B and Llama 3-70B models using a single RTX3090-24GB GPU and 4 A100-80GB GPUs, respectively. The results confirm BAdam's efficiency in terms of memory usage, running time, and optimization capability. Furthermore, the downstream performance evaluation based on MT-bench and math benchmarks shows that BAdam outperforms existing memory efficient baselines such as LoRA. It also demonstrates that BAdam can achieve comparable or even superior performance compared to Adam. Finally, the ablation study using SGD's update rule illustrates the suitability of BCD for finetuning LLMs. Our code can be easily integrated into any PyTorch-based codebase and is available at https://github.com/Ledzy/BAdam.

For agents

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

get_harvested_code_for_paper("2404.02827")
get_code_for_paper("2404.02827")
have("2404.02827")

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

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

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

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

Connect an agent — have() is free.