SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2507.10225 · ICCV · 2025

Synthesizing Near-Boundary OOD Samples for Out-of-Distribution Detection

Jinglun Li, Weifeng Ge, Wenqiang Zhang, Yao Tang, Zhaoyu Chen, Kaixun Jiang, Bo Lin

arXiv · PDF · Open in the Atlas

Code that ran

10 of 13 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 0 have no contract verdict; 9 failures of our instrument; 3 no recorded run), measured 2026-11-23; 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/2507.10225.json · badge: /api/ran/2507.10225.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
Jarvisgivemeasuit/SynOOD canonical (classifier label)
classifier basis: census
10 ran · 3 no recorded run
FunctionStatusWhere it lives
compute_average_results Ran
ran; our contract draft was wrong, not the code
Jarvisgivemeasuit/SynOOD/utils.py
code served (permissive licence) · get_code("6f1cab3d683b7b2f")
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)

# Analyze the function: it expects all_results to be an iterable of dicts,
# where each dict has keys 'FPR', 'AUROC', 'AUIN' with numeric values.
# The function iterates through all_results and sums values, then divides by count.

all_results = [
    {
        'FPR': 0.15,
        'AUROC': 0.92,
        'AUIN': 0.88
    },
    {
        'FPR': 0.18,
        'AUROC': 0.95,
        'AUIN': 0.90
    },
    {
        'FPR': 0.12,
        'AUROC': 0.89,
        'AUIN': 0.85
    }
]

ARGS = {
    'all_results': all_results
}
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
compute_similarity_in_batches Ran
ran; our contract draft was wrong, not the code
Jarvisgivemeasuit/SynOOD/ood_label_mining.py
code served (permissive licence) · get_code("38b9b60d495aaddb")
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 (2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal model that has encode_image method
class MinimalImageEncoder(nn.Module):
    def __init__(self, image_dim=4, output_dim=3):
        super().__init__()
        self.linear = nn.Linear(image_dim, output_dim)
    
    def encode_image(self, image):
        # image shape: (batch, channels, height, width) -> flatten and encode
        batch_size = image.shape[0]
        image_flat = image.reshape(batch_size, -1)
        return self.linear(image_flat)

# Create model instance
model = MinimalImageEncoder(image_dim=16, output_dim=3)

# Create text_features: shape (num_texts, embedding_dim)
text_features = torch.randn(2, 3, dtype=torch.float32)

# Create image tensor: shape (batch, channels, height, width)
# 16 total elements per image (4*4 or 2*2*4, etc)
image = torch.randn(2, 1, 4, 4, dtype=torch.float32)

# Device
device = torch.device('cpu')

# Batch size
batch_size = 5000

ARGS = {
    'text_features': text_features,
    'image': image,
    'model': model,
    'device': device,
    'batch_size': batch_size
}
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 (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_curve Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Jarvisgivemeasuit/SynOOD/utils.py
code served (permissive licence) · get_code("7d491ca6c7c6459b")
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 numpy as np

# Create simple numpy arrays for known and novel scores
# These should be 1D arrays of floats representing model confidence scores
known = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], dtype=np.float32)
novel = np.array([0.15, 0.25, 0.35, 0.45], dtype=np.float32)

# method can be 'row' or None (or other string)
method = None

ARGS = {
    'known': known,
    'novel': novel,
    'method': method
}
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 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_loss Ran
ran; our contract draft was wrong, not the code
Jarvisgivemeasuit/SynOOD/generate_near_ood_sample.py
code served (permissive licence) · get_code("bfd7d9cb5001a5f1")
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 as nn

torch.manual_seed(0)

# Create a minimal model that outputs logits
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(3, 1000)
    
    def forward(self, x):
        return self.fc(x)

model = SimpleModel()

# Create small batch of images (batch_size=2, feature_dim=3)
images = torch.randn(2, 3)

# Test with 'energy' method (the one that uses logits more directly)
methods = 'energy'

# Use CPU device
device = 'cpu'

ARGS = {
    'model': model,
    'images': images,
    'methods': methods,
    'device': device
}
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
get_neg_label Ran
ran; our contract draft was wrong, not the code
Jarvisgivemeasuit/SynOOD/datasets.py
code served (permissive licence) · get_code("f6fe8fd9eb1f7a34")
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 tempfile
import os

# Create a temporary file with sample negative labels
temp_dir = tempfile.mkdtemp()
label_path = os.path.join(temp_dir, "neg_labels.txt")

with open(label_path, 'w') as f:
    f.write("label1\n")
    f.write("label2\n")
    f.write("label3\n")

ARGS = {
    "label_path": label_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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_ood_loaders Ran
ran; our contract draft was wrong, not the code
Jarvisgivemeasuit/SynOOD/datasets.py
code served (permissive licence) · get_code("5058afdd915502bf")
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
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
import tempfile
import os
from PIL import Image

torch.manual_seed(0)

# Create a temporary directory structure with mock image files
temp_dir = tempfile.mkdtemp()

# Create subdirectories for each OOD dataset
dataset_dirs = {
    'iNaturalist': os.path.join(temp_dir, 'iNaturalist'),
    'SUN': os.path.join(temp_dir, 'SUN'),
    'Places': os.path.join(temp_dir, 'Places'),
    'Textures': os.path.join(temp_dir, 'dtd/images')
}

for dataset_name, dataset_path in dataset_dirs.items():
    os.makedirs(dataset_path, exist_ok=True)
    
    # Create a few subdirectories with mock images
    for folder_idx in range(2):
        folder_path = os.path.join(dataset_path, f'folder_{folder_idx}')
        os.makedirs(folder_path, exist_ok=True)
        
        # Create mock image files
        for img_idx in range(2):
            img_path = os.path.join(folder_path, f'image_{img_idx}.jpg')
            img = Image.new('RGB', (4, 3), color=(73, 109, 137))
            img.save(img_path)

# Create a simple transform
transform = transforms.Compose([
    transforms.Resize((4, 3)),
    transforms.ToTensor(),
])

ARGS = {
    'ood_root': temp_dir,
    'transform': transform,
    'batch_size': 2,
    'num_workers': 0
}
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 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
process_image Ran
ran; our contract draft was wrong, not the code
Jarvisgivemeasuit/SynOOD/cleaned/clean_data.py
code served (permissive licence) · get_code("779f3cc955ee3059")
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 os
import tempfile
from PIL import Image
import io

# Create a temporary directory and a test image
temp_dir = tempfile.mkdtemp()
cate_path = temp_dir

# Create a small test image (100x100 RGB image)
img = Image.new('RGB', (100, 100), color='red')
img_name = 'test_image.png'
img_path = os.path.join(cate_path, img_name)
img.save(img_path)

# Construct the args tuple as expected by process_image
args = (img_name, cate_path)

ARGS = {
    'args': args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — 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
process_image_file Ran
ran; our contract draft was wrong, not the code
Jarvisgivemeasuit/SynOOD/texts/clean_prompt.py
code served (permissive licence) · get_code("dcbc220cb8ad5d73")
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)

# Analyze the function:
# - args is a tuple of 3 elements: (all_cleaned_data, answer_data, question_data)
# - all_cleaned_data: a list that supports 'in' operator and .remove() method
# - answer_data: a dict with 'text' key
# - question_data: a dict with 'image' key

# Construct valid arguments
all_cleaned_data = ['image1.jpg', 'image2.jpg', 'image3.jpg']
answer_data = {'text': 'This is the answer text'}
question_data = {'image': 'image1.jpg'}

args = (all_cleaned_data, answer_data, question_data)

ARGS = {
    'args': args
}
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
retrieve_latents Ran
ran, honoured the contract we drafted
Jarvisgivemeasuit/SynOOD/diffusion_inpainting_pipeline.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from JS-CHU/RoamScene3D, is pointer only (licence: NONE) · get_code("98bcd15cf273e3b4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from JS-CHU/RoamScene3D, and GitHub detected no licence in that repository when it was checked. 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.

retrieve_timesteps Ran
ran; our contract draft was wrong, not the code
Jarvisgivemeasuit/SynOOD/diffusion_inpainting_pipeline.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from krafton-ai/Rare-to-Frequent, is pointer only (licence: NONE) · get_code("0b56680ee1708fee")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from krafton-ai/Rare-to-Frequent, and GitHub detected no licence in that repository when it was checked. 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.

cal_metric Not yet run
unverified (harvested, no recorded run)
Jarvisgivemeasuit/SynOOD/utils.py
code served (permissive licence) · get_code("19c2302530829663")
How it ran

no invocation recorded.

get_generate_ood_loader Not yet run
unverified (harvested, no recorded run)
Jarvisgivemeasuit/SynOOD/datasets.py
code served (permissive licence) · get_code("9cf45533161722bd")
How it ran

no invocation recorded.

process_file Not yet run
unverified (harvested, no recorded run)
Jarvisgivemeasuit/SynOOD/texts/clean_prompt.py
code served (permissive licence) · get_code("0b8c67201af06908")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 1 the same month, 2 later) and 10 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
retrieve_timesteps 46 other papers
28 dated earlier, 1 the same month, 14 later, 1 same year, order not determinable, 2 undated
2312.04461 (2023-12)
PhotoMaker: Customizing Realistic Human Photos via Stacked ID Embedding
2402.10491 (2024-02)
Make a Cheap Scaling: A Self-Cascade Diffusion Model for Higher-Resolution Adaptation
2405.18991 (2024-05)
EasyAnimate: High-Performance Video Generation Framework with Hybrid Windows Attention and Reward Backpropagation
and 43 more not named here
retrieve_latents 19 other papers
13 dated earlier, 5 later, 1 undated
2401.07519 (2024-01)
InstantID: Zero-shot Identity-Preserving Generation in Seconds
2403.14773 (2024-03)
StreamingT2V: Consistent, Dynamic, and Extendable Long Video Generation from Text
2404.06666 (2024-04)
SafeGen: Mitigating Sexually Explicit Content Generation in Text-to-Image Models
and 16 more not named here
get_curve 1 other paper
1 dated earlier
2402.02653 (2024-02)
Learning with Mixture of Prototypes for Out-of-Distribution Detection

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

Pre-trained vision-language models have exhibited remarkable abilities in detecting out-of-distribution (OOD) samples. However, some challenging OOD samples, which lie close to in-distribution (InD) data in image feature space, can still lead to misclassification. The emergence of foundation models like diffusion models and multimodal large language models (MLLMs) offers a potential solution to this issue. In this work, we propose SynOOD, a novel approach that harnesses foundation models to generate synthetic, challenging OOD data for fine-tuning CLIP models, thereby enhancing boundary-level discrimination between InD and OOD samples. Our method uses an iterative in-painting process guided by contextual prompts from MLLMs to produce nuanced, boundary-aligned OOD samples. These samples are refined through noise adjustments based on gradients from OOD scores like the energy score, effectively sampling from the InD/OOD boundary. With these carefully synthesized images, we fine-tune the CLIP image encoder and negative label features derived from the text encoder to strengthen connections between near-boundary OOD samples and a set of negative labels. Finally, SynOOD achieves state-of-the-art performance on the large-scale ImageNet benchmark, with minimal increases in parameters and runtime. Our approach significantly surpasses existing methods, improving AUROC by 2.80% and reducing FPR95 by 11.13%. Codes are available in https://github.com/Jarvisgivemeasuit/SynOOD.

For agents

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

get_harvested_code_for_paper("2507.10225")
get_code_for_paper("2507.10225")
have("2507.10225")

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

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

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

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

Connect an agent — have() is free.