SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1908.09451 · 2019

Improving Neural Story Generation by Targeted Common Sense Grounding

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 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; 0 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/1908.09451.json · badge: /api/ran/1908.09451.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
calclavia/story-generation canonical (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_logprobs Ran
ran; our contract draft was wrong, not the code
calclavia/story-generation/analysis/eval_ppl.py
code served (permissive licence) · get_code("72e3dec83b518f41")
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 torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self, vocab_size=10, hidden_dim=4):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.linear = nn.Linear(hidden_dim, vocab_size)
    
    def forward(self, input_tokens):
        embedded = self.embedding(input_tokens)
        logits = self.linear(embedded)
        return logits, None

batch_size = 2
seq_length = 5
vocab_size = 10

token_tensor = torch.randint(0, vocab_size, (batch_size, seq_length))
model = SimpleModel(vocab_size=vocab_size, hidden_dim=4)

ARGS = {
    "token_tensor": token_tensor,
    "model": model,
}
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
sample_sequence Ran
ran; our contract draft was wrong, not the code
calclavia/story-generation/analysis/generate.py
code served (permissive licence) · get_code("f59ea1d42728beca")
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 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.nn as nn
import torch.nn.functional as F

torch.manual_seed(0)

class SimpleLanguageModel(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, input_ids, past=None):
        # input_ids: (batch_size, seq_len)
        # Returns: (logits, mem)
        # logits shape: (batch_size, seq_len, vocab_size)
        # mem: can be any state object (we'll use None for simplicity)
        x = self.embedding(input_ids)
        logits = self.linear(x)
        return logits, None

model = SimpleLanguageModel(vocab_size=10, hidden_size=4)

context = torch.tensor([[1, 2, 3], [4, 5, 6]], dtype=torch.long)

ARGS = {
    'model': model,
    'length': 5,
    'batch_size': 2,
    'context': context,
    'temperature': 1.0,
    'top_p': 0.9,
    'device': 'cpu',
    'sample': True,
    'eos_token': 9
}
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 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_p_logits Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
calclavia/story-generation/analysis/generate.py
code served (permissive licence) · get_code("f4bdad69d56eb2a0")
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 torch.nn.functional as F

torch.manual_seed(0)

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

# Create ARGS dict with all parameters
ARGS = {
    "logits": logits,
    "p": 0.9
}
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
word_level_ppl Ran
ran; our contract draft was wrong, not the code
calclavia/story-generation/analysis/eval_ppl.py
code served (permissive licence) · get_code("28062937f5813d05")
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 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 re

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        # decoder maps token IDs to byte sequences
        self.decoder = {
            0: 'H',
            1: 'e',
            2: 'l',
            3: 'l',
            4: 'o',
            5: ' ',
            6: 'w',
            7: 'o',
            8: 'r',
            9: 'l',
            10: 'd',
            11: '---\n',
            12: 'T',
            13: 'e',
            14: 's',
            15: 't',
        }
        # byte_decoder maps characters to bytes
        self.byte_decoder = {
            'H': ord('H'),
            'e': ord('e'),
            'l': ord('l'),
            'o': ord('o'),
            ' ': ord(' '),
            'w': ord('w'),
            'r': ord('r'),
            'd': ord('d'),
            '-': ord('-'),
            '\n': ord('\n'),
            'T': ord('T'),
            's': ord('s'),
            't': ord('t'),
        }
        self.errors = 'replace'

# Create target tokens - sequence of token IDs
target_tokens = [11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# Create log probabilities - one per token
lprobs = torch.tensor([-0.5, -0.3, -0.2, -0.4, -0.1, -0.6, -0.2, -0.3, -0.4, -0.5, -0.2, -0.1])

# Create tokenizer
tokenizer = MockTokenizer()

# Create raw_token for comparison
raw_token = ['Hello', 'world']

ARGS = {
    'target_tokens': target_tokens,
    'lprobs': lprobs,
    'tokenizer': tokenizer,
    'raw_token': raw_token,
}
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 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

Also present in other papers' code

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

Stories generated with neural language models have shown promise in grammatical and stylistic consistency. However, the generated stories are still lacking in common sense reasoning, e.g., they often contain sentences deprived of world knowledge. We propose a simple multi-task learning scheme to achieve quantitatively better common sense reasoning in language models by leveraging auxiliary training signals from datasets designed to provide common sense grounding. When combined with our two-stage fine-tuning pipeline, our method achieves improved common sense reasoning and state-of-the-art perplexity on the Writing Prompts (Fan et al., 2018) story generation dataset.

For agents

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

get_harvested_code_for_paper("1908.09451")
get_code_for_paper("1908.09451")
have("1908.09451")

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

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

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

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

Connect an agent — have() is free.