SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1906.00346 · 2019

Pre-training of Graph Augmented Transformers for Medication Recommendation

arXiv · PDF · Open in the Atlas

Code that ran

6 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 4 have no contract verdict; 2 failures of our instrument; 3 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/1906.00346.json · badge: /api/ran/1906.00346.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
jshang123/G-Bert canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
FunctionStatusWhere it lives
build_cominbed_edges Ran
ran on a synthesized input
jshang123/G-Bert/code/build_tree.py
code served (permissive licence) · get_code("7be7468bc7867a06")
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 torch
import numpy as np

class SimpleGraphVocab:
    def __init__(self):
        self.word2idx = {
            'word0': 0,
            'word1': 1,
            'word2': 2,
            'word3': 3,
            'word4': 4,
        }

graph_voc = SimpleGraphVocab()

res = [
    ['word0', 'word1', 'word2'],
    ['word3', 'word4', 'word1'],
]

ARGS = {
    'res': res,
    'graph_voc': graph_voc,
}
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 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
build_stage_one_edges Ran
ran on a synthesized input
jshang123/G-Bert/code/build_tree.py
code served (permissive licence) · get_code("12cb637233775372")
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 torch
import numpy as np

class GraphVocab:
    def __init__(self):
        self.word2idx = {
            'word0': 0,
            'word1': 1,
            'word2': 2,
            'word3': 3,
            'word4': 4,
            'word5': 5,
        }

# Create sample data: list of sequences where each sequence is a list of words
res = [
    ['word0', 'word1', 'word2'],
    ['word1', 'word3', 'word4'],
    ['word2', 'word5', 'word3'],
]

graph_voc = GraphVocab()

ARGS = {
    'res': res,
    'graph_voc': graph_voc,
}
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 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
build_stage_two_edges Ran
ran on a synthesized input
jshang123/G-Bert/code/build_tree.py
code served (permissive licence) · get_code("c96d9ce1076a16a6")
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 torch

class MockGraphVocab:
    def __init__(self):
        self.word2idx = {
            'word1': 0,
            'word2': 1,
            'word3': 2,
            'word4': 3,
            'word5': 4,
        }

res = [
    ['word1', 'word2', 'word3'],
    ['word2', 'word4', 'word5'],
    ['word1', 'word3'],
]

graph_voc = MockGraphVocab()

ARGS = {
    'res': res,
    'graph_voc': graph_voc,
}
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 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
gelu Ran
ran; our contract draft was wrong, not the code
jshang123/G-Bert/code/bert_models.py
code served (permissive licence) · get_code("8d23fbe2b99b840b")
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 Tensor, ndim 2, dtype family float, shape (2, 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 torch
import math

torch.manual_seed(0)

# Create a small tensor for testing
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
random_word Ran
ran on a synthesized input
jshang123/G-Bert/code/run_pretraining.py
code served (permissive licence) · get_code("9166c871f0af6e16")
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 random

class Vocab:
    def __init__(self):
        self.word2idx = {
            'hello': 0,
            'world': 1,
            'foo': 2,
            'bar': 3,
            'baz': 4
        }

vocab = Vocab()
tokens = ['hello', 'world', 'foo']

ARGS = {
    'tokens': tokens,
    'vocab': vocab
}
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 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
t2n Ran
ran; our contract draft was wrong, not the code
jshang123/G-Bert/code/utils.py
code served (permissive licence) · get_code("2c4438c79bd4a86a")
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 (2, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function t2n takes a tensor x and converts it to numpy
# It calls .detach(), .cpu(), and .numpy() on the input
# So x must be a torch.Tensor

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
load_dataset Not yet run
unverified (harvested, no recorded run)
jshang123/G-Bert/code/run_gbert.py
code served (permissive licence) · get_code("feaaa7cf4f1fc582")
How it ran

no invocation recorded.

load_dataset Not yet run
unverified (harvested, no recorded run)
jshang123/G-Bert/code/run_gbert_side.py
code served (permissive licence) · get_code("4d071c499ef55822")
How it ran

no invocation recorded.

load_dataset Not yet run
unverified (harvested, no recorded run)
jshang123/G-Bert/code/run_pretraining.py
code served (permissive licence) · get_code("8d954c8ce60d4edf")
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, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 2 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
gelu 51 other papers
3 dated earlier, 3 the same month, 45 later · 8 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
and 48 more not named here
t2n 1 other paper
1 later
2403.17745 (2024-03)
Leave No Patient Behind: Enhancing Medication Recommendation for Rare Disease Patients

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

Medication recommendation is an important healthcare application. It is commonly formulated as a temporal prediction task. Hence, most existing works only utilize longitudinal electronic health records (EHRs) from a small number of patients with multiple visits ignoring a large number of patients with a single visit (selection bias). Moreover, important hierarchical knowledge such as diagnosis hierarchy is not leveraged in the representation learning process. To address these challenges, we propose G-BERT, a new model to combine the power of Graph Neural Networks (GNNs) and BERT (Bidirectional Encoder Representations from Transformers) for medical code representation and medication recommendation. We use GNNs to represent the internal hierarchical structures of medical codes. Then we integrate the GNN representation into a transformer-based visit encoder and pre-train it on EHR data from patients only with a single visit. The pre-trained visit encoder and representation are then fine-tuned for downstream predictive tasks on longitudinal EHRs from patients with multiple visits. G-BERT is the first to bring the language model pre-training schema into the healthcare domain and it achieved state-of-the-art performance on the medication recommendation task.

For agents

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

get_harvested_code_for_paper("1906.00346")
get_code_for_paper("1906.00346")
have("1906.00346")

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

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

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

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

Connect an agent — have() is free.