SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.17227 · ICLR · 2024

Efficient Backpropagation with Variance-Controlled Adaptive Sampling

Jun Zhu, Jianfei Chen, Ziteng Wang

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 3 failures of our instrument; 2 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/2402.17227.json · badge: /api/ran/2402.17227.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/vcas canonical (classifier label)
classifier basis: classifier_2025
8 ran · 2 no recorded run
FunctionStatusWhere it lives
ActSampler Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("ba445cd4cf315028")
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 an instance of its own class, ActSampler: the run constructed the object and did not call it, so no result was computed. 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 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

torch.manual_seed(0)

class Scheme:
    def __init__(self):
        self.sample = False
        self.cal_var = True
        self.s = 0.5
        self.act_ratio_sched = [0.5, 0.6, 0.7]
        self.act_ratio_up_sched = [0.0, 0.0, 0.0]
        self.act_ratio_down_sched = [0.0, 0.0, 0.0]
        self.nonzero_data_index = None
        self.args = type('Args', (), {'s_update_step': 0.1})()
    
    def register_act_sampler(self, sampler):
        pass

scheme = Scheme()

ARGS = {
    "scheme": scheme
}
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 ActSampler — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ActSampler 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
Linear Ran
ran on a synthesized input
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("df0b4214c141ce1c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. 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 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 torch.nn as nn

# Create a minimal scheme object that the Linear layer expects
class MinimalScheme:
    def __init__(self):
        self.sample = False
        self.cal_var = False
        self.nonzero_data_index = None
        self.w_ratio_list = {}
        self.sample_perm_list = {}
        self.sgd_grad_dict = {}
        self.sgd_grad_mean_dict = {}
        self.sgd_sq_grad_mean_dict = {}
        self.w_var_dict = {}
        self.act_var_dict = {}
    
    def register_linear(self, linear_layer):
        pass

# Create a base linear layer to wrap
base_linear = nn.Linear(in_features=4, out_features=3, bias=True)

# Create scheme
scheme = MinimalScheme()

INIT_ARGS = {
    'linear_ori': base_linear,
    'scheme': scheme
}

ARGS = {
    'input': torch.randn(2, 4)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
VcasSampleArguments Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("ed9c7478c271d5c5")
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 an instance of its own class, VcasSampleArguments: the run constructed the object and did not call it, so no result was computed. 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
from dataclasses import dataclass, field

torch.manual_seed(0)

ARGS = {
    'act_var_tau': 0.025,
    'w_var_tau': 0.025,
    'cal_var_freq': 100,
    's_update_step': 0.01,
    'w_ratio_mul': 0.95,
    'cal_var_m': 2,
    'act_sched_decay': 0.6,
    'param_sample_ratio': 0.01,
}
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 VcasSampleArguments — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VcasSampleArguments 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
find_top_sum Ran
ran; our contract draft was wrong, not the code
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("9e66beb8df316fd7")
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 float, 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)

# Create a small tensor for testing
# The function uses: tensor.view(-1), tensor.sum(), torch.sort(), torch.cumsum()
tensor = torch.randn(2, 4)

# Create a target_percentage between 0 and 1
target_percentage = 0.8

ARGS = {
    "tensor": tensor,
    "target_percentage": target_percentage,
}
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 float, 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
leverage_k Ran
ran; our contract draft was wrong, not the code
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("5b17933b4ea5e8af")
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 float, 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 torch

torch.manual_seed(0)

# A is shape (M, K) - matrix with K columns
# B is shape (K, N) - matrix with K rows
# ratio is a float between 0 and 1

M = 2
K = 4
N = 3

A = torch.randn(M, K)
B = torch.randn(K, N)
ratio = 0.5

ARGS = {
    "A": A,
    "B": B,
    "ratio": ratio,
}
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 2, dtype family float, 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
linear Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("0e793350f9814916")
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 an instance of its own class, linear: the run constructed the object and did not call it, so no result was computed. 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 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

torch.manual_seed(0)

# Create tiny tensors for testing
batch_size = 2
C_in = 4
C_out = 3

input_tensor = torch.randn(batch_size, C_in)
weight_tensor = torch.randn(C_out, C_in)
bias_tensor = torch.randn(C_out)

# Create a scheme object with all required attributes
class Scheme:
    def __init__(self):
        self.sample = False
        self.cal_var = False
        self.nonzero_data_index = torch.tensor([0, 1])
        self.w_ratio_list = [0.5]
        self.sample_perm_list = [torch.tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])]
        self.sgd_grad_dict = {}
        self.sgd_grad_mean_dict = {}
        self.sgd_sq_grad_mean_dict = {}
        self.w_var_dict = {}
        self.act_var_dict = {}

scheme = Scheme()
idx = 0

ARGS = {
    "input": input_tensor,
    "weight": weight_tensor,
    "bias": bias_tensor,
    "scheme": scheme,
    "idx": idx,
}
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 linear — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a linear 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
sampling Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("d133f23c0715ba63")
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 an instance of its own class, sampling: the run constructed the object and did not call it, so no result was computed. 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 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 minimal scheme object that has all required attributes
class Scheme:
    def __init__(self):
        self.sample = True
        self.act_ratio_sched = [0.5, 0.6, 0.7]
        self.nonzero_data_index = None
        self.cal_var = False
        self.s = 0.8
        self.act_ratio_up_sched = [0.0, 0.0, 0.0]
        self.act_ratio_down_sched = [0.0, 0.0, 0.0]
        self.args = type('Args', (), {'s_update_step': 0.1})()

# Create test tensors
input_tensor = torch.randn(2, 4)  # batch_size=2, feature_dim=4
scheme = Scheme()
idx = 0

ARGS = {
    'input': input_tensor,
    'scheme': scheme,
    'idx': idx
}
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 sampling — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a sampling 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
soft_topk Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("d4d8fa0fce043913")
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 2, 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 a small tensor for testing
# The function expects a 1D tensor based on how it uses x.shape[0]
x = torch.randn(5)

# k should be less than N for the interesting case
k = 2

ARGS = {
    "x": x,
    "k": k,
}
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 2, 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
VcasSampleScheme Not yet run
unverified (harvested, no recorded run)
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("7ad9a72c7c1854f1")
How it ran

no invocation recorded.

cal_leverage_var Not yet run
unverified (harvested, no recorded run)
thu-ml/vcas/vcas/sample_scheme.py
code served (permissive licence) · get_code("e1f851c5530e9bf3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 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.

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

Sampling-based algorithms, which eliminate "unimportant" computations during forward and/or back propagation (BP), offer potential solutions to accelerate neural network training. However, since sampling introduces approximations to training, such algorithms may not consistently maintain accuracy across various tasks. In this work, we introduce a variance-controlled adaptive sampling (VCAS) method designed to accelerate BP. VCAS computes an unbiased stochastic gradient with fine-grained layerwise importance sampling in data dimension for activation gradient calculation and leverage score sampling in token dimension for weight gradient calculation. To preserve accuracy, we control the additional variance by learning the sample ratio jointly with model parameters during training. We assessed VCAS on multiple fine-tuning and pre-training tasks in both vision and natural language domains. On all the tasks, VCAS can preserve the original training loss trajectory and validation accuracy with an up to 73.87% FLOPs reduction of BP and 49.58% FLOPs reduction of the whole training process. The implementation is available at https://github.com/thu-ml/VCAS.

For agents

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

get_harvested_code_for_paper("2402.17227")
get_code_for_paper("2402.17227")
have("2402.17227")

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

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

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

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

Connect an agent — have() is free.