SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.07315 · ICLR · 2025

Group-robust Sample Reweighting for Subpopulation Shifts via Influence Functions

Bryan Kian, Hsiang Low, Wei Pang, Koh, Zhaoxuan Wu, Rui Qiao, Jingtan Wang

arXiv · PDF · Open in the Atlas

Code that ran

4 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 2 failures of our instrument; 10 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/2503.07315.json · badge: /api/ran/2503.07315.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
qiaoruiyt/gsr canonical (classifier label)
classifier basis: classifier_2025
4 ran · 10 no recorded run
FunctionStatusWhere it lives
StepLR Ran
ran on a synthesized input · constructed an object; no result was computed
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("08917fa5845d4743")
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, StepLR: 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 torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "step_size": 30,
    "gamma": 0.1,
}
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 StepLR — 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 StepLR 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
WeightedObjective Ran
ran on a synthesized input · constructed an object; no result was computed
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("6f1d4d10d1e5c202")
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, WeightedObjective: 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 torch.nn as nn
import torch.nn.functional as F

torch.manual_seed(0)

# Create a minimal model that takes input and produces logits
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(4, 3)  # 4 input features, 3 classes
    
    def forward(self, x):
        return self.fc(x)

# Create sample weights tensor for batch indexing
sample_weights = torch.tensor([0.5, 0.7, 0.6, 0.8, 0.9])

ARGS = {
    "sample_weights": sample_weights,
    "weight_decay": 0.01,
    "normalize": 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 WeightedObjective — 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 WeightedObjective 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
evaluate_group_metrics Ran
ran; our contract draft was wrong, not the code
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("e169611ba2ac5ecc")
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. 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
import torch.utils.data as data

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self, num_classes=3):
        super().__init__()
        self.fc = nn.Linear(4, num_classes)
    
    def forward(self, x):
        return self.fc(x)

class SimpleDataset(data.Dataset):
    def __init__(self, n_samples=4, n_groups=2, use_prepared_indices=False):
        self.n_samples = n_samples
        self.n_groups = n_groups
        self.use_prepared_indices = use_prepared_indices
        
        if use_prepared_indices:
            self.all_group_indices = [
                torch.tensor([0, 1]),
                torch.tensor([2, 3])
            ]
        else:
            self.all_group_indices = None
    
    def __len__(self):
        return self.n_samples
    
    def __getitem__(self, idx):
        data_item = torch.randn(4)
        target = torch.tensor(idx % 3)
        group = torch.tensor(idx % self.n_groups)
        confounder = torch.tensor(0)
        index = torch.tensor(idx)
        return data_item, target, group, confounder, index

class SimpleLoader:
    def __init__(self, dataset, batch_size=2):
        self.dataset = dataset
        self.batch_size = batch_size
        self.data_list = [dataset[i] for i in range(len(dataset))]
    
    def __iter__(self):
        for i in range(0, len(self.data_list), self.batch_size):
            batch = self.data_list[i:i+self.batch_size]
            data = torch.stack([item[0] for item in batch])
            target = torch.stack([item[1] for item in batch])
            group = torch.stack([item[2] for item in batch])
            confounder = torch.stack([item[3] for item in batch])
            index = torch.stack([item[4] for item in batch])
            yield data, target, group, confounder, index

dataset = SimpleDataset(n_samples=4, n_groups=2, use_prepared_indices=False)
loader = SimpleLoader(dataset, batch_size=2)
model = SimpleModel(num_classes=3)

ARGS = {
    'model': model,
    'loader': loader,
    'device': 'cpu'
}
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
get_scheduler Ran
ran; our contract draft was wrong, not the code
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("2864831366686f37")
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 StepLR. 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

torch.manual_seed(0)

# The function get_scheduler takes two parameters:
# 1. lr_scheduler_name: string that determines which scheduler to return
# 2. args: optional argument (not used in the current implementation)

# Looking at the function body:
# - lr_scheduler_name is checked against 'step'
# - args is accepted but not used in the function
# - If lr_scheduler_name == 'step', it returns StepLR()
# - Otherwise it raises ValueError

# For valid execution, we need to pass a valid scheduler name
# The only valid value shown is 'step'

ARGS = {
    'lr_scheduler_name': 'step',
    'args': None
}
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 StepLR — a StepLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a StepLR 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
BaseInfluenceModule Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("3fd80b99367c12ea")
How it ran

no invocation recorded.

BaseObjective Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("2c20ae130b043d1b")
How it ran

no invocation recorded.

CGInfluenceModule Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("f479c3ef9035af3a")
How it ran

no invocation recorded.

FastExactInfluenceModule Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("fc12323333290500")
How it ran

no invocation recorded.

FastHFInfluenceModule Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("9b4e102e69368b30")
How it ran

no invocation recorded.

GSRTrainer Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("63ab38b374ee2fc8")
How it ran

no invocation recorded.

LiSSAInfluenceModule Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("8d4b41e721b86e4c")
How it ran

no invocation recorded.

NoninvInfluenceModule Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("b1bcc58431353e09")
How it ran

no invocation recorded.

_del_attr Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("fe7f4afa378d85ca")
How it ran

no invocation recorded.

_set_attr Not yet run
unverified (harvested, no recorded run)
qiaoruiyt/gsr/gsr.py
code served (permissive licence) · get_code("60d1488f20a46cd1")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 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 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.

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

Machine learning models often have uneven performance among subpopulations (a.k.a., groups) in the data distributions. This poses a significant challenge for the models to generalize when the proportions of the groups shift during deployment. To improve robustness to such shifts, existing approaches have developed strategies that train models or perform hyperparameter tuning using the group-labeled data to minimize the worst-case loss over groups. However, a non-trivial amount of high-quality labels is often required to obtain noticeable improvements. Given the costliness of the labels, we propose to adopt a different paradigm to enhance group label efficiency: utilizing the group-labeled data as a target set to optimize the weights of other group-unlabeled data. We introduce Group-robust Sample Reweighting (GSR), a two-stage approach that first learns the representations from group-unlabeled data, and then tinkers the model by iteratively retraining its last layer on the reweighted data using influence functions. Our GSR is theoretically sound, practically lightweight, and effective in improving the robustness to subpopulation shifts. In particular, GSR outperforms the previous state-of-the-art approaches that require the same amount or even more group labels. Our code is available at https://github.com/qiaoruiyt/GSR.

For agents

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

get_harvested_code_for_paper("2503.07315")
get_code_for_paper("2503.07315")
have("2503.07315")

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

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

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

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

Connect an agent — have() is free.