SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.04197 · 2024

CS4: Measuring the Creativity of Large Language Models Automatically by Controlling the Number of Story-Writing Constraints

arXiv · PDF · Open in the Atlas

Code that ran

7 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 0 have no contract verdict; 7 failures of our instrument; 4 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/2410.04197.json · badge: /api/ran/2410.04197.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
anirudhlakkaraju/cs4_benchmark canonical (classifier label)
classifier basis: census
7 ran · 4 no recorded run
FunctionStatusWhere it lives
Quc_9VsRcs_7_39 Ran
ran; our contract draft was wrong, not the code
anirudhlakkaraju/cs4_benchmark/evaluation/coherence_vs_constraint_graph.py
code served (permissive licence) · get_code("fbca3fb05f5d729f")
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 DataFrame. 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 pandas as pd

# Construct quc_results: dict with model names as keys, each containing nested dict with '39' key
quc_results = {
    'model_a': {'39': 0.85, '40': 0.82},
    'model_b': {'39': 0.91, '40': 0.88},
    'model_c': {'39': 0.78, '40': 0.75}
}

# Construct rcs_results: dict with model names as keys, each containing nested dict with '39-7' key
rcs_results = {
    'model_a': {'39-7': 0.79, '40-8': 0.76},
    'model_b': {'39-7': 0.87, '40-8': 0.84},
    'model_c': {'39-7': 0.72, '40-8': 0.69}
}

ARGS = {
    'quc_results': quc_results,
    'rcs_results': rcs_results
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
calculate_quc_and_rcs Ran
ran; our contract draft was wrong, not the code
anirudhlakkaraju/cs4_benchmark/evaluation/coherence_vs_constraint_graph.py
code served (permissive licence) · get_code("41dfba5ffb866e95")
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 pandas as pd
import numpy as np

# Create a sample DataFrame that has the structure expected by the function
# The function expects:
# - A DataFrame with 'normalized_coherence_score' and 'average_percentage_gpt4' columns
# - An index that represents constraints

# Create sample data for one model
constraints = ['constraint_1', 'constraint_2', 'constraint_3']
data = {
    'normalized_coherence_score': [0.8, 0.6, 0.7],
    'average_percentage_gpt4': [0.9, 0.75, 0.85]
}
df1 = pd.DataFrame(data, index=constraints)

# Create sample data for another model
df2 = pd.DataFrame(data, index=constraints)

# Create the grouped_results dictionary mapping model names to DataFrames
grouped_results = {
    'model_a': df1,
    'model_b': df2
}

ARGS = {
    'grouped_results': grouped_results
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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
calculate_quc_and_rcs Ran
ran; our contract draft was wrong, not the code
anirudhlakkaraju/cs4_benchmark/evaluation/quc_and_rcs.py
code served (permissive licence) · get_code("b8d6b945452eee55")
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 pandas as pd
import numpy as np

# Create a sample DataFrame with the required columns and index
# The function expects grouped_results to be a dict where:
# - keys are model names (strings)
# - values are DataFrames with 'normalized_coherence_score' and 'average_percentage_gpt4' columns
# - DataFrame index contains constraint names

np.random.seed(0)

# Create sample data
constraints = ['constraint_A', 'constraint_B', 'constraint_C']
data = {
    'normalized_coherence_score': np.array([0.8, 0.6, 0.7]),
    'average_percentage_gpt4': np.array([0.9, 0.85, 0.95])
}

df1 = pd.DataFrame(data, index=constraints)
df2 = pd.DataFrame(data, index=constraints)

grouped_results = {
    'model_1': df1,
    'model_2': df2
}

ARGS = {
    'grouped_results': grouped_results
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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
chat Ran
ran; our contract draft was wrong, not the code
anirudhlakkaraju/cs4_benchmark/evaluation/story_quality_eval.py
code served (permissive licence) · get_code("9b2db3fdfca284ab")
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 Mock. 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.

from unittest.mock import Mock, MagicMock

# Create a mock client that mimics the OpenAI client structure
mock_client = Mock()
mock_response = Mock()
mock_response.choices = [Mock(message=Mock(content="This is a test response"))]
mock_client.chat.completions.create.return_value = mock_response

ARGS = {
    'client': mock_client,
    'instruction': 'What is the capital of France?',
    'model': 'gpt-3.5-turbo',
    'system_prompt': 'You are a helpful assistant.'
}
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 Mock — a Mock 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
generate_response Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
anirudhlakkaraju/cs4_benchmark/code_files/storygen.py
code served (permissive licence) · get_code("b547c94262782cf4")
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. 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

torch.manual_seed(0)

# Stand-in tokenizer class
class MockTokenizer:
    def apply_chat_template(self, chat, tokenize=False, add_generation_prompt=False):
        return "user: test prompt"
    
    def encode(self, text, add_special_tokens=False, return_tensors=None):
        # Return a small tensor of token ids
        tokens = torch.tensor([[101, 2054, 2003, 1045, 102]], dtype=torch.long)
        if return_tensors == 'pt':
            return tokens
        return tokens
    
    def batch_decode(self, token_ids, skip_special_tokens=False):
        return ["This is a generated response from the model."]

# Stand-in OLMo model class
class MockOLMo(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(1000, 8)
        self.linear = nn.Linear(8, 1000)
    
    def forward(self, input_ids):
        return self.linear(self.embedding(input_ids))
    
    def generate(self, input_ids, max_new_tokens=4096, do_sample=True, top_p=0.95):
        # Return a tensor of generated token ids (batch_size x seq_len)
        batch_size = input_ids.shape[0]
        seq_len = input_ids.shape[1] + max_new_tokens
        # Return on CPU
        return torch.randint(0, 1000, (batch_size, seq_len), dtype=torch.long)

tokenizer = MockTokenizer()
olmo = MockOLMo()
prompt_text = "What is the meaning of life?"

ARGS = {
    'tokenizer': tokenizer,
    'olmo': olmo,
    'prompt_text': prompt_text,
    'max_tokens': 4096
}
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
initialize_openai Ran
ran; our contract draft was wrong, not the code
anirudhlakkaraju/cs4_benchmark/evaluation/story_quality_eval.py
code served (permissive licence) · get_code("f3c3e6083ca33d17")
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 OpenAI. 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 os
from openai import OpenAI

# The function just needs a valid API key string
# We'll use a dummy API key since we're not actually making network calls
# The OpenAI client will be instantiated but not used for actual requests

api_key = "sk-test-1234567890abcdefghijklmnopqrstuvwxyz"

ARGS = {
    "api_key": api_key
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OpenAI — a OpenAI output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OpenAI 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
load_grouped_dfs_from_json Ran
ran; our contract draft was wrong, not the code
anirudhlakkaraju/cs4_benchmark/evaluation/quc_and_rcs.py
code served (permissive licence) · get_code("4874c30058799290")
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 pandas as pd
import json
import tempfile
import os

# Create a temporary JSON file with grouped data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_data.json")

# Create sample data as a dictionary of lists (which will become DataFrames)
sample_data = {
    "group_1": [
        {"col_a": 1, "col_b": "x"},
        {"col_a": 2, "col_b": "y"}
    ],
    "group_2": [
        {"col_a": 3, "col_b": "z"},
        {"col_a": 4, "col_b": "w"}
    ]
}

# Write the JSON file
with open(temp_file, 'w') as f:
    json.dump(sample_data, f)

ARGS = {
    "filename": temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
main Not yet run
unverified (harvested, no recorded run)
anirudhlakkaraju/cs4_benchmark/evaluation/constraint_satisfaction.py
code served (permissive licence) · get_code("1a773a549f580915")
How it ran

no invocation recorded.

main Not yet run
unverified (harvested, no recorded run)
anirudhlakkaraju/cs4_benchmark/evaluation/diversity_calculation.py
code served (permissive licence) · get_code("5baffd5407078613")
How it ran

no invocation recorded.

main Not yet run
unverified (harvested, no recorded run)
anirudhlakkaraju/cs4_benchmark/evaluation/diversity_graphs.py
code served (permissive licence) · get_code("c811600eab5c3bf7")
How it ran

no invocation recorded.

parse_evaluation Not yet run
unverified (harvested, no recorded run)
anirudhlakkaraju/cs4_benchmark/evaluation/story_quality_eval.py
code served (permissive licence) · get_code("f6bdebfeb1ddf260")
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, 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 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.

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

Evaluating the creativity of large language models (LLMs) in story writing is difficult because LLM-generated stories could seemingly look creative but be very similar to some existing stories in their huge and proprietary training corpus. To overcome this challenge, we introduce a novel benchmark dataset with varying levels of prompt specificity: CS4 ($\mathbf{C}$omparing the $\mathbf{S}$kill of $\mathbf{C}$reating $\mathbf{S}$tories by $\mathbf{C}$ontrolling the $\mathbf{S}$ynthesized $\mathbf{C}$onstraint $\mathbf{S}$pecificity). By increasing the number of requirements/constraints in the prompt, we can increase the prompt specificity and hinder LLMs from retelling high-quality narratives in their training data. Consequently, CS4 empowers us to indirectly measure the LLMs' creativity without human annotations. Our experiments on LLaMA, Gemma, and Mistral not only highlight the creativity challenges LLMs face when dealing with highly specific prompts but also reveal that different LLMs perform very differently under different numbers of constraints and achieve different balances between the model's instruction-following ability and narrative coherence. Additionally, our experiments on OLMo suggest that Learning from Human Feedback (LHF) can help LLMs select better stories from their training data but has limited influence in boosting LLMs' ability to produce creative stories that are unseen in the training corpora. The benchmark is released at https://github.com/anirudhlakkaraju/cs4_benchmark.

For agents

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

get_harvested_code_for_paper("2410.04197")
get_code_for_paper("2410.04197")
have("2410.04197")

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

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

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

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

Connect an agent — have() is free.