SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.13701 · 2023

$\text{EFO}_{k}$-CQA: Towards Knowledge Graph Complex Query Answering beyond Set Operation

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 7 failures of our instrument; 2 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-24; 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/2307.13701.json · badge: /api/ran/2307.13701.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
hkust-knowcomp/efok-cqa canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
FunctionStatusWhere it lives
read_from_yaml Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/efok-cqa/QG_EFOX.py
code served (permissive licence) · get_code("84eb10126b44cd7c")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned dict. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T00:43:41Z). 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 tempfile
import yaml
import os

# Create a temporary YAML file with test content
temp_dir = tempfile.mkdtemp()
yaml_path = os.path.join(temp_dir, "test_config.yaml")

test_data = {
    "model": "test_model",
    "learning_rate": 0.001,
    "batch_size": 32,
    "layers": [64, 128, 256],
    "nested": {
        "key1": "value1",
        "key2": 42
    }
}

with open(yaml_path, 'w') as f:
    yaml.dump(test_data, f)

ARGS = {
    "yaml_path": yaml_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
yaml — 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
align_entities_relations Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/efok-cqa/convert_beta_dataset.py
code served (permissive licence) · get_code("2c5d6c341e63248e")
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

torch.manual_seed(0)

# Analyzing the function:
# - labeled_beta_type: nested structure that can contain strings or other iterables
# - beta_sample: parallel nested structure with corresponding samples
# - The function recursively zips these together
# - It checks if sub_type is a string, and if so, checks if first char is 's' or 'r'
# - It stores matching sub_type -> sub_sample pairs in dictionary d

# Create a nested structure for labeled_beta_type
# Mix of strings (some starting with 's' or 'r', some not) and nested lists
labeled_beta_type = [
    "subject_type",
    "relation_type",
    ["nested_s_entity", "other_field"],
    "random_string"
]

# Create corresponding nested structure for beta_sample
# Must have same nesting structure as labeled_beta_type
beta_sample = [
    torch.randn(2, 4),
    torch.randn(2, 4),
    [torch.randn(2, 4), torch.randn(2, 4)],
    torch.randn(2, 4)
]

ARGS = {
    "labeled_beta_type": labeled_beta_type,
    "beta_sample": beta_sample
}
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
compute_batch_score_complex Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hkust-knowcomp/efok-cqa/data_preparation/compute_score.py
code served (permissive licence) · get_code("dfaa9a08584100be")
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, 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)

# Analyze the function:
# - rel: shape (batch, ?, 2*rank) - split into real/img at dimension 2
# - arg1: shape (batch, ?, 2*rank) - split into real/img at dimension 2
# - arg2: shape (batch, ?, 2*rank) - split into real/img at dimension 2
# - rank: int - used to split the last dimension
# - Returns: tensor of shape (batch, ?)

batch_size = 2
num_entities = 3
rank = 2

# Create tensors with shape (batch, num_entities, 2*rank)
# This allows the function to split at rank: [:, :, :rank] and [:, :, rank:]
rel = torch.randn(batch_size, num_entities, 2 * rank)
arg1 = torch.randn(batch_size, num_entities, 2 * rank)
arg2 = torch.randn(batch_size, num_entities, 2 * rank)

ARGS = {
    "rel": rel,
    "arg1": arg1,
    "arg2": arg2,
    "rank": rank,
}
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, 3) — shape (2, 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
compute_batch_score_distmult Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/efok-cqa/data_preparation/compute_score.py
code served (permissive licence) · get_code("1869521a4be75145")
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 (2,) 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 compute_batch_score_distmult expects:
# - rel: tensor of shape (batch_size, embedding_dim)
# - h_emb: tensor of shape (batch_size, embedding_dim)
# - t_emb: tensor of shape (batch_size, embedding_dim)
# It computes element-wise multiplication and sums along the last dimension

batch_size = 2
embedding_dim = 4

rel = torch.randn(batch_size, embedding_dim)
h_emb = torch.randn(batch_size, embedding_dim)
t_emb = torch.randn(batch_size, embedding_dim)

ARGS = {
    "rel": rel,
    "h_emb": h_emb,
    "t_emb": t_emb,
}
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 (2,) — shape (2,) 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
compute_batch_score_transe Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/efok-cqa/data_preparation/compute_score.py
code served (permissive licence) · get_code("8c0698d90001cd35")
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 (2,) 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 expects:
# - rel: tensor of shape (batch_size, embedding_dim)
# - h_emb: tensor of shape (batch_size, embedding_dim)
# - t_emb: tensor of shape (batch_size, embedding_dim)
# All tensors are used in arithmetic operations and norm computation

batch_size = 2
embedding_dim = 4

rel = torch.randn(batch_size, embedding_dim)
h_emb = torch.randn(batch_size, embedding_dim)
t_emb = torch.randn(batch_size, embedding_dim)

ARGS = {
    'rel': rel,
    'h_emb': h_emb,
    't_emb': t_emb,
}
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 (2,) — shape (2,) 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_beta_model Ran
ran, honoured the contract we drafted
hkust-knowcomp/efok-cqa/QG_EFOX.py
code served (permissive licence) · get_code("25412604ebe7d821")
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 tuple, 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
import tempfile
import os

torch.manual_seed(0)

# Create a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create model and optimizer instances
model = SimpleModel()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

# Create a temporary directory and checkpoint file
temp_dir = tempfile.mkdtemp()
checkpoint_data = {
    'step': 100,
    'model_state_dict': model.state_dict(),
    'current_learning_rate': 0.001,
    'warm_up_steps': 1000,
    'optimizer_state_dict': optimizer.state_dict(),
}
torch.save(checkpoint_data, os.path.join(temp_dir, 'checkpoint'))

ARGS = {
    'checkpoint_path': temp_dir,
    'model': model,
    'optimizer': optimizer,
}
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 tuple, ndim 1, dtype family float — a tuple 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
load_model Ran
ran, honoured the contract we drafted
hkust-knowcomp/efok-cqa/QG_EFOX.py
code served (permissive licence) · get_code("4c08e440ba7f3e8c")
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 tuple, 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
import tempfile
import os

torch.manual_seed(0)

# Create a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create a minimal optimizer
model = SimpleModel()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

# Create a temporary checkpoint directory and file
temp_dir = tempfile.mkdtemp()
checkpoint_path = temp_dir

# Create a valid checkpoint file
step = 100
checkpoint_file = os.path.join(checkpoint_path, f'{step}.ckpt')

checkpoint_data = {
    'model_parameter': model.state_dict(),
    'optimizer_parameter': optimizer.state_dict(),
    'learning_rate': 0.001,
    'warm_up_steps': 1000
}

torch.save(checkpoint_data, checkpoint_file)

# Define arguments
ARGS = {
    'step': step,
    'checkpoint_path': checkpoint_path,
    'model': model,
    'opt': optimizer,
    'load_device': 'cpu'
}
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 tuple, ndim 1, dtype family float — a tuple 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
log_add_metric Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/efok-cqa/evaluate_lmpnn.py
code served (permissive licence) · get_code("8e7c46d561388d36")
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)

# Construct the arguments for log_add_metric
add_log = {
    'MRR': 0.0,
    'HITS1': 0,
    'HITS3': 0,
    'HITS10': 0,
    'num_queries': 0,
    'couple_MRR': 0.0,
    'HITS1*1': 0,
    'HITS3*3': 0,
    'HITS10*10': 0
}

mrr = 0.85
h1 = 1
h3 = 1
h10 = 1
mul_mrr = 0.85
h1_1 = 1
h3_3 = 3
h10_10 = 10

ARGS = {
    'add_log': add_log,
    'mrr': mrr,
    'h1': h1,
    'h3': h3,
    'h10': h10,
    'mul_mrr': mul_mrr,
    'h1_1': h1_1,
    'h3_3': h3_3,
    'h10_10': h10_10
}
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
ranking2metrics Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/efok-cqa/evaluate_lmpnn.py
code served (permissive licence) · get_code("e9bc5bf12edea40c")
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 tuple, 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

torch.manual_seed(0)

# The function expects:
# - ranking: a tensor that can be indexed with lists
# - easy_ans: a set or list of indices
# - hard_ans: a set or list of indices
# - ranking_device: a torch device

# Create a small ranking tensor with scores for different answers
# We need enough elements to index with easy_ans and hard_ans
ranking = torch.randn(10)

# Create disjoint sets of easy and hard answers
easy_ans = {0, 1}
hard_ans = {2, 3, 4}

# Device is CPU
ranking_device = torch.device('cpu')

ARGS = {
    'ranking': ranking,
    'easy_ans': easy_ans,
    'hard_ans': hard_ans,
    'ranking_device': ranking_device
}
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 tuple, ndim 1, dtype family float — a tuple 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
construct_matrix_list Not yet run
unverified (harvested, no recorded run)
hkust-knowcomp/efok-cqa/FIT.py
code served (permissive licence) · get_code("67f4ee4ad4d0d75f")
How it ran

no invocation recorded.

evaluate_batch_joint Not yet run
unverified (harvested, no recorded run)
hkust-knowcomp/efok-cqa/evaluate_lmpnn.py
code served (permissive licence) · get_code("34cfe3992789f9f7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 10 are also present in other papers whose code we hold (10 with at least one paper dated earlier, 0 the same month, 0 later) and 1 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
align_entities_relations 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
compute_batch_score_complex 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
compute_batch_score_distmult 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
compute_batch_score_transe 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
evaluate_batch_joint 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
load_beta_model 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
load_model 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
log_add_metric 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
ranking2metrics 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors
read_from_yaml 1 other paper
1 dated earlier
2304.07063 (2023-04)
Rethinking Complex Queries on Knowledge Graphs with Neural Link Predictors

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-24.

Repositories linked to this paper

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

Abstract

To answer complex queries on knowledge graphs, logical reasoning over incomplete knowledge is required due to the open-world assumption. Learning-based methods are essential because they are capable of generalizing over unobserved knowledge. Therefore, an appropriate dataset is fundamental to both obtaining and evaluating such methods under this paradigm. In this paper, we propose a comprehensive framework for data generation, model training, and method evaluation that covers the combinatorial space of Existential First-order Queries with multiple variables ($\text{EFO}_{k}$). The combinatorial query space in our framework significantly extends those defined by set operations in the existing literature. Additionally, we construct a dataset, $\text{EFO}_{k}$-CQA, with 741 types of query for empirical evaluation, and our benchmark results provide new insights into how query hardness affects the results. Furthermore, we demonstrate that the existing dataset construction process is systematically biased that hinders the appropriate development of query-answering methods, highlighting the importance of our work. Our code and data are provided in~\url{https://github.com/HKUST-KnowComp/EFOK-CQA}.

For agents

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

get_harvested_code_for_paper("2307.13701")
get_code_for_paper("2307.13701")
have("2307.13701")

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

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

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

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

Connect an agent — have() is free.