SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.16359 · ICML · 2024

Feedback Efficient Online Fine-Tuning of Diffusion Models

Sergey Levine, Masatoshi Uehara, Ehsan Hajiramezanali, Yulai Zhao, Nathaniel Diamant, Alex Tseng, Tommaso Biancalani, Gabriele Scalia, Kevin Black

arXiv · PDF · Open in the Atlas

Code that ran

1 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 0 have no contract verdict; 1 failure of our instrument; 3 no recorded run), measured 2026-11-22; 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/2402.16359.json · badge: /api/ran/2402.16359.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
zhaoyl18/SEIKO community
Papers with Code archive
1 ran · 0 no recorded run
masa-ue/RLfinetuning_Diffusion_Bioseq community
Papers with Code archive
0 ran · 3 no recorded run
FunctionStatusWhere it lives
generate_new_x Ran
ran; our contract draft was wrong, not the code
zhaoyl18/SEIKO/online/model_utils.py
code served (permissive licence) · get_code("f7dab25c871c3d4f")
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) and returned Tensor, ndim 2, dtype family float, shape (2, 768) 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
from unittest.mock import Mock, MagicMock
import random

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

# Stand-in config class
class Config:
    def __init__(self):
        self.good_prompt_prop = 0.5
        self.sd_guidance_scale = 7.5
        self.sample_eta = 1.0
        self.sample = Mock()
        self.sample.batch_size_per_gpu_available = 2

# Stand-in UNet model
class StandInUNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4 * 64 * 64, 4 * 64 * 64)
    
    def forward(self, latent, t, embeds):
        batch_size = latent.shape[0]
        latent_flat = latent.view(batch_size, -1)
        output = self.linear(latent_flat)
        output = output.view(batch_size, 4, 64, 64)
        result = Mock()
        result.sample = output
        return result

# Stand-in text encoder
class StandInTextEncoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(10, 768)
    
    def forward(self, input_ids):
        batch_size = input_ids.shape[0]
        output = self.linear(input_ids.float())
        return (output,)

# Stand-in VAE
class StandInVAE(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4 * 64 * 64, 3 * 32 * 32)
        self.dtype = torch.float32
    
    def decode(self, latent):
        batch_size = latent.shape[0]
        latent_flat = latent.view(batch_size, -1)
        output = self.linear(latent_flat)
        output = output.view(batch_size, 3, 32, 32)
        result = Mock()
        result.sample = output
        return result

# Stand-in tokenizer
class StandInTokenizer:
    def __init__(self):
        self.model_max_length = 10
    
    def __call__(self, prompts, return_tensors=None, padding=None, truncation=None, max_length=None):
        batch_size = len(prompts)
        input_ids = torch.randint(0, 100, (batch_size, self.model_max_length))
        result = Mock()
        result.input_ids = input_ids
        return result

# Stand-in scheduler
class StandInScheduler:
    def __init__(self):
        self.timesteps = [999, 799, 599, 399, 199]
        self.alphas_cumprod = torch.linspace(1.0, 0.0, 1000)
    
    def step(self, noise_pred, timestep, latent, eta):
        result = Mock()
        result.prev_sample = latent + torch.randn_like(latent) * 0.01
        return result

# Stand-in pipeline
class StandInPipeline:
    def __init__(self):
        self.tokenizer = StandInTokenizer()
        self.text_encoder = StandInTextEncoder()
        self.vae = StandInVAE()
        self.scheduler = StandInScheduler()

# Stand-in accelerator
class StandInAccelerator:
    def __init__(self):
        self.device = torch.device('cpu')
        self.is_local_main_process = True

# Prompt function
def prompt_fn():
    return ('cat', {})

# Embedding function
def embedding_fn(images):
    batch_size = images.shape[0]
    return torch.randn(batch_size, 768)

# Negative prompt embeds
sample_neg_prompt_embeds = torch.randn(1, 10, 768)

ARGS = {
    'current_unet': StandInUNet(),
    'num_new_x': 2,
    'pipeline': StandInPipeline(),
    'accelerator': StandInAccelerator(),
    'config': Config(),
    'inference_dtype': torch.float32,
    'prompt_fn': prompt_fn,
    'sample_neg_prompt_embeds': sample_neg_prompt_embeds,
    'embedding_fn': embedding_fn,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch, tqdm — 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, 768) — shape (2, 768) 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
Euler_Maruyama_sampler_PPO Not yet run
unverified (harvested, no recorded run)
masa-ue/RLfinetuning_Diffusion_Bioseq/src/model/ddsm_PPO.py
pointer only (licence: NONE) · get_code("d2ab5c7f2a32f044")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, masa-ue/RLfinetuning_Diffusion_Bioseq 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. No invocation recorded.

calculate_newprob Not yet run
unverified (harvested, no recorded run)
masa-ue/RLfinetuning_Diffusion_Bioseq/src/model/ddsm_PPO.py
pointer only (licence: NONE) · get_code("be0a0bacc7733f80")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, masa-ue/RLfinetuning_Diffusion_Bioseq 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. No invocation recorded.

fine_tuning Not yet run
unverified (harvested, no recorded run)
masa-ue/RLfinetuning_Diffusion_Bioseq/src/model/ddsm_PPO.py
pointer only (licence: NONE) · get_code("bce5cae39a6a1b77")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, masa-ue/RLfinetuning_Diffusion_Bioseq 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. 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

Diffusion models excel at modeling complex data distributions, including those of images, proteins, and small molecules. However, in many cases, our goal is to model parts of the distribution that maximize certain properties: for example, we may want to generate images with high aesthetic quality, or molecules with high bioactivity. It is natural to frame this as a reinforcement learning (RL) problem, in which the objective is to fine-tune a diffusion model to maximize a reward function that corresponds to some property. Even with access to online queries of the ground-truth reward function, efficiently discovering high-reward samples can be challenging: they might have a low probability in the initial distribution, and there might be many infeasible samples that do not even have a well-defined reward (e.g., unnatural images or physically impossible molecules). In this work, we propose a novel reinforcement learning procedure that efficiently explores on the manifold of feasible samples. We present a theoretical analysis providing a regret guarantee, as well as empirical validation across three domains: images, biological sequences, and molecules. The code is available at https://github.com/zhaoyl18/SEIKO.

For agents

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

get_harvested_code_for_paper("2402.16359")
get_code_for_paper("2402.16359")
have("2402.16359")

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

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

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

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

Connect an agent — have() is free.