SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1810.05241 · 2018

One Size Does Not Fit All: Generating and Evaluating Variable Number of Keyphrases

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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; 1 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/1810.05241.json · badge: /api/ran/1810.05241.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
memray/OpenNMT-kpg-release canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
average_models Ran
ran on a synthesized input
memray/OpenNMT-kpg-release/onmt/bin/average_models.py
code served (permissive licence) · get_code("df1510f43e187231")
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 torch
import tempfile
import os

torch.manual_seed(0)

# Create temporary model files with the expected structure
temp_dir = tempfile.mkdtemp()

# Create first model checkpoint
model_file_1 = os.path.join(temp_dir, 'model_1.pt')
checkpoint_1 = {
    'vocab': {'word': 0, 'test': 1},
    'opt': {'learning_rate': 0.001, 'optimizer': 'adam'},
    'model': {
        'layer1.weight': torch.randn(4, 3),
        'layer1.bias': torch.randn(4),
        'layer2.weight': torch.randn(5, 4),
    },
    'generator': {
        'gen_layer1.weight': torch.randn(3, 4),
        'gen_layer1.bias': torch.randn(3),
    }
}
torch.save(checkpoint_1, model_file_1)

# Create second model checkpoint with same structure
model_file_2 = os.path.join(temp_dir, 'model_2.pt')
checkpoint_2 = {
    'vocab': {'word': 0, 'test': 1},
    'opt': {'learning_rate': 0.001, 'optimizer': 'adam'},
    'model': {
        'layer1.weight': torch.randn(4, 3),
        'layer1.bias': torch.randn(4),
        'layer2.weight': torch.randn(5, 4),
    },
    'generator': {
        'gen_layer1.weight': torch.randn(3, 4),
        'gen_layer1.bias': torch.randn(3),
    }
}
torch.save(checkpoint_2, model_file_2)

ARGS = {
    'model_files': [model_file_1, model_file_2],
    'fp32': 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 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
baseline_pred_loader Ran
ran on a synthesized input
memray/OpenNMT-kpg-release/kp_evaluate.py
code served (permissive licence) · get_code("e47d1a4e477699f8")
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 os
import tempfile
import shutil

# Create a temporary directory with test files
temp_dir = tempfile.mkdtemp()

# Create test files for 'tfidf' model
test_file_1 = os.path.join(temp_dir, "0.txt.phrases")
with open(test_file_1, 'w') as f:
    f.write("machine learning\n")
    f.write("neural networks\n")

test_file_2 = os.path.join(temp_dir, "1.txt.phrases")
with open(test_file_2, 'w') as f:
    f.write("deep learning\n")
    f.write("artificial intelligence\n")

test_file_3 = os.path.join(temp_dir, "2.txt.phrases")
with open(test_file_3, 'w') as f:
    f.write("natural language processing\n")

ARGS = {
    'pred_path': temp_dir,
    'model_name': 'tfidf'
}
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, 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
kp_results_to_str Ran
ran on a synthesized input
memray/OpenNMT-kpg-release/kp_evaluate.py
code served (permissive licence) · get_code("049b4bcce7af7550")
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 json
import numpy as np

# Create a results_dict with lists of values
# The function iterates over items and calls np.average on each value
results_dict = {
    "rouge_1_f_score": [0.5, 0.6, 0.55],
    "rouge_2_f_score": [0.4, 0.45, 0.42],
    "rouge_3_f_score": [0.3, 0.35, 0.32],
    "rouge_l_f_score": [0.55, 0.65, 0.60],
    "rouge_su*_f_score": [0.48, 0.52, 0.50],
}

ARGS = {
    "results_dict": results_dict,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
scan_new_checkpoints Ran
ran on a synthesized input
memray/OpenNMT-kpg-release/kp_gen_eval.py
code served (permissive licence) · get_code("04f73d793cecec06")
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 os
import tempfile
import shutil

# Create a temporary directory structure with some .pt files
temp_dir = tempfile.mkdtemp()

# Create some subdirectories and .pt files
os.makedirs(os.path.join(temp_dir, "subdir1"), exist_ok=True)
os.makedirs(os.path.join(temp_dir, "subdir2"), exist_ok=True)

# Create some checkpoint files
open(os.path.join(temp_dir, "checkpoint_1.pt"), 'w').close()
open(os.path.join(temp_dir, "subdir1", "checkpoint_2.pt"), 'w').close()
open(os.path.join(temp_dir, "subdir1", "model_weights.pt"), 'w').close()
open(os.path.join(temp_dir, "subdir2", "final.pt"), 'w').close()
# Create a non-.pt file that should be ignored
open(os.path.join(temp_dir, "readme.txt"), 'w').close()

ARGS = {
    "ckpt_dir": temp_dir
}
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 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
scan_predictions Ran
ran on a synthesized input
memray/OpenNMT-kpg-release/kp_gen_eval_transfer.py
code served (permissive licence) · get_code("9ad8afa6c8870f3d")
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 os
import tempfile
import shutil

# Create a temporary directory structure with .pred files
temp_dir = tempfile.mkdtemp()

# Create subdirectories and .pred files with valid naming patterns
subdir1 = os.path.join(temp_dir, 'experiment1')
os.makedirs(subdir1)

subdir2 = os.path.join(temp_dir, 'experiment1', 'nested')
os.makedirs(subdir2)

# Create valid .pred files with format: "step_<number>-data<name>.pred"
pred_file1 = os.path.join(subdir1, 'step_100-dataimagenet.pred')
with open(pred_file1, 'w') as f:
    f.write('dummy prediction data')

pred_file2 = os.path.join(subdir2, 'step_250-datacifar10.pred')
with open(pred_file2, 'w') as f:
    f.write('dummy prediction data')

pred_file3 = os.path.join(temp_dir, 'step_500-dataeval.pred')
with open(pred_file3, 'w') as f:
    f.write('dummy prediction data')

# Create an invalid .pred file to test error handling
invalid_pred_file = os.path.join(subdir1, 'invalid_name.pred')
with open(invalid_pred_file, 'w') as f:
    f.write('invalid format')

ARGS = {
    'exp_root_dir': temp_dir
}
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, 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_ctranslate2_model_spec Not yet run
unverified (harvested, no recorded run)
memray/OpenNMT-kpg-release/onmt/bin/release_model.py
code served (permissive licence) · get_code("a7400d7c2f3b1eea")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 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.

FunctionAlso present inEarliest-datedOthers named
average_models 3 other papers
1 dated earlier, 2 later
1805.11462 (2018-05)
OpenNMT: Neural Machine Translation Toolkit
2004.00588 (2020-04)
Better Sign Language Translation with STMC-Transformer
2010.05465 (2020-10)
COGS: A Compositional Generalization Challenge Based on Semantic Interpretation
get_ctranslate2_model_spec 2 other papers
1 dated earlier, 1 later
1805.11462 (2018-05)
OpenNMT: Neural Machine Translation Toolkit
2010.05465 (2020-10)
COGS: A Compositional Generalization Challenge Based on Semantic Interpretation

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

Different texts shall by nature correspond to different number of keyphrases. This desideratum is largely missing from existing neural keyphrase generation models. In this study, we address this problem from both modeling and evaluation perspectives. We first propose a recurrent generative model that generates multiple keyphrases as delimiter-separated sequences. Generation diversity is further enhanced with two novel techniques by manipulating decoder hidden states. In contrast to previous approaches, our model is capable of generating diverse keyphrases and controlling number of outputs. We further propose two evaluation metrics tailored towards the variable-number generation. We also introduce a new dataset StackEx that expands beyond the only existing genre (i.e., academic writing) in keyphrase generation tasks. With both previous and new evaluation metrics, our model outperforms strong baselines on all datasets.

For agents

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

get_harvested_code_for_paper("1810.05241")
get_code_for_paper("1810.05241")
have("1810.05241")

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

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

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

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

Connect an agent — have() is free.