SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1803.09473 · 2018

code2vec: Learning Distributed Representations of Code

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; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 6 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/1803.09473.json · badge: /api/ran/1803.09473.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
tech-srl/adversarial-examples extension (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
TakutoYoshikai/code2vec reimplementation (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
adversary_by_prefix_random Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tech-srl/adversarial-examples/tf-gnn-samples/adversarial.py
code served (permissive licence) · get_code("9ab8f76e5ee9bc91")
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 ndarray, ndim 1, dtype family int, shape (6,) 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 random

random.seed(0)
np.random.seed(0)

# Create a small numpy array of integers representing a label
# The array contains character codes, with 0 as a padding marker
unique_label_to_adverse_as_ints = np.array([5, 10, 15, 20, 0, 0], dtype=np.int32)

# prefix_count: number of characters to replace (-1 means all)
prefix_count = 3

ARGS = {
    "unique_label_to_adverse_as_ints": unique_label_to_adverse_as_ints,
    "prefix_count": prefix_count,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 1, dtype family int, shape (6,) — shape (6,) 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
construct_name_from_ints Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tech-srl/adversarial-examples/tf-gnn-samples/adversarial.py
code served (permissive licence) · get_code("4534c7d95faadccc")
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 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 numpy as np

def construct_name_from_ints(unique_label_as_ints, index_to_alphabet):
    length = get_label_length(unique_label_as_ints)
    return ''.join([index_to_alphabet(unique_label_as_ints[i]) for i in range(length)])

def get_label_length(unique_label_as_ints):
    if any(unique_label_as_ints == 0):
        return np.argmax(unique_label_as_ints == 0)
    return unique_label_as_ints.size

# Create a simple index_to_alphabet function that maps integers to characters
def index_to_alphabet(index):
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    return alphabet[int(index) % len(alphabet)]

# Create unique_label_as_ints as a numpy array
# Using a sequence that ends with 0 to test the get_label_length logic
unique_label_as_ints = np.array([1, 2, 3, 0], dtype=np.int32)

ARGS = {
    "unique_label_as_ints": unique_label_as_ints,
    "index_to_alphabet": index_to_alphabet
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
get_label_length Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tech-srl/adversarial-examples/tf-gnn-samples/adversarial.py
code served (permissive licence) · get_code("748bf8510e84bca3")
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 int64, 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 numpy as np

# The function takes unique_label_as_ints as a parameter
# It checks if any element equals 0, and if so returns the index of the first 0
# Otherwise returns the size of the array

# Create a simple numpy array with some unique labels
# Case 1: array with a 0 in it
unique_label_as_ints = np.array([5, 3, 0, 1, 2], dtype=np.int32)

ARGS = {
    "unique_label_as_ints": unique_label_as_ints
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int64, 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
init_deadcode_variable Ran
ran; our contract draft was wrong, not the code
tech-srl/adversarial-examples/code2vec/adversarialsearcher.py
code served (permissive licence) · get_code("d2024a1a569eaabf")
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 list, ndim 2, 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 torch.nn as nn

torch.manual_seed(0)

# The function takes 'code' and 'variables' as parameters
# Looking at the function body, it simply returns a hardcoded list
# So we need to provide valid arguments that match the parameter names

code = "some_code_string"
variables = {"var1": "value1", "var2": "value2"}

ARGS = {
    "code": code,
    "variables": variables
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — 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 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
is_equal_path_context Ran
ran, violated the contract we drafted
TakutoYoshikai/code2vec/code2vec.py
pointer only (licence: NONE) · get_code("9a14ad661cafefde")
How it ran

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

path_context Ran
ran; our contract draft was wrong, not the code
TakutoYoshikai/code2vec/code2vec.py
pointer only (licence: NONE) · get_code("0380fb616d64670b")
How it ran

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

path_down Ran
ran; our contract draft was wrong, not the code
TakutoYoshikai/code2vec/code2vec.py
pointer only (licence: NONE) · get_code("b77f421883ace0b9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, TakutoYoshikai/code2vec 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, 4 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 4 later) and 3 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
adversary_by_prefix_random 1 other paper
1 later
1910.07517 (2019-10)
Adversarial Examples for Models of Code
construct_name_from_ints 1 other paper
1 later
1910.07517 (2019-10)
Adversarial Examples for Models of Code
get_label_length 1 other paper
1 later
1910.07517 (2019-10)
Adversarial Examples for Models of Code
init_deadcode_variable 1 other paper
1 later
1910.07517 (2019-10)
Adversarial Examples for Models of Code

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

We present a neural model for representing snippets of code as continuous distributed vectors ("code embeddings"). The main idea is to represent a code snippet as a single fixed-length $\textit{code vector}$, which can be used to predict semantic properties of the snippet. This is performed by decomposing code to a collection of paths in its abstract syntax tree, and learning the atomic representation of each path $\textit{simultaneously}$ with learning how to aggregate a set of them. We demonstrate the effectiveness of our approach by using it to predict a method's name from the vector representation of its body. We evaluate our approach by training a model on a dataset of 14M methods. We show that code vectors trained on this dataset can predict method names from files that were completely unobserved during training. Furthermore, we show that our model learns useful method name vectors that capture semantic similarities, combinations, and analogies. Comparing previous techniques over the same data set, our approach obtains a relative improvement of over 75%, being the first to successfully predict method names based on a large, cross-project, corpus. Our trained model, visualizations and vector similarities are available as an interactive online demo at http://code2vec.org. The code, data, and trained models are available at https://github.com/tech-srl/code2vec.

For agents

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

get_harvested_code_for_paper("1803.09473")
get_code_for_paper("1803.09473")
have("1803.09473")

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

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

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

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

Connect an agent — have() is free.