SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.02266 · 2021

SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 4 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/2106.02266.json · badge: /api/ran/2106.02266.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
shahtalebi/SAND-mask canonical (classifier label)
classifier basis: census
8 ran · 4 no recorded run
FunctionStatusWhere it lives
Classifier Ran
ran; our contract draft was wrong, not the code
shahtalebi/SAND-mask/domainbed/networks.py
pointer only (licence: MIT) · get_code("ce7990d7ad5821ff")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

conv3x3 Ran
ran; our contract draft was wrong, not the code
shahtalebi/SAND-mask/domainbed/lib/wide_resnet.py
pointer only (licence: MIT); the stored copy get_code serves, from DaikiTanak/manifold_mixup, is pointer only (licence: NONE) · get_code("00e569acd6b45ef0")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_test_records Ran
ran; our contract draft was wrong, not the code
shahtalebi/SAND-mask/domainbed/model_selection.py
pointer only (licence: MIT) · get_code("53fac8d8d949e72b")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

hashable Ran
ran, honoured the contract we drafted
shahtalebi/SAND-mask/domainbed/lib/query.py
pointer only (licence: MIT) · get_code("71a3a61ceed99bf3")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

make_selector_fn Ran
ran; our contract draft was wrong, not the code
shahtalebi/SAND-mask/domainbed/lib/query.py
pointer only (licence: MIT) · get_code("2f8af5779e1edcb6")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

make_weights_for_balanced_classes Ran
ran, honoured the contract we drafted
shahtalebi/SAND-mask/domainbed/lib/misc.py
pointer only (licence: MIT) · get_code("5f576ed342c48a0a")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

remove_batch_norm_from_resnet Ran
ran; our contract draft was wrong, not the code
shahtalebi/SAND-mask/domainbed/networks.py
pointer only (licence: MIT) · get_code("196cab71d7129d62")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

split_dataset Ran
ran; our contract draft was wrong, not the code
shahtalebi/SAND-mask/domainbed/lib/misc.py
code served (permissive licence) · get_code("18e820e42046bc45")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from torch.utils.data import Dataset

torch.manual_seed(0)
np.random.seed(0)

# Create a simple stand-in dataset
class SimpleDataset(Dataset):
    def __init__(self, size=10):
        self.size = size
        self.data = torch.randn(size, 4)
        self.labels = torch.randint(0, 2, (size,))
    
    def __getitem__(self, idx):
        return self.data[idx], self.labels[idx]
    
    def __len__(self):
        return self.size

# Instantiate the dataset
dataset = SimpleDataset(size=10)

ARGS = {
    "dataset": dataset,
    "n": 7,
    "seed": 0
}
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 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_algorithm_class Not yet run
unverified (harvested, no recorded run)
shahtalebi/SAND-mask/domainbed/algorithms.py
pointer only (licence: MIT) · get_code("b0bc80b1655a6802")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_dataset_class Not yet run
unverified (harvested, no recorded run)
shahtalebi/SAND-mask/domainbed/datasets.py
pointer only (licence: MIT) · get_code("d0ea85d74c20dea9")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

num_environments Not yet run
unverified (harvested, no recorded run)
shahtalebi/SAND-mask/domainbed/datasets.py
pointer only (licence: MIT) · get_code("73f32252eedba6a4")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

print_row Not yet run
unverified (harvested, no recorded run)
shahtalebi/SAND-mask/domainbed/lib/misc.py
pointer only (licence: MIT) · get_code("af3c9a80c8fd1f7a")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, shahtalebi/SAND-mask, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 12 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 4 the same month, 12 later) and 0 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
conv3x3 74 other papers
24 dated earlier, 1 the same month, 49 later · 5 only as an assembly brick
1605.07146 (2016-05)
Wide Residual Networks
1707.01629 (2017-07)
Dual Path Networks
1802.05668 (2018-02)
Model compression via distillation and quantization
and 71 more not named here
get_algorithm_class 39 other papers
4 dated earlier, 2 the same month, 33 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
24 later · 4 only as an assembly brick
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
2205.13462 (2022-05)
FedBR: Improving Federated Learning on Heterogeneous Data via Local Learning Bias Reduction
and 21 more not named here
remove_batch_norm_from_resnet 23 other papers
1 dated earlier, 22 later
1907.02893 (2019-07)
Invariant Risk Minimization
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 20 more not named here
get_test_records 22 other papers
2 dated earlier, 20 later
1710.03077 (2017-10)
Deeper, Broader and Artier Domain Generalization
1907.02893 (2019-07)
Invariant Risk Minimization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
and 19 more not named here
get_dataset_class 21 other papers
2 dated earlier, 1 the same month, 18 later
1907.02893 (2019-07)
Invariant Risk Minimization
2007.01434 (2020-07)
In Search of Lost Domain Generalization
2106.06607 (2021-06)
Invariance Principle Meets Information Bottleneck for Out-of-Distribution Generalization
and 18 more not named here
num_environments 21 other papers
2 dated earlier, 1 the same month, 18 later
1907.02893 (2019-07)
Invariant Risk Minimization
2007.01434 (2020-07)
In Search of Lost Domain Generalization
2106.06607 (2021-06)
Invariance Principle Meets Information Bottleneck for Out-of-Distribution Generalization
and 18 more not named here
hashable 20 other papers
20 later
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2203.10789 (2022-03)
Domain Generalization by Mutual-Information Regularization with Pre-trained Models
2205.09739 (2022-05)
Diverse Weight Averaging for Out-of-Distribution Generalization
and 17 more not named here
make_selector_fn 20 other papers
20 later
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2203.10789 (2022-03)
Domain Generalization by Mutual-Information Regularization with Pre-trained Models
2205.09739 (2022-05)
Diverse Weight Averaging for Out-of-Distribution Generalization
and 17 more not named here
make_weights_for_balanced_classes 18 other papers
1 dated earlier, 17 later
1907.02893 (2019-07)
Invariant Risk Minimization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2203.10789 (2022-03)
Domain Generalization by Mutual-Information Regularization with Pre-trained Models
and 15 more not named here
print_row 11 other papers
1 dated earlier, 10 later
1907.02893 (2019-07)
Invariant Risk Minimization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2205.13462 (2022-05)
FedBR: Improving Federated Learning on Heterogeneous Data via Local Learning Bias Reduction
and 8 more not named here
split_dataset 5 other papers
5 later
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2207.10792 (2022-07)
Test-Time Adaptation via Self-Training with Nearest Neighbor Information
2307.08187 (2023-07)
An Empirical Study of Pre-trained Model Selection for Out-of-Distribution Generalization and Calibration
and 2 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

A major bottleneck in the real-world applications of machine learning models is their failure in generalizing to unseen domains whose data distribution is not i.i.d to the training domains. This failure often stems from learning non-generalizable features in the training domains that are spuriously correlated with the label of data. To address this shortcoming, there has been a growing surge of interest in learning good explanations that are hard to vary, which is studied under the notion of Out-of-Distribution (OOD) Generalization. The search for good explanations that are \textit{invariant} across different domains can be seen as finding local (global) minimas in the loss landscape that hold true across all of the training domains. In this paper, we propose a masking strategy, which determines a continuous weight based on the agreement of gradients that flow in each edge of network, in order to control the amount of update received by the edge in each step of optimization. Particularly, our proposed technique referred to as "Smoothed-AND (SAND)-masking", not only validates the agreement in the direction of gradients but also promotes the agreement among their magnitudes to further ensure the discovery of invariances across training domains. SAND-mask is validated over the Domainbed benchmark for domain generalization and significantly improves the state-of-the-art accuracy on the Colored MNIST dataset while providing competitive results on other domain generalization datasets.

For agents

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

get_harvested_code_for_paper("2106.02266")
get_code_for_paper("2106.02266")
have("2106.02266")

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

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

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

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

Connect an agent — have() is free.