SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.11049 · 2025

GuardReasoner-VL: Safeguarding VLMs via Reinforced Reasoning

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 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 6 have no contract verdict; 3 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/2505.11049.json · badge: /api/ran/2505.11049.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
yueliu1999/guardreasoner-vl canonical (classifier label)
classifier basis not recorded on the link
9 ran · 3 no recorded run
FunctionStatusWhere it lives
cal_weighted_f1 Ran
ran on a synthesized input
yueliu1999/guardreasoner-vl/evaluate.py
code served (permissive licence) · get_code("d4fcebcf31275298")
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:
# - f1_list parameter: a list of dicts, each dict has 'f1' and 'weight' keys
# - clear parameter: boolean, defaults to True
# The function iterates through f1_list and accesses i['f1'] and i['weight']

# Create sample f1_list with dicts containing 'f1' and 'weight' keys
f1_list = [
    {'f1': 0.85, 'weight': 2.0},
    {'f1': 0.90, 'weight': 3.0},
    {'f1': 0.88, 'weight': 1.5}
]

ARGS = {
    'f1_list': f1_list,
    'clear': True
}
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
compute_gae_advantage_return Ran
ran on a synthesized input
yueliu1999/guardreasoner-vl/train/EasyR1/verl/trainer/core_algos.py
code served (permissive licence) · get_code("e12b5e0633d1b0a3")
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 torch.nn.functional as F

torch.manual_seed(0)

# Create a stand-in for VF.masked_whiten since it's referenced in the function
class VF:
    @staticmethod
    def masked_whiten(values, mask):
        """Simple whitening: normalize by mean and std, respecting mask"""
        masked_values = values * mask
        mean = masked_values.sum() / mask.sum().clamp(min=1e-8)
        var = ((masked_values - mean) ** 2 * mask).sum() / mask.sum().clamp(min=1e-8)
        return (values - mean) / (torch.sqrt(var) + 1e-8)

# Patch it into the function's namespace
import sys
current_module = sys.modules[__name__]
setattr(current_module, 'VF', VF)

# Set up tensor arguments
batch_size = 2
response_length = 4

token_level_rewards = torch.randn(batch_size, response_length)
values = torch.randn(batch_size, response_length)
eos_mask = torch.ones(batch_size, response_length)
eos_mask[0, 3] = 0  # Mask out token after EOS for first batch
eos_mask[1, 2:] = 0  # Mask out tokens after EOS for second batch

gamma = torch.tensor(0.99)
lam = torch.tensor(0.95)

ARGS = {
    "token_level_rewards": token_level_rewards,
    "values": values,
    "eos_mask": eos_mask,
    "gamma": gamma,
    "lam": lam,
}
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
concat_text Ran
ran on a synthesized input
yueliu1999/guardreasoner-vl/train/data_augmentation.py
code served (permissive licence) · get_code("e82f29866d9b24d6")
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 str. 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)

t1 = "  hello world  "
t2 = "  foo bar  "

ARGS = {
    "t1": t1,
    "t2": t2,
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
get_kl_controller Ran
ran; our contract draft was wrong, not the code
yueliu1999/guardreasoner-vl/train/EasyR1/verl/trainer/core_algos.py
code served (permissive licence) · get_code("b5973cf2aefac349")
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 AdaptiveKLController. 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

class AlgorithmConfig:
    def __init__(self, kl_type, kl_coef, kl_target=None, kl_horizon=None):
        self.kl_type = kl_type
        self.kl_coef = kl_coef
        self.kl_target = kl_target
        self.kl_horizon = kl_horizon

ARGS = {
    'algorithm_config': AlgorithmConfig(
        kl_type='adaptive',
        kl_coef=0.1,
        kl_target=0.01,
        kl_horizon=10000.0
    )
}
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 AdaptiveKLController — a AdaptiveKLController output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AdaptiveKLController 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
prompt_gt_mix Ran
ran on a synthesized input
yueliu1999/guardreasoner-vl/train/data_augmentation.py
code served (permissive licence) · get_code("d797f71ea34bc6e9")
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 str. 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 = {
    'promtpt1': 'harmful',
    'prompt2': 'unharmful'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
res_gt_mix Ran
ran on a synthesized input
yueliu1999/guardreasoner-vl/train/data_augmentation.py
code served (permissive licence) · get_code("d0231286cb1e3033")
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 str. 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

ARGS = {
    'promtpt1': 'harmful',
    'prompt2': 'unharmful'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
reverse Ran
ran on a synthesized input
yueliu1999/guardreasoner-vl/evaluate.py
code served (permissive licence) · get_code("a940cd1fa5eb303c")
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 str. 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

torch.manual_seed(0)

# The function 'reverse' takes a single parameter 'gt_example' which is a string
# that can be either 'harmful' or 'unharmful'. It returns the opposite classification.
# We'll test with one of the valid string inputs.

ARGS = {
    'gt_example': 'harmful'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
union_tensor_dict Ran
ran; our contract draft was wrong, not the code
yueliu1999/guardreasoner-vl/train/EasyR1/verl/protocol.py
pointer only (licence: MIT); the stored copy get_code serves, from Chengsong-Huang/RelayLLM, is pointer only (licence: NONE) · get_code("ad658a1d6fe829ba")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from Chengsong-Huang/RelayLLM, 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.

unpad_dataproto Ran
ran; our contract draft was wrong, not the code
yueliu1999/guardreasoner-vl/train/EasyR1/verl/protocol.py
code served (permissive licence) · get_code("a91c18341292d50e")
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 DataProto. 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

torch.manual_seed(0)

class DataProto:
    """Stand-in DataProto class that supports slicing via __getitem__"""
    def __init__(self, data):
        self.data = data
    
    def __getitem__(self, key):
        """Support slicing operation"""
        sliced_data = self.data[key]
        return DataProto(sliced_data)
    
    def __repr__(self):
        return f"DataProto({self.data})"

# Create a small DataProto instance with some data
data_tensor = torch.randn(2, 4)
data_proto = DataProto(data_tensor)

# Define arguments
ARGS = {
    "data": data_proto,
    "pad_size": 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 DataProto — a DataProto output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataProto 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
cal_f1 Not yet run
unverified (harvested, no recorded run)
yueliu1999/guardreasoner-vl/evaluate.py
code served (permissive licence) · get_code("2f407d7f61063ffb")
How it ran

no invocation recorded.

compute_grpo_outcome_advantage Not yet run
unverified (harvested, no recorded run)
yueliu1999/guardreasoner-vl/train/EasyR1/verl/trainer/core_algos.py
code served (permissive licence) · get_code("dc62e3047c2f6e56")
How it ran

no invocation recorded.

pad_dataproto_to_divisor Not yet run
unverified (harvested, no recorded run)
yueliu1999/guardreasoner-vl/train/EasyR1/verl/protocol.py
code served (permissive licence) · get_code("2604e5877f8242b0")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 4 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 4 the same month, 4 later) and 8 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
unpad_dataproto 10 other papers
1 dated earlier, 1 the same month, 7 later, 1 undated
2503.17352 (2025-03)
OpenVLThinker: Complex Vision-Language Reasoning via Iterative SFT-RL Cycles
2505.16282 (2025-05)
ARPO:End-to-End Policy Optimization for GUI Agents with Experience Replay
2506.01908 (2025-06)
Reinforcement Learning Tuning for VideoLLMs: Reward Design and Data Efficiency
and 7 more not named here
get_kl_controller 9 other papers
1 dated earlier, 1 the same month, 6 later, 1 undated
2503.17352 (2025-03)
OpenVLThinker: Complex Vision-Language Reasoning via Iterative SFT-RL Cycles
2505.16282 (2025-05)
ARPO:End-to-End Policy Optimization for GUI Agents with Experience Replay
2506.01908 (2025-06)
Reinforcement Learning Tuning for VideoLLMs: Reward Design and Data Efficiency
and 6 more not named here
union_tensor_dict 7 other papers
1 dated earlier, 1 the same month, 4 later, 1 undated
2503.17352 (2025-03)
OpenVLThinker: Complex Vision-Language Reasoning via Iterative SFT-RL Cycles
2505.16282 (2025-05)
ARPO:End-to-End Policy Optimization for GUI Agents with Experience Replay
2506.01908 (2025-06)
Reinforcement Learning Tuning for VideoLLMs: Reward Design and Data Efficiency
and 4 more not named here
pad_dataproto_to_divisor 4 other papers
1 the same month, 3 later
2505.16282 (2025-05)
ARPO:End-to-End Policy Optimization for GUI Agents with Experience Replay
2506.01908 (2025-06)
Reinforcement Learning Tuning for VideoLLMs: Reward Design and Data Efficiency
2507.05386 (2025-07)
Reinforcement Fine-Tuning Naturally Mitigates Forgetting in Continual Post-Training
and 1 more not named here

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

To enhance the safety of VLMs, this paper introduces a novel reasoning-based VLM guard model dubbed GuardReasoner-VL. The core idea is to incentivize the guard model to deliberatively reason before making moderation decisions via online RL. First, we construct GuardReasoner-VLTrain, a reasoning corpus with 123K samples and 631K reasoning steps, spanning text, image, and text-image inputs. Then, based on it, we cold-start our model's reasoning ability via SFT. In addition, we further enhance reasoning regarding moderation through online RL. Concretely, to enhance diversity and difficulty of samples, we conduct rejection sampling followed by data augmentation via the proposed safety-aware data concatenation. Besides, we use a dynamic clipping parameter to encourage exploration in early stages and exploitation in later stages. To balance performance and token efficiency, we design a length-aware safety reward that integrates accuracy, format, and token cost. Extensive experiments demonstrate the superiority of our model. Remarkably, it surpasses the runner-up by 19.27% F1 score on average. We release data, code, and models (3B/7B) of GuardReasoner-VL at https://github.com/yueliu1999/GuardReasoner-VL/

For agents

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

get_harvested_code_for_paper("2505.11049")
get_code_for_paper("2505.11049")
have("2505.11049")

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

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

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

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

Connect an agent — have() is free.