SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.04039 · 2021

Plug-and-Blend: A Framework for Controllable Story Generation with Blended Control Codes

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 (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 3 no recorded run), measured 2026-11-21; 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/2104.04039.json · badge: /api/ran/2104.04039.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
xxbidiao/plug-and-blend canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
FunctionStatusWhere it lives
SharedDropout2 Ran
ran; our contract draft was wrong, not the code
xxbidiao/plug-and-blend/gedi_helpers/modeling_gpt2.py
code served (permissive licence) · get_code("464d483ca9073ea6")
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 Dropout. 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)

ARGS = {
    "p": 0.5
}
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 Dropout — a Dropout output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Dropout 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
gelu Ran
ran; our contract draft was wrong, not the code
xxbidiao/plug-and-blend/gedi_helpers/modeling_gpt2.py
code served (permissive licence) · get_code("8d23fbe2b99b840b")
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) 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. 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 math

torch.manual_seed(0)

# Create a small tensor for testing
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 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
prune_linear_layer Ran
ran; our contract draft was wrong, not the code
xxbidiao/plug-and-blend/gedi_helpers/modeling_utils.py
code served (permissive licence) · get_code("d30d6c3098df2c42")
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) and returned Linear. 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 torch import nn

torch.manual_seed(0)

# Create a linear layer to prune
# Using distinct sizes: input_features=3, output_features=4
layer = nn.Linear(in_features=3, out_features=4, bias=True)

# Create an index tensor to select which output features to keep
# Selecting 2 out of 4 output features
index = torch.tensor([0, 2], dtype=torch.long)

# dim=0 means we're pruning along the output dimension (rows of weight matrix)
dim = 0

ARGS = {
    "layer": layer,
    "index": index,
    "dim": dim,
}
Setup block drafted by
a language model, Claude Haiku 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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
top_k_top_p_filtering Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xxbidiao/plug-and-blend/gedi_helpers/modeling_utils.py
code served (permissive licence) · get_code("49f3df5f44c69b6f")
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, 4) 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 small logits tensor: batch_size=2, vocab_size=4
logits = torch.randn(2, 4)

# Define arguments for the function
ARGS = {
    "logits": logits,
    "top_k": 2,
    "top_p": 0.9,
    "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 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
calc_banned_ngram_tokens Not yet run
unverified (harvested, no recorded run)
xxbidiao/plug-and-blend/gedi_helpers/modeling_utils.py
code served (permissive licence) · get_code("35214bf3a3709500")
How it ran

no invocation recorded.

cut_into_sentences Not yet run
unverified (harvested, no recorded run)
xxbidiao/plug-and-blend/gedi_skill.py
code served (permissive licence) · get_code("a4d7da98da6cd7ff")
How it ran

no invocation recorded.

load_tf_weights_in_gpt2 Not yet run
unverified (harvested, no recorded run)
xxbidiao/plug-and-blend/gedi_helpers/modeling_gpt2.py
code served (permissive licence) · get_code("c4bac98236c1fc2c")
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, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 1 the same month, 4 later) and 1 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
gelu 51 other papers
23 dated earlier, 1 the same month, 27 later · 8 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
and 48 more not named here
prune_linear_layer 29 other papers
17 dated earlier, 12 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1906.08230 (2019-06)
Evaluating Protein Transfer Learning with TAPE
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
and 26 more not named here
top_k_top_p_filtering 21 other papers
3 dated earlier, 18 later
1909.11942 (2019-09)
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
2005.00796 (2020-05)
A Simple Language Model for Task-Oriented Dialogue
2009.06367 (2020-09)
GeDi: Generative Discriminator Guided Sequence Generation
and 18 more not named here
load_tf_weights_in_gpt2 5 other papers
3 dated earlier, 2 later
2005.00796 (2020-05)
A Simple Language Model for Task-Oriented Dialogue
2009.06367 (2020-09)
GeDi: Generative Discriminator Guided Sequence Generation
2009.12719 (2020-09)
Stylized Dialogue Response Generation Using Stylized Unpaired Texts
and 2 more not named here
SharedDropout2 1 other paper
1 dated earlier
2009.06367 (2020-09)
GeDi: Generative Discriminator Guided Sequence Generation
calc_banned_ngram_tokens 1 other paper
1 dated earlier
2009.06367 (2020-09)
GeDi: Generative Discriminator Guided Sequence 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-21.

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 pre-trained neural language models (LM) have very powerful text generation capabilities. However, in practice, they are hard to control for creative purposes. We describe a Plug-and-Play controllable language generation framework, Plug-and-Blend, that allows a human user to input multiple control codes (topics). In the context of automated story generation, this allows a human user loose or fine-grained control of the topics and transitions between them that will appear in the generated story, and can even allow for overlapping, blended topics. Automated evaluations show our framework, working with different generative LMs, controls the generation towards given continuous-weighted control codes while keeping the generated sentences fluent, demonstrating strong blending capability. A human participant evaluation shows that the generated stories are observably transitioning between two topics.

For agents

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

get_harvested_code_for_paper("2104.04039")
get_code_for_paper("2104.04039")
have("2104.04039")

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

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

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

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

Connect an agent — have() is free.