SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.03074 · ICLR · 2025

MetaOOD: Automatic Selection of OOD Detection Models

Yichi Zhang, Yue Zhao, Xueying Ding, Yuehan Qin, Yi Nian

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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 2 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-22; 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/2410.03074.json · badge: /api/ran/2410.03074.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
yqin43/metaood community
Papers with Code archive
3 ran · 1 no recorded run
FunctionStatusWhere it lives
Utils Ran
ran on a synthesized input
yqin43/metaood/metaood/metaood_0.py
code served (permissive licence) · get_code("18dd1f7f9d71a93e")
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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. 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, 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
from torch import nn
import torch.nn.functional as F
import random
import numpy as np

class Utils:

    def __init__(self):
        pass

    def set_seed(self, seed):
        np.random.seed(seed)
        random.seed(seed)
        torch.manual_seed(seed)
        torch.backends.cudnn.deterministic = True
        torch.backends.cudnn.benchmark = False

    def unique(self, a, b):
        u = 0.5 * (a + b) * (a + b + 1) + b
        return int(u)

    def get_device(self, gpu_specific=True):
        if gpu_specific:
            if torch.cuda.is_available():
                n_gpu = torch.cuda.device_count()
                print(f'number of gpu: {n_gpu}')
                print(f'cuda name: {torch.cuda.get_device_name(0)}')
                print('GPU is on')
            else:
                print('GPU is off')
            device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
        else:
            device = torch.device('cpu')
        return device

    def criterion(self, y_true, y_pred, mode=None):
        assert torch.is_tensor(y_true) and torch.is_tensor(y_pred)
        if mode == 'pearson':
            x = y_pred
            y = y_true
            vx = x - torch.mean(x)
            vy = y - torch.mean(y)
            metric = torch.sum(vx * vy) / (torch.sqrt(torch.sum(vx ** 2)) * torch.sqrt(torch.sum(vy ** 2)))
        elif mode == 'ranknet':
            n = y_pred.size(0)
            assert y_true.ndim == 1 and y_pred.ndim == 1
            y_true = y_true.unsqueeze(1)
            y_pred = y_pred.unsqueeze(1)
            mask = ~torch.eye(n, dtype=torch.bool)
            p_ij = torch.sign(y_true - y_true.T)
            p_ij[p_ij == -1] = 0
            s_ij = torch.sigmoid((y_pred - y_pred.T) * 100)
            p_ij = p_ij[mask].view(n, n - 1)
            s_ij = s_ij[mask].view(n, n - 1)
            metric = -F.binary_cross_entropy(s_ij, p_ij)
        elif mode == 'mse':
            criterion = nn.MSELoss()
            metric = -criterion(y_pred, y_true)
        elif mode == 'weighted_mse':
            start = 1.0
            end = 0.01
            decay_factor = 0.5
            t = torch.linspace(0, 1, y_pred.shape[0])
            exponential_decay = torch.exp(torch.log(torch.tensor(end / start)) * decay_factor * t) * start
            exponential_decay = exponential_decay.to(y_pred.device)
            idx_sort = torch.argsort(0.8 * y_true + 0.2 * y_pred)
            y_pred = y_pred[idx_sort]
            y_true = y_true[idx_sort]
            metric = torch.sum(torch.pow(y_pred - y_true, 2) * exponential_decay)
            metric = -metric
        else:
            raise NotImplementedError
        return metric


INIT_ARGS = {}

ARGS = {
    'y_true': torch.tensor([1.0, 2.0, 3.0, 4.0]),
    'y_pred': torch.tensor([1.1, 2.1, 2.9, 4.2]),
    'mode': 'pearson'
}

METHOD = 'criterion'

if __name__ == '__main__':
    utils = Utils(**INIT_ARGS)
    result = getattr(utils, METHOD)(**ARGS)
    print(f"Result: {result}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
fit Ran
ran; our contract draft was wrong, not the code
yqin43/metaood/metaood/metaood_0.py
code served (permissive licence) · get_code("ee6c756d2eb41474")
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. 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, 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
from torch import nn
import numpy as np
import random

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

mf_dim = 358
num_methods = 11

# Build a small model that matches the function's usage
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(mf_dim + 1 + num_methods, 1)
    
    def forward(self, batch_meta_features, batch_la, batch_components):
        # Concatenate inputs and produce output
        x = torch.cat([batch_meta_features, batch_la, batch_components], dim=1)
        pred = self.linear(x)
        return pred, pred

model = SimpleModel()

# Build optimizer
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

# Create tiny train_loader as a list of batches
# Each batch needs: [mf_dim + 1 + num_methods + 1] columns
# mf_dim=358, 1 for la, num_methods=11, 1 for y = 371 total
batch_size = 2
feature_dim = mf_dim + 1 + num_methods + 1

train_data = torch.randn(batch_size, feature_dim)
train_loader = [train_data]

# Create tiny val_loader
val_data = torch.randn(batch_size, feature_dim)
val_loader = [val_data]

ARGS = {
    'train_loader': train_loader,
    'model': model,
    'optimizer': optimizer,
    'epochs': 2,
    'loss_name': 'mse',
    'val_loader': val_loader,
    'es': False,
    'tol': 5
}
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 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
meta_predictor Ran
ran on a synthesized input
yqin43/metaood/metaood/metaood_0.py
code served (permissive licence) · get_code("d15339a4e99e1a88")
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 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
from torch import nn

mf_dim = 358

class meta_predictor(nn.Module):

    def __init__(self, n_col, n_per_col, embedding_dim=3):
        super(meta_predictor, self).__init__()
        self.embeddings = nn.ModuleList([nn.Embedding(int(n_per_col[i]), embedding_dim) for i in range(n_col)])
        self.classifier = nn.Sequential(nn.Linear(mf_dim + 1 + n_col * embedding_dim, 20), nn.ReLU(), nn.Linear(20, 1), nn.Sigmoid())

    def forward(self, meta_features=None, nla=None, components=None):
        assert components.shape[1] == len(self.embeddings)
        embedding_list = []
        for i, e in enumerate(self.embeddings):
            embedding_list.append(e(components[:, i].long()))
        embedding = torch.cat(embedding_list, dim=1)
        embedding = torch.cat((meta_features, nla, embedding), dim=1)
        pred = self.classifier(embedding)
        return (embedding, pred)


INIT_ARGS = {
    'n_col': 4,
    'n_per_col': [10, 15, 12, 8],
    'embedding_dim': 3,
}

ARGS = {
    'meta_features': torch.randn(2, 358),
    'nla': torch.randn(2, 1),
    'components': torch.randint(0, 10, (2, 4)),
}

if __name__ == '__main__':
    model = meta_predictor(**INIT_ARGS)
    embedding, pred = model(**ARGS)
    print(f"Embedding shape: {embedding.shape}")
    print(f"Prediction shape: {pred.shape}")
    print(f"Prediction values: {pred}")
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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
run Not yet run
unverified (harvested, no recorded run)
yqin43/metaood/metaood/metaood_0.py
code served (permissive licence) · get_code("959ebdf279f5e4e0")
How it ran

no invocation recorded.

Also present in other papers' code

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

How can we automatically select an out-of-distribution (OOD) detection model for various underlying tasks? This is crucial for maintaining the reliability of open-world applications by identifying data distribution shifts, particularly in critical domains such as online transactions, autonomous driving, and real-time patient diagnosis. Despite the availability of numerous OOD detection methods, the challenge of selecting an optimal model for diverse tasks remains largely underexplored, especially in scenarios lacking ground truth labels. In this work, we introduce MetaOOD, the first zero-shot, unsupervised framework that utilizes metalearning to select an OOD detection model automatically. As a meta-learning approach, MetaOOD leverages historical performance data of existing methods across various benchmark OOD detection datasets, enabling the effective selection of a suitable model for new datasets without the need for labeled data at the test time. To quantify task similarities more accurately, we introduce language model-based embeddings that capture the distinctive OOD characteristics of both datasets and detection models. Through extensive experimentation with 24 unique test dataset pairs to choose from among 11 OOD detection models, we demonstrate that MetaOOD significantly outperforms existing methods and only brings marginal time overhead. Our results, validated by Wilcoxon statistical tests, show that MetaOOD surpasses a diverse group of 11 baselines, including established OOD detectors and advanced unsupervised selection methods.

For agents

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

get_harvested_code_for_paper("2410.03074")
get_code_for_paper("2410.03074")
have("2410.03074")

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

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

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

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

Connect an agent — have() is free.