SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.03214 · 2023

PREADD: Prefix-Adaptive Decoding for Controlled Text Generation

arXiv · PDF · Open in the Atlas

Code that ran

6 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; 2 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 6 no recorded run), measured 2026-11-22; 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/2307.03214.json · badge: /api/ran/2307.03214.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
jonnypei/acl23-preadd canonical (classifier label)
classifier basis: census
6 ran · 6 no recorded run
FunctionStatusWhere it lives
clamp Ran
ran, honoured the contract we drafted
jonnypei/acl23-preadd/methods/fudge/util.py
code served (permissive licence) · get_code("2f04763df90287b6")
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

torch.manual_seed(0)

# The function clamp(x, limit) takes two parameters:
# - x: a numeric value to be clamped
# - limit: the limit for clamping
# The function uses max() and min() on x and limit, so they should be numeric types

ARGS = {
    "x": 5.5,
    "limit": 3.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 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
collate Ran
ran; our contract draft was wrong, not the code
jonnypei/acl23-preadd/methods/fudge/data.py
code served (permissive licence) · get_code("bd461652e2d3d3ad")
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. 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)

# Construct a batch of data items
# Each item is a tuple: (input_tensor, length, labels_list)
batch_item_1 = (
    torch.LongTensor([1, 2, 3]),  # input tensor of length 3
    3,                             # length
    [[0.5], [0.2], [0.8]]         # labels list with 3 elements
)

batch_item_2 = (
    torch.LongTensor([4, 5]),      # input tensor of length 2
    2,                             # length
    [[0.1], [0.9]]                # labels list with 2 elements
)

batch = [batch_item_1, batch_item_2]

ARGS = {
    "batch": batch
}
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 — 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
get_tokenizer Ran
ran; our contract draft was wrong, not the code
jonnypei/acl23-preadd/utils/engine_util.py
code served (permissive licence) · get_code("aab18278f4e1c226")
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 MagicMock. 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
from unittest.mock import MagicMock

torch.manual_seed(0)

# Mock the AutoTokenizer.from_pretrained to avoid actual downloads
from transformers import AutoTokenizer
original_from_pretrained = AutoTokenizer.from_pretrained

def mock_from_pretrained(model_string):
    mock_tokenizer = MagicMock()
    mock_tokenizer.encode = MagicMock(return_value=[101, 2054, 2003, 102])
    mock_tokenizer.decode = MagicMock(return_value="what is this")
    return mock_tokenizer

AutoTokenizer.from_pretrained = mock_from_pretrained

ARGS = {
    "model_string": "bert-base-uncased"
}
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 MagicMock — a MagicMock output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MagicMock output the recorded ndim 1 and dtype family None 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
num_params Ran
ran, honoured the contract we drafted
jonnypei/acl23-preadd/methods/fudge/util.py
code served (permissive licence) · get_code("48689cd65df839d6")
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

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model
}
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
pad_to_length Ran
ran; our contract draft was wrong, not the code
jonnypei/acl23-preadd/methods/fudge/util.py
code served (permissive licence) · get_code("bb59f1498141e958")
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, 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 tensor to pad
# Shape: (2, 3) - batch of 2, feature dim of 3
tensor = torch.randn(2, 3)

# Define arguments for pad_to_length
ARGS = {
    "tensor": tensor,
    "length": 5,
    "dim": 1,
    "value": 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, 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
server_next_logprobs Ran
ran on a synthesized input
jonnypei/acl23-preadd/utils/engine_util.py
code served (permissive licence) · get_code("bc1c2e993c8a4009")
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 dict. 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

torch.manual_seed(0)

# The function makes a POST request to a server and expects:
# - prompt: a string to send as the first element of a list
# - model_string: a string identifier for the model
# - cache_id: optional cache identifier (can be None)
# - url: optional URL endpoint (defaults to localhost)

# Since this function just constructs a request dict and posts it,
# we only need to provide simple string arguments.

ARGS = {
    'prompt': 'Hello, how are you?',
    'model_string': 'gpt2',
    'cache_id': None,
    'url': 'http://localhost:9741/logits'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
requests, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
generate_preadd Not yet run
unverified (harvested, no recorded run)
jonnypei/acl23-preadd/methods/method_preadd.py
code served (permissive licence) · get_code("3809b788d60c9780")
How it ran

no invocation recorded.

generate_standard Not yet run
unverified (harvested, no recorded run)
jonnypei/acl23-preadd/methods/method_standard.py
code served (permissive licence) · get_code("e85fb66a8e9c0dc8")
How it ran

no invocation recorded.

get_next_logprobs Not yet run
unverified (harvested, no recorded run)
jonnypei/acl23-preadd/utils/engine_util.py
code served (permissive licence) · get_code("255dbccf793bbcfb")
How it ran

no invocation recorded.

grammaticality Not yet run
unverified (harvested, no recorded run)
jonnypei/acl23-preadd/utils/metrics.py
code served (permissive licence) · get_code("b871ff7f6e73b7a8")
How it ran

no invocation recorded.

load_model Not yet run
unverified (harvested, no recorded run)
jonnypei/acl23-preadd/utils/model_server.py
code served (permissive licence) · get_code("e621046299d54577")
How it ran

no invocation recorded.

perplexity Not yet run
unverified (harvested, no recorded run)
jonnypei/acl23-preadd/utils/metrics.py
code served (permissive licence) · get_code("99ee132d16e7f4b7")
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, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 1 the same month, 0 later) and 11 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
num_params 1 other paper
1 the same month
2307.04686 (2023-07)
VampNet: Music Generation via Masked Acoustic Token Modeling

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-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We propose Prefix-Adaptive Decoding (PREADD), a flexible method for controlled text generation. Unlike existing methods that use auxiliary expert models to control for attributes, PREADD does not require an external model, instead relying on linearly combining output logits from multiple prompts. Specifically, PREADD contrasts the output logits generated using a raw prompt against those generated using a prefix-prepended prompt, enabling both positive and negative control with respect to any attribute encapsulated by the prefix. We evaluate PREADD on three tasks -- toxic output mitigation, gender bias reduction, and sentiment control -- and find that PREADD outperforms not only prompting baselines, but also an auxiliary-expert control method, by 12% or more in relative gain on our main metrics for each task.

For agents

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

get_harvested_code_for_paper("2307.03214")
get_code_for_paper("2307.03214")
have("2307.03214")

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

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

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

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

Connect an agent — have() is free.