SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1609.05473 · 2016

SeqGAN: Sequence Generative Adversarial Nets with Policy Gradient

arXiv · PDF · Open in the Atlas

Code that ran

14 of 21 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; 7 honoured the contract we drafted, 1 violated it and 4 have no contract verdict; 2 failures of our instrument; 7 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/1609.05473.json · badge: /api/ran/1609.05473.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
project-basileus/multitype-sequence-generation-by-tlstm-gan community (classifier label)
classifier basis not recorded on the link
4 ran · 2 no recorded run
GuyTevet/SeqGAN-eval reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
rupes438/CodeGen reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
AWLyrics/SeqGAN_Poem extension (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
vedantc6/SeqGAN reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 4 no recorded run
desire2020/RankGAN extension (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
create_dataset Ran
ran on a synthesized input
project-basileus/multitype-sequence-generation-by-tlstm-gan/sgtlstm/utils.py
code served (permissive licence) · get_code("8df2bb8e4b4e31f3")
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 _BatchDataset. 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 numpy as np
import tensorflow as tf

# Create small numpy arrays for features and labels
np.random.seed(0)
features = np.random.randn(8, 4).astype(np.float32)  # 8 samples, 4 features
labels = np.random.randint(0, 2, size=(8,)).astype(np.int32)  # 8 binary labels

ARGS = {
    "features": features,
    "labels": labels,
    "batch_size": 2,
    "epochs": 10,
    "buffer_size": 10000
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type _BatchDataset — a _BatchDataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a _BatchDataset 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
create_real_data_dict Ran
ran; our contract draft was wrong, not the code
GuyTevet/SeqGAN-eval/sequence_gan.py
pointer only (licence: NONE) · get_code("3f30492d9d21c9de")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, GuyTevet/SeqGAN-eval when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_word Ran
ran; our contract draft was wrong, not the code
medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling/seq_gan_real_data.py
pointer only (licence: NONE) · get_code("7000645c309cf316")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_fixed_length_sequence_from_pickle Ran
ran on a synthesized input
project-basileus/multitype-sequence-generation-by-tlstm-gan/sgtlstm/utils.py
code served (permissive licence) · get_code("bbbbe8176df8559a")
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 4, 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 pickle
import numpy as np
import tempfile
import os

# Create a temporary pickle file with sample sequence data
temp_dir = tempfile.mkdtemp()
pickle_file_path = os.path.join(temp_dir, "test_sequences.pickle")

# Create sample sequence data: list of sequences, each sequence is list of (event_type, timestamp) tuples
# Format: [[(1, 11), (1, 24), (2, 37), (3, 47)], [(2, 15), (1, 30), (3, 45), (2, 60)]]
sample_sequences = [
    [(1, 11), (1, 24), (2, 37), (3, 47)],
    [(2, 15), (1, 30), (3, 45), (2, 60)],
]

with open(pickle_file_path, 'wb') as f:
    pickle.dump(sample_sequences, f)

ARGS = {
    'pickle_file_path': pickle_file_path,
    'to_timedelta': True,
    'end_token': 0,
}
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 tuple, ndim 4, 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
pre_train_epoch Ran
ran, honoured the contract we drafted
GuyTevet/SeqGAN-eval/sequence_gan.py
pointer only (licence: NONE) · get_code("b101ab100e14737c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, GuyTevet/SeqGAN-eval when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

pre_train_epoch Ran
ran, honoured the contract we drafted
rupes438/CodeGen/SeqGAN_3/sequence_gan_main.py
pointer only (licence: NONE) · get_code("d742e892dc2e5813")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rupes438/CodeGen when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

pre_train_epoch Ran
ran, honoured the contract we drafted
AWLyrics/SeqGAN_Poem/seq_gan.py
pointer only (licence: NONE) · get_code("2f4e665c16f88075")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, AWLyrics/SeqGAN_Poem when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

pre_train_epoch Ran
ran, honoured the contract we drafted
desire2020/RankGAN/sequence_gan.py
pointer only (licence: NONE) · get_code("aa4db51897e50f7a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, desire2020/RankGAN when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

pre_train_epoch Ran
ran, honoured the contract we drafted
vedantc6/SeqGAN/seqGAN.py
code served (permissive licence) · get_code("3a13afabc045cbd8")
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 float64, ndim 0, dtype family float, shape () 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 numpy as np
import torch
import torch.nn as nn

torch.manual_seed(0)

# Mock session object (TensorFlow-style)
class MockSession:
    pass

# Mock trainable model with pretrain_step method
class TrainableModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def pretrain_step(self, sess, batch):
        # Returns (something, g_loss)
        # g_loss should be a scalar that can be appended to a list
        g_loss = float(np.random.random())
        return None, g_loss

# Mock data loader with required interface
class DataLoader:
    def __init__(self, num_batches=3):
        self.num_batch = num_batches
        self.batches = [
            (torch.randn(2, 4), torch.randn(2, 3))
            for _ in range(num_batches)
        ]
        self.current_idx = 0
    
    def reset_pointer(self):
        self.current_idx = 0
    
    def next_batch(self):
        batch = self.batches[self.current_idx]
        self.current_idx += 1
        return batch

# Construct arguments
sess = MockSession()
trainable_model = TrainableModel()
data_loader = DataLoader(num_batches=3)

ARGS = {
    "sess": sess,
    "trainable_model": trainable_model,
    "data_loader": data_loader
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float, shape () — shape () 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
pre_train_epoch_v2 Ran
ran, violated the contract we drafted
AWLyrics/SeqGAN_Poem/seq_gan.py
pointer only (licence: NONE) · get_code("96e62562bcc4ec1b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, AWLyrics/SeqGAN_Poem when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

recover_timedelta_to_timestamp Ran
ran on a synthesized input
project-basileus/multitype-sequence-generation-by-tlstm-gan/sgtlstm/utils.py
code served (permissive licence) · get_code("f89e786b42200ca5")
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

torch.manual_seed(0)

# Analyzing the function:
# - time_seq is iterated over with "for dt in time_seq"
# - Each element dt is compared with 0 and added to curr
# - The function accumulates timedeltas and builds a cumulative sum list
# - Input should be a sequence (list) of numeric values representing time deltas

# Create a small list of time deltas (some zero, some non-zero)
time_seq = [0.5, 0, 1.2, 0, 0.3, 2.0]

ARGS = {
    "time_seq": time_seq
}
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
target_loss Ran
ran, honoured the contract we drafted
rupes438/CodeGen/SeqGAN_3/sequence_gan_main.py
pointer only (licence: NONE) · get_code("336fb3340370addd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rupes438/CodeGen when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

target_loss Ran
ran, honoured the contract we drafted
vedantc6/SeqGAN/seqGAN.py
code served (permissive licence) · get_code("4b1acb7daafe3443")
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 float64, ndim 0, dtype family float, shape () 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 numpy as np
import tensorflow as tf

# Create a mock session
class MockSession:
    def run(self, tensor, feed_dict):
        # Return a scalar loss value
        return np.random.rand()

sess = MockSession()

# Create a mock target_lstm with required attributes
class MockTargetLSTM:
    def __init__(self):
        self.pretrain_loss = "loss_tensor"
        self.x = "input_placeholder"

target_lstm = MockTargetLSTM()

# Create a mock data_loader with required methods and attributes
class MockDataLoader:
    def __init__(self):
        self.num_batch = 3
        self.batch_index = 0
        self.batches = [
            np.random.randn(2, 4),
            np.random.randn(2, 4),
            np.random.randn(2, 4)
        ]
    
    def reset_pointer(self):
        self.batch_index = 0
    
    def next_batch(self):
        batch = self.batches[self.batch_index]
        self.batch_index += 1
        return batch

data_loader = MockDataLoader()

ARGS = {
    "sess": sess,
    "target_lstm": target_lstm,
    "data_loader": data_loader
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float, shape () — shape () 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
zcore_norm Ran
ran on a synthesized input
project-basileus/multitype-sequence-generation-by-tlstm-gan/sgtlstm/SeqGan.py
code served (permissive licence) · get_code("4e78bccb2a14902a")
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. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-26T21:52:49Z. 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 tensorflow as tf
import numpy as np

# Create a small sample tensor for z-score normalization
# Shape: (batch=2, height=4, width=3)
data = tf.constant([
    [[1.0, 2.0, 3.0],
     [4.0, 5.0, 6.0],
     [7.0, 8.0, 9.0],
     [10.0, 11.0, 12.0]],
    [[2.0, 3.0, 4.0],
     [5.0, 6.0, 7.0],
     [8.0, 9.0, 10.0],
     [11.0, 12.0, 13.0]]
], dtype=tf.float32)

ARGS = {
    "data": data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — 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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
apply_mean_std Not yet run
unverified (harvested, no recorded run)
project-basileus/multitype-sequence-generation-by-tlstm-gan/sgtlstm/SeqGan.py
code served (permissive licence) · get_code("882605693d737cfd")
How it ran

no invocation recorded.

eval_epoch Not yet run
unverified (harvested, no recorded run)
medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling/seq_gan_different_disc.py
pointer only (licence: NONE) · get_code("b3ce81cc1e76607b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

eval_epoch Not yet run
unverified (harvested, no recorded run)
medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling/seq_gan_real_data.py
pointer only (licence: NONE) · get_code("f677dc5ff6c9c370")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_mean_std Not yet run
unverified (harvested, no recorded run)
project-basileus/multitype-sequence-generation-by-tlstm-gan/sgtlstm/SeqGan.py
code served (permissive licence) · get_code("468186920a536265")
How it ran

no invocation recorded.

target_loss Not yet run
unverified (harvested, no recorded run)
GuyTevet/SeqGAN-eval/sequence_gan.py
pointer only (licence: NONE) · get_code("3715a5e4aecc4849")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, GuyTevet/SeqGAN-eval when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

train_epoch Not yet run
unverified (harvested, no recorded run)
medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling/seq_gan_different_disc.py
pointer only (licence: NONE) · get_code("65a0b336d24a2e2a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

train_epoch Not yet run
unverified (harvested, no recorded run)
medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling/seq_gan_real_data.py
pointer only (licence: NONE) · get_code("ee1e503421fb53db")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, medtray/SeqGAN-vs-MLE-vs-PG-BLEU-vs-ScheduleSampling when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 21 samples lifted from this paper's linked repositories, 21 carry a function identity and 0 do not. Of the 21 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 16 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
create_real_data_dict 1 other paper
1 later
1810.12686 (2018-10)
Evaluating Text GANs as Language Models
pre_train_epoch 1 other paper
1 later
1709.08624 (2017-09)
Long Text Generation via Adversarial Training with Leaked Information
pre_train_epoch 1 other paper
1 later
1810.12686 (2018-10)
Evaluating Text GANs as Language Models
target_loss 1 other paper
1 later
1810.12686 (2018-10)
Evaluating Text GANs as Language Models
target_loss 1 other paper
1 later
1709.08624 (2017-09)
Long Text Generation via Adversarial Training with Leaked Information

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

As a new way of training generative models, Generative Adversarial Nets (GAN) that uses a discriminative model to guide the training of the generative model has enjoyed considerable success in generating real-valued data. However, it has limitations when the goal is for generating sequences of discrete tokens. A major reason lies in that the discrete outputs from the generative model make it difficult to pass the gradient update from the discriminative model to the generative model. Also, the discriminative model can only assess a complete sequence, while for a partially generated sequence, it is non-trivial to balance its current score and the future one once the entire sequence has been generated. In this paper, we propose a sequence generation framework, called SeqGAN, to solve the problems. Modeling the data generator as a stochastic policy in reinforcement learning (RL), SeqGAN bypasses the generator differentiation problem by directly performing gradient policy update. The RL reward signal comes from the GAN discriminator judged on a complete sequence, and is passed back to the intermediate state-action steps using Monte Carlo search. Extensive experiments on synthetic data and real-world tasks demonstrate significant improvements over strong baselines.

For agents

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

get_harvested_code_for_paper("1609.05473")
get_code_for_paper("1609.05473")
have("1609.05473")

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

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

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

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

Connect an agent — have() is free.