SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.19109 · EMNLP · 2024

RSA-Control: A Pragmatics-Grounded Lightweight Controllable Text Generation Framework

Vera Demberg, Yifan Wang

arXiv · PDF · Open in the Atlas

Code that ran

4 of 7 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; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 3 no recorded run), 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/2410.19109.json · badge: /api/ran/2410.19109.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
ewanwong/rsa-control canonical (classifier label)
classifier basis: census
3 ran · 2 no recorded run
Ewanwong/RSA-Control community
Papers with Code archive
1 ran · 1 no recorded run
FunctionStatusWhere it lives
StepwiseOutput Ran
ran on a synthesized input · constructed an object; no result was computed
Ewanwong/RSA-Control/readability_controlled_summarization/PragmaticLlama.py
code served (permissive licence) · get_code("f13140a03613fa93")
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, StepwiseOutput: 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 numpy as np

torch.manual_seed(0)

# Create small probability tensors
# Using distinct shapes for clarity: (2, 4) for batch_size=2, num_outcomes=4
unconditional_probs = torch.softmax(torch.randn(2, 4), dim=-1)
literal_speaker_probs = torch.softmax(torch.randn(2, 4), dim=-1)
pragmatic_speaker_probs = torch.softmax(torch.randn(2, 4), dim=-1)
pragmatic_listener_probs = torch.softmax(torch.randn(2, 4), dim=-1)
prior_probs = torch.softmax(torch.randn(2, 4), dim=-1)

ARGS = {
    "unconditional_probabilities": unconditional_probs,
    "literal_speaker_probabilities": literal_speaker_probs,
    "pragmatic_speaker_probabilities": pragmatic_speaker_probs,
    "pragmatic_listener_probabilities": pragmatic_listener_probs,
    "prior_probabilities": prior_probs,
}
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 StepwiseOutput — 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 StepwiseOutput 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
load_data Ran
ran; our contract draft was wrong, not the code
ewanwong/rsa-control/toxicity_bias_mitigation/output_perplexity.py
code served (permissive licence) · get_code("3cae5430e4c7162e")
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 2, 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 json
import tempfile
import os

# Create a temporary file with valid JSON examples
temp_dir = tempfile.mkdtemp()
examples_file = os.path.join(temp_dir, "examples.jsonl")

# Write test data to the file
test_examples = [
    {
        "prompt": "Once upon a time",
        "continuations": [{"text": " there was a kingdom."}]
    },
    {
        "prompt": "In a galaxy far away",
        "continuations": [{"text": " lived mysterious creatures."}]
    }
]

with open(examples_file, 'w') as f:
    for example in test_examples:
        f.write(json.dumps(example) + '\n')

ARGS = {
    'examples_filename': examples_file
}
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 tuple, ndim 2, 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
load_model_outputs Ran
ran; our contract draft was wrong, not the code
ewanwong/rsa-control/toxicity_bias_mitigation/io_utils.py
code served (permissive licence) · get_code("a6df2fb7f84eb042")
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 json
import tempfile
import os

# Create a temporary JSONL file with test data in RealToxicityPrompts format
temp_dir = tempfile.mkdtemp()
test_file = os.path.join(temp_dir, "test_outputs.jsonl")

# Write test data to the file
test_data = [
    {
        "generations": [
            {
                "text": "This is a generated example with scores",
                "toxicity": 0.1,
                "severity": 0.05
            },
            {
                "text": "Another generated text",
                "toxicity": 0.3,
                "severity": 0.2
            }
        ]
    },
    {
        "continuation": {
            "text": "This is a continuation example",
            "toxicity": 0.15,
            "severity": 0.08
        }
    },
    {
        "text": "Direct text example",
        "toxicity": 0.25,
        "severity": 0.12
    }
]

with open(test_file, 'w', encoding='utf8') as fh:
    for item in test_data:
        fh.write(json.dumps(item) + '\n')

ARGS = {
    "filename": test_file
}
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
load_prompts Ran
ran; our contract draft was wrong, not the code
ewanwong/rsa-control/toxicity_bias_mitigation/io_utils.py
code served (permissive licence) · get_code("44bbf4459b4f2e94")
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 json
import tempfile
import os

# Create a temporary JSONL file with RealToxicityPrompts format data
temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.jsonl', delete=False, encoding='utf8')
temp_filename = temp_file.name

# Write sample data in the expected format
sample_data = [
    {'prompt': {'text': 'This is a test prompt'}, 'challenging': False},
    {'prompt': {'text': 'This is a challenging prompt'}, 'challenging': True},
    {'prompt': {'text': 'Another non-challenging prompt'}, 'challenging': False},
]

for item in sample_data:
    temp_file.write(json.dumps(item) + '\n')

temp_file.close()

ARGS = {
    'filename': temp_filename,
    'challenging_only': False,
}
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
PragmaticLlamaForCausalLM Not yet run
unverified (harvested, no recorded run)
Ewanwong/RSA-Control/readability_controlled_summarization/PragmaticLlama.py
code served (permissive licence) · get_code("465efe240c5fe168")
How it ran

no invocation recorded.

compute_conditional_perplexity Not yet run
unverified (harvested, no recorded run)
ewanwong/rsa-control/toxicity_bias_mitigation/output_perplexity.py
code served (permissive licence) · get_code("65ff3cc64458c73e")
How it ran

no invocation recorded.

compute_perplexity Not yet run
unverified (harvested, no recorded run)
ewanwong/rsa-control/toxicity_bias_mitigation/output_perplexity.py
code served (permissive licence) · get_code("b501be3d87f11fd2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 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 7 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-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

Despite significant advancements in natural language generation, controlling language models to produce texts with desired attributes remains a formidable challenge. In this work, we introduce RSA-Control, a training-free controllable text generation framework grounded in pragmatics. RSA-Control directs the generation process by recursively reasoning between imaginary speakers and listeners, enhancing the likelihood that target attributes are correctly interpreted by listeners amidst distractors. Additionally, we introduce a self-adjustable rationality parameter, which allows for automatic adjustment of control strength based on context. Our experiments, conducted with two task types and two types of language models, demonstrate that RSA-Control achieves strong attribute control while maintaining language fluency and content consistency. Our code is available at https://github.com/Ewanwong/RSA-Control.

For agents

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

get_harvested_code_for_paper("2410.19109")
get_code_for_paper("2410.19109")
have("2410.19109")

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

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

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

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

Connect an agent — have() is free.