SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.04730 · ACL · 2022

A Neural Network Architecture for Program Understanding Inspired by Human Behaviors

Ming Gao, Lei Yuan, Xiang Li, Renyu Zhu, Wenyuan Cai

arXiv · PDF · Open in the Atlas

Code that ran

5 of 9 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; 4 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.04730.json · badge: /api/ran/2206.04730.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
c2nes/javalang canonical (classifier label)
classifier basis not recorded on the link
5 ran · 4 no recorded run
FunctionStatusWhere it lives
join Ran
ran on a synthesized input
c2nes/javalang/javalang/javadoc.py
code served (permissive licence) · get_code("d351384dc258a23d")
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 torch
import numpy as np

torch.manual_seed(0)

# The function 'join' takes a single parameter 's' which should be a string
# It splits the string by newlines, strips each line, and joins them with spaces

s = "  hello world  \n  foo bar  \n  baz  "

ARGS = {
    "s": s
}
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 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
load Ran
ran on a synthesized input
c2nes/javalang/javalang/ast.py
code served (permissive licence) · get_code("cfcffc522853f364")
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
import io

# Create a simple object to pickle
data = {
    'key1': 'value1',
    'key2': [1, 2, 3],
    'key3': {'nested': 'dict'}
}

# Serialize it to a BytesIO object
pickled_bytes = io.BytesIO()
pickle.dump(data, pickled_bytes)
pickled_bytes.seek(0)

ARGS = {
    'file': pickled_bytes
}
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
parse Ran
ran on a synthesized input
c2nes/javalang/javalang/javadoc.py
code served (permissive licence) · get_code("dfeacfa37a441cb3")
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 DocBlock. 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 re

def join(s):
    return ' '.join((l.strip() for l in s.split('\n')))

class DocBlock(object):

    def __init__(self):
        self.description = ''
        self.return_doc = None
        self.params = []
        self.authors = []
        self.deprecated = False
        self.throws = {}
        self.exceptions = self.throws
        self.tags = {}

    def add_block(self, name, value):
        value = value.strip()
        if name == 'param':
            try:
                param, description = value.split(None, 1)
            except ValueError:
                param, description = (value, '')
            self.params.append((param, join(description)))
        elif name in ('throws', 'exception'):
            try:
                ex, description = value.split(None, 1)
            except ValueError:
                ex, description = (value, '')
            self.throws[ex] = join(description)
        elif name == 'return':
            self.return_doc = value
        elif name == 'author':
            self.authors.append(value)
        elif name == 'deprecated':
            self.deprecated = True
        self.tags.setdefault(name, []).append(value)

blocks_re = re.compile('(^@)', re.MULTILINE)

leading_space_re = re.compile('^\\s*\\*', re.MULTILINE)

blocks_justify_re = re.compile('^\\s*@', re.MULTILINE)

def _sanitize(s):
    s = s.strip()
    if not (s[:3] == '/**' and s[-2:] == '*/'):
        raise ValueError('not a valid Javadoc comment')
    s = s.replace('\t', '    ')
    return s

def _uncomment(s):
    s = s[3:-2].strip()
    return leading_space_re.sub('', s)

def _get_indent_level(s):
    return len(s) - len(s.lstrip())

def _left_justify(s):
    lines = s.rstrip().splitlines()
    if not lines:
        return ''
    indent_levels = []
    for line in lines:
        if line.strip():
            indent_levels.append(_get_indent_level(line))
    indent_levels.sort()
    common_indent = indent_levels[0]
    if common_indent == 0:
        return s
    else:
        lines = [line[common_indent:] for line in lines]
        return '\n'.join(lines)

def _force_blocks_left(s):
    return blocks_justify_re.sub('@', s)

def parse(raw):
    sanitized = _sanitize(raw)
    uncommented = _uncomment(sanitized)
    justified = _left_justify(uncommented)
    justified_fixed = _force_blocks_left(justified)
    prepared = justified_fixed
    blocks = blocks_re.split(prepared)
    doc = DocBlock()
    if blocks[0] != '@':
        doc.description = blocks[0].strip()
        blocks = blocks[2::2]
    else:
        blocks = blocks[1::2]
    for block in blocks:
        try:
            tag, value = block.split(None, 1)
        except ValueError:
            tag, value = (block, '')
        doc.add_block(tag, value)
    return doc

raw_javadoc = """/**
 * This is a sample function description.
 * It processes some data.
 *
 * @param inputFile the input file path
 * @param outputFormat the desired output format
 * @return the processed result
 * @author John Doe
 * @throws IOException if file cannot be read
 * @deprecated use newMethod instead
 */"""

ARGS = {
    'raw': raw_javadoc
}
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 DocBlock — a DocBlock output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DocBlock 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
parse_debug Ran
ran on a synthesized input
c2nes/javalang/javalang/parser.py
code served (permissive licence) · get_code("3a4e5e4f641a3eca")
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 function. 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 six

ENABLE_DEBUG_SUPPORT = True

class JavaParserBaseException(Exception):
    def __init__(self, message=''):
        super(JavaParserBaseException, self).__init__(message)

class JavaSyntaxError(JavaParserBaseException):
    def __init__(self, description, at=None):
        super(JavaSyntaxError, self).__init__()
        self.description = description
        self.at = at

class MockToken:
    def __init__(self, value):
        self.value = value
    
    def __str__(self):
        return f"Token({self.value})"

class MockTokens:
    def __init__(self):
        self.current_token = MockToken("test_value")
        self.last_token = MockToken("last_value")
    
    def look(self):
        return self.current_token
    
    def last(self):
        return self.last_token

class MockParser:
    def __init__(self):
        self.tokens = MockTokens()
        self.debug = True
        self.recursion_depth = 0
    
    def test_method(self):
        return "result"

def parse_debug(method):
    global ENABLE_DEBUG_SUPPORT
    if ENABLE_DEBUG_SUPPORT:
        def _method(self):
            if not hasattr(self, 'recursion_depth'):
                self.recursion_depth = 0
            if self.debug:
                depth = '%02d' % (self.recursion_depth,)
                token = six.text_type(self.tokens.look())
                start_value = self.tokens.look().value
                name = method.__name__
                sep = '-' * self.recursion_depth
                e_message = ''
                print('%s %s> %s(%s)' % (depth, sep, name, token))
                self.recursion_depth += 1
                try:
                    r = method(self)
                except JavaSyntaxError as e:
                    e_message = e.description
                    raise
                except Exception as e:
                    e_message = six.text_type(e)
                    raise
                finally:
                    token = six.text_type(self.tokens.last())
                    print('%s <%s %s(%s, %s) %s' % (depth, sep, name, start_value, token, e_message))
                    self.recursion_depth -= 1
            else:
                self.recursion_depth += 1
                try:
                    r = method(self)
                finally:
                    self.recursion_depth -= 1
            return r
        return _method
    else:
        return method

parser_instance = MockParser()

def sample_method(self):
    return "test_result"

decorated_method = parse_debug(sample_method)

ARGS = {
    'method': sample_method
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
six — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
reformat_tokens Ran
ran on a synthesized input
c2nes/javalang/javalang/tokenizer.py
code served (permissive licence) · get_code("54c74426e04ae0d3")
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 torch
import numpy as np

class JavaToken(object):

    def __init__(self, value, position=None, javadoc=None):
        self.value = value
        self.position = position
        self.javadoc = javadoc

    def __repr__(self):
        if self.position:
            return '%s "%s" line %d, position %d' % (self.__class__.__name__, self.value, self.position[0], self.position[1])
        else:
            return '%s "%s"' % (self.__class__.__name__, self.value)

    def __str__(self):
        return repr(self)

    def __eq__(self, other):
        raise Exception('Direct comparison not allowed')

class Keyword(JavaToken):
    VALUES = set(['abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'const', 'continue', 'default', 'do', 'double', 'else', 'enum', 'extends', 'final', 'finally', 'float', 'for', 'goto', 'if', 'implements', 'import', 'instanceof', 'int', 'interface', 'long', 'native', 'new', 'package', 'private', 'protected', 'public', 'return', 'short', 'static', 'strictfp', 'super', 'switch', 'synchronized', 'this', 'throw', 'throws', 'transient', 'try', 'void', 'volatile', 'while'])

class Literal(JavaToken):
    pass

class Operator(JavaToken):
    MAX_LEN = 4
    VALUES = set(['>>>=', '>>=', '<<=', '%=', '^=', '|=', '&=', '/=', '*=', '-=', '+=', '<<', '--', '++', '||', '&&', '!=', '>=', '<=', '==', '%', '^', '|', '&', '/', '*', '-', '+', ':', '?', '~', '!', '<', '>', '=', '...', '->', '::'])
    INFIX = set(['||', '&&', '|', '^', '&', '==', '!=', '<', '>', '<=', '>=', '<<', '>>', '>>>', '+', '-', '*', '/', '%'])
    PREFIX = set(['++', '--', '!', '~', '+', '-'])
    POSTFIX = set(['++', '--'])
    ASSIGNMENT = set(['=', '+=', '-=', '*=', '/=', '&=', '|=', '^=', '%=', '<<=', '>>=', '>>>='])
    LAMBDA = set(['->'])
    METHOD_REFERENCE = set(['::'])

    def is_infix(self):
        return self.value in self.INFIX

    def is_prefix(self):
        return self.value in self.PREFIX

    def is_postfix(self):
        return self.value in self.POSTFIX

    def is_assignment(self):
        return self.value in self.ASSIGNMENT

class Identifier(JavaToken):
    pass

def reformat_tokens(tokens):
    indent = 0
    closed_block = False
    ident_last = False
    output = list()
    for token in tokens:
        if closed_block:
            closed_block = False
            indent -= 4
            output.append('\n')
            output.append(' ' * indent)
            output.append('}')
            if isinstance(token, (Literal, Keyword, Identifier)):
                output.append('\n')
                output.append(' ' * indent)
        if token.value == '{':
            indent += 4
            output.append(' {\n')
            output.append(' ' * indent)
        elif token.value == '}':
            closed_block = True
        elif token.value == ',':
            output.append(', ')
        elif isinstance(token, (Literal, Keyword, Identifier)):
            if ident_last:
                output.append(' ')
            ident_last = True
            output.append(token.value)
        elif isinstance(token, Operator):
            output.append(' ' + token.value + ' ')
        elif token.value == ';':
            output.append(';\n')
            output.append(' ' * indent)
        else:
            output.append(token.value)
        ident_last = isinstance(token, (Literal, Keyword, Identifier))
    if closed_block:
        output.append('\n}')
    output.append('\n')
    return ''.join(output)

# Create a list of sample tokens
sample_tokens = [
    Keyword('public'),
    Keyword('class'),
    Identifier('MyClass'),
    JavaToken('{'),
    Keyword('private'),
    Keyword('int'),
    Identifier('x'),
    Operator('='),
    Literal('5'),
    JavaToken(';'),
    JavaToken('}'),
]

ARGS = {
    'tokens': sample_tokens
}
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 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
parse_constructor_signature Not yet run
unverified (harvested, no recorded run)
c2nes/javalang/javalang/parse.py
code served (permissive licence) · get_code("dc30565ef68bb512")
How it ran

no invocation recorded.

parse_expression Not yet run
unverified (harvested, no recorded run)
c2nes/javalang/javalang/parse.py
code served (permissive licence) · get_code("b4a69eb39b11786a")
How it ran

no invocation recorded.

parse_member_signature Not yet run
unverified (harvested, no recorded run)
c2nes/javalang/javalang/parse.py
code served (permissive licence) · get_code("3743d6b9b445152e")
How it ran

no invocation recorded.

tokenize Not yet run
unverified (harvested, no recorded run)
c2nes/javalang/javalang/tokenizer.py
code served (permissive licence) · get_code("74e056a2350fa629")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 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 9 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-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

Program understanding is a fundamental task in program language processing. Despite the success, existing works fail to take human behaviors as reference in understanding programs. In this paper, we consider human behaviors and propose the PGNN-EK model that consists of two main components. On the one hand, inspired by the "divide-and-conquer" reading behaviors of humans, we present a partitioningbased graph neural network model PGNN on the upgraded AST of codes. On the other hand, to characterize human behaviors of resorting to other resources to help code comprehension, we transform raw codes with external knowledge and apply pre-training techniques for information extraction. Finally, we combine the two embeddings generated from the two components to output code embeddings. We conduct extensive experiments to show the superior performance of PGNN-EK on the code summarization and code clone detection tasks. In particular, to show the generalization ability of our model, we release a new dataset that is more challenging for code clone detection and could advance the development of the community. Our codes and data are publicly available at https://github.com/ RecklessRonan/PGNN-EK.

For agents

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

get_harvested_code_for_paper("2206.04730")
get_code_for_paper("2206.04730")
have("2206.04730")

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

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

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

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

Connect an agent — have() is free.