SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.08328 · CVPR · 2023

Distribution Shift Inversion for Out-of-Distribution Prediction

Xinchao Wang, Songhua Liu, Xingyi Yang, Runpeng Yu

arXiv · PDF · Open in the Atlas

Code that ran

8 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; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 2 failures of our instrument; 8 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/2306.08328.json · badge: /api/ran/2306.08328.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
yu-rp/distribution-shift-iverson canonical (classifier label)
classifier basis: census
8 ran · 8 no recorded run
FunctionStatusWhere it lives
Classifier Ran
ran; our contract draft was wrong, not the code
yu-rp/distribution-shift-iverson/DSI/Predictor/domainbed_part/networks.py
code served (permissive licence) · get_code("ce7990d7ad5821ff")
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 Linear. 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)

ARGS = {
    "in_features": 16,
    "out_features": 4,
    "is_nonlinear": 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 Linear — a Linear output has no array shape of its own; none 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
Featurizer Ran
ran on a synthesized input
yu-rp/distribution-shift-iverson/DSI/Predictor/domainbed_part/networks.py
code served (permissive licence) · get_code("387b3ed83dbf9591")
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 MLP. 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)

# For the 1D case (MLP)
hparams = {
    'mlp_width': 16,
    'mlp_dropout': 0.1,
    'mlp_depth': 3,
    'resnet_dropout': 0.1
}

# Test with a 1D input shape (for MLP branch)
input_shape_1d = (8,)

ARGS = {
    'input_shape': input_shape_1d,
    'hparams': hparams
}
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 MLP — a MLP output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MLP 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
Fourier Ran
ran on a synthesized input
yu-rp/distribution-shift-iverson/DSI/DiffusionModel/post_processing.py
code served (permissive licence) · get_code("af49b2eeee127db3")
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 ndarray, ndim 3, dtype family float, shape (2, 4, 2) 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

torch.manual_seed(0)

# The function expects a tensor with a detach() method, cpu() method, and numpy() method
# It performs a 2D FFT, so we need at least 2D data
# We'll create a small 2D tensor (batch_size=2, height=4, width=3)
x = torch.randn(2, 4, 3)

ARGS = {
    'x': x
}
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 ndarray, ndim 3, dtype family float, shape (2, 4, 2) — shape (2, 4, 2) 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
cpu_var Ran
ran on a synthesized input
yu-rp/distribution-shift-iverson/DSI/metrics.py
code served (permissive licence) · get_code("5c82a73ea5e957eb")
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 function. 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
import functools

torch.manual_seed(0)

def cpu_var(func):
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        nargs = [arg.cpu() for arg in args]
        nkwargs = {}
        for k, v in kwargs.items():
            nkwargs[k] = v.cpu()
        return func(*nargs, **nkwargs)
    return wrapper

def dummy_func(x, y):
    return x + y

decorated_func = cpu_var(dummy_func)

ARGS = {
    'func': decorated_func
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
detach_var Ran
ran on a synthesized input
yu-rp/distribution-shift-iverson/DSI/metrics.py
code served (permissive licence) · get_code("4a5985f881f48c7d")
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 function. 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 functools

torch.manual_seed(0)

# The function detach_var is a decorator that takes a function as input
# It returns a wrapper function that detaches tensor arguments before calling the original function

# Create a simple test function to be decorated
def sample_function(tensor_arg, scalar_arg, **kwargs):
    """A simple function that takes tensors and other arguments"""
    return tensor_arg + scalar_arg

# Create test tensors
test_tensor_1 = torch.randn(2, 4, requires_grad=True)
test_tensor_2 = torch.randn(2, 4, requires_grad=True)

# Create test keyword argument tensor
test_kwarg_tensor = torch.randn(2, 4, requires_grad=True)

ARGS = {
    "func": sample_function
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
flatten Ran
ran on a synthesized input
yu-rp/distribution-shift-iverson/DSI/DiffusionModel/post_processing.py
code served (permissive licence) · get_code("e57760f9904f71d8")
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 (4, 2) 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 flatten function takes a tensor y and reshapes it
# It expects y to have a .shape attribute and .reshape() method
# It accesses y.shape[0] (batch dimension) and uses -1 for flattening
# Then transposes the result

y = torch.randn(2, 4)  # batch_size=2, features=4

ARGS = {
    "y": y
}
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 (4, 2) — shape (4, 2) 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
pprint Ran
ran on a synthesized input
yu-rp/distribution-shift-iverson/DSI/utils.py
code served (permissive licence) · get_code("4f0c7fbe852a3d65")
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 str. 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)

# Test case 1: dict with with_title=False
dict_obj_1 = {
    'key1': 'value1_test',
    'key2': 'value2_test',
    'key3': 'value3_test'
}

# Test case 2: dict with with_title=True
dict_obj_2 = {
    'loss': 0.5432,
    'accuracy': 0.9876,
    'epoch': 42
}

# Test case 3: list with with_title=False
list_obj_1 = [
    'item_one',
    'item_two',
    'item_three',
    'item_four'
]

# Test case 4: list/tuple with with_title=True (pairs of name, value)
list_obj_2 = [
    'metric1', 0.123,
    'metric2', 0.456,
    'metric3', 0.789
]

# Test case 5: tuple with with_title=False
tuple_obj_1 = ('val_a', 'val_b', 'val_c')

# Main ARGS dict - using dict_obj_1 and with_title=False as base case
ARGS = {
    'obj': dict_obj_1,
    'with_title': False
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
remove_batch_norm_from_resnet Ran
ran; our contract draft was wrong, not the code
yu-rp/distribution-shift-iverson/DSI/Predictor/domainbed_part/networks.py
code served (permissive licence) · get_code("196cab71d7129d62")
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 MinimalResNet. 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)

class Identity(nn.Module):
    """An identity layer"""

    def __init__(self):
        super(Identity, self).__init__()

    def forward(self, x):
        return x

class BottleneckBlock(nn.Module):
    """Minimal bottleneck block for ResNet"""
    def __init__(self, in_channels, out_channels, downsample=False):
        super(BottleneckBlock, self).__init__()
        self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=1)
        self.bn1 = nn.BatchNorm2d(out_channels)
        self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=3, padding=1)
        self.bn2 = nn.BatchNorm2d(out_channels)
        self.conv3 = nn.Conv2d(out_channels, out_channels * 4, kernel_size=1)
        self.bn3 = nn.BatchNorm2d(out_channels * 4)
        
        if downsample:
            self.downsample = nn.Sequential(
                nn.Conv2d(in_channels, out_channels * 4, kernel_size=1),
                nn.BatchNorm2d(out_channels * 4)
            )
        else:
            self.downsample = None

class MinimalResNet(nn.Module):
    """Minimal ResNet-like model for testing"""
    def __init__(self):
        super(MinimalResNet, self).__init__()
        self.conv1 = nn.Conv2d(3, 64, kernel_size=7, padding=3)
        self.bn1 = nn.BatchNorm2d(64)
        
        self.layer1 = nn.Sequential(
            BottleneckBlock(64, 64, downsample=False)
        )
        self.layer2 = nn.Sequential(
            BottleneckBlock(256, 128, downsample=True)
        )
        self.layer3 = nn.Sequential(
            BottleneckBlock(512, 256, downsample=False)
        )
        self.layer4 = nn.Sequential(
            BottleneckBlock(1024, 512, downsample=False)
        )

model = MinimalResNet()

ARGS = {
    "model": model
}
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 MinimalResNet — a MinimalResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MinimalResNet 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
download_models Not yet run
unverified (harvested, no recorded run)
yu-rp/distribution-shift-iverson/DiffusionModel/stable-diffusion-main/notebook_helpers.py
code served (permissive licence) · get_code("4533e43e06a12dc5")
How it ran

no invocation recorded.

ensemble Not yet run
unverified (harvested, no recorded run)
yu-rp/distribution-shift-iverson/DSI/Predictor/ensemble.py
code served (permissive licence) · get_code("abee7dd03af97a09")
How it ran

no invocation recorded.

ensemble2 Not yet run
unverified (harvested, no recorded run)
yu-rp/distribution-shift-iverson/DSI/Predictor/ensemble.py
code served (permissive licence) · get_code("5b4b926100b414ec")
How it ran

no invocation recorded.

ensembleN Not yet run
unverified (harvested, no recorded run)
yu-rp/distribution-shift-iverson/DSI/Predictor/ensemble.py
code served (permissive licence) · get_code("42050f16bad6d41f")
How it ran

no invocation recorded.

get_algorithm_class Not yet run
unverified (harvested, no recorded run)
yu-rp/distribution-shift-iverson/DSI/Predictor/domainbed_part/algorithms.py
code served (permissive licence) · get_code("b0bc80b1655a6802")
How it ran

no invocation recorded.

gpu_summary Not yet run
unverified (harvested, no recorded run)
yu-rp/distribution-shift-iverson/DSI/utils.py
code served (permissive licence) · get_code("bc1daaae1ff9752f")
How it ran

no invocation recorded.

pp_identity Not yet run
unverified (harvested, no recorded run)
yu-rp/distribution-shift-iverson/DSI/DiffusionModel/post_processing.py
code served (permissive licence) · get_code("1a36f0162b6d35c9")
How it ran

no invocation recorded.

ptime Not yet run
unverified (harvested, no recorded run)
yu-rp/distribution-shift-iverson/DSI/utils.py
code served (permissive licence) · get_code("e924f83e343bd341")
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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 1 the same month, 4 later) and 12 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
get_algorithm_class 39 other papers
26 dated earlier, 13 later
1907.02893 (2019-07)
Invariant Risk Minimization
2007.01434 (2020-07)
In Search of Lost Domain Generalization
2007.02931 (2020-07)
Adaptive Risk Minimization: Learning to Adapt to Domain Shift
and 36 more not named here
Classifier 24 other papers
12 dated earlier, 12 later · 4 only as an assembly brick
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2205.09739 (2022-05)
Diverse Weight Averaging for Out-of-Distribution Generalization
and 21 more not named here
remove_batch_norm_from_resnet 23 other papers
11 dated earlier, 12 later
1907.02893 (2019-07)
Invariant Risk Minimization
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
and 20 more not named here
download_models 17 other papers
4 dated earlier, 1 the same month, 11 later, 1 same year, order not determinable
2211.01324 (2022-11)
eDiff-I: Text-to-Image Diffusion Models with an Ensemble of Expert Denoisers
Dombrowski_Foreground-Background_Separation_through_Concept_Distillation_from_Generative_Image_Foundation_Models_ICCV_2023_paper (2023 (year only))
Foreground-Background Separation through Concept Distillation from Generative Image Foundation Models
2303.00836 (2023-03)
Ensemble flow reconstruction in the atmospheric boundary layer from spatially limited measurements through latent diffusion models
and 14 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

Figure 1. Transformed OoD samples from PACS dataset. Odd rows show the original OoD images, and even rows show their transformation results to the source distribution, obtained by the proposed DSI. Please zoom in for better visualization.

For agents

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

get_harvested_code_for_paper("2306.08328")
get_code_for_paper("2306.08328")
have("2306.08328")

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

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

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

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

Connect an agent — have() is free.