SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.12030 · 2024

SPA-VL: A Comprehensive Safety Preference Alignment Dataset for Vision Language Model

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 2 no recorded run); 2 of them were also run on the host, not in the jail, by the peer-agreement lane that set their level, measured 2026-11-23; 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/2406.12030.json · badge: /api/ran/2406.12030.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
echosechen/spa-vl-rlhf canonical (classifier label)
classifier basis: census
7 ran · 2 no recorded run
FunctionStatusWhere it lives
batch_select Ran
ran; our contract draft was wrong, not the code
echosechen/spa-vl-rlhf/models/ppo/reward_model.py
code served (permissive licence) · get_code("2154e44a6b59e432")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family int, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T22:51:12Z). 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 input tensor: batch_size=2, num_features=4
input = torch.tensor([
    [0, 1, 2, 5],
    [3, 0, 9, 4],
])

# Create index tensor: batch_size=2, num_selections=3
# Each row contains indices to select from the corresponding input row
index = torch.tensor([
    [0, 1, 3],
    [1, 0, 2],
])

ARGS = {
    "input": input,
    "index": index,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 int, shape (2, 3) — shape (2, 3) 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
unpack_dict Ran
ran; our contract draft was wrong, not the code
echosechen/spa-vl-rlhf/models/ppo/reward_model.py
code served (permissive licence) · get_code("a6989412aca721c1")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T01:20:33Z). 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)

# Create a sample dictionary with various keys and values
d = {
    'key1': torch.randn(2, 4),
    'key2': torch.randn(3, 5),
    'key3': 'value3',
    'key4': 42,
    'key5': [1, 2, 3],
}

# Define keys to extract
keys = ['key1', 'key3', 'key4']

# Define return type
return_type = tuple

ARGS = {
    'd': d,
    'keys': keys,
    'return_type': return_type,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — 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
adjust_queries Ran
ran; our contract draft was wrong, not the code
echosechen/spa-vl-rlhf/infer_json.py
code served (permissive licence) · get_code("d81457ff8457bb3b")
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, 3) 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)

# The function expects queries to be a tensor that supports:
# - != comparison (returns boolean tensor)
# - .long() conversion
# - .sum(dim=1) operation
# - .max() operation
# - slicing with [:, -max_length:]

# Create a small queries tensor: batch_size=2, sequence_length=4
# Include some zeros to make the non_zero_lengths calculation meaningful
queries = torch.tensor([
    [5, 3, 0, 0],
    [2, 1, 4, 0]
], dtype=torch.float32)

ARGS = {
    "queries": queries
}
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, 3) — shape (2, 3) 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
all_gather_and_cat Ran
ran, honoured the contract we drafted
echosechen/spa-vl-rlhf/all_utils/distributed_utils.py
code served (permissive licence) · get_code("5aa59c85970b28a7")
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, 4) 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 os
import torch
import torch.distributed as dist

torch.manual_seed(0)

# Set up a non-distributed environment (WORLD_SIZE = 1)
# This allows the function to run without actual distributed setup
os.environ['WORLD_SIZE'] = '1'

# Create a small tensor for testing
# Shape: (2, 4) - batch size 2, feature dimension 4
tensor = torch.randn(2, 4)

ARGS = {
    'tensor': tensor,
    'dim': 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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
create_scheduler Ran
ran; our contract draft was wrong, not the code
echosechen/spa-vl-rlhf/all_utils/trainer_utils.py
code served (permissive licence) · get_code("42596ac916e883a5")
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 LambdaLR. 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.optim import Adam

torch.manual_seed(0)

# Create a minimal optimizer
model = nn.Linear(4, 3)
optimizer = Adam(model.parameters(), lr=1e-4)

# Create a minimal args object with required attributes and methods
class Args:
    def __init__(self):
        self.lr_scheduler_type = "linear"
    
    def get_warmup_steps(self, num_training_steps):
        return int(0.1 * num_training_steps)

args = Args()

# Set up the remaining parameters
num_training_steps = 1000
lr_scheduler = None

ARGS = {
    "args": args,
    "optimizer": optimizer,
    "lr_scheduler": lr_scheduler,
    "num_training_steps": num_training_steps,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR 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
setup Ran
ran, honoured the contract we drafted
echosechen/spa-vl-rlhf/all_utils/distributed_utils.py
code served (permissive licence) · get_code("4098e9c2afde4a5d")
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 1, dtype family int; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 sys
import torch
import torch.distributed as dist

torch.manual_seed(0)

# The setup function takes optional rank and world_size parameters
# If None, it tries to read from environment variables RANK and WORLD_SIZE
# For testing, we'll provide explicit values to avoid needing env vars

ARGS = {
    'rank': 0,
    'world_size': 1,
}
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 1, dtype family int — 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
truncate_after_eos_with_padding Ran
ran, honoured the contract we drafted
echosechen/spa-vl-rlhf/models/dpo/dpo_trainer.py
code served (permissive licence) · get_code("6ff9248489766439")
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 int, shape (2, 5) 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 a small batch of token sequences
# Shape: (batch_size=2, sequence_length=5)
completions = torch.tensor([
    [101, 102, 103, 0, 0],      # sequence with eos_token_id=102 at position 1
    [101, 104, 105, 102, 0]     # sequence with eos_token_id=102 at position 3
], dtype=torch.long)

eos_token_id = 102
pad_token_id = 0
additional_tokens = [103, 104]  # list of additional token ids to truncate after

ARGS = {
    "completions": completions,
    "eos_token_id": eos_token_id,
    "pad_token_id": pad_token_id,
    "additional_tokens": additional_tokens
}
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 int, shape (2, 5) — shape (2, 5) 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
custom_gather Not yet run
unverified (harvested, no recorded run)
echosechen/spa-vl-rlhf/infer_json.py
code served (permissive licence) · get_code("4d9dae8e7537c18a")
How it ran

no invocation recorded.

setup_accelerator Not yet run
unverified (harvested, no recorded run)
echosechen/spa-vl-rlhf/all_utils/trainer_utils.py
code served (permissive licence) · get_code("ddf566ec4ea0d353")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 6 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 5 the same month, 2 later) and 3 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
create_scheduler 4 other papers
2 dated earlier, 1 the same month, 1 later
2309.09055 (2023-09)
Exploring the impact of low-rank adaptation on the performance, efficiency, and regularization of RLHF
2310.05910 (2023-10)
SALMON: Self-Alignment with Instructable Reward Models
2406.11280 (2024-06)
ISR-DPO: Aligning Large Multimodal Models for Videos by Iterative Self-Retrospective DPO
and 1 more not named here
all_gather_and_cat 3 other papers
2 dated earlier, 1 the same month
2310.05910 (2023-10)
SALMON: Self-Alignment with Instructable Reward Models
2405.11165 (2024-05)
Automated Multi-level Preference for MLLMs
2406.11280 (2024-06)
ISR-DPO: Aligning Large Multimodal Models for Videos by Iterative Self-Retrospective DPO
batch_select 3 other papers
2 dated earlier, 1 the same month
2310.05910 (2023-10)
SALMON: Self-Alignment with Instructable Reward Models
2403.09472 (2024-03)
Easy-to-Hard Generalization: Scalable Alignment Beyond Human Supervision
2406.11280 (2024-06)
ISR-DPO: Aligning Large Multimodal Models for Videos by Iterative Self-Retrospective DPO
setup 3 other papers
2 dated earlier, 1 the same month
2310.05910 (2023-10)
SALMON: Self-Alignment with Instructable Reward Models
2405.11165 (2024-05)
Automated Multi-level Preference for MLLMs
2406.11280 (2024-06)
ISR-DPO: Aligning Large Multimodal Models for Videos by Iterative Self-Retrospective DPO
unpack_dict 3 other papers
2 dated earlier, 1 the same month
2310.05910 (2023-10)
SALMON: Self-Alignment with Instructable Reward Models
2403.09472 (2024-03)
Easy-to-Hard Generalization: Scalable Alignment Beyond Human Supervision
2406.11280 (2024-06)
ISR-DPO: Aligning Large Multimodal Models for Videos by Iterative Self-Retrospective DPO
truncate_after_eos_with_padding 1 other paper
1 later
2501.09695 (2025-01)
Mitigating Hallucinations in Large Vision-Language Models via DPO: On-Policy Data Hold the Key

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

The emergence of Vision Language Models (VLMs) has brought unprecedented advances in understanding multimodal information. The combination of textual and visual semantics in VLMs is highly complex and diverse, making the safety alignment of these models challenging. Furthermore, due to the limited study on the safety alignment of VLMs, there is a lack of large-scale, high-quality datasets. To address these limitations, we propose a Safety Preference Alignment dataset for Vision Language Models named SPA-VL. In terms of breadth, SPA-VL covers 6 harmfulness domains, 13 categories, and 53 subcategories, and contains 100,788 samples of the quadruple (question, image, chosen response, rejected response). In terms of depth, the responses are collected from 12 open-source (e.g., QwenVL) and closed-source (e.g., Gemini) VLMs to ensure diversity. The construction of preference data is fully automated, and the experimental results indicate that models trained with alignment techniques on the SPA-VL dataset exhibit substantial improvements in harmlessness and helpfulness while maintaining core capabilities. SPA-VL, as a large-scale, high-quality, and diverse dataset, represents a significant milestone in ensuring that VLMs achieve both harmlessness and helpfulness.

For agents

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

get_harvested_code_for_paper("2406.12030")
get_code_for_paper("2406.12030")
have("2406.12030")

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

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

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

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

Connect an agent — have() is free.