SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2602.12636 · 2026

Dual-Granularity Contrastive Reward via Generated Episodic Guidance for Efficient Embodied RL

Yixuan Li, Xin Liu, Haoran Li, Dongbin Zhao, Yuhui Chen, Yuxing Qin

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 0 failures of our instrument; 0 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/2602.12636.json · badge: /api/ran/2602.12636.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
modelscope/DiffSynth-Studio community
Papers with Code archive
4 ran · 0 no recorded run
FunctionStatusWhere it lives
UnifiedReward2Model Ran
ran on a synthesized input · constructed an object; no result was computed
modelscope/DiffSynth-Studio/diffsynth/models/unified_reward_2.py
code served (permissive licence) · get_code("18d36b714bd7802f")
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, UnifiedReward2Model: 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 PIL import Image

torch.manual_seed(0)

# Create a minimal mock model
class MockVisionLanguageModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embed = nn.Linear(16, 32)
    
    def generate(self, **kwargs):
        # Return dummy generated token ids
        batch_size = kwargs.get('input_ids', torch.zeros(1, 10)).shape[0]
        max_new_tokens = kwargs.get('max_new_tokens', 10)
        input_ids = kwargs.get('input_ids', torch.zeros(batch_size, 10, dtype=torch.long))
        # Simulate generation by concatenating dummy tokens
        dummy_tokens = torch.randint(100, 200, (batch_size, max_new_tokens), dtype=torch.long)
        return torch.cat([input_ids, dummy_tokens], dim=1)

# Create a minimal mock processor
class MockProcessor:
    def __init__(self):
        self.tokenizer = MockTokenizer()
    
    def __call__(self, text=None, images=None, padding=None, return_tensors=None):
        # Return dummy processor output
        batch_size = len(text) if text else 1
        num_images = len(images) if images else 0
        
        result = {
            'input_ids': torch.randint(0, 1000, (batch_size, 32), dtype=torch.long),
            'attention_mask': torch.ones(batch_size, 32, dtype=torch.long),
            'pixel_values': torch.randn(batch_size, 3, 224, 224),
        }
        
        # Return object with to() method
        return ProcessorOutput(result)
    
    def apply_chat_template(self, messages, tokenize=False, add_generation_prompt=False):
        return "You are presented with a generated image and its associated text caption."
    
    def batch_decode(self, token_ids, skip_special_tokens=False, clean_up_tokenization_spaces=False):
        # Return mock decoded text with expected format
        return [
            "Alignment Score (1-5): 4\nCoherence Score (1-5): 3\nStyle Score (1-5): 5"
        ]

class MockTokenizer:
    pad_token_id = 0
    eos_token_id = 2

class ProcessorOutput(dict):
    def to(self, device=None, dtype=None):
        result = {}
        for key, value in self.items():
            if torch.is_tensor(value):
                if dtype is not None:
                    result[key] = value.to(dtype=dtype)
                else:
                    result[key] = value
            else:
                result[key] = value
        return result

# Create minimal model with parameters so device/dtype properties work
model = MockVisionLanguageModel()
processor = MockProcessor()

ARGS = {
    'model': model,
    'processor': processor,
    'max_new_tokens': 1024
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type UnifiedReward2Model — 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 UnifiedReward2Model 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
_as_list Ran
ran, honoured the contract we drafted
modelscope/DiffSynth-Studio/diffsynth/models/unified_reward_2.py
code served (permissive licence) · get_code("946f8dd3aeac4ab6")
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 int; 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 numpy as np

torch.manual_seed(0)

# Test case 1: list input
list_value = [1, 2, 3]

# Test case 2: tuple input
tuple_value = (4, 5, 6)

# Test case 3: scalar input
scalar_value = 42

# Test case 4: string input
string_value = "hello"

# Test case 5: numpy array input
numpy_value = np.array([1, 2, 3])

# Test case 6: tensor input
tensor_value = torch.randn(2, 4)

# We'll test with a simple scalar value
ARGS = {
    "value": 42
}
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 list, ndim 1, dtype family int — 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
_coerce_float Ran
ran, honoured the contract we drafted
modelscope/DiffSynth-Studio/diffsynth/models/unified_reward_2.py
code served (permissive licence) · get_code("b648100542b71e18")
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 re

def _coerce_float(value):
    if isinstance(value, bool):
        return None
    if isinstance(value, (int, float)):
        return float(value)
    if isinstance(value, str):
        match = re.search('[-+]?\\d*\\.?\\d+', value)
        if match:
            return float(match.group())
    return None

# The function takes a single parameter 'value' which can be:
# - bool (returns None)
# - int or float (returns float)
# - str (extracts and returns float if found, else None)
# - anything else (returns None)

ARGS = {
    "value": 42.5
}
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 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
_mean Ran
ran, honoured the contract we drafted
modelscope/DiffSynth-Studio/diffsynth/models/unified_reward_2.py
code served (permissive licence) · get_code("4f6b773950cc2bb8")
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
import numpy as np

# Analyze the function:
# _mean takes 'values' parameter
# It filters out None values
# It sums the remaining values and divides by their count
# It returns None if values list is empty after filtering

# Create test values - mix of numbers and None
values = [1.5, 2.5, None, 3.5, 4.0, None, 5.5]

ARGS = {
    "values": values
}
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 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

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

Designing suitable rewards poses a significant challenge in reinforcement learning (RL), especially for embodied manipulation. Trajectory success rewards are suitable for human judges or model fitting, but the sparsity severely limits RL sample efficiency. While recent methods have effectively improved RL via dense rewards, they rely heavily on high-quality human-annotated data or abundant expert supervision. To tackle these issues, this paper proposes Dual-granularity contrastive reward via generated Episodic Guidance (DEG), a novel framework to seek sampleefficient dense rewards without requiring human annotations or extensive supervision. Leveraging the prior knowledge of large video generation models, DEG only needs a small number of expert videos for domain adaptation to generate dedicated task guidance for each RL episode. Then, the proposed dual-granularity reward that balances coarse-grained exploration and fine-grained matching, will guide the agent to efficiently approximate the generated guidance video sequentially in the contrastive self-supervised latent space, and finally complete the target task. Extensive experiments on 18 diverse tasks across both simulation and real-world settings show that DEG can not only serve as an efficient exploration stimulus to help the agent quickly discover sparse success rewards, but also guide effective RL and stable policy convergence independently.

For agents

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

get_harvested_code_for_paper("2602.12636")
get_code_for_paper("2602.12636")
have("2602.12636")

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

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

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

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

Connect an agent — have() is free.