SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.06666 · 2024

SafeGen: Mitigating Sexually Explicit Content Generation in Text-to-Image Models

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 2 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/2404.06666.json · badge: /api/ran/2404.06666.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
letterligo/text-agnostic-governance canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
preprocess_video Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
letterligo/text-agnostic-governance/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py
code served (permissive licence) · get_code("307ff0034e728f78")
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 5, dtype family float, shape (1, 3, 2, 4, 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 numpy as np
import torch
import PIL.Image

torch.manual_seed(0)

# Create a small video input as a list of numpy arrays
# Each frame is (H, W, C) format, uint8
frame1 = np.random.randint(0, 256, (4, 3, 3), dtype=np.uint8)
frame2 = np.random.randint(0, 256, (4, 3, 3), dtype=np.uint8)

video = [frame1, frame2]

ARGS = {
    "video": video
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 5, dtype family float, shape (1, 3, 2, 4, 3) — shape (1, 3, 2, 4, 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
rearrange_0 Ran
ran; our contract draft was wrong, not the code
letterligo/text-agnostic-governance/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py
code served (permissive licence) · get_code("c94fdebafdd5993d")
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 5, dtype family float, shape (4, 3, 2, 4, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Create a tensor with shape (F, C, H, W)
# F must be divisible by f
# Using distinct sizes: F=8, C=3, H=4, W=5
tensor = torch.randn(8, 3, 4, 5)

# f must divide F evenly
f = 2

ARGS = {
    "tensor": tensor,
    "f": f
}
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 5, dtype family float, shape (4, 3, 2, 4, 5) — shape (4, 3, 2, 4, 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
rearrange_1 Ran
ran; our contract draft was wrong, not the code
letterligo/text-agnostic-governance/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py
code served (permissive licence) · get_code("85ec51431a1b359b")
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 4, dtype family float, shape (6, 4, 5, 6) 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)

# The function expects a 5D tensor with dimensions (B, C, F, H, W)
# where:
# B = batch size
# C = channels
# F = frames (or frequency)
# H = height
# W = width

# Create a small 5D tensor with distinct sizes for each dimension
# B=2, C=4, F=3, H=5, W=6
tensor = torch.randn(2, 4, 3, 5, 6)

ARGS = {
    "tensor": tensor
}
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 4, dtype family float, shape (6, 4, 5, 6) — shape (6, 4, 5, 6) 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
rearrange_3 Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
letterligo/text-agnostic-governance/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_zero.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ybybzhang/videoelevator, is pointer only (licence: NONE) · get_code("55abb7c763ca4252")
How it ran

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

retrieve_latents Ran
ran, honoured the contract we drafted
letterligo/text-agnostic-governance/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth_img2img.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from JS-CHU/RoamScene3D, is pointer only (licence: NONE) · get_code("98bcd15cf273e3b4")
How it ran

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

tensor2vid Ran
ran; our contract draft was wrong, not the code
letterligo/text-agnostic-governance/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py
code served (permissive licence) · get_code("6abc8eb6537ace1e")
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 4, 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)

# Construct a valid video tensor
# Shape: (batch=2, channels=3, frames=4, height=8, width=6)
# Values normalized to typical range for video (e.g., [-1, 1] after normalization)
video = torch.randn(2, 3, 4, 8, 6)

# Define the ARGS dictionary with all parameters
ARGS = {
    "video": video,
    "mean": [0.5, 0.5, 0.5],
    "std": [0.5, 0.5, 0.5],
}
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 4, 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
get_down_block Not yet run
unverified (harvested, no recorded run)
letterligo/text-agnostic-governance/src/diffusers/pipelines/versatile_diffusion/modeling_text_unet.py
code served (permissive licence) · get_code("6cdb5efd1bc4e690")
How it ran

no invocation recorded.

get_up_block Not yet run
unverified (harvested, no recorded run)
letterligo/text-agnostic-governance/src/diffusers/pipelines/versatile_diffusion/modeling_text_unet.py
code served (permissive licence) · get_code("052b20f9896c58b9")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 1 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
retrieve_latents 19 other papers
2 dated earlier, 1 the same month, 15 later, 1 undated
2401.07519 (2024-01)
InstantID: Zero-shot Identity-Preserving Generation in Seconds
2403.14773 (2024-03)
StreamingT2V: Consistent, Dynamic, and Extendable Long Video Generation from Text
2404.14951 (2024-04)
Reconstructing the Image Stitching Pipeline: Integrating Fusion and Rectangling into a Unified Inpainting Model
and 16 more not named here
rearrange_3 3 other papers
2 dated earlier, 1 later
2305.14330 (2023-05)
DirecT2V: Large Language Models are Frame-Level Directors for Zero-Shot Text-to-Video Generation
2403.05438 (2024-03)
VideoElevator: Elevating Video Generation Quality with Versatile Text-to-Image Diffusion Models
2507.09102 (2025-07)
Harnessing Text-to-Image Diffusion Models for Point Cloud Self-Supervised Learning
tensor2vid 2 other papers
2 dated earlier
2309.15818 (2023-09)
Show-1: Marrying Pixel and Latent Diffusion Models for Text-to-Video Generation
2312.07509 (2023-12)
PEEKABOO: Interactive Video Generation via Masked-Diffusion
rearrange_0 1 other paper
1 dated earlier
2305.14330 (2023-05)
DirecT2V: Large Language Models are Frame-Level Directors for Zero-Shot Text-to-Video Generation
rearrange_1 1 other paper
1 dated earlier
2305.14330 (2023-05)
DirecT2V: Large Language Models are Frame-Level Directors for Zero-Shot Text-to-Video Generation

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

Text-to-image (T2I) models, such as Stable Diffusion, have exhibited remarkable performance in generating high-quality images from text descriptions in recent years. However, text-to-image models may be tricked into generating not-safe-for-work (NSFW) content, particularly in sexually explicit scenarios. Existing countermeasures mostly focus on filtering inappropriate inputs and outputs, or suppressing improper text embeddings, which can block sexually explicit content (e.g., naked) but may still be vulnerable to adversarial prompts -- inputs that appear innocent but are ill-intended. In this paper, we present SafeGen, a framework to mitigate sexual content generation by text-to-image models in a text-agnostic manner. The key idea is to eliminate explicit visual representations from the model regardless of the text input. In this way, the text-to-image model is resistant to adversarial prompts since such unsafe visual representations are obstructed from within. Extensive experiments conducted on four datasets and large-scale user studies demonstrate SafeGen's effectiveness in mitigating sexually explicit content generation while preserving the high-fidelity of benign images. SafeGen outperforms eight state-of-the-art baseline methods and achieves 99.4% sexual content removal performance. Furthermore, our constructed benchmark of adversarial prompts provides a basis for future development and evaluation of anti-NSFW-generation methods.

For agents

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

get_harvested_code_for_paper("2404.06666")
get_code_for_paper("2404.06666")
have("2404.06666")

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

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

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

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

Connect an agent — have() is free.