SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.06394 · NAACL · 2025

SynthDetoxM: Modern LLMs are Few-Shot Parallel Detoxification Data Annotators

Alexander Panchenko, Elena Tutubalina, Daniil Moskovskiy, Sergey Pletenev, N. Sushko

arXiv · PDF · Open in the Atlas

Code that ran

7 of 10 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 7 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/2502.06394.json · badge: /api/ran/2502.06394.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
s-nlp/synthdetoxm canonical (classifier label)
classifier basis not recorded on the link
7 ran · 3 no recorded run
FunctionStatusWhere it lives
calculate_mean_detox_delta Ran
ran on a synthesized input
s-nlp/synthdetoxm/src/filter_non_detoxifiable_examples.py
code served (permissive licence) · get_code("8bcb6473ab313cdf")
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 DataFrame. 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
import pandas as pd

# Create a sample DataFrame that matches the function's expectations
data = {
    'sta_toxic_pipe': [0.8, 0.7],
    'sta_detoxed_pipe_file1': [0.3, 0.2],
    'sta_detoxed_pipe_file2': [0.4, 0.25],
    'is_refusal_file1': [False, False],
    'is_refusal_file2': [False, True],
    'sta_toxic_api': [0.75, 0.65],
    'sta_detoxed_api_file1': [0.25, 0.15],
    'sta_detoxed_api_file2': [0.35, 0.20],
}

df = pd.DataFrame(data)

ARGS = {
    'df': df
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
classify_refusals Ran
ran on a synthesized input
s-nlp/synthdetoxm/src/filter_non_detoxifiable_examples.py
code served (permissive licence) · get_code("38bab01156f3782e")
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 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

class MockRefusalPipeline:
    """Mock refusal classification pipeline that returns predictions."""
    def __call__(self, sentence):
        # Simulate pipeline output: list with single dict containing label and score
        # Alternate between REFUSAL and NOT_REFUSAL based on sentence length
        if len(sentence) > 10:
            return [{'label': 'REFUSAL', 'score': 0.85}]
        else:
            return [{'label': 'NOT_REFUSAL', 'score': 0.90}]

# Create mock pipeline
refusal_pipe = MockRefusalPipeline()

# Create list of test sentences
sentences = [
    "I cannot help with that request.",
    "Sure, I can assist.",
    "I'm unable to provide this information as it violates policy.",
    "Yes"
]

# Create ARGS dictionary with all parameters
ARGS = {
    'refusal_pipe': refusal_pipe,
    'sentences': sentences,
    'threshold': 0.6
}
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 list, ndim 1, dtype family float — 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
cleanup Ran
ran on a synthesized input
s-nlp/synthdetoxm/src/filter_samples.py
code served (permissive licence) · get_code("2c66bc40ce1e687a")
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 re
import string

EMOJI_PATTERN = re.compile('[' + re.escape(string.punctuation) + ']', re.UNICODE)

def cleanup(text: str) -> str:
    """
    Cleans up input text by removing unnecessary characters, URLs, and emojis.

    Args:
        text (str): The input text to clean up.

    Returns:
        str: The cleaned up text.
    """
    text = text.rstrip().lstrip()
    text = re.sub('\\n+', '', text)
    text = re.sub('(?:((?<=[\\s\\W])|^)[#](\\w+|[^#]|$)|((?<=[\\s\\W])|^)[@]([a-zA-Z0-9_]+|$))', '', text)
    text = re.sub('(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)', '', text)
    text = EMOJI_PATTERN.sub('', text)
    text = re.sub('\\s+', ' ', text)
    return text

# Setup code to construct valid arguments
ARGS = {
    "text": "  Hello @user! Check out https://example.com #hashtag\nNew line with emoji! 😀 Multiple   spaces   here.  "
}
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 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
extract_toxic_sentences_with_labels Ran
ran on a synthesized input
s-nlp/synthdetoxm/src/api.py
code served (permissive licence) · get_code("4d84be17581b03bf")
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 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.

# Setup code for extract_toxic_sentences_with_labels

# Define the arguments dictionary
ARGS = {
    'text': "This is a toxic example. You are stupid and I hate you. Another clean sentence.",
    'sentences': [
        "This is a toxic example.",
        "You are stupid and I hate you.",
        "Another clean sentence."
    ],
    'response': {
        'attributeScores': {
            'TOXICITY': {
                'spanScores': [
                    {'begin': 10, 'end': 15},
                    {'begin': 31, 'end': 36}
                ]
            },
            'SEVERE_TOXICITY': {
                'spanScores': [
                    {'begin': 31, 'end': 36}
                ]
            },
            'IDENTITY_ATTACK': {
                'spanScores': []
            },
            'INSULT': {
                'spanScores': [
                    {'begin': 31, 'end': 42}
                ]
            },
            'PROFANITY': {
                'spanScores': [
                    {'begin': 47, 'end': 51}
                ]
            }
        }
    }
}
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 list, ndim 1, dtype family float — 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
extract_toxic_spans Ran
ran on a synthesized input
s-nlp/synthdetoxm/src/api.py
code served (permissive licence) · get_code("db64f51f772c7101")
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 2, 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.

# Setup code for extract_toxic_spans function

ARGS = {
    "response": {
        "attributeScores": {
            "TOXICITY": {
                "spanScores": [
                    {"begin": 0, "end": 5, "score": {"value": 0.7}},
                    {"begin": 10, "end": 15, "score": {"value": 0.3}},
                    {"begin": 14, "end": 20, "score": {"value": 0.6}},
                ]
            },
            "SEVERE_TOXICITY": {
                "spanScores": [
                    {"begin": 25, "end": 30, "score": {"value": 0.8}},
                ]
            },
            "THREAT": {
                "spanScores": [
                    {"begin": 5, "end": 10, "score": {"value": 0.4}},
                ]
            },
            "PROFANITY": {
                "spanScores": [
                    {"begin": 30, "end": 35, "score": {"value": 0.55}},
                ]
            },
        }
    },
    "toxicity_threshold": 0.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 list, ndim 2, 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
find_language_column Ran
ran on a synthesized input
s-nlp/synthdetoxm/src/evaluate_on_multiparadetox.py
code served (permissive licence) · get_code("eefeb7e38f4fe9e8")
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 pandas as pd

# Create a simple DataFrame with a 'language' column
df = pd.DataFrame({
    'language': ['en', 'fr', 'de', 'es'],
    'text': ['hello', 'bonjour', 'hallo', 'hola'],
    'score': [0.9, 0.85, 0.88, 0.92]
})

ARGS = {
    'df': df
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
prepare_target_label Ran
ran on a synthesized input
s-nlp/synthdetoxm/src/evaluation.py
code served (permissive licence) · get_code("8cd996672e45a2b8")
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 int, ndim 0, dtype family int, 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 torch.nn as nn

class MockConfig:
    def __init__(self):
        self.id2label = {0: "positive", 1: "negative", 2: "neutral"}
        self.label2id = {"positive": 0, "negative": 1, "neutral": 2}

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.config = MockConfig()
    
    def forward(self, x):
        return x

torch.manual_seed(0)
model = MockModel()
target_label = "positive"

ARGS = {
    "model": model,
    "target_label": target_label
}
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 int, ndim 0, dtype family int, 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
classify_texts Not yet run
unverified (harvested, no recorded run)
s-nlp/synthdetoxm/src/evaluation.py
code served (permissive licence) · get_code("94df471b4ae2fde8")
How it ran

no invocation recorded.

filter_by_length Not yet run
unverified (harvested, no recorded run)
s-nlp/synthdetoxm/src/filter_samples.py
code served (permissive licence) · get_code("d615697ff73498f8")
How it ran

no invocation recorded.

split_by_words Not yet run
unverified (harvested, no recorded run)
s-nlp/synthdetoxm/src/filter_samples.py
code served (permissive licence) · get_code("fd0b35071214815a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 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
classify_texts 1 other paper
1 dated earlier
2024.findings-emnlp.839 (2024 (year only))
LLMs to Replace Crowdsourcing For Parallel Data Creation? The Case of Text Detoxification
prepare_target_label 1 other paper
1 dated earlier
2024.findings-emnlp.839 (2024 (year only))
LLMs to Replace Crowdsourcing For Parallel Data Creation? The Case of Text Detoxification

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

Existing approaches to multilingual text detoxification are hampered by the scarcity of parallel multilingual datasets. In this work, we introduce a pipeline for the generation of multilingual parallel detoxification data. We also introduce SynthDetoxM, a manually collected and synthetically generated multilingual parallel text detoxification dataset comprising 16,000 high-quality detoxification sentence pairs across German, French, Spanish and Russian. The data was sourced from different toxicity evaluation datasets and then rewritten with nine modern open-source LLMs in few-shot setting. Our experiments demonstrate that models trained on the produced synthetic datasets have superior performance to those trained on the human-annotated MultiParaDetox dataset even in data limited setting. Models trained on SynthDetoxM outperform all evaluated LLMs in few-shot setting. We release our dataset and code to help further research in multilingual text detoxification. Warning: this paper contains illustrative examples of texts that readers may find offensive or disturbing.

For agents

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

get_harvested_code_for_paper("2502.06394")
get_code_for_paper("2502.06394")
have("2502.06394")

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

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

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

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

Connect an agent — have() is free.