SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.01507 · NeurIPS · 2023

Memory Efficient Optimizers with 4-bit States

Jun Zhu, Jianfei Chen, Bingrui Li

arXiv · PDF · Open in the Atlas

Code that ran

6 of 16 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; 2 failures of our instrument; 10 no recorded run), measured 2026-11-23; 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/2309.01507.json · badge: /api/ran/2309.01507.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
thu-ml/low-bit-optimizers canonical (classifier label)
classifier basis: census
4 ran · 2 no recorded run
TimDettmers/bitsandbytes community
Papers with Code archive
2 ran · 8 no recorded run
FunctionStatusWhere it lives
compute_tensor_bytes Ran
ran, honoured the contract we drafted
thu-ml/low-bit-optimizers/lpmm/utils.py
code served (permissive licence) · get_code("d2bb0513c0ced80b")
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 int64, 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)

# Create test tensors with different dtypes and small sizes
tensor_float32 = torch.randn(2, 4, dtype=torch.float32)
tensor_int = torch.randint(0, 10, (2, 4), dtype=torch.int)
tensor_bfloat16 = torch.randn(2, 4, dtype=torch.bfloat16)
tensor_float16 = torch.randn(2, 4, dtype=torch.float16)
tensor_int16 = torch.randint(0, 10, (2, 4), dtype=torch.int16)
tensor_int8 = torch.randint(0, 10, (2, 4), dtype=torch.int8)

# Test with list of tensors
tensors_list = [tensor_float32, tensor_int, tensor_bfloat16, tensor_float16, tensor_int16, tensor_int8]

ARGS = {
    "tensors": tensors_list
}
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 int64, 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
create_dynamic_map Ran
ran, honoured the contract we drafted
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("7fdba018171d569d")
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 1, dtype family float, shape (256,) 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)

ARGS = {
    "signed": True,
    "max_exponent_bits": 7,
    "total_bits": 8,
}
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 Tensor, ndim 1, dtype family float, shape (256,) — shape (256,) 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
get_memory_usage Ran
ran, honoured the contract we drafted
thu-ml/low-bit-optimizers/lpmm/utils.py
code served (permissive licence) · get_code("91fa51701824ba48")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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)

ARGS = {
    'print_info': 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 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
get_ptr Ran
ran; our contract draft was wrong, not the code
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("fe16424c4d1274c3")
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 c_void_p. 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 ctypes as ct

torch.manual_seed(0)

# Create a small tensor for testing
tensor_arg = torch.randn(2, 4)

# Also test the None case by creating a second argument set
# But since the function signature only has one parameter, we'll test with the tensor
ARGS = {
    "A": tensor_arg
}
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 c_void_p — a c_void_p output has no array shape of its own; none is 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
min_fn Ran
ran, violated the contract we drafted
thu-ml/low-bit-optimizers/lpmm/utils.py
code served (permissive licence) · get_code("3de3be977987454d")
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

torch.manual_seed(0)

# The function min_fn(a, b) returns a < b
# This is a simple comparison operation that works with any comparable types
# Let's provide two simple numeric values

a = 5
b = 10

ARGS = {
    "a": a,
    "b": b,
}
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 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
quant_scaling Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thu-ml/low-bit-optimizers/lpmm/functional.py
code served (permissive licence) · get_code("ea43590572014e4b")
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. 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

torch.manual_seed(0)

# Create a small test tensor
qx = torch.randn(4, 3, dtype=torch.float32)

# Define ARGS dict with all required parameters for quant_scaling
ARGS = {
    'qx': qx,
    'scale_type': 'tensor',
    'gp_sz': 2
}
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 tuple — a tuple output has no array shape of its own; none is 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
GlobalOptimManager Not yet run
unverified (harvested, no recorded run)
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("cc9b180d56dffb55")
How it ran

no invocation recorded.

GlobalPageManager Not yet run
unverified (harvested, no recorded run)
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("41b6a354727a39f2")
How it ran

no invocation recorded.

Optimizer8bit Not yet run
unverified (harvested, no recorded run)
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("c13970cae0e4a5cc")
How it ran

no invocation recorded.

elementwise_func Not yet run
unverified (harvested, no recorded run)
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("9b56a04f1799f813")
How it ran

no invocation recorded.

fill Not yet run
unverified (harvested, no recorded run)
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("ffaf09e9115fadc4")
How it ran

no invocation recorded.

get_config Not yet run
unverified (harvested, no recorded run)
thu-ml/low-bit-optimizers/lpmm/config.py
code served (permissive licence) · get_code("fb980938b63437b1")
How it ran

no invocation recorded.

get_paged Not yet run
unverified (harvested, no recorded run)
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("58028763004a706b")
How it ran

no invocation recorded.

prefetch_tensor Not yet run
unverified (harvested, no recorded run)
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("b3492dd2ebb56802")
How it ran

no invocation recorded.

sync_gpu Not yet run
unverified (harvested, no recorded run)
TimDettmers/bitsandbytes/bitsandbytes/optim/optimizer.py
code served (permissive licence) · get_code("6e31b8a818bea572")
How it ran

no invocation recorded.

update_config Not yet run
unverified (harvested, no recorded run)
thu-ml/low-bit-optimizers/lpmm/config.py
code served (permissive licence) · get_code("7312dc8a06a264c3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 16 samples lifted from this paper's linked repositories, 16 carry a function identity and 0 do not. Of the 16 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 14 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
create_dynamic_map
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2211.05100 (2022-11)
BLOOM: A 176B-Parameter Open-Access Multilingual Language Model
get_memory_usage 1 other paper
1 dated earlier
2104.14129 (2021-04)
ActNN: Reducing Training Memory Footprint via 2-Bit Activation Compressed Training

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

Optimizer states are a major source of memory consumption for training neural networks, limiting the maximum trainable model within given memory budget. Compressing the optimizer states from 32-bit floating points to lower bitwidth is promising to reduce the training memory footprint, while the current lowest achievable bitwidth is 8-bit. In this work, we push optimizer states bitwidth down to 4-bit through a detailed empirical analysis of first and second moments. Specifically, we find that moments have complicated outlier patterns, that current block-wise quantization cannot accurately approximate. We use a smaller block size and propose to utilize both row-wise and column-wise information for better quantization. We further identify a zero point problem of quantizing the second moment, and solve this problem with a linear quantizer that excludes the zero point. Our 4-bit optimizers are evaluated on a wide variety of benchmarks including natural language understanding, machine translation, image classification, and instruction tuning. On all the tasks our optimizers can achieve comparable accuracy with their full-precision counterparts, while enjoying better memory efficiency. * * Code is available at https://github.com/thu-ml/low-bit-optimizers † Corresponding author. 37th Conference on Neural Information Processing Systems (NeurIPS 2023).

For agents

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

get_harvested_code_for_paper("2309.01507")
get_code_for_paper("2309.01507")
have("2309.01507")

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

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

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

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

Connect an agent — have() is free.