SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.01793 · 2026

ReFP-AD: Rectified Flow Preconditioning for Energy-Based Anomaly Detection

Egor Bondarev, Camile Lendering, Erkut Akdag, Joaquín Figueira

arXiv · PDF · Open in the Atlas

Code that ran

14 of 25 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (8 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 10 have no contract verdict; 3 failures of our instrument; 11 no recorded run), measured 2026-11-24; 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/2608.01793.json · badge: /api/ran/2608.01793.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
CLendering/ReFP-AD community
Papers with Code archive
14 ran · 11 no recorded run
FunctionStatusWhere it lives
EMA Ran
ran on a synthesized input · constructed an object; no result was computed
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("c678168a82acffd3")
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, EMA: 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 torch
import torch.nn as nn
import copy

torch.manual_seed(0)

# Create a simple model for testing
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
        self.register_buffer('buffer1', torch.randn(2, 4))
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    'model': model,
    'decay': 0.999,
    'update_buffers': False
}
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 EMA — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a EMA 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
EnergyNet Ran
ran on a synthesized input · constructed an object; no result was computed
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("57663488e4178390")
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, EnergyNet: 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 torch
import torch.nn as nn
from torch.nn.utils import spectral_norm

torch.manual_seed(0)

ARGS = {
    "dim": 4,
    "hidden": 8,
    "use_sn": False,
}
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 EnergyNet — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a EnergyNet 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
FlowHealthLog Ran
ran on a synthesized input · constructed an object; no result was computed
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("46d6a3093215ff29")
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, FlowHealthLog: 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 torch
import numpy as np
from dataclasses import dataclass, field

torch.manual_seed(0)

ARGS = {
    'patience': 3,
    'min_dist_corr': 0.5,
    'min_epochs': 2,
    'score_delta': 0.0001,
    'history': [],
    'best_score': float('inf'),
    'wait': 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 FlowHealthLog — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a FlowHealthLog 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
FlowMLP Ran
ran on a synthesized input · constructed an object; no result was computed
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("bc7931fa32dfb0e6")
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, FlowMLP: 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 torch
import torch.nn as nn
from torch.nn.utils import spectral_norm

torch.manual_seed(0)

ARGS = {
    "dim": 4,
    "hidden": 64,
    "depth": 3,
    "use_sn": False,
}

# Test instantiation and forward pass
if __name__ == "__main__":
    model = nn.Module.__new__(type('FlowMLP', (nn.Module,), {}))
    
    # Manually construct FlowMLP to verify
    def lin(a, b):
        layer = nn.Linear(a, b)
        return spectral_norm(layer) if ARGS["use_sn"] else layer
    
    layers = []
    in_dim = ARGS["dim"] + 1
    h = ARGS["hidden"]
    for i in range(ARGS["depth"] - 1):
        layers += [lin(in_dim if i == 0 else h, h), nn.SiLU()]
    layers += [lin(h, ARGS["dim"])]
    
    net = nn.Sequential(*layers)
    
    # Test forward pass
    t = torch.randn(2, 1)
    x = torch.randn(2, 4)
    output = net(torch.cat([t, x], dim=1))
    assert output.shape == (2, 4), f"Expected shape (2, 4), got {output.shape}"
    print("✓ Setup valid")
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 FlowMLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a FlowMLP 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
GWSamplerGPU Ran
ran on a synthesized input
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("1aa7c3aa8b7199d3")
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, ndim 3, 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 math

INIT_ARGS = {
    'reg': 0.01,
    'num_iters': 30,
}

ARGS = {
    'x0': torch.randn(2, 4),
    'x1': torch.randn(2, 4),
}

METHOD = 'sample_plan'

# Import the classes
import torch
import math
from typing import Tuple, Dict, Any

class OTSamplerGPU:
    """Log-domain Sinkhorn OT coupling on GPU.

    Works entirely with log-probabilities to prevent underflow/overflow,
    preserving the exact geometric cost without artificial scaling.
    """

    def __init__(self, reg: float=0.01, num_iters: int=30):
        self.reg = reg
        self.num_iters = num_iters

    @torch.no_grad()
    def sample_plan(self, x0: torch.Tensor, x1: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
        """Solve OT and return (x0, x1[matched]) pairs."""
        B = x0.size(0)
        x0_sq = torch.sum(x0 ** 2, dim=1, keepdim=True)
        x1_sq = torch.sum(x1 ** 2, dim=1, keepdim=True)
        C = x0_sq + x1_sq.t() - 2 * torch.mm(x0, x1.t())
        target_log_marginal = -math.log(B)
        f = torch.zeros(B, device=x0.device)
        g = torch.zeros(B, device=x0.device)
        K_log = -C / self.reg
        for _ in range(self.num_iters):
            f = target_log_marginal - torch.logsumexp(K_log + g.unsqueeze(0), dim=1)
            g = target_log_marginal - torch.logsumexp(K_log + f.unsqueeze(1), dim=0)
        log_P = f.unsqueeze(1) + g.unsqueeze(0) + K_log
        probs = torch.softmax(log_P, dim=1)
        target_indices = torch.multinomial(probs, num_samples=1).squeeze(1)
        return (x0, x1[target_indices])

class GWSamplerGPU(OTSamplerGPU):
    """Gromov-Wasserstein coupling for geometry-preserving flows."""

    @torch.no_grad()
    def sample_plan(self, x0: torch.Tensor, x1: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
        B = x0.size(0)
        D0 = torch.cdist(x0, x0).pow(2)
        D1 = torch.cdist(x1, x1).pow(2)
        D0 = D0 / (D0.max() + 1e-08)
        D1 = D1 / (D1.max() + 1e-08)
        log_P = torch.full((B, B), -math.log(B), device=x0.device)
        for _ in range(self.num_iters):
            P = torch.exp(log_P)
            M = -2.0 * torch.mm(D1, torch.mm(P, D0))
            target_log_marginal = -math.log(B)
            f = torch.zeros(B, device=x0.device)
            g = torch.zeros(B, device=x0.device)
            K_log = -M / self.reg
            for _ in range(10):
                f = target_log_marginal - torch.logsumexp(K_log + g.unsqueeze(0), dim=1)
                g = target_log_marginal - torch.logsumexp(K_log + f.unsqueeze(1), dim=0)
            log_P = f.unsqueeze(1) + g.unsqueeze(0) + K_log
        probs = torch.softmax(log_P, dim=1)
        target_indices = torch.multinomial(probs, num_samples=1).squeeze(1)
        return (x0, x1[target_indices])

# Construct and call
instance = GWSamplerGPU(**INIT_ARGS)
result = getattr(instance, METHOD)(**ARGS)
print(f"Result shapes: x0={result[0].shape}, x1_matched={result[1].shape}")
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, ndim 3, dtype family float — a tuple 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
OTSamplerGPU Ran
ran on a synthesized input · constructed an object; no result was computed
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("41348fa854d7395b")
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, OTSamplerGPU: 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 torch
import math

torch.manual_seed(0)

# Create small sample tensors
# x0: batch of 2 points in 4D space
x0 = torch.randn(2, 4)
# x1: batch of 2 points in 4D space
x1 = torch.randn(2, 4)

ARGS = {
    "reg": 0.01,
    "num_iters": 30,
}
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 OTSamplerGPU — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a OTSamplerGPU 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
OrthogonalRandomProjector Ran
ran on a synthesized input · constructed an object; no result was computed
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("65f6f61d3389310b")
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, OrthogonalRandomProjector: 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Define small distinct dimensions for in_dim and out_dim
in_dim = 8
out_dim = 5

# Create arguments dictionary
ARGS = {
    "in_dim": in_dim,
    "out_dim": out_dim,
    "seed": 42,
}
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 OrthogonalRandomProjector — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a OrthogonalRandomProjector 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
ReplayBuffer Ran
ran on a synthesized input · constructed an object; no result was computed
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("91230af41ce76aa9")
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, ReplayBuffer: 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 torch

torch.manual_seed(0)

ARGS = {
    "size": 10,
    "dim": 4,
    "device": "cpu",
    "temp": 1.0,
}
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 ReplayBuffer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ReplayBuffer 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
TokenCache Ran
ran on a synthesized input · constructed an object; no result was computed
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("0ade62f95e49e602")
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, TokenCache: 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 torch
import torch.nn as nn
from pathlib import Path
import tempfile

torch.manual_seed(0)

class MockDINO(nn.Module):
    """Mock DINO model that extracts patch tokens."""
    def __init__(self, token_dim=4):
        super().__init__()
        self.token_dim = token_dim
    
    def extract(self, img_path):
        """Mock extraction - returns random tokens of shape (num_patches, token_dim)."""
        # Return a small tensor of tokens
        return torch.randn(2, self.token_dim)

class MockAggregation:
    """Mock aggregation config."""
    def __init__(self, name='CONCAT'):
        self.name = name

class MockConfig:
    """Mock configuration object."""
    def __init__(self):
        self.cache_dir = tempfile.mkdtemp()
        self.dino_model = 'dino_vits8'
        self.layers = [11]
        self.resize = (224, 224)
        self.center_crop = (196, 196)
        self.aggregation = MockAggregation(name='CONCAT')
        self.data_path = tempfile.mkdtemp()
        self.flow_hidden = 3
        self.seed = 42

cfg = MockConfig()
dino = MockDINO(token_dim=4)

ARGS = {
    'cfg': cfg,
    'dino': dino,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TokenCache — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TokenCache 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
TokenStats Ran
ran on a synthesized input
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("6bc9b85f14440f85")
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 numpy as np

# TokenStats.__init__ takes no parameters
INIT_ARGS = {}

# The main computation method is 'fit', which takes tokens and max_tokens
# We'll create a small token tensor to fit the stats
tokens = torch.randn(100, 8)  # 100 tokens, each with dimension 8

METHOD = 'fit'
ARGS = {
    'tokens': tokens,
    'max_tokens': 6000000
}
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 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)
pairwise_distance_correlation Ran
ran, honoured the contract we drafted
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("f885ba9717cd26dc")
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

torch.manual_seed(0)

# Create two small tensors with distinct shapes
# z and u should have the same number of samples (N) but can have different feature dimensions
z = torch.randn(8, 4)  # 8 samples, 4 dimensions
u = torch.randn(8, 3)  # 8 samples, 3 dimensions

ARGS = {
    "z": z,
    "u": u,
    "n_pairs": 5000,
}
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
precond_sgld Ran
ran; our contract draft was wrong, not the code
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("36785f33d5bb7698")
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, ndim 3, 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
import math

torch.manual_seed(0)

# Define a simple EBM model that takes x and outputs a scalar energy
class SimpleEBM(nn.Module):
    def __init__(self, input_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, 1)
    
    def forward(self, x):
        return self.linear(x).squeeze(-1)

# Create model
model = SimpleEBM(input_dim=4)

# Create input tensor x (batch_size=2, dim=4)
x = torch.randn(2, 4, dtype=torch.float32)

# Create velocity tensor v (same shape as x for momentum tracking)
v = torch.zeros_like(x, dtype=torch.float32)

# Number of SGLD steps
steps = 5

# Step size for the update
step_size = 0.01

# Standard deviation of noise
noise_std = 0.1

# Momentum decay parameter (beta in [0, 1])
beta = 0.9

# Small epsilon for numerical stability
eps = 1e-8

# Clipping bounds for preconditioner (lower, upper)
precond_clip = [0.1, 10.0]

ARGS = {
    "model": model,
    "x": x,
    "v": v,
    "steps": steps,
    "step_size": step_size,
    "noise_std": noise_std,
    "beta": beta,
    "eps": eps,
    "precond_clip": precond_clip,
}
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 tuple, ndim 3, dtype family float — a tuple 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
sgld_fitness Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("92138da5f18fc295")
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 math

torch.manual_seed(0)

# Create a small sample tensor of shape (B, D)
# B=2 (batch size), D=4 (feature dimension)
u = torch.randn(2, 4)

ARGS = {
    'u': u,
    'rp_dim': 3,
    'rp_seed': 0,
}
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
vanilla_sgld Ran
ran; our contract draft was wrong, not the code
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("d6fa68ba72ac1c65")
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, ndim 3, 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
import math

torch.manual_seed(0)

class SimpleEBM(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 1)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleEBM()

x = torch.randn(2, 4, requires_grad=False)
v = torch.randn(2, 4, requires_grad=False)
steps = 3
step_size = 0.01
noise_std = 0.1
beta = 1.0
eps = 1e-8
precond_clip = 0.1

ARGS = {
    "model": model,
    "x": x,
    "v": v,
    "steps": steps,
    "step_size": step_size,
    "noise_std": noise_std,
    "beta": beta,
    "eps": eps,
    "precond_clip": precond_clip
}
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 tuple, ndim 3, dtype family float — a tuple 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
BasePipeline Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("123b6f6b45779f06")
How it ran

no invocation recorded.

CFG Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("def83beca45da1c1")
How it ran

no invocation recorded.

DinoBackbone Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("75c6a9c64dfc70cb")
How it ran

no invocation recorded.

FeatureAggregation Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("7cde7fc01ab2df67")
How it ran

no invocation recorded.

Mode Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("a9ca8c1e2e4ff66d")
How it ran

no invocation recorded.

RectifiedFlow Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("95016716baf3d2b4")
How it ran

no invocation recorded.

UnifiedPipeline Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("2308f7c280ab0a03")
How it ran

no invocation recorded.

_score_image Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("9c75d40f4d9f136a")
How it ran

no invocation recorded.

safe_chunked_encode Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("7af99297ced8e645")
How it ran

no invocation recorded.

train_ebm Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("862306513f2d2e46")
How it ran

no invocation recorded.

train_flow Not yet run
unverified (harvested, no recorded run)
CLendering/ReFP-AD/pipeline.py
code served (permissive licence) · get_code("2f9f732eb4d69549")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Unified anomaly detection requires modeling highly heterogeneous normal data without access to anomalous samples. While foundation models like DINOv2 provide rich token representations, leveraging these spaces for explicit density estimation remains challenging. Energy-Based Models (EBMs) offer a principled formulation, but their training in high-dimensional token spaces is unstable due to anisotropy and strong cross-dimensional correlations, which degrades finite-step Markov Chain Monte Carlo (MCMC) sampling. We identify this instability as fundamentally geometric and introduce ReFP-AD (Rectified Flow Preconditioning for Anomaly Detection), which learns a geometric reparameterization that maps high-dimensional embeddings into a well-conditioned latent space via an optimal transport (OT)-coupled rectified flow. This preconditioning enables stable persistent contrastive divergence with preconditioned Stochastic Gradient Langevin Dynamics (SGLD) in full-dimensional token spaces. Anomaly scores are then derived from the learned energy landscape using gradient norms. Under a strict unified protocol on the MVTec-AD and VisA datasets, ReFP-AD achieves 98.6%/97.9% Image/Pixel AUROC on MVTec-AD and 97.3%/99.0% on VisA, outperforming prior unified EBM baselines by up to +10.8% in Image AUROC. Ablation experiments demonstrate that geometric reparameterization is critical for finite-step MCMC and accurate anomaly localization in high-dimensional token spaces. Code is available at https://github.com/CLendering/ReFP-AD

For agents

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

get_harvested_code_for_paper("2608.01793")
get_code_for_paper("2608.01793")
have("2608.01793")

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

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

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

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

Connect an agent — have() is free.