SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.10321 · ACL · 2022

Sequence-to-Sequence Knowledge Graph Completion and Question Answering

Apoorv Saxena, Adrian Kochsiek, Rainer Gemulla

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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; 1 no recorded run), measured 2026-11-23; 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/2203.10321.json · badge: /api/ran/2203.10321.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
apoorvumang/kgt5 canonical (classifier label)
classifier basis not recorded on the link
5 ran · 1 no recorded run
FunctionStatusWhere it lives
eval Ran
ran on a synthesized input
apoorvumang/kgt5/eval_accelerate.py
code served (permissive licence) · get_code("3e6ba40bc8b3abdd")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from torch.utils.data import Dataset
from unittest.mock import Mock

torch.manual_seed(0)

class SimpleTokenizer:
    def batch_decode(self, token_ids, skip_special_tokens=False):
        # Convert token ids to text strings for testing
        return [f"prediction_{i}" for i in range(len(token_ids))]

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def generate(self, input_ids, attention_mask):
        # Return dummy token ids
        batch_size = input_ids.shape[0]
        return torch.randint(0, 100, (batch_size, 5))
    
    def eval(self):
        return self
    
    def cuda(self):
        return self

class SimpleDataset(Dataset):
    def __init__(self):
        self.tokenizer = SimpleTokenizer()
        self.data = [
            (torch.randint(0, 100, (5,)), torch.ones(5), f"target_{i}")
            for i in range(4)
        ]
    
    def __len__(self):
        return len(self.data)
    
    def __getitem__(self, idx):
        return self.data[idx]
    
    def _collate_eval(self, batch):
        input_ids_list = [item[0] for item in batch]
        attention_mask_list = [item[1] for item in batch]
        target_text_list = [item[2] for item in batch]
        
        input_ids = torch.stack(input_ids_list)
        attention_mask = torch.stack(attention_mask_list)
        
        return input_ids, attention_mask, target_text_list

class Args:
    def __init__(self):
        self.batch_size = 2

model = SimpleModel()
dataset = SimpleDataset()
args = Args()

ARGS = {
    "model": model,
    "dataset": dataset,
    "args": args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, 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
getGreedyOutput Ran
ran on a synthesized input
apoorvumang/kgt5/eval_accelerate.py
code served (permissive licence) · get_code("18abe939ed3719ed")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Stand-in tokenizer class
class MockTokenizer:
    def __init__(self):
        self.vocab_size = 100
        self.pad_token_id = 0
    
    def __call__(self, texts, return_tensors=None):
        # Simulate tokenization: return a simple batch
        batch_size = len(texts)
        seq_len = 5
        input_ids = torch.randint(1, self.vocab_size, (batch_size, seq_len))
        
        class TokenizerOutput:
            def __init__(self, ids):
                self.input_ids = ids
        
        return TokenizerOutput(input_ids)
    
    def batch_decode(self, token_ids, skip_special_tokens=False):
        # Simple mock decode: return strings
        return ["generated text " + str(i) for i in range(len(token_ids))]

# Minimal model that has a generate method
class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(100, 100)
    
    def generate(self, input_ids):
        # Mock generate: return token ids of shape (batch_size, seq_len)
        batch_size = input_ids.shape[0]
        seq_len = 7
        return torch.randint(1, 100, (batch_size, seq_len))

model = MockModel()
tokenizer = MockTokenizer()
encoder_input_str = "hello world"

ARGS = {
    "model": model,
    "tokenizer": tokenizer,
    "encoder_input_str": encoder_input_str
}
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 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
removeModuleFromKeys Ran
ran on a synthesized input
apoorvumang/kgt5/utils_accelerate.py
code served (permissive licence) · get_code("10dc27d79a090adc")
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 torch.nn as nn

torch.manual_seed(0)

# Create a sample state_dict with 'module.' prefix in keys
state_dict = {
    'module.layer1.weight': torch.randn(4, 3),
    'module.layer1.bias': torch.randn(4),
    'module.layer2.weight': torch.randn(5, 4),
    'module.layer2.bias': torch.randn(5),
}

ARGS = {
    'state_dict': state_dict
}
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 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
removePadding Ran
ran on a synthesized input
apoorvumang/kgt5/eval_models.py
code served (permissive licence) · get_code("2c9a7c494e855d9d")
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 1, dtype family float, shape (3,) 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)

# The function removePadding takes an array (tensor) and removes padding (zeros) from the end
# It finds the first index where a 0 occurs, and returns elements up to that point
# If no zeros exist, it returns the entire array

# Create a small tensor with some padding (zeros at the end)
arr = torch.tensor([5, 3, 2, 0], dtype=torch.float32)

ARGS = {
    "arr": arr
}
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 1, dtype family float, shape (3,) — shape (3,) 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
split_example Ran
ran on a synthesized input
apoorvumang/kgt5/make_dataset.py
code served (permissive licence) · get_code("69d92df11258fee4")
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

def split_example(example):
    text = example['text'].split('\t')
    example['input_text'] = text[0]
    example['target_text'] = text[1]
    return example

ARGS = {
    'example': {
        'text': 'This is input\tThis is target'
    }
}
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
load_accelerator_model Not yet run
unverified (harvested, no recorded run)
apoorvumang/kgt5/utils_accelerate.py
code served (permissive licence) · get_code("0e293c88fb992f3c")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Knowledge graph embedding (KGE) models represent each entity and relation of a knowledge graph (KG) with low-dimensional embedding vectors. These methods have recently been applied to KG link prediction and question answering over incomplete KGs (KGQA). KGEs typically create an embedding for each entity in the graph, which results in large model sizes on real-world graphs with millions of entities. For downstream tasks these atomic entity representations often need to be integrated into a multi stage pipeline, limiting their utility. We show that an off-the-shelf encoder-decoder Transformer model can serve as a scalable and versatile KGE model obtaining state-of-the-art results for KG link prediction and incomplete KG question answering. We achieve this by posing KG link prediction as a sequence-tosequence task and exchange the triple scoring approach taken by prior KGE methods with autoregressive decoding. Such a simple but powerful method reduces the model size up to 98% compared to conventional KGE models while keeping inference time tractable. After finetuning this model on the task of KGQA over incomplete KGs, our approach outperforms baselines on multiple large-scale datasets without extensive hyperparameter tuning. 1

For agents

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

get_harvested_code_for_paper("2203.10321")
get_code_for_paper("2203.10321")
have("2203.10321")

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

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

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

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

Connect an agent — have() is free.