SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2509.17289 · EMNLP · 2025

Automated Knowledge Graph Construction using Large Language Models and Sentence Complexity Modelling

Sydney Anuyah, Mehedi Kaushik, Krishna Dwarampudi, Rakesh Shiradkar, Arjan Durresi, Sunandan Chakraborty

arXiv · PDF · Open in the Atlas

Code that ran

8 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 0 have no contract verdict; 8 failures of our instrument; 1 no recorded run), measured 2026-11-24; 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/2509.17289.json · badge: /api/ran/2509.17289.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
KaushikMahmud/CoDe-KG_EMNLP_2025 canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
build_prompt Ran
ran; our contract draft was wrong, not the code
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/prompts.py
code served (permissive licence) · get_code("ec50c014e2ffb4f5")
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

torch.manual_seed(0)

system_text = "You are a helpful assistant."
user_text = "What is {topic}?"
kwargs = {"topic": "machine learning"}

ARGS = {
    "system_text": system_text,
    "user_text": user_text,
    **kwargs
}
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 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
extract_simplified_sentences Ran
ran; our contract draft was wrong, not the code
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/simplify_stage.py
code served (permissive licence) · get_code("4c1c276e20a63bf7")
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.

def extract_simplified_sentences(raw: str) -> list:
    sents = []
    for line in raw.splitlines():
        line = line.strip()
        if not line.startswith('S'):
            continue
        if '->' in line:
            parts = line.split('->', 1)
        elif '→' in line:
            parts = line.split('→', 1)
        else:
            continue
        if len(parts) == 2:
            sent = parts[1].strip()
            if sent:
                sents.append(sent)
    return sents


# Construct a valid raw string argument with multiple lines
# Some lines start with 'S' and have '->' or '→' separators
raw_text = """S1 -> This is the first simplified sentence
S2 → This is the second simplified sentence
Other line that should be ignored
S3 -> Third sentence
Not starting with S -> should be ignored
S4 → Final sentence"""

ARGS = {
    'raw': raw_text
}
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
extract_triples_regex Ran
ran; our contract draft was wrong, not the code
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/relation_extract_stage.py
code served (permissive licence) · get_code("2301f0553e126272")
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 re
from typing import List, Dict, Any

def extract_triples_regex(raw: str) -> List[Dict[str, str]]:
    """
    Tries to extract repeated blocks containing:
    "Entity 1": "...", "Relationship": "...", "Entity 2": "..."
    Works even with JSON-ish output.
    """
    triples = []
    blocks = re.findall('\\{[^{}]*Entity\\s*1[^{}]*\\}', raw, flags=re.DOTALL)
    if not blocks:
        blocks = [raw]
    for b in blocks:
        e1 = re.search('Entity\\s*1"\\s*:\\s*"([^"]+)"', b)
        if e1 is None:
            e1 = re.search('Entity\\s*1\\s*:\\s*"([^"]+)"', b)
        rel = re.search('Relationship"\\s*:\\s*"([^"]+)"', b)
        if rel is None:
            rel = re.search('Relationship\\s*:\\s*"([^"]+)"', b)
        e2 = re.search('Entity\\s*2"\\s*:\\s*"([^"]+)"', b)
        if e2 is None:
            e2 = re.search('Entity\\s*2\\s*:\\s*"([^"]+)"', b)
        if e1 and rel and e2:
            triples.append({'Entity 1': e1.group(1).strip(), 'Relationship': rel.group(1).strip(), 'Entity 2': e2.group(1).strip()})
    return triples


ARGS = {
    'raw': '''
    {
        "Entity 1": "Alice",
        "Relationship": "knows",
        "Entity 2": "Bob"
    }
    {
        "Entity 1": "Bob",
        "Relationship": "works_with",
        "Entity 2": "Charlie"
    }
    '''
}
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
format_pairs Ran
ran; our contract draft was wrong, not the code
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/tokenize_paper.py
code served (permissive licence) · get_code("c6892ba32b539e6f")
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
from typing import List, Tuple

# Construct valid arguments for format_pairs
pairs = [
    ("hello", 42),
    ("world", 7),
    ("test", 100)
]

ARGS = {
    "pairs": pairs
}
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_coref_output Ran
ran; our contract draft was wrong, not the code
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/coref_stage.py
code served (permissive licence) · get_code("93f11ea2806ab826")
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 re
from typing import Dict, List, Tuple, Any

def _extract_coref_blocks(raw: str) -> List[Dict[str, Any]]:
    """
    Regex-first extraction for blocks that contain:
    Expression, StartToken, EndToken, RefersTo
    Works even if JSON is slightly malformed.
    """
    blocks = []
    candidates = re.findall('\\{[^{}]*"Expression"[^{}]*\\}', raw, flags=re.DOTALL)
    if not candidates:
        candidates = re.findall('\\{[^{}]*Expression[^{}]*\\}', raw, flags=re.DOTALL)
    for c in candidates:
        exp = re.search('Expression"\\s*:\\s*"([^"]+)"', c)
        if exp is None:
            exp = re.search('Expression\\s*:\\s*"([^"]+)"', c)
        st = re.search('StartToken"\\s*:\\s*(\\d+)', c)
        if st is None:
            st = re.search('StartToken\\s*:\\s*(\\d+)', c)
        en = re.search('EndToken"\\s*:\\s*(\\d+)', c)
        if en is None:
            en = re.search('EndToken\\s*:\\s*(\\d+)', c)
        rf = re.search('RefersTo"\\s*:\\s*"([^"]+)"', c)
        if rf is None:
            rf = re.search('RefersTo\\s*:\\s*"([^"]+)"', c)
        if exp and st and en and rf:
            blocks.append({'Expression': exp.group(1), 'StartToken': int(st.group(1)), 'EndToken': int(en.group(1)), 'RefersTo': rf.group(1)})
    return blocks

def parse_coref_output(raw: str) -> List[Dict[str, Any]]:
    blocks = _extract_coref_blocks(raw)
    return blocks


# Test input with properly formatted coref blocks
raw_input = '''
[
  {"Expression": "John", "StartToken": 0, "EndToken": 1, "RefersTo": "person_1"},
  {"Expression": "he", "StartToken": 5, "EndToken": 6, "RefersTo": "person_1"},
  {"Expression": "Mary", "StartToken": 10, "EndToken": 11, "RefersTo": "person_2"}
]
'''

ARGS = {
    "raw": raw_input
}
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
read_abstracts Ran
ran; our contract draft was wrong, not the code
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/run_pipeline.py
code served (permissive licence) · get_code("5d7289d845ba85d7")
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 DataFrame. 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 pandas as pd
from io import StringIO
import tempfile
import os

# Create a temporary CSV file for testing
csv_content = """id,title,content
1,First Paper,This is the abstract of the first paper
2,Second Paper,This is the abstract of the second paper
3,Third Paper,This is the abstract of the third paper"""

# Write to a temporary file
temp_fd, temp_path = tempfile.mkstemp(suffix='.csv', text=True)
os.write(temp_fd, csv_content.encode())
os.close(temp_fd)

# Create args object as a simple namespace-like class
class Args:
    def __init__(self):
        self.input_csv = temp_path
        self.text_col = 'content'
        self.id_col = 'id'
        self.abstract = None

ARGS = {
    'args': Args()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
tokenize Ran
ran; our contract draft was wrong, not the code
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/tokenize_paper.py
code served (permissive licence) · get_code("f407977ea730a68c")
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 re
from typing import List

def tokenize(text: str, strip_punct: bool=True) -> List[str]:
    if strip_punct:
        out = []
        for token in text.split():
            cleaned = re.sub('^\\W+|\\W+$', '', token)
            if cleaned:
                out.append(cleaned)
        return out
    return text.split()

ARGS = {
    "text": "Hello, world! This is a test.",
    "strip_punct": True
}
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
tokens_with_indices Ran
ran; our contract draft was wrong, not the code
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/tokenize_paper.py
code served (permissive licence) · get_code("1074daf6a8a220b4")
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 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 re
from typing import List, Tuple

def tokenize(text: str, strip_punct: bool=True) -> List[str]:
    if strip_punct:
        out = []
        for token in text.split():
            cleaned = re.sub('^\\W+|\\W+$', '', token)
            if cleaned:
                out.append(cleaned)
        return out
    return text.split()

def tokens_with_indices(text: str, keep_punct: bool=True) -> List[Tuple[str, int]]:
    toks = tokenize(text, strip_punct=not keep_punct)
    return [(t, i) for i, t in enumerate(toks)]

ARGS = {
    "text": "Hello, world! This is a test.",
    "keep_punct": False
}
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 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
split_sentences Not yet run
unverified (harvested, no recorded run)
KaushikMahmud/CoDe-KG_EMNLP_2025/CoDe-KG/sentence_split_stage.py
code served (permissive licence) · get_code("d9ea78a8be7f2476")
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-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

We introduce CoDe-KG, an open-source, endto-end pipeline for extracting sentence-level knowledge graphs by combining robust coreference resolution with syntactic sentence decomposition. Using our model, we contribute a dataset of over 150 000 knowledge triples, which is open source. We also contribute a training corpus of 7248 rows for sentence complexity, 190 rows of gold human annotations for co-reference resolution using open source lung-cancer abstracts from PubMed, 900 rows of gold human annotations for sentence conversion policies, and 398 triples of gold human annotations. We systematically select optimal prompt-model pairs across five complexity categories, showing that hybrid chainof-thought and few-shot prompting yields up to 99.8% exact-match accuracy on sentence simplification. On relation extraction (RE), our pipeline achieves 65.8% macro-F1 on REBEL, an 8-point gain over the prior state of the art, and 75.7% micro-F1 on WebNLG2, while matching or exceeding performance on Wiki-NRE and CaRB. Ablation studies demonstrate that integrating coreference and decomposition increases recall on rare relations by over 20%. Code and dataset are available at https://github.com/KaushikMahmud/CoDe-KG_EMNLP_2025.

For agents

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

get_harvested_code_for_paper("2509.17289")
get_code_for_paper("2509.17289")
have("2509.17289")

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

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

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

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

Connect an agent — have() is free.