SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1912.02164 · 2019

Plug and Play Language Models: A Simple Approach to Controlled Text Generation

arXiv · PDF · Open in the Atlas

Code that ran

17 of 22 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 13 have no contract verdict; 4 failures of our instrument; 5 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/1912.02164.json · badge: /api/ran/1912.02164.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
uber-research/PPLM canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
jefflai108/6.438-final community (classifier label)
classifier basis not recorded on the link
10 ran · 1 no recorded run
fsoft-ailab/poem-generator community (classifier label)
classifier basis not recorded on the link
5 ran · 3 no recorded run
FunctionStatusWhere it lives
build_bows_one_hot_vectors Ran
ran on a synthesized input
fsoft-ailab/poem-generator/ailamtho/utils/bow.py
code served (permissive licence) · get_code("bb82e66218a5e42e")
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. 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 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)

class MockTokenizer:
    def __init__(self, vocab_size=10):
        self.vocab_size = vocab_size

# Create mock bow_indices: list of lists where each inner list contains token indices
# Structure: bow_indices[i] = list of token indices for document i
# For this function, single_bow[i] should be a list/tensor of token indices
bow_indices = [
    [[1, 3], [2, 5], [0, 4]],  # First document: 3 positions, each with token indices
    [[2, 4], [1, 6]],           # Second document: 2 positions, each with token indices
]

tokenizer = MockTokenizer(vocab_size=10)

ARGS = {
    'bow_indices': bow_indices,
    'tokenizer': tokenizer,
    'device': 'cpu'
}
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 — a list 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
cached_collate_fn Ran
ran; our contract draft was wrong, not the code
jefflai108/6.438-final/run_pplm_discrim_train.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from lucywang720/model-surgery, is pointer only (licence: NONE) · get_code("9f95f3541586ad5c")
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 lucywang720/model-surgery, 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.

cat_past Ran
ran on a synthesized input
jefflai108/6.438-final/ours/method3.py
code served (permissive licence) · get_code("200de6c5c7533d37")
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)

# The function expects:
# - past: a list/tuple of tensors
# - cur_past: a list/tuple of tensors
# - last: a boolean flag
# 
# The function concatenates tensors along dim=3
# When last=True, it takes only the last timestep of cur_past[i] using [..., -1:, :]
# When last=False, it concatenates the full cur_past[i]

# Create sample tensors with distinct dimensions for clarity
# Shape: (batch=2, seq=3, hidden=4, context=5)
past_tensor_1 = torch.randn(2, 3, 4, 5)
past_tensor_2 = torch.randn(2, 3, 4, 6)

# cur_past tensors - these will be concatenated along dim=3
# Shape: (batch=2, seq=3, hidden=4, context=7)
cur_past_tensor_1 = torch.randn(2, 3, 4, 7)
cur_past_tensor_2 = torch.randn(2, 3, 4, 8)

past = [past_tensor_1, past_tensor_2]
cur_past = [cur_past_tensor_1, cur_past_tensor_2]
last = False

ARGS = {
    "past": past,
    "cur_past": cur_past,
    "last": last
}
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
cat_past Ran
ran on a synthesized input
jefflai108/6.438-final/ours/method4.py
code served (permissive licence) · get_code("9b3442a1518d31ff")
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 5, 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

torch.manual_seed(0)

# Construct past and cur_past as tuples of tensors
# The function iterates over them and concatenates along dim=3
# past[i] and cur_past[i] should have compatible shapes for concatenation on dim=3

# Create small tensors with distinct dimensions
# Shape: (batch=2, seq=3, heads=4, dim=5)
past_tensor_1 = torch.randn(2, 3, 4, 5)
past_tensor_2 = torch.randn(2, 3, 4, 5)
past = (past_tensor_1, past_tensor_2)

# cur_past tensors should also be concatenable on dim=3
# When last=True, we take only the last position (dim=2): cur_past[i][..., -1:, :]
# When last=False, we use the full tensor
cur_past_tensor_1 = torch.randn(2, 3, 4, 6)
cur_past_tensor_2 = torch.randn(2, 3, 4, 6)
cur_past = (cur_past_tensor_1, cur_past_tensor_2)

ARGS = {
    "past": past,
    "cur_past": cur_past,
    "last": False
}
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 5, 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
collate_fn Ran
ran; our contract draft was wrong, not the code
jefflai108/6.438-final/run_pplm_discrim_train.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from lucywang720/model-surgery, is pointer only (licence: NONE) · get_code("c5e400dbec9871ce")
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 lucywang720/model-surgery, 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.

collate_fn Ran
ran on a synthesized input
jefflai108/6.438-final/paper_code/gpt2tunediscrim.py
code served (permissive licence) · get_code("895ee1e721fbbb88")
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. 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 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.utils.data as data

torch.manual_seed(0)

# The function expects a list of dictionaries, each with 'X' and 'y' keys
# 'X' contains sequences (lists or tensors) of varying lengths
# 'y' contains labels (integers)

batch_data = [
    {
        'X': torch.tensor([1, 2, 3], dtype=torch.long),
        'y': 0
    },
    {
        'X': torch.tensor([4, 5], dtype=torch.long),
        'y': 1
    }
]

ARGS = {
    'data': batch_data
}
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
conditioning Ran
ran on a synthesized input
jefflai108/6.438-final/ours/utils.py
code served (permissive licence) · get_code("41cffde6e7f145a7")
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, 10) 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
import torch.nn.functional as F

torch.manual_seed(0)

# Build a minimal model that accepts (ids, past=None) and returns a tuple with [0][:, -1]
class MinimalModel(nn.Module):
    def __init__(self, vocab_size=10, hidden_size=4):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_size)
        self.linear = nn.Linear(hidden_size, vocab_size)
    
    def forward(self, ids, past=None):
        x = self.embedding(ids)
        logits = self.linear(x)
        return (logits,)

# Build a minimal tokenizer
class MinimalTokenizer:
    pass

# Set up arguments
tokenizer = MinimalTokenizer()

# logprobs: shape (batch=2, vocab=10)
logprobs = torch.randn(2, 10)

# cond_ids: indices into vocabulary for conditioning
cond_ids = torch.tensor([0, 1, 2], dtype=torch.long)

# model
model = MinimalModel(vocab_size=10, hidden_size=4)

# past: optional, can be None
past = None

# ids_to_retain: shape (batch=2, top_k=5)
ids_to_retain = torch.tensor([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]], dtype=torch.long)

# weights: shape (len(cond_ids)=3,)
weights = torch.tensor([0.5, 0.3, 0.2])

# cnt: scalar count
cnt = 3

ARGS = {
    "tokenizer": tokenizer,
    "logprobs": logprobs,
    "cond_ids": cond_ids,
    "model": model,
    "past": past,
    "ids_to_retain": ids_to_retain,
    "weights": weights,
    "cnt": cnt,
}
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, 10) — shape (2, 10) 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
evaluate_performance Ran
ran on a synthesized input
jefflai108/6.438-final/run_pplm_discrim_train.py
code served (permissive licence) · get_code("368c3700824b81fb")
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 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
import torch.nn.functional as F
from torch.utils.data import DataLoader, TensorDataset

torch.manual_seed(0)

# Create a simple discriminator model
class SimpleDiscriminator(nn.Module):
    def __init__(self):
        super(SimpleDiscriminator, self).__init__()
        self.fc1 = nn.Linear(4, 8)
        self.fc2 = nn.Linear(8, 3)
    
    def forward(self, x):
        x = F.relu(self.fc1(x))
        x = F.log_softmax(self.fc2(x), dim=1)
        return x

# Create small tensors for data
# Input: batch_size=2, features=4
# Target: batch_size=2, classes=3
input_data = torch.randn(2, 4)
target_data = torch.randint(0, 3, (2,))

# Create a dataset and data loader
dataset = TensorDataset(input_data, target_data)
data_loader = DataLoader(dataset, batch_size=2)

# Create discriminator instance
discriminator = SimpleDiscriminator()

ARGS = {
    'data_loader': data_loader,
    'discriminator': discriminator,
    'device': 'cpu'
}
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 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
get_bag_of_words_indices Ran
ran on a synthesized input
fsoft-ailab/poem-generator/ailamtho/utils/bow.py
code served (permissive licence) · get_code("2bc0b122982a024e")
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. 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 tempfile
import os

class MockTokenizer:
    def encode(self, text, add_special_tokens=False):
        # Simple mock: return list of token ids based on word length
        return [ord(c) % 10 for c in text.strip()]

# Create a temporary file with sample words
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt') as f:
    f.write("hello\nworld\npython\ncode")
    temp_file_path = f.name

try:
    ARGS = {
        'file_path_bow': temp_file_path,
        'tokenizer': MockTokenizer()
    }
finally:
    # Clean up after function execution would happen
    pass
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 — a list 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
is_stanza Ran
ran on a synthesized input
fsoft-ailab/poem-generator/ailamtho/utils/check_rule.py
code served (permissive licence) · get_code("85766c79fe9b99bb")
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 bool, 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

# The function checks if input is a stanza by splitting on double newlines
# and verifying the result has length 1 (meaning no double newlines exist)
# So we need to pass a string parameter

# Test with a string that is a single stanza (no double newlines)
sentences = "This is the first line.\nThis is the second line.\nThis is the third line."

ARGS = {
    "sentences": sentences
}
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 bool, 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
post_process Ran
ran on a synthesized input
fsoft-ailab/poem-generator/ailamtho/utils/process.py
code served (permissive licence) · get_code("49e475b822b30d82")
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 torch

torch.manual_seed(0)

ARGS = {
    "text": "hello_world@@test\n\nfirst stanza\nsecond line\n\nthird stanza\nfourth line",
    "n_stanzas": 2
}
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 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
repeat_past Ran
ran on a synthesized input
jefflai108/6.438-final/ours/utils.py
code served (permissive licence) · get_code("1dcfab77356ba4f5")
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 6, 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

torch.manual_seed(0)

# The function expects:
# - past: a sequence (list/tuple) of tensors with shape (batch, ?, ?, ?, ?)
# - top_k: an integer to use as repeat factor
# 
# The function converts past to a list, repeats each tensor along dimension 1,
# then converts back to tuple.

# Create a tuple of small tensors with shape (batch=2, seq=3, heads=4, dim=5, depth=6)
# These represent typical transformer past key/value cache tensors
past = (
    torch.randn(2, 3, 4, 5, 6),
    torch.randn(2, 3, 4, 5, 6),
)

top_k = 2

ARGS = {
    "past": past,
    "top_k": top_k,
}
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 6, 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
split_word Ran
ran on a synthesized input
fsoft-ailab/poem-generator/ailamtho/utils/check_rule.py
code served (permissive licence) · get_code("10c0ed80ad796bd1")
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.

# Setup code for split_word function

# Define the global list_start_vowels that the function uses
list_start_vowels = ['a', 'e', 'i', 'o', 'u', 'à', 'á', 'ả', 'ã', 'ạ', 
                     'ă', 'ằ', 'ắ', 'ẳ', 'ẵ', 'ặ', 'â', 'ầ', 'ấ', 'ẩ', 
                     'ẫ', 'ậ', 'è', 'é', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ề', 'ế', 
                     'ể', 'ễ', 'ệ', 'ì', 'í', 'ỉ', 'ĩ', 'ị', 'ò', 'ó', 
                     'ỏ', 'õ', 'ọ', 'ô', 'ồ', 'ố', 'ổ', 'ỗ', 'ộ', 'ơ', 
                     'ờ', 'ớ', 'ở', 'ỡ', 'ợ', 'ù', 'ú', 'ủ', 'ũ', 'ụ', 
                     'ư', 'ừ', 'ứ', 'ử', 'ữ', 'ự', 'ỳ', 'ý', 'ỷ', 'ỹ', 'ỵ']

# Test word: starts with consonants 'mù', then has vowel 'a'
word = "mùa"

ARGS = {
    "word": word
}
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
to_var Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
uber-research/PPLM/run_pplm.py
code served (permissive licence) · get_code("bbebd95a156061b0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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. 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, 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
from torch.autograd import Variable

torch.manual_seed(0)

x = torch.randn(2, 4)
requires_grad = True
volatile = False
device = 'cpu'

ARGS = {
    'x': x,
    'requires_grad': requires_grad,
    'volatile': volatile,
    'device': device
}
Setup block drafted by
a language model, Claude Sonnet 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 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
top_k_filter Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
uber-research/PPLM/run_pplm.py
code served (permissive licence) · get_code("ac71b1f4007ef1dd")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 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)

# Create a small batch of logits
# batch_size = 2, vocab_size = 6
logits = torch.randn(2, 6)

# Set k to filter top 3 entries
k = 3

# probs flag set to False (default behavior)
probs = False

ARGS = {
    "logits": logits,
    "k": k,
    "probs": probs
}
Setup block drafted by
a language model, Claude Sonnet 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 float, shape (2, 6) — shape (2, 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
top_k_filtering Ran
ran on a synthesized input
jefflai108/6.438-final/ours/method3.py
code served (permissive licence) · get_code("b975947f493d596d")
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 small logits tensor (batch_size=2, vocab_size=4)
logits = torch.randn(2, 4)

# Define ARGS with all parameters
ARGS = {
    "logits": logits,
    "top_k": 2,
    "filter_value": -float('Inf'),
    "min_tokens_to_keep": 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 — 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
top_k_filtering Ran
ran on a synthesized input
jefflai108/6.438-final/ours/utils.py
code served (permissive licence) · get_code("a6e350b1e7b2bef3")
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)

# Create a small tensor of logits with shape (2, 4)
# batch_size=2, vocab_size=4
logits = torch.randn(2, 4)

ARGS = {
    "logits": logits,
    "top_k": 2,
    "filter_value": -float('Inf'),
    "min_tokens_to_keep": 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 — 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
add_past Not yet run
unverified (harvested, no recorded run)
jefflai108/6.438-final/ours/method3.py
code served (permissive licence) · get_code("da6a6099de169fa6")
How it ran

no invocation recorded.

generate_text_pplm Not yet run
unverified (harvested, no recorded run)
fsoft-ailab/poem-generator/ailamtho/generate/generate_topic.py
code served (permissive licence) · get_code("73250b2a460d9cd9")
How it ran

no invocation recorded.

load_data Not yet run
unverified (harvested, no recorded run)
fsoft-ailab/poem-generator/ailamtho/utils/check_rule.py
code served (permissive licence) · get_code("217f0089cb193f97")
How it ran

no invocation recorded.

perturb_past Not yet run
unverified (harvested, no recorded run)
uber-research/PPLM/run_pplm.py
code served (permissive licence) · get_code("13fe54bb9dec7e8c")
How it ran

no invocation recorded.

perturb_past Not yet run
unverified (harvested, no recorded run)
fsoft-ailab/poem-generator/ailamtho/generate/generate_topic.py
code served (permissive licence) · get_code("3176b47b94387f2a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 22 distinct functions with an identity, 4 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 4 later) and 18 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
to_var 4 other papers
4 later
2009.11462 (2020-09)
REALTOXICITYPROMPTS: Evaluating Neural Toxic Degeneration in Language Models
2010.05906 (2020-10)
Back to the Future: Unsupervised Backprop-based Decoding for Counterfactual and Abductive Commonsense Reasoning
2011.04000 (2020-11)
Adapting a Language Model for Controlled Affective Text Generation
and 1 more not named here
top_k_filter 3 other papers
3 later
2009.11462 (2020-09)
REALTOXICITYPROMPTS: Evaluating Neural Toxic Degeneration in Language Models
2011.04000 (2020-11)
Adapting a Language Model for Controlled Affective Text Generation
2105.00164 (2021-05)
Hidden Backdoors in Human-Centric Language Models
cached_collate_fn 1 other paper
1 later
2407.08770 (2024-07)
Model Surgery: Modulating LLM's Behavior Via Simple Parameter Editing
collate_fn 1 other paper
1 later
2407.08770 (2024-07)
Model Surgery: Modulating LLM's Behavior Via Simple Parameter Editing

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

Large transformer-based language models (LMs) trained on huge text corpora have shown unparalleled generation capabilities. However, controlling attributes of the generated language (e.g. switching topic or sentiment) is difficult without modifying the model architecture or fine-tuning on attribute-specific data and entailing the significant cost of retraining. We propose a simple alternative: the Plug and Play Language Model (PPLM) for controllable language generation, which combines a pretrained LM with one or more simple attribute classifiers that guide text generation without any further training of the LM. In the canonical scenario we present, the attribute models are simple classifiers consisting of a user-specified bag of words or a single learned layer with 100,000 times fewer parameters than the LM. Sampling entails a forward and backward pass in which gradients from the attribute model push the LM's hidden activations and thus guide the generation. Model samples demonstrate control over a range of topics and sentiment styles, and extensive automated and human annotated evaluations show attribute alignment and fluency. PPLMs are flexible in that any combination of differentiable attribute models may be used to steer text generation, which will allow for diverse and creative applications beyond the examples given in this paper.

For agents

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

get_harvested_code_for_paper("1912.02164")
get_code_for_paper("1912.02164")
have("1912.02164")

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

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

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

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

Connect an agent — have() is free.