SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.01093 · ACL · 2021

LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relations

Lu Chen, Zhi Chen, Yanbin Zhao, Kai Yu, Su Zhu, Ruisheng Cao

arXiv · PDF · Open in the Atlas

Code that ran

10 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; 0 honoured the contract we drafted, 3 violated it and 3 have no contract verdict; 4 failures of our instrument; 1 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/2106.01093.json · badge: /api/ran/2106.01093.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
rhythmcao/text2sql-lgesql canonical (classifier label)
classifier basis: census
10 ran · 1 no recorded run
FunctionStatusWhere it lives
clones Ran
ran; our contract draft was wrong, not the code
rhythmcao/text2sql-lgesql/model/model_utils.py
code served (permissive licence) · get_code("25c42ad079e7167e")
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 ModuleList. 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
import copy

torch.manual_seed(0)

# The clones function takes a module and clones it N times.
# It uses copy.deepcopy on the module, so the module must be a valid nn.Module.
# Let's create a simple neural network module as a stand-in.

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

# Create the arguments
module = SimpleModel()
N = 5

ARGS = {
    "module": module,
    "N": N
}
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 ModuleList — a ModuleList output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModuleList output the recorded ndim 1 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
condition_has_like Ran
ran, violated the contract we drafted
rhythmcao/text2sql-lgesql/evaluation.py
code served (permissive licence) · get_code("8231e3fdffa9c8ee")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, 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.

WHERE_OPS = ('not', 'between', '=', '>', '<', '>=', '<=', '!=', 'in', 'like', 'is', 'exists')

# The function expects conds to be a list where every other element (starting at 0, i.e., conds[::2])
# is a cond_unit. Each cond_unit must be indexable with [1] to get an operation index.
# The operation index should be an integer that can be checked against WHERE_OPS.index('like').

# WHERE_OPS.index('like') = 9

# Create a valid conds structure
# conds[::2] gives us every other element starting from index 0
# Each cond_unit needs to be a sequence where cond_unit[1] is an integer representing the operation

# Example: conds with 4 elements, so conds[::2] will give us elements at indices 0 and 2
# Each cond_unit can be a tuple/list like (col_id, op_id, value)

conds = [
    (0, 2, 'value1'),  # index 0: operation '=' (index 2)
    'separator',        # index 1: some separator (not accessed by [::2])
    (1, 9, 'pattern'), # index 2: operation 'like' (index 9)
    'separator'         # index 3: another separator (not accessed by [::2])
]

ARGS = {'conds': conds}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 bool, 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
condition_has_or Ran
ran, violated the contract we drafted
rhythmcao/text2sql-lgesql/evaluation.py
code served (permissive licence) · get_code("f2d76234528d3b57")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, 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 torch
import numpy as np

# The function checks if 'or' is in conds[1::2], which means it's looking at every other element starting from index 1
# This suggests conds is a list where odd indices might contain operators like 'or', 'and', etc.
# A typical structure would be: [condition1, 'or', condition2, 'and', condition3, ...]

# Example 1: conds with 'or' in odd positions
conds_with_or = ['condition1', 'or', 'condition2', 'and', 'condition3']

# Example 2: conds without 'or' in odd positions
conds_without_or = ['condition1', 'and', 'condition2', 'and', 'condition3']

# We'll use the first example as the argument
ARGS = {
    'conds': conds_with_or
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, 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
condition_has_sql Ran
ran, violated the contract we drafted
rhythmcao/text2sql-lgesql/evaluation.py
code served (permissive licence) · get_code("954c76e256cc7220")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, 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.

# The function checks if any condition unit in conds (at even indices) 
# has val1 (index 3) or val2 (index 4) that is a dict.
# conds is a list where every other element (starting at 0) is a cond_unit
# Each cond_unit must be indexable with indices 3 and 4

# Case 1: conds with no SQL (no dicts in positions 3 or 4)
conds_no_sql = [
    [0, 1, 2, None, None],  # cond_unit at index 0
    "separator",             # odd index (skipped)
    [0, 1, 2, "value", 5],  # cond_unit at index 2
    "separator",             # odd index (skipped)
]

# Case 2: conds with SQL (dict in position 3)
conds_with_sql_val1 = [
    [0, 1, 2, {"nested": "sql"}, None],  # cond_unit with dict at index 3
    "separator",
]

# Case 3: conds with SQL (dict in position 4)
conds_with_sql_val2 = [
    [0, 1, 2, None, {"nested": "query"}],  # cond_unit with dict at index 4
]

# Use one of these for the test
ARGS = {
    "conds": conds_with_sql_val1
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 bool, 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
cumsoftmax Ran
ran; our contract draft was wrong, not the code
rhythmcao/text2sql-lgesql/model/decoder/onlstm.py
code served (permissive licence) · get_code("b54d0a53e495106f")
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 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.functional as F

torch.manual_seed(0)

# Create a small tensor for the input
# Using shape (2, 4) - batch size 2, feature dimension 4
x = torch.randn(2, 4)

# The function takes x and dim as parameters
# x should be a tensor, dim should be an integer specifying the dimension
ARGS = {
    "x": x,
    "dim": -1
}
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 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
get_schema Ran
ran; our contract draft was wrong, not the code
rhythmcao/text2sql-lgesql/process_sql.py
code served (permissive licence) · get_code("0992d2a47ae733fa")
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 sqlite3
import tempfile
import os

# Create a temporary SQLite database with some test tables
temp_dir = tempfile.mkdtemp()
db_path = os.path.join(temp_dir, "test.db")

conn = sqlite3.connect(db_path)
cursor = conn.cursor()

# Create a sample table
cursor.execute("""
    CREATE TABLE users (
        id INTEGER PRIMARY KEY,
        name TEXT,
        email TEXT
    )
""")

# Create another sample table
cursor.execute("""
    CREATE TABLE products (
        id INTEGER PRIMARY KEY,
        title TEXT,
        price REAL,
        stock INTEGER
    )
""")

conn.commit()
conn.close()

ARGS = {
    "db": db_path
}
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 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
get_schema_from_json Ran
ran; our contract draft was wrong, not the code
rhythmcao/text2sql-lgesql/process_sql.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from ygan/NatSQL, is pointer only (licence: NONE) · get_code("c4dcaf29b663a364")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from ygan/NatSQL, and GitHub detected no licence in that repository 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.

lens2mask Ran
ran on a synthesized input
rhythmcao/text2sql-lgesql/model/model_utils.py
code served (permissive licence) · get_code("dfc4442988bf7e23")
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 2, dtype family float, shape (4, 5) 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)

# lens2mask expects a 1D tensor of lengths
# The function uses: lens.numel(), lens.max(), lens.unsqueeze(1), lens.device, lens.dtype
# It creates masks for sequences of different lengths in a batch

lens = torch.tensor([3, 5, 2, 4], dtype=torch.long)

ARGS = {
    "lens": lens
}
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 2, dtype family float, shape (4, 5) — shape (4, 5) 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
mask2matrix Ran
ran on a synthesized input
rhythmcao/text2sql-lgesql/model/model_utils.py
code served (permissive licence) · get_code("9bbd7187f61c565a")
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 3, dtype family float, shape (2, 4, 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

torch.manual_seed(0)

# mask2matrix takes a mask tensor and performs unsqueeze operations on it
# then performs bitwise AND operations between col_mask and row_mask
# The mask should be a boolean tensor

mask = torch.tensor([[True, False, True, False],
                     [False, True, False, True]], dtype=torch.bool)

ARGS = {
    "mask": mask
}
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 3, dtype family float, shape (2, 4, 4) — shape (2, 4, 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
remove_comment Ran
ran on a synthesized input
rhythmcao/text2sql-lgesql/asdl/asdl.py
code served (permissive licence) · get_code("212773f9c186f66c")
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 re
import os

def remove_comment(text):
    text = re.sub(re.compile('#.*'), '', text)
    text = '\n'.join(filter(lambda x: x, text.split('\n')))
    return text

# The function takes a single parameter 'text' which is a string
# It removes comments (lines starting with #) and empty lines
# We need to construct a valid string argument

ARGS = {
    'text': '''# This is a comment
def hello():
    print("world")  # inline comment
    x = 42

# Another comment
y = 100'''
}
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 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
tokenize Not yet run
unverified (harvested, no recorded run)
rhythmcao/text2sql-lgesql/process_sql.py
code served (permissive licence) · get_code("a906f5de1f5971b0")
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, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 1 the same month, 8 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
clones 79 other papers
30 dated earlier, 1 the same month, 47 later, 1 same year, order not determinable · 11 only as an assembly brick
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1706.03762 (2017-06)
Attention Is All You Need
and 76 more not named here
condition_has_like 14 other papers
4 dated earlier, 10 later
1809.08887 (2018-09)
Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task
1906.02285 (2019-06)
SParC: Cross-Domain Semantic Parsing in Context
2020.emnlp-main.564 (2020 (year only))
Re-examining the Role of Schema Linking in Text-to-SQL
and 11 more not named here
condition_has_or 14 other papers
4 dated earlier, 10 later
1809.08887 (2018-09)
Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task
1906.02285 (2019-06)
SParC: Cross-Domain Semantic Parsing in Context
2020.emnlp-main.564 (2020 (year only))
Re-examining the Role of Schema Linking in Text-to-SQL
and 11 more not named here
get_schema_from_json 13 other papers
2 dated earlier, 11 later
1911.04942 (2019-11)
RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers
2020.emnlp-main.564 (2020 (year only))
Re-examining the Role of Schema Linking in Text-to-SQL
2204.11454 (2022-04)
Natural Language to Code Translation with Execution
and 10 more not named here
condition_has_sql 11 other papers
4 dated earlier, 7 later
1809.08887 (2018-09)
Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task
1906.02285 (2019-06)
SParC: Cross-Domain Semantic Parsing in Context
2020.emnlp-main.564 (2020 (year only))
Re-examining the Role of Schema Linking in Text-to-SQL
and 8 more not named here
get_schema 11 other papers
2 dated earlier, 9 later
1911.04942 (2019-11)
RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers
2020.emnlp-main.564 (2020 (year only))
Re-examining the Role of Schema Linking in Text-to-SQL
2204.11454 (2022-04)
Natural Language to Code Translation with Execution
and 8 more not named here
tokenize 10 other papers
2 dated earlier, 8 later
1911.04942 (2019-11)
RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers
2020.emnlp-main.564 (2020 (year only))
Re-examining the Role of Schema Linking in Text-to-SQL
2204.11454 (2022-04)
Natural Language to Code Translation with Execution
and 7 more not named here
cumsoftmax 2 other papers
1 dated earlier, 1 later
1810.09536 (2018-10)
Ordered Neurons: Integrating Tree Structures into Recurrent Neural Networks
2203.10256 (2022-03)
Dependency-based Mixture Language Models

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

This work aims to tackle the challenging heterogeneous graph encoding problem in the text-to-SQL task. Previous methods are typically node-centric and merely utilize different weight matrices to parameterize edge types, which 1) ignore the rich semantics embedded in the topological structure of edges, and 2) fail to distinguish local and nonlocal relations for each node. To this end, we propose a Line Graph Enhanced Text-to-SQL (LGESQL) model to mine the underlying relational features without constructing metapaths. By virtue of the line graph, messages propagate more efficiently through not only connections between nodes, but also the topology of directed edges. Furthermore, both local and non-local relations are integrated distinctively during the graph iteration. We also design an auxiliary task called graph pruning to improve the discriminative capability of the encoder. Our framework achieves state-of-theart results (62.8% with GLOVE, 72.0% with ELECTRA) on the cross-domain text-to-SQL benchmark Spider at the time of writing.

For agents

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

get_harvested_code_for_paper("2106.01093")
get_code_for_paper("2106.01093")
have("2106.01093")

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

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

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

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

Connect an agent — have() is free.