SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.05239 · 2022

StructCoder: Structure-Aware Transformer for Code Generation

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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; 1 failure of our instrument; 2 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/2206.05239.json · badge: /api/ran/2206.05239.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
reddy-lab-code-research/structcoder canonical (classifier label)
classifier basis not recorded on the link
6 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_bleu Ran
ran; our contract draft was wrong, not the code
reddy-lab-code-research/structcoder/bleu.py
pointer only (licence: MIT); the stored copy get_code serves, from WangXFng/RDRec, is pointer only (licence: NONE) · get_code("49289a7f94c227bd")
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 WangXFng/RDRec, 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.

count_parameters Ran
ran on a synthesized input
reddy-lab-code-research/structcoder/pretrain_utils.py
code served (permissive licence) · get_code("31a496057f62e087")
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 int, ndim 0, dtype family int, 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 torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model,
    "only_trainable": 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 int, ndim 0, dtype family int, 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
get_link_mat_from_ll Ran
ran on a synthesized input
reddy-lab-code-research/structcoder/finetune_generation_utils.py
code served (permissive licence) · get_code("43a22dc043bf3e06")
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 ndarray, ndim 2, dtype family float, shape (3, 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 numpy as np

# Analyze the function:
# - ll: iterable of indices (used in enumerate and indexing into m)
# - num_cols: integer (used as second dimension of zeros)
# The function creates a matrix where each row i has a 1 at column ll[i]

# Create valid arguments
ll = [0, 2, 1]  # List of column indices
num_cols = 4    # Number of columns in output matrix

ARGS = {
    "ll": ll,
    "num_cols": num_cols
}
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 ndarray, ndim 2, dtype family float, shape (3, 4) — shape (3, 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
parse_list_of_lists Ran
ran on a synthesized input
reddy-lab-code-research/structcoder/pretrain_utils.py
code served (permissive licence) · get_code("f7390353a6a94e77")
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 2, dtype family int; 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 numpy as np

# The function parses a string representation of a list of lists
# It expects a string formatted like "[[1, 2, 3], [4, 5, 6]]"

s = "[[1, 2, 3], [4, 5, 6], [7, 8, 9]]"
max_value = 7
max_len = 2
inner_max_len = 2

ARGS = {
    "s": s,
    "max_value": max_value,
    "max_len": max_len,
    "inner_max_len": inner_max_len
}
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 list, ndim 2, dtype family int — 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
prepare_code_inputs Ran
ran on a synthesized input
reddy-lab-code-research/structcoder/finetune_translation_utils.py
code served (permissive licence) · get_code("f1e410d9398d469f")
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 numpy as np

class Args:
    def __init__(self):
        self.source_lang = 'python'
        self.max_length_source_code = 10
        self.max_source_dfg_nodes = 5
        self.max_source_ast_leaves = 4
        self.max_ast_depth = 3

# Create sample data structure
data = {
    'python_tokens': [
        [1, 2, 3, 4, 5, 6],
        [1, 2, 3, 4, 5, 6, 7, 8]
    ],
    'python_dfg_node_code_token_idxs': [
        [[0, 1], [2, 3], [1, 2]],
        [[0], [1, 2], [3], [4, 5]]
    ],
    'python_ast_leaf_code_token_idxs': [
        [[0], [1, 2], [3]],
        [[0, 1], [2], [3, 4]]
    ],
    'python_dfg_edges': [
        [(0, [1, 2]), (1, [2])],
        [(0, [1, 2, 3]), (1, [2]), (2, [3])]
    ],
    'python_ll_sims': [
        np.array([[1.0, 0.5, 0.3], [0.5, 1.0, 0.4], [0.3, 0.4, 1.0], [0.2, 0.3, 0.5]]),
        np.array([[1.0, 0.6, 0.2, 0.1], [0.6, 1.0, 0.5, 0.3], [0.2, 0.5, 1.0, 0.4], [0.1, 0.3, 0.4, 1.0]])
    ],
    'python_lr_paths_types': [
        [[1, 2], [2, 3, 1], [1]],
        [[1], [2, 1], [3, 2, 1], [1, 2]]
    ]
}

ARGS = {
    'data': data,
    'args': Args()
}
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
prepare_text_inputs Ran
ran on a synthesized input
reddy-lab-code-research/structcoder/finetune_generation_utils.py
code served (permissive licence) · get_code("af6ba70190bd063c")
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 numpy as np

torch.manual_seed(0)

# Create a small stand-in args object with max_length_source_text attribute
class Args:
    def __init__(self):
        self.max_length_source_text = 5

ARGS = {
    'data': {
        'nl_tokens': [
            [101, 2054, 2003, 2009, 102],  # length 5
            [101, 2054, 2003, 2054, 2003, 2054, 2003, 2054, 102],  # length 9 (longer than 2 + max_length_source_text)
            [101, 2054, 102]  # length 3
        ]
    },
    'args': Args()
}
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 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
format_dfg_edges Not yet run
unverified (harvested, no recorded run)
reddy-lab-code-research/structcoder/pretrain_utils.py
code served (permissive licence) · get_code("ebf7e8e50f40e30b")
How it ran

no invocation recorded.

prepare_code_outputs Not yet run
unverified (harvested, no recorded run)
reddy-lab-code-research/structcoder/finetune_translation_utils.py
code served (permissive licence) · get_code("9a8bbe900f6809f3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 1 later) and 7 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
compute_bleu 10 other papers
2 dated earlier, 1 the same month, 7 later
1909.09436 (2019-09)
CodeSearchNet Challenge: Evaluating the State of Semantic Code Search
aaai_6453 (2020 (year only))
Improving Knowledge-Aware Dialogue Generation via Knowledge Base Question Answering
2206.08474 (2022-06)
XLCoST: A Benchmark Dataset for Cross-lingual Code Intelligence
and 7 more not named here

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

There has been a recent surge of interest in automating software engineering tasks using deep learning. This paper addresses the problem of code generation, where the goal is to generate target code given source code in a different language or a natural language description. Most state-of-the-art deep learning models for code generation use training strategies primarily designed for natural language. However, understanding and generating code requires a more rigorous comprehension of the code syntax and semantics. With this motivation, we develop an encoder-decoder Transformer model where both the encoder and decoder are explicitly trained to recognize the syntax and data flow in the source and target codes, respectively. We not only make the encoder structure-aware by leveraging the source code's syntax tree and data flow graph, but we also support the decoder in preserving the syntax and data flow of the target code by introducing two novel auxiliary tasks: AST (Abstract Syntax Tree) paths prediction and data flow prediction. To the best of our knowledge, this is the first work to introduce a structure-aware Transformer decoder that models both syntax and data flow to enhance the quality of generated code. The proposed StructCoder model achieves state-of-the-art performance on code translation and text-to-code generation tasks in the CodeXGLUE benchmark, and improves over baselines of similar size on the APPS code generation benchmark. Our code is publicly available at https://github.com/reddy-lab-code-research/StructCoder/.

For agents

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

get_harvested_code_for_paper("2206.05239")
get_code_for_paper("2206.05239")
have("2206.05239")

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

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

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

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

Connect an agent — have() is free.