SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2308.09942 · ICCV · 2023

On the Robustness of Open-World Test-Time Training: Self-Training with Dynamic Prototype Expansion

Kui Jia, Yongyi Su, Xun Xu, Yushu Li

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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; 1 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 6 failures of our instrument; 2 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/2308.09942.json · badge: /api/ran/2308.09942.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
yushu-li/owttt canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
Yushu-Li/OWTTT community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
Prototype_Pool Ran
ran on a synthesized input
Yushu-Li/OWTTT/imagenet/OURS.py
code served (permissive licence) · get_code("cef24caf1e089ade")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. 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

class Prototype_Pool(nn.Module):
    """
    Prototype pool containing strong OOD prototypes.

    Methods:
        __init__: Constructor method to initialize the prototype pool, storing the values of delta, the number of weak OOD categories, and the maximum count of strong OOD prototypes.
        forward: Method to farward pass, return the cosine similarity with strong OOD prototypes.
        update_pool: Method to append and delete strong OOD prototypes.
    """

    def __init__(self, delta=0.1, class_num=10, max=100):
        super(Prototype_Pool, self).__init__()
        self.class_num = class_num
        self.max_length = max
        self.flag = 0
        self.delta = delta

    def forward(self, x, all=False):
        if not self.flag:
            return None
        out = torch.mm(x, self.memory.t())
        if all == True:
            return out
        else:
            return torch.max(out / self.delta, dim=1)[0].unsqueeze(1)

    def update_pool(self, feature):
        if not self.flag:
            self.register_buffer('memory', feature.detach())
            self.flag = 1
        elif self.memory.shape[0] < self.max_length:
            self.memory = torch.cat([self.memory, feature.detach()], dim=0)
        else:
            self.memory = torch.cat([self.memory[1:], feature.detach()], dim=0)
        self.memory = F.normalize(self.memory)


INIT_ARGS = {
    'delta': 0.1,
    'class_num': 10,
    'max': 100
}

ARGS = {
    'x': torch.randn(2, 4),
    'all': False
}


if __name__ == '__main__':
    pool = Prototype_Pool(**INIT_ARGS)
    
    feature_batch = torch.randn(3, 4)
    pool.update_pool(feature_batch)
    
    result = pool(**ARGS)
    print("Result shape:", result.shape if result is not None else None)
    print("Result:", result)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
compute_os_variance Ran
ran, honoured the contract we drafted
yushu-li/owttt/imagenet/OURS.py
code served (permissive licence) · get_code("0baec8b7c9a4f6cf")
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 float64, ndim 0, 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 numpy as np

# Construct OOD score queue - a 1D array of out-of-distribution scores
os = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0])

# Construct threshold - a scalar value to separate weak and strong OOD samples
th = 0.5

ARGS = {
    "os": os,
    "th": th,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
coral Ran
ran; our contract draft was wrong, not the code
yushu-li/owttt/imagenet/utils/offline.py
code served (permissive licence) · get_code("c95f91085d13f9a0")
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

torch.manual_seed(0)

# The coral function takes two tensors cs and ct
# It accesses .shape[0] on cs (gets first dimension)
# It calls .pow(2) and .sum() on tensors
# Both tensors need to be the same shape based on the subtraction (cs - ct)

cs = torch.randn(4, 3)
ct = torch.randn(4, 3)

ARGS = {
    "cs": cs,
    "ct": ct,
}
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
covariance Ran
ran; our contract draft was wrong, not the code
yushu-li/owttt/imagenet/utils/offline.py
code served (permissive licence) · get_code("f872e8da97313523")
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, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small 2D feature tensor
# Shape: (batch_size=2, feature_dim=4)
features = torch.randn(2, 4)

ARGS = {
    'features': features
}
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, 4) — shape (4, 4) 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
create_dataloader Ran
ran on a synthesized input
yushu-li/owttt/imagenet/utils/prepare_dataset.py
code served (permissive licence) · get_code("bb8138f4b12d16e1")
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 DataLoader. 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 random
import numpy as np
from torch.utils.data import Dataset

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

class DummyDataset(Dataset):
    def __init__(self, size=8, input_dim=4, output_dim=3):
        self.size = size
        self.input_dim = input_dim
        self.output_dim = output_dim
    
    def __len__(self):
        return self.size
    
    def __getitem__(self, idx):
        x = torch.randn(self.input_dim)
        y = torch.randint(0, self.output_dim, (1,)).item()
        return x, y

class Args:
    def __init__(self):
        self.batch_size = 2
        self.workers = 0
        self.pin_memory = True

dataset = DummyDataset(size=8, input_dim=4, output_dim=3)
args = Args()

ARGS = {
    'dataset': dataset,
    'args': args,
    'shuffle': False,
    'drop_last': 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 DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader 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
extractor_from_layer2 Ran
ran; our contract draft was wrong, not the code
yushu-li/owttt/cifar/models/SSHead.py
code served (permissive licence) · get_code("8da0fe56566ec48b")
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 Sequential. 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 SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)
        self.layer1 = nn.Sequential(
            nn.Conv2d(16, 32, kernel_size=3, padding=1),
            nn.ReLU()
        )
        self.layer2 = nn.Sequential(
            nn.Conv2d(32, 64, kernel_size=3, padding=1),
            nn.ReLU()
        )

net = SimpleNet()

ARGS = {
    "net": net
}
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 Sequential — a Sequential 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
extractor_from_layer3 Ran
ran; our contract draft was wrong, not the code
yushu-li/owttt/cifar/models/SSHead.py
code served (permissive licence) · get_code("b63ee690a5540952")
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 Sequential. 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 MockResNet(nn.Module):
    def __init__(self):
        super(MockResNet, self).__init__()
        self.conv1 = nn.Conv2d(3, 4, kernel_size=3, padding=1)
        self.layer1 = nn.Sequential(nn.Conv2d(4, 4, kernel_size=3, padding=1))
        self.layer2 = nn.Sequential(nn.Conv2d(4, 8, kernel_size=3, padding=1))
        self.layer3 = nn.Sequential(nn.Conv2d(8, 16, kernel_size=3, padding=1))
        self.bn = nn.BatchNorm2d(16)
        self.relu = nn.ReLU()
        self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
    
    def forward(self, x):
        x = self.conv1(x)
        x = self.layer1(x)
        x = self.layer2(x)
        x = self.layer3(x)
        x = self.bn(x)
        x = self.relu(x)
        x = self.avgpool(x)
        return x

net = MockResNet()

ARGS = {
    "net": net
}
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 Sequential — a Sequential 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
head_on_layer2 Ran
ran; our contract draft was wrong, not the code
yushu-li/owttt/cifar/models/SSHead.py
code served (permissive licence) · get_code("7391885e7d0b7f9d")
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 Sequential. 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 copy

torch.manual_seed(0)

# Build a minimal net with the required attributes: layer3, bn, relu, avgpool
class MinimalNet(nn.Module):
    def __init__(self):
        super(MinimalNet, self).__init__()
        self.layer3 = nn.Conv2d(3, 64, kernel_size=3, padding=1)
        self.bn = nn.BatchNorm2d(64)
        self.relu = nn.ReLU(inplace=True)
        self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
    
    def forward(self, x):
        x = self.layer3(x)
        x = self.bn(x)
        x = self.relu(x)
        x = self.avgpool(x)
        return x

net = MinimalNet()
width = 1
classes = 5

ARGS = {
    "net": net,
    "width": width,
    "classes": classes
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
linear_mmd Ran
ran; our contract draft was wrong, not the code
yushu-li/owttt/imagenet/utils/offline.py
code served (permissive licence) · get_code("fa6b9886e3f4d5e7")
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

torch.manual_seed(0)

# The function linear_mmd expects two tensors ms and mt
# It computes (ms - mt).pow(2).mean()
# So both need to be tensors that support subtraction, pow, and mean operations

ms = torch.randn(2, 4)
mt = torch.randn(2, 4)

ARGS = {
    "ms": ms,
    "mt": mt,
}
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
prepare_ood_test_data_a Not yet run
unverified (harvested, no recorded run)
yushu-li/owttt/imagenet/utils/prepare_dataset.py
code served (permissive licence) · get_code("65de77c4179cd7bf")
How it ran

no invocation recorded.

prepare_ood_test_data_r Not yet run
unverified (harvested, no recorded run)
yushu-li/owttt/imagenet/utils/prepare_dataset.py
code served (permissive licence) · get_code("56ee83374ce97d04")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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
coral 1 other paper
1 dated earlier
2206.02721 (2022-06)
Revisiting Realistic Test-Time Training: Sequential Inference and Adaptation by Anchored Clustering
covariance 1 other paper
1 dated earlier
2206.02721 (2022-06)
Revisiting Realistic Test-Time Training: Sequential Inference and Adaptation by Anchored Clustering
extractor_from_layer2 1 other paper
1 dated earlier
2206.02721 (2022-06)
Revisiting Realistic Test-Time Training: Sequential Inference and Adaptation by Anchored Clustering
extractor_from_layer3 1 other paper
1 dated earlier
2206.02721 (2022-06)
Revisiting Realistic Test-Time Training: Sequential Inference and Adaptation by Anchored Clustering
head_on_layer2 1 other paper
1 dated earlier
2206.02721 (2022-06)
Revisiting Realistic Test-Time Training: Sequential Inference and Adaptation by Anchored Clustering
linear_mmd 1 other paper
1 dated earlier
2206.02721 (2022-06)
Revisiting Realistic Test-Time Training: Sequential Inference and Adaptation by Anchored Clustering

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

Generalizing deep learning models to unknown target domain distribution with low latency has motivated research into test-time training/adaptation (TTT/TTA). Existing approaches often focus on improving test-time training performance under well-curated target domain data. As figured out in this work, many state-of-the-art methods fail to maintain the performance when the target domain is contaminated with strong out-of-distribution (OOD) data, a.k.a. open-world test-time training (OWTTT). The failure is mainly due to the inability to distinguish strong OOD samples from regular weak OOD samples. To improve the robustness of OWTTT we first develop an adaptive strong OOD pruning which improves the efficacy of the self-training TTT method. We further propose a way to dynamically expand the prototypes to represent strong OOD samples for an improved weak/strong OOD data separation. Finally, we regularize self-training with distribution alignment and the combination yields the state-of-the-art performance on 5 OWTTT benchmarks. The code is available at https://github.com/Yushu-Li/OWTTT.

For agents

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

get_harvested_code_for_paper("2308.09942")
get_code_for_paper("2308.09942")
have("2308.09942")

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

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

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

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

Connect an agent — have() is free.