SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.14967 · EMNLP · 2020

PLOTMACHINES: Outline-Conditioned Generation with Dynamic Plot State Tracking

Yejin Choi, Jianfeng Gao, Asli Celikyilmaz, Hannah Rashkin

arXiv · PDF · Open in the Atlas

Code that ran

5 of 11 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 5 have no contract verdict; 0 failures of our instrument; 6 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/2004.14967.json · badge: /api/ran/2004.14967.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
hrashkin/plotmachines canonical (classifier label)
classifier basis: census
5 ran · 6 no recorded run
FunctionStatusWhere it lives
clean_top_features Ran
ran on a synthesized input
hrashkin/plotmachines/src/preprocessing/extract_outlines.py
code served (permissive licence) · get_code("e5254f89c922b130")
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 numpy as np

# Analyze the function:
# - clean_top_features takes 'keywords' (a list) and 'top' (an int, default 10)
# - sorting() sorts the list by len, so keywords must be a list of objects with len()
# - The function calls startswith() on elements, so they must be strings
# - It returns a list of strings

# Build valid arguments
keywords = [
    "cat",
    "catalog",
    "dog",
    "doghouse",
    "apple",
    "application",
    "bat",
    "battery",
    "car",
    "carbon",
    "d",
    "de"
]

top = 10

ARGS = {
    "keywords": keywords,
    "top": top
}
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 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
get_paragraph_input_loader Ran
ran on a synthesized input
hrashkin/plotmachines/src/model/data_loader.py
code served (permissive licence) · get_code("7bbd968c32b606f8")
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 DataLoader. 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 pickle
import tempfile
import os

torch.manual_seed(0)

# Create a minimal encoder mock that has all the methods used
class MockEncoder:
    def __init__(self):
        self.bos_token_id = 101
        self.eos_token_id = 102
        self.cls_token_id = 103
        self.special_tokens = {
            '_t_': 104,
            '_i_': 105,
            '_b_': 106,
            '_c_': 107,
            '_kw_': 108,
            '_endkw_': 109,
        }
    
    def encode(self, text, add_prefix_space=False, add_special_tokens=False):
        # Return a small list of token ids based on text length
        return [110 + (hash(text) % 10) for _ in range(max(1, len(text) // 5))]
    
    def convert_tokens_to_ids(self, token):
        return self.special_tokens.get(token, 110)

# Create temporary data file with valid format
def create_temp_data_file():
    fd, path = tempfile.mkstemp(suffix='.pkl')
    os.close(fd)
    
    # Create data that matches the expected format
    # Each line should have 7 tab-separated fields
    # Format: doc_id\tkeywords\t...\t...\tsent_id\ttarget_text\t...
    data_lines = [
        b"header_line\n",  # First line (skipped in loop)
        b"doc_1_0\tkey1[SEP]key2\tunused\tunused\t5\t<o>target text one<o>\tunused\n",
        b"doc_2_1\tkey3[SEP]key4\tunused\tunused\t5\t<o>target text two<o>\tunused\n",
        b"doc_3_2\tkey5[SEP]key6\tunused\tunused\t5\t<o>target text three<o>\tunused\n",
    ]
    
    with open(path, 'wb') as f:
        for line in data_lines:
            f.write(line)
    
    return path

# Create the data file
data_file = create_temp_data_file()

# Create encoder
encoder = MockEncoder()

# Define all arguments for get_paragraph_input_loader
ARGS = {
    'data_file': data_file,
    'batch_size': 2,
    'encoder': encoder,
    'shuffle': False,
    'num_workers': 0,
    'max_size': None,
    'n_ctx': 102,
    'gen_len': 401,
    'include_neigh': False,
    'include_discourse_type': True,
    'include_kw': True,
    'dim': 768,
    'debug_mode': 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 DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader 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
sorting Ran
ran on a synthesized input
hrashkin/plotmachines/src/preprocessing/extract_outlines.py
code served (permissive licence) · get_code("0e25e46b2b194ec9")
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

torch.manual_seed(0)

# The function sorts a list by the length of its elements
# It takes a single parameter 'lst' which should be a list of items with len()

ARGS = {
    "lst": ["hello", "a", "world", "ab", "testing"]
}
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
tfmclassifier Ran
ran on a synthesized input
hrashkin/plotmachines/src/model/generate_stories.py
code served (permissive licence) · get_code("4180ed5582c6b9e4")
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. 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
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class SimpleTokenizer:
    def encode(self, text, add_special_tokens=False):
        # Return a simple sequence of token ids
        return [1, 2, 3, 4, 5, 6, 7, 8]

# Create a minimal model that returns outputs compatible with the function
class SimpleModel(nn.Module):
    def __init__(self, hidden_dim=4):
        super().__init__()
        self.hidden_dim = hidden_dim
        self.linear = nn.Linear(1, hidden_dim)
    
    def forward(self, wds):
        # wds shape: (batch_size, gen_len)
        # Function expects outputs[0] to be a tensor of shape (batch_size, gen_len, hidden_dim)
        batch_size, gen_len = wds.shape
        # Return a tuple where first element is (batch_size, gen_len, hidden_dim)
        output_tensor = torch.randn(batch_size, gen_len, self.hidden_dim)
        return (output_tensor,)

# Construct arguments
textlines = [
    "This is the first sample text.",
    "This is the second sample text."
]

model = SimpleModel(hidden_dim=4)

tokenizer = SimpleTokenizer()

gen_len = 6

ARGS = {
    "textlines": textlines,
    "model": model,
    "tokenizer": tokenizer,
    "gen_len": gen_len
}
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
trim_body Ran
ran on a synthesized input
hrashkin/plotmachines/src/preprocessing/extract_outlines.py
code served (permissive licence) · get_code("f0b738900bf46558")
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 numpy as np

# Analyze the function: trim_body takes a single parameter 'body' which is a string
# The function processes text with markers like ' <p> ', ' <s>', and '::act' or ':act '
# It returns either None or a list of strings

# Create a valid test body string with proper formatting
body = "This is a first sentence <s> with some content here <s> and more text <s>. <p> Second paragraph starts here <s> with multiple sentences <s> and continues on <s>."

ARGS = {
    "body": body
}
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 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
format_text Not yet run
unverified (harvested, no recorded run)
hrashkin/plotmachines/src/model/eval_utils.py
code served (permissive licence) · get_code("6a513c34286196f4")
How it ran

no invocation recorded.

generate_paragraph Not yet run
unverified (harvested, no recorded run)
hrashkin/plotmachines/src/model/generate_utils.py
code served (permissive licence) · get_code("b24152fcf7367e21")
How it ran

no invocation recorded.

get_fullstory_loader Not yet run
unverified (harvested, no recorded run)
hrashkin/plotmachines/src/model/data_loader.py
code served (permissive licence) · get_code("7af03149f79091ab")
How it ran

no invocation recorded.

get_paragraph_memory_input_loader Not yet run
unverified (harvested, no recorded run)
hrashkin/plotmachines/src/model/data_loader.py
code served (permissive licence) · get_code("7b3e0b9ace785681")
How it ran

no invocation recorded.

patch_replication_callback Not yet run
unverified (harvested, no recorded run)
hrashkin/plotmachines/src/model/parallel.py
code served (permissive licence) · get_code("e50200dbeffa0133")
How it ran

no invocation recorded.

toks_to_str Not yet run
unverified (harvested, no recorded run)
hrashkin/plotmachines/src/model/generate_utils.py
code served (permissive licence) · get_code("07488921aa1474d5")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 1 later) and 10 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
patch_replication_callback 16 other papers
5 dated earlier, 1 the same month, 10 later
1612.01105 (2016-12)
Pyramid Scene Parsing Network
1807.10221 (2018-07)
Unified Perceptual Parsing for Scene Understanding
1904.01941 (2019-04)
Character Region Awareness for Text Detection
and 13 more not named here

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

We propose the task of outline-conditioned story generation: given an outline as a set of phrases that describe key characters and events to appear in a story, the task is to generate a coherent narrative that is consistent with the provided outline. This task is challenging as the input only provides a rough sketch of the plot, and thus, models need to generate a story by interweaving the key points provided in the outline. This requires the model to keep track of the dynamic states of the latent plot, conditioning on the input outline while generating the full story. We present PLOTMACHINES, a neural narrative model that learns to transform an outline into a coherent story by tracking the dynamic plot states. In addition, we enrich PLOTMACHINES with high-level discourse structure so that the model can learn different writing styles corresponding to different parts of the narrative. Comprehensive experiments over three fiction and non-fiction datasets demonstrate that large-scale language models, such as GPT-2 and GROVER, despite their impressive generation performance, are not sufficient in generating coherent narratives for the given outline, and dynamic plot state tracking is important for composing narratives with tighter, more consistent plots.

For agents

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

get_harvested_code_for_paper("2004.14967")
get_code_for_paper("2004.14967")
have("2004.14967")

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

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

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

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

Connect an agent — have() is free.