SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.04545 · NeurIPS · 2021

Towards Data-Free Domain Generalization

Volker Tresp, Ahmed Frikha, Haokun Chen, Denis Krompaß, Thomas Runkler, Emtiyaz Khan, Mehmet Gönen, H Frikha, D Chen, T Krompaß, V Runkler, Tresp

arXiv · PDF · Open in the Atlas

Code that ran

15 of 20 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 8 failures of our instrument; 5 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/2110.04545.json · badge: /api/ran/2110.04545.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
HaokunChen245/DFDG marked official in Papers with Code
Papers with Code archive
15 ran · 5 no recorded run
FunctionStatusWhere it lives
MNISTM Ran
ran on a synthesized input · constructed an object; no result was computed
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("cd7b9603cbce6487")
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, MNISTM: 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 os
import torch
import torch.utils.data as data
from PIL import Image
import tempfile
from torchvision import transforms

torch.manual_seed(0)

# Create a temporary directory with the necessary file structure
tmpdir = tempfile.mkdtemp()
mnist_m_dir = os.path.join(tmpdir, 'mnist_m')
train_dir = os.path.join(mnist_m_dir, 'mnist_m_train')
test_dir = os.path.join(mnist_m_dir, 'mnist_m_test')

os.makedirs(train_dir, exist_ok=True)
os.makedirs(test_dir, exist_ok=True)

# Create dummy image files and label files
train_labels_path = os.path.join(mnist_m_dir, 'mnist_m_train_labels.txt')
test_labels_path = os.path.join(mnist_m_dir, 'mnist_m_test_labels.txt')

# Create some dummy training images and labels
with open(train_labels_path, 'w') as f:
    for i in range(2):
        img_name = f'train_img_{i}.png'
        img_path = os.path.join(train_dir, img_name)
        # Create a small RGB image
        img = Image.new('RGB', (28, 28), color=(i*100, i*100, i*100))
        img.save(img_path)
        f.write(f'{img_name} {i % 10}\n')

# Create some dummy test images and labels
with open(test_labels_path, 'w') as f:
    for i in range(2):
        img_name = f'test_img_{i}.png'
        img_path = os.path.join(test_dir, img_name)
        # Create a small RGB image
        img = Image.new('RGB', (28, 28), color=((i+5)*100, (i+5)*100, (i+5)*100))
        img.save(img_path)
        f.write(f'{img_name} {(i + 2) % 10}\n')

# Create a simple transform that converts PIL image to tensor
transform = transforms.Compose([
    transforms.ToTensor(),
])

ARGS = {
    'root': tmpdir,
    'transform': transform
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MNISTM — the run constructed an instance of its own class and did not call it; no shape 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
OfficeHome Ran
ran on a synthesized input · constructed an object; no result was computed
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("52e13479de87ebea")
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, OfficeHome: 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 os
import torch
import torch.utils.data as data
import torchvision.transforms as tfs
import random
from PIL import Image
import tempfile
import shutil

torch.manual_seed(0)

# Create a temporary directory structure for OfficeHome dataset
temp_root = tempfile.mkdtemp()
domain = 'Art'
domain_dir = os.path.join(temp_root, domain)
os.makedirs(domain_dir, exist_ok=True)

# Create class subdirectories with dummy images
classes = ['ALARM CLOCK', 'BACKPACK', 'BATTERIES']
for cls in classes:
    cls_dir = os.path.join(domain_dir, cls.replace(' ', '_'))
    os.makedirs(cls_dir, exist_ok=True)
    # Create dummy image files
    for i in range(5):
        img_path = os.path.join(cls_dir, f'image_{i}.jpg')
        img = Image.new('RGB', (100, 100), color='red')
        img.save(img_path)

# Create split files
split_file_train = os.path.join(domain_dir, 'train.txt')
split_file_val = os.path.join(domain_dir, 'val.txt')
split_file_test = os.path.join(domain_dir, 'test.txt')

with open(split_file_train, 'w') as f:
    for cls in classes:
        for i in range(4):
            f.write(f"{domain}/{cls.replace(' ', '_')}/image_{i}.jpg\n")

with open(split_file_val, 'w') as f:
    for cls in classes:
        f.write(f"{domain}/{cls.replace(' ', '_')}/image_4.jpg\n")

with open(split_file_test, 'w') as f:
    for cls in classes:
        f.write(f"{domain}/{cls.replace(' ', '_')}/image_4.jpg\n")

ARGS = {
    'dataset_root_dir': temp_root,
    'mode': 'train',
    'domain': domain,
    'img_size': 64
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OfficeHome — the run constructed an instance of its own class and did not call it; no shape 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
PACS Ran
ran on a synthesized input · constructed an object; no result was computed
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("c8899dbd625b82a7")
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, PACS: 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 os
import torch
import torch.utils.data as data
import torchvision.transforms as tfs
from PIL import Image
import tempfile
from pathlib import Path

torch.manual_seed(0)

# Create a minimal temporary directory structure that mimics PACS dataset layout
temp_dir = tempfile.mkdtemp()
root_dir = temp_dir

# Create necessary subdirectories
os.makedirs(os.path.join(root_dir, 'splits'), exist_ok=True)
os.makedirs(os.path.join(root_dir, 'images', 'kfold', 'dog'), exist_ok=True)

# Create minimal split files for different modes and domains
split_configs = [
    ('train_art_painting.txt', 'train', 'art_painting'),
    ('val_art_painting.txt', 'val', 'art_painting'),
    ('test_art_painting.txt', 'test', 'art_painting'),
]

for filename, mode, domain in split_configs:
    split_file = os.path.join(root_dir, 'splits', filename)
    with open(split_file, 'w') as f:
        # Write image paths with class labels
        f.write('dog/image_001.jpg 0\n')
        f.write('dog/image_002.jpg 0\n')

# Create dummy image files
dummy_img = Image.new('RGB', (256, 256), color='red')
dummy_img.save(os.path.join(root_dir, 'images', 'kfold', 'dog', 'image_001.jpg'))
dummy_img.save(os.path.join(root_dir, 'images', 'kfold', 'dog', 'image_002.jpg'))

ARGS = {
    'dataset_root_dir': root_dir,
    'mode': 'train',
    'domain': 'art_painting',
    'img_size': 224,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PACS — the run constructed an instance of its own class and did not call it; no shape 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
VLCS Ran
ran on a synthesized input · constructed an object; no result was computed
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("7988844fd79a2a10")
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, VLCS: 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 os
import tempfile
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create a temporary directory structure that mimics VLCS dataset
temp_dir = tempfile.mkdtemp()

# Create domain subdirectory
domain_name = 'Caltech101'
domain_dir = os.path.join(temp_dir, domain_name)
os.makedirs(domain_dir, exist_ok=True)

# Create class subdirectories with dummy images
classes = ['bird', 'car', 'chair', 'dog', 'person']
for cls in classes:
    cls_dir = os.path.join(domain_dir, cls.replace(' ', '_'))
    os.makedirs(cls_dir, exist_ok=True)
    # Create 5 dummy images per class
    for i in range(5):
        img_array = np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8)
        img = Image.fromarray(img_array)
        img.save(os.path.join(cls_dir, f'img_{i}.jpg'))

ARGS = {
    'dataset_root_dir': temp_dir,
    'mode': 'train',
    'domain': domain_name,
    'img_size': 224
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type VLCS — the run constructed an instance of its own class and did not call it; no shape 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
evaluate_oneset Ran
ran, honoured the contract we drafted
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("bf5c752f1fdd2344")
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
import torch.nn as nn

torch.manual_seed(0)

# Build a minimal model that satisfies the function's usage:
# - model.eval() is called
# - model(imgs) is called and .argmax(1) is applied to result
# - Result should have shape compatible with labels comparison
class SimpleClassifier(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)

model = SimpleClassifier(num_classes=3)

# Create a data loader: list of (imgs, labels) tuples
# imgs: shape (batch_size, 4) - batch of 2, feature dim 4
# labels: shape (batch_size,) - class indices
loader = [
    (torch.randn(2, 4), torch.tensor([0, 1])),
    (torch.randn(2, 4), torch.tensor([2, 0])),
]

ARGS = {
    "model": model,
    "loader": loader,
}
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
get_abbr_map Ran
ran; our contract draft was wrong, not the code
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("7e028dd7cef44939")
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

torch.manual_seed(0)

ARGS = {
    'dataset': 'PACS'
}
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 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
get_class_names Ran
ran; our contract draft was wrong, not the code
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("38e9002eb1f23978")
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 list, ndim 1, 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
import numpy as np

torch.manual_seed(0)

# The function get_class_names takes a dataset parameter and returns class names
# based on the dataset name. It doesn't actually use the dataset object beyond
# comparing it to strings, so we just need to pass a valid dataset name string.

ARGS = {
    'dataset': 'PACS'
}
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 list, ndim 1, dtype family float — a list 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
get_class_number Ran
ran, honoured the contract we drafted
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("068a32afcb1a875d")
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

torch.manual_seed(0)

ARGS = {
    'dataset': 'PACS'
}
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_net Ran
ran; our contract draft was wrong, not the code
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("9966b8ec681f4404")
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 ResNet. 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 torchvision

torch.manual_seed(0)

# Define ARGS dict with all parameters for get_net
ARGS = {
    'backbone': 'resnet18',
    'num_class': 10,
    'pretrained': False,
    'load_path': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
get_source_domains Ran
ran; our contract draft was wrong, not the code
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("56fb6475cb294744")
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 list, ndim 1, 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
import torch.nn as nn

torch.manual_seed(0)

# The function only uses the 'dataset' parameter to check string equality
# and return a list of domain names. No complex objects needed.

ARGS = {
    'dataset': 'PACS'
}
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 list, ndim 1, dtype family float — a list 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
get_source_domains_abbr Ran
ran; our contract draft was wrong, not the code
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("32c7347d3ae61759")
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 list, ndim 1, 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

ARGS = {
    'dataset': 'PACS'
}
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 list, ndim 1, dtype family float — a list 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
kl_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("7ee01bf5efd50d92")
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.functional as F

torch.manual_seed(0)

# Construct small tensors for the function
# y: student logits, shape (batch_size, num_classes)
y = torch.randn(2, 4)

# teacher_scores: teacher logits or probabilities, same shape as y
teacher_scores = torch.randn(2, 4)

# temp: temperature parameter (scalar)
temp = 3

# softmax_applied: boolean flag
softmax_applied = False

ARGS = {
    "y": y,
    "teacher_scores": teacher_scores,
    "temp": temp,
    "softmax_applied": softmax_applied
}
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 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
lr_cosine_policy Ran
ran; our contract draft was wrong, not the code
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("9fd6750328ee3f9a")
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 torch.nn as nn
import numpy as np
from torch.optim import SGD

torch.manual_seed(0)

# Create a simple model with parameters
model = nn.Linear(4, 2)

# Create an optimizer
optimizer = SGD(model.parameters(), lr=0.1)

# Define the parameters for lr_cosine_policy
base_lr = 0.1
warmup_length = 5
epochs = 20

ARGS = {
    'base_lr': base_lr,
    'warmup_length': warmup_length,
    'epochs': epochs
}
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 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
lr_policy Ran
ran; our contract draft was wrong, not the code
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("8879e55d89cdc808")
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 torch.nn as nn
from torch.optim import SGD

torch.manual_seed(0)

# Define a simple learning rate function
def lr_fn(epoch):
    """Simple learning rate decay: starts at 0.1 and decays by 0.95 each epoch"""
    return 0.1 * (0.95 ** epoch)

# Create a minimal model
model = nn.Linear(4, 2)

# Create an optimizer
optimizer = SGD(model.parameters(), lr=0.1)

# Construct ARGS dict
ARGS = {
    'lr_fn': lr_fn
}
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 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
miniDomainNet Ran
ran on a synthesized input · constructed an object; no result was computed
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("1bf3b903e2947d69")
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, miniDomainNet: 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 os
import torch
import tempfile
from PIL import Image

torch.manual_seed(0)

# Create a temporary directory to act as dataset_root_dir
temp_dir = tempfile.mkdtemp()

# Create necessary directory structure and files
domain = "sketch"
mode = "train"

# Create domain and class subdirectories
class_name = "umbrella"
class_dir = os.path.join(temp_dir, class_name)
os.makedirs(class_dir, exist_ok=True)

# Create a dummy image file
dummy_img = Image.new('RGB', (96, 96), color='red')
img_path = os.path.join(class_dir, "image_001.png")
dummy_img.save(img_path)

# Create split file with proper format: "class_name/image_name label_index"
split_file = os.path.join(temp_dir, f'{domain}_{mode}.txt')
with open(split_file, 'w') as f:
    f.write(f"{class_name}/image_001.png 0\n")

# Define ARGS dictionary with all required parameters
ARGS = {
    'dataset_root_dir': temp_dir,
    'mode': mode,
    'domain': domain,
    'img_size': 96
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type miniDomainNet — the run constructed an instance of its own class and did not call it; no shape 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
BaseDataset Not yet run
unverified (harvested, no recorded run)
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("bbd4ba6ba7e4b9d1")
How it ran

no invocation recorded.

Digits Not yet run
unverified (harvested, no recorded run)
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("0f3ead3a52a4792f")
How it ran

no invocation recorded.

FAKE Not yet run
unverified (harvested, no recorded run)
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("302b7a0d15a99b07")
How it ran

no invocation recorded.

get_dataset Not yet run
unverified (harvested, no recorded run)
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("18be128efd090a2d")
How it ran

no invocation recorded.

train_student_syn_img Not yet run
unverified (harvested, no recorded run)
HaokunChen245/DFDG/dfdg/training/train_student_syn_img.py
code served (permissive licence) · get_code("307f729c69e1ba8f")
How it ran

no invocation recorded.

Also present in other papers' code

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

In this work, we investigate the unexplored intersection of domain generalization (DG) and datafree learning. In particular, we address the question: How can knowledge contained in models trained on different source domains be merged into a single model that generalizes well to unseen target domains, in the absence of source and target domain data? Machine learning models that can cope with domain shift are essential for real-world scenarios with often changing data distributions. Prior DG methods typically rely on using source domain data, making them unsuitable for private decentralized data. We define the novel problem of Data-Free Domain Generalization (DFDG), a practical setting where models trained on the source domains separately are available instead of the original datasets, and investigate how to effectively solve the domain generalization problem in that case. We propose DEKAN, an approach that extracts and fuses domain-specific knowledge from the available teacher models into a student model robust to domain shift. Our empirical evaluation demonstrates the effectiveness of our method which achieves first state-of-the-art results in DFDG by significantly outperforming data-free knowledge distillation and ensemble baselines.

For agents

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

get_harvested_code_for_paper("2110.04545")
get_code_for_paper("2110.04545")
have("2110.04545")

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

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

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

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

Connect an agent — have() is free.