SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1910.05923 · 2019

Code Generation as a Dual Task of Code Summarization

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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; 2 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 2 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/1910.05923.json · badge: /api/ran/1910.05923.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
Bolin0215/CSCGDual canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
code-gen/cgcs community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
FunctionStatusWhere it lives
batchify Ran
ran on a synthesized input
code-gen/cgcs/language_model/lm_train.py
code served (permissive licence) · get_code("bbb1abc416d6331e")
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 (16, 2) 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

torch.manual_seed(0)

# Construct arguments for batchify function
data = torch.randn(8, 4)  # 8 samples, 4 features
bsz = 2  # batch size
device = 'cpu'  # CPU only

ARGS = {
    'data': data,
    'bsz': bsz,
    'device': device
}
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 (16, 2) — shape (16, 2) 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
get_batch Ran
ran on a synthesized input
code-gen/cgcs/language_model/lm_train.py
code served (permissive licence) · get_code("eea2e3f3d0c4b1c0")
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. 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 torch.nn as nn

torch.manual_seed(0)

# The function get_batch takes:
# - bptt: an integer (backprop through time length)
# - source: a tensor that supports indexing and len()
# - i: an integer (starting index)
#
# It slices source and returns (data, target) tuples
# source needs to be indexable and have a len()

# Create a small source tensor
# Make it 1D or 2D - the function slices it with [i:i+seq_len]
# and also calls .view(-1) on target, so source should be at least 1D
source = torch.arange(20).reshape(10, 2)  # Shape: (10, 2) - sequence length 10, feature dim 2

bptt = 5  # backprop through time
i = 2     # starting index

ARGS = {
    'bptt': bptt,
    'source': source,
    'i': i
}
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 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
input_transpose Ran
ran, honoured the contract we drafted
Bolin0215/CSCGDual/nmt/model.py
pointer only (licence: NONE) · get_code("d2ed25a42e05d009")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Bolin0215/CSCGDual 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_pt_glove Ran
ran on a synthesized input
code-gen/cgcs/loaders.py
code served (permissive licence) · get_code("bd07c5a783ad5f05")
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 pickle
from pathlib import Path
import numpy as np
import tempfile

# Create a temporary pickle file with a valid embedding dictionary
temp_dir = tempfile.TemporaryDirectory()
temp_path = Path(temp_dir.name) / "glove.pkl"

# Create a sample embedding dictionary
emb_dict = {
    "the": np.array([0.1, 0.2, 0.3, 0.4], dtype='float32'),
    "and": np.array([0.5, 0.6, 0.7, 0.8], dtype='float32'),
    "of": np.array([0.9, 1.0, 1.1, 1.2], dtype='float32'),
}

# Save it as pickle
with open(temp_path, 'wb') as fp:
    pickle.dump(emb_dict, fp)

ARGS = {
    "emb_file": temp_path
}
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 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
repackage_hidden Ran
ran, honoured the contract we drafted
code-gen/cgcs/language_model/lm_train.py
pointer only (licence: MIT); the stored copy get_code serves, from puhsu/pruning, is pointer only (licence: NONE) · get_code("6aaf07ccda31ac5f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from puhsu/pruning, and GitHub detected no licence in that repository 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.

tensor_transform Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Bolin0215/CSCGDual/nmt/model.py
pointer only (licence: NONE) · get_code("a9090d706c05b137")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Bolin0215/CSCGDual 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.

word2id Ran
ran; our contract draft was wrong, not the code
Bolin0215/CSCGDual/nmt/model.py
pointer only (licence: NONE) · get_code("bfd4a7f346c5a4e6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Bolin0215/CSCGDual 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.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 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, 1 later) and 5 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
repackage_hidden 15 other papers
8 dated earlier, 7 later
1609.04309 (2016-09)
Efficient softmax approximation for GPUs
1704.05119 (2017-04)
Exploring Sparsity in Recurrent Neural Networks
1803.08240 (2018-03)
An Analysis of Neural Language Modeling at Multiple Scales
and 12 more not named here
word2id 1 other paper
1 dated earlier
1506.08909 (2015-06)
The Ubuntu Dialogue Corpus: A Large Dataset for Research in Unstructured Multi-Turn Dialogue Systems

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

Code summarization (CS) and code generation (CG) are two crucial tasks in the field of automatic software development. Various neural network-based approaches are proposed to solve these two tasks separately. However, there exists a specific intuitive correlation between CS and CG, which have not been exploited in previous work. In this paper, we apply the relations between two tasks to improve the performance of both tasks. In other words, exploiting the duality between the two tasks, we propose a dual training framework to train the two tasks simultaneously. In this framework, we consider the dualities on probability and attention weights, and design corresponding regularization terms to constrain the duality. We evaluate our approach on two datasets collected from GitHub, and experimental results show that our dual framework can improve the performance of CS and CG tasks over baselines.

For agents

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

get_harvested_code_for_paper("1910.05923")
get_code_for_paper("1910.05923")
have("1910.05923")

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

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

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

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

Connect an agent — have() is free.