SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2504.08600 · NeurIPS · 2025

SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learning

Jian Guo, Chengjin Xu, Peixian Ma, Xialie Zhuang, Xuhui Jiang, Ran Chen

arXiv · PDF · Open in the Atlas

Code that ran

21 of 22 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; 1 honoured the contract we drafted, 4 violated it and 9 have no contract verdict; 7 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2504.08600.json · badge: /api/ran/2504.08600.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
IDEA-FinAI/SQL-R1 canonical (classifier label)
classifier basis not recorded on the link
17 ran · 1 no recorded run
DataArcTech/SQL-R1 canonical (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
FunctionStatusWhere it lives
compare_sql Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/evaluation_bird_post.py
code served (permissive licence) · get_code("0d3763ae4f97d43c")
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 sqlite3
import tempfile
import os

# Create a temporary SQLite database for testing
temp_db = tempfile.NamedTemporaryFile(mode='w', suffix='.db', delete=False)
db_file = temp_db.name
temp_db.close()

# Initialize the database with a simple table and data
conn = sqlite3.connect(db_file)
cursor = conn.cursor()
cursor.execute('''
    CREATE TABLE users (
        id INTEGER PRIMARY KEY,
        name TEXT,
        age INTEGER
    )
''')
cursor.execute("INSERT INTO users (name, age) VALUES ('Alice', 30)")
cursor.execute("INSERT INTO users (name, age) VALUES ('Bob', 25)")
conn.commit()
conn.close()

# Define the arguments for compare_sql
question_id = 1
question = "How many users are there?"
ground_truth = "SELECT COUNT(*) FROM users"
pred_sql = "SELECT COUNT(*) FROM users"

ARGS = {
    'question_id': question_id,
    'db_file': db_file,
    'question': question,
    'ground_truth': ground_truth,
    'pred_sql': pred_sql
}
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 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
compare_sql_wrapper Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/evaluation_bird_post.py
code served (permissive licence) · get_code("91f2db0ec7a2841f")
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 tempfile
import sqlite3

# Create a temporary SQLite database with test data
temp_db = tempfile.NamedTemporaryFile(suffix=".db", delete=False)
db_file = temp_db.name
temp_db.close()

# Initialize the database with test tables
conn = sqlite3.connect(db_file)
cursor = conn.cursor()
cursor.execute('''
    CREATE TABLE users (
        id INTEGER PRIMARY KEY,
        name TEXT,
        age INTEGER
    )
''')
cursor.execute("INSERT INTO users (id, name, age) VALUES (1, 'Alice', 30)")
cursor.execute("INSERT INTO users (id, name, age) VALUES (2, 'Bob', 25)")
conn.commit()
conn.close()

# Define test arguments
question_id = 1
question = "Select all users"
ground_truth = "SELECT * FROM users ORDER BY id"
pred_sql = "SELECT * FROM users ORDER BY id"
timeout = 5

args = (question_id, db_file, question, ground_truth, pred_sql)

ARGS = {
    "args": args,
    "timeout": timeout
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
func_timeout — 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
condition_has_like Ran
ran, violated the contract we drafted
IDEA-FinAI/SQL-R1/src/evaluation_spider.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
IDEA-FinAI/SQL-R1/src/evaluation_spider.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
execute_query Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/data_preprocess/nl2sql_synsql_nonvalue.py
code served (permissive licence) · get_code("6ad9f49ae16cf31d")
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 sqlite3
import tempfile
import os

# Create a temporary database for testing
temp_db = tempfile.NamedTemporaryFile(delete=False, suffix='.db')
temp_db_path = temp_db.name
temp_db.close()

# Initialize the database with a simple table
con = sqlite3.connect(temp_db_path)
cur = con.cursor()
cur.execute('CREATE TABLE test_table (id INTEGER, name TEXT)')
cur.execute('INSERT INTO test_table VALUES (1, "Alice")')
cur.execute('INSERT INTO test_table VALUES (2, "Bob")')
con.commit()
con.close()

# Test case 1: Single query string with path_db
query_single = "SELECT * FROM test_table WHERE id = 1"

# Test case 2: List of queries with path_db
query_list = [
    "SELECT * FROM test_table WHERE id = 1",
    "SELECT * FROM test_table WHERE id = 2"
]

# Test case 3: Using cursor directly
con_reuse = sqlite3.connect(temp_db_path)
cur_reuse = con_reuse.cursor()

ARGS = {
    'queries': query_single,
    'path_db': temp_db_path,
    'cur': None
}
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
execute_sql Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/evaluation_bird_post.py
code served (permissive licence) · get_code("490449c025d402b2")
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 sqlite3
import tempfile
import os

# Create a temporary database file for testing
temp_db = tempfile.NamedTemporaryFile(delete=False, suffix='.db')
db_file_path = temp_db.name
temp_db.close()

# Initialize the database with a simple table
conn = sqlite3.connect(db_file_path)
cursor = conn.cursor()
cursor.execute('CREATE TABLE test_table (id INTEGER PRIMARY KEY, name TEXT)')
cursor.execute('INSERT INTO test_table (name) VALUES ("Alice")')
cursor.execute('INSERT INTO test_table (name) VALUES ("Bob")')
conn.commit()
conn.close()

# Define arguments for the function
ARGS = {
    'data_idx': 0,
    'db_file': db_file_path,
    'sql': 'SELECT * FROM test_table'
}
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 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
format_sql Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/evaluation_spider_post.py
code served (permissive licence) · get_code("15b496c5d27aa7dc")
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

def format_sql(sql):
    sql = sql.strip()
    sql = re.sub('/\\*.*?\\*/', '', sql, flags=re.DOTALL)
    sql = re.sub('--.*$', '', sql, flags=re.MULTILINE)
    sql = sql.replace('\n', ' ').replace('\t', ' ')
    sql = sql.strip()
    if sql == '':
        sql = 'Error SQL'
    return sql

ARGS = {
    'sql': 'SELECT * FROM users WHERE id = 1'
}
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
get_schema Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/SQL-R1/src/evaluations/spider1_evaluations/src/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
IDEA-FinAI/SQL-R1/src/evaluations/spider1_evaluations/src/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.

get_schema_slot Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/data_preprocess/nl2sql_synsql_nonvalue.py
code served (permissive licence) · get_code("5e51a446415a6550")
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 os
import sqlite3
import tempfile
import shutil

# Create a temporary directory for the database
temp_dir = tempfile.mkdtemp()

# Create a simple SQLite database with a table
db_id = "test_db"
db_folder = os.path.join(temp_dir, db_id)
os.makedirs(db_folder, exist_ok=True)
path_db = os.path.join(db_folder, f"{db_id}.sqlite")

# Initialize the database with a simple table
con = sqlite3.connect(path_db)
cur = con.cursor()
cur.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)")
cur.execute("CREATE TABLE products (id INTEGER PRIMARY KEY, title TEXT, price REAL)")
con.commit()
con.close()

# Create arguments for get_schema_slot function
ARGS = {
    "database_path": temp_dir,
    "db_id": db_id,
    "cur": None
}
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
get_table_names Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/data_preprocess/nl2sql_synsql_nonvalue.py
code served (permissive licence) · get_code("73750dcbdb55d522")
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 sqlite3
import tempfile
import os

# Create a temporary database with a test table
temp_dir = tempfile.mkdtemp()
path_db = os.path.join(temp_dir, "test.db")

# Initialize database with a test table
con = sqlite3.connect(path_db)
cur = con.cursor()
cur.execute("CREATE TABLE users (id INTEGER, name TEXT)")
cur.execute("CREATE TABLE products (id INTEGER, title TEXT)")
con.commit()
con.close()

# Define ARGS for get_table_names function
ARGS = {
    'path_db': path_db,
    'cur': None
}
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
obtain_db_ddls Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/utils/prepare_input_seq.py
code served (permissive licence) · get_code("062dbe705bf0ea9b")
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 sqlite3
import tempfile
import os

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

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

# Create some test tables
cursor.execute("""
    CREATE TABLE users (
        id INTEGER PRIMARY KEY,
        name TEXT NOT NULL,
        email TEXT
    )
""")

cursor.execute("""
    CREATE TABLE orders (
        id INTEGER PRIMARY KEY,
        user_id INTEGER,
        amount REAL,
        FOREIGN KEY (user_id) REFERENCES users(id)
    )
""")

conn.commit()
conn.close()

ARGS = {
    "db_file_dir": db_file
}
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
parse_response Ran
ran; our contract draft was wrong, not the code
DataArcTech/SQL-R1/src/inference.py
code served (permissive licence) · get_code("4127f7104f276d1b")
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 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

def parse_response(response):
    pattern = '```sql\\s*(.*?)\\s*```'
    sql_blocks = re.findall(pattern, response, re.DOTALL)
    if sql_blocks:
        last_sql = sql_blocks[-1].strip()
        return last_sql
    else:
        return ''

# Setup code to construct valid arguments
response_with_sql = """
Some text here.
sql
SELECT * FROM users WHERE id = 1

More text.
sql
SELECT name, email FROM customers

"""

ARGS = {
    'response': response_with_sql
}
Setup block drafted by
a language model, Claude Haiku 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 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
permute_tuple Ran
ran, violated the contract we drafted
DataArcTech/SQL-R1/src/evaluations/spider1_evaluations/src/exec_eval.py
code served (permissive licence) · get_code("ea2e45a6df8f96db")
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 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
from typing import Tuple

torch.manual_seed(0)

# The function permute_tuple takes:
# - element: Tuple - a tuple to permute
# - perm: Tuple - a tuple of indices specifying the permutation

# Looking at the function body:
# - It asserts len(element) == len(perm)
# - It returns a tuple by indexing element with indices from perm

# Create valid test arguments
element = (10, 20, 30, 40)  # A tuple with 4 elements
perm = (3, 1, 0, 2)  # A tuple of indices that reorders the element

ARGS = {
    "element": element,
    "perm": perm,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch, tqdm — 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 int — 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
quick_rej Ran
ran, violated the contract we drafted
DataArcTech/SQL-R1/src/evaluations/spider1_evaluations/src/exec_eval.py
code served (permissive licence) · get_code("dcd3006254e3d81a")
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 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 random
from typing import Tuple, List

torch.manual_seed(0)
random.seed(0)

# Create sample result lists with tuples
result1 = [
    (1, "a", 2.5),
    (3, "b", 4.5),
    (5, "c", 6.5)
]

result2 = [
    (1, "a", 2.5),
    (3, "b", 4.5),
    (5, "c", 6.5)
]

order_matters = False

ARGS = {
    "result1": result1,
    "result2": result2,
    "order_matters": order_matters
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch, tqdm — 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
read_data Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/SQL-R1/src/evaluation_spider.py
code served (permissive licence) · get_code("63fda278334d1f2e")
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 json
import tempfile
import os

# Create a temporary JSON file with valid data
temp_dir = tempfile.mkdtemp()
data_file = os.path.join(temp_dir, "test_data.json")

# Write sample JSON data to the file
sample_data = {
    "items": [
        {"id": 1, "name": "item1"},
        {"id": 2, "name": "item2"}
    ],
    "metadata": {
        "version": "1.0",
        "count": 2
    }
}

with open(data_file, 'w') as f:
    json.dump(sample_data, f)

ARGS = {
    "data_path": data_file
}
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
remove_sql_comments Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/SQL-R1/src/utils/prepare_input_seq.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from RUCKBReasoning/OmniSQL, is pointer only (licence: NONE) · get_code("f49ea7fd7f652e43")
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 RUCKBReasoning/OmniSQL, 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.

tokenize Ran
ran on a synthesized input
IDEA-FinAI/SQL-R1/src/evaluations/spider1_evaluations/src/process_sql.py
code served (permissive licence) · get_code("b72b76d185b39d84")
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 numpy as np
from nltk.tokenize import TreebankWordTokenizer

# The function takes a single parameter: string
# It converts it to str, processes quotes and tokenization
# No complex objects needed - just a string input

ARGS = {
    "string": "Hello 'world' and foo != bar and x > = 5"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk, 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 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
union_tensor_dict Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/SQL-R1/verl/protocol.py
code served (permissive licence) · get_code("21331a58f93375e4")
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 TensorDict. 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
from tensordict import TensorDict

torch.manual_seed(0)

# Create two TensorDicts with identical batch size
batch_size = torch.Size([2])

# First tensor dict with some keys
tensor_dict1 = TensorDict(
    {
        "shared_key": torch.randn(2, 4),
        "key1": torch.randn(2, 3),
    },
    batch_size=batch_size,
)

# Second tensor dict with overlapping and new keys
tensor_dict2 = TensorDict(
    {
        "shared_key": tensor_dict1["shared_key"].clone(),  # Same tensor values
        "key2": torch.randn(2, 5),
    },
    batch_size=batch_size,
)

ARGS = {
    "tensor_dict1": tensor_dict1,
    "tensor_dict2": tensor_dict2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensordict, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TensorDict — a TensorDict output has no array shape of its own; none is 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
unorder_row Ran
ran, honoured the contract we drafted
DataArcTech/SQL-R1/src/evaluations/spider1_evaluations/src/exec_eval.py
code served (permissive licence) · get_code("fb60a4c142ce9cb2")
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 numpy as np
from typing import Tuple

torch.manual_seed(0)

def unorder_row(row: Tuple) -> Tuple:
    return tuple(sorted(row, key=lambda x: str(x) + str(type(x))))

# Construct test arguments
test_row = (5, "hello", 3.14, 2, "world", 1.5)

ARGS = {
    "row": test_row
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch, tqdm — 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
unpad_dataproto Ran
ran; our contract draft was wrong, not the code
IDEA-FinAI/SQL-R1/verl/protocol.py
code served (permissive licence) · get_code("25f0ea3f460f6ce1")
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 DataProto. 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)

class DataProto:
    """Stand-in class for DataProto that supports slicing."""
    def __init__(self, data):
        self.data = data
    
    def __getitem__(self, key):
        """Support slicing to return a new DataProto with sliced data."""
        sliced_data = self.data[key]
        return DataProto(sliced_data)
    
    def __repr__(self):
        return f"DataProto({self.data})"

# Create a small DataProto instance with some data
data_tensor = torch.randn(2, 4)
data_proto = DataProto(data_tensor)

ARGS = {
    "data": data_proto,
    "pad_size": 0
}
Setup block drafted by
a language model, Claude Haiku 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 DataProto — a DataProto output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataProto 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_weight_loader Not yet run
unverified (harvested, no recorded run)
IDEA-FinAI/SQL-R1/verl/models/weight_loader_registry.py
code served (permissive licence) · get_code("919cf310ad4c189a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 22 distinct functions with an identity, 12 are also present in other papers whose code we hold (12 with at least one paper dated earlier, 3 the same month, 10 later) and 10 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
unpad_dataproto 89 other papers
7 dated earlier, 4 the same month, 74 later, 1 same year, order not determinable, 3 undated
2409.19256 (2024-09)
HybridFlow: A Flexible and Efficient RLHF Framework
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2025.findings-emnlp.1015 (2025 (year only))
MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learning
and 86 more not named here
union_tensor_dict 64 other papers
7 dated earlier, 4 the same month, 49 later, 1 same year, order not determinable, 3 undated · 4 only as an assembly brick
2409.19256 (2024-09)
HybridFlow: A Flexible and Efficient RLHF Framework
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2025.findings-emnlp.1015 (2025 (year only))
MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learning
and 61 more not named here
get_weight_loader 20 other papers
3 dated earlier, 2 the same month, 13 later, 1 same year, order not determinable, 1 undated
2410.21236 (2024-10)
Flaming-hot Initiation with Regular Execution Sampling for Large Language Models
2025.findings-emnlp.1015 (2025 (year only))
MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learning
2502.14768 (2025-02)
Logic-RL: Unleashing LLM Reasoning with Rule-Based Reinforcement Learning
and 17 more not named here
condition_has_like 14 other papers
12 dated earlier, 1 later, 1 same year, order not determinable
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
12 dated earlier, 1 later, 1 same year, order not determinable
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
10 dated earlier, 2 later, 1 same year, order not determinable
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
2106.01093 (2021-06)
LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relations
and 10 more not named here
get_schema 11 other papers
9 dated earlier, 1 later, 1 same year, order not determinable
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
2106.01093 (2021-06)
LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relations
and 8 more not named here
permute_tuple 6 other papers
4 dated earlier, 1 later, 1 same year, order not determinable
2302.08468 (2023-02)
LEVER: Learning to Verify Language-to-Code Generation with Execution
2310.17342 (2023-10)
ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-Thought
2406.12288 (2024-06)
An Investigation of Neuron Activation as a Unified Lens to Explain Chain-of-Thought Eliciting Arithmetic Reasoning of LLMs
and 3 more not named here
quick_rej 6 other papers
4 dated earlier, 1 later, 1 same year, order not determinable
2302.08468 (2023-02)
LEVER: Learning to Verify Language-to-Code Generation with Execution
2310.17342 (2023-10)
ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-Thought
2406.12288 (2024-06)
An Investigation of Neuron Activation as a Unified Lens to Explain Chain-of-Thought Eliciting Arithmetic Reasoning of LLMs
and 3 more not named here
unorder_row 6 other papers
4 dated earlier, 1 later, 1 same year, order not determinable
2302.08468 (2023-02)
LEVER: Learning to Verify Language-to-Code Generation with Execution
2310.17342 (2023-10)
ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-Thought
2406.12288 (2024-06)
An Investigation of Neuron Activation as a Unified Lens to Explain Chain-of-Thought Eliciting Arithmetic Reasoning of LLMs
and 3 more not named here
read_data 1 other paper
1 dated earlier
2406.12288 (2024-06)
An Investigation of Neuron Activation as a Unified Lens to Explain Chain-of-Thought Eliciting Arithmetic Reasoning of LLMs
remove_sql_comments 1 other paper
1 dated earlier
2503.02240 (2025-03)
OmniSQL: Synthesizing High-quality Text-to-SQL Data at Scale

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

Natural Language to SQL (NL2SQL) enables intuitive interactions with databases by transforming natural language queries into structured SQL statements. Despite recent advancements in enhancing human-computer interaction within database applications, significant challenges persist, particularly regarding the reasoning performance in complex scenarios involving multi-table joins and nested queries. Current methodologies primarily utilize supervised fine-tuning (SFT) to train the NL2SQL model, which may limit adaptability and interpretability in new environments (e.g., finance and healthcare). In order to enhance the reasoning performance of the NL2SQL model in the above complex situations, we introduce SQL-R1, a novel NL2SQL reasoning model trained by the reinforcement learning (RL) algorithms. We design a specialized RL-based reward function tailored for NL2SQL tasks and discussed the impact of cold start and synthetic data on the effectiveness of intensive training. In addition, we achieve competitive accuracy using only a tiny amount of synthetic NL2SQL data for augmented training and further explore data engineering for RL. In existing experiments, SQL-R1 achieves execution accuracy of 88.6% and 67.1% on the benchmark Spider and BIRD, respectively. The code is available at https://github.com/IDEA-FinAI/SQL-R1.

For agents

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

get_harvested_code_for_paper("2504.08600")
get_code_for_paper("2504.08600")
have("2504.08600")

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

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

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

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

Connect an agent — have() is free.