SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.12916 · 2024

MSc-SQL: Multi-Sample Critiquing Small Language Models For Text-To-SQL Translation

arXiv · PDF · Open in the Atlas

Code that ran

9 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, 1 violated it and 1 has no contract verdict; 7 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2410.12916.json · badge: /api/ran/2410.12916.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
layer6ai-labs/msc-sql canonical (classifier label)
classifier basis: census
9 ran · 0 no recorded run
FunctionStatusWhere it lives
construct_db_table_names_dict Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/msc-sql/dataset_preprocess.py
code served (permissive licence) · get_code("4d77bf10ae07767a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

ARGS = {
    'table_data': [
        {
            'db_id': 'database_1',
            'table_names': ['users', 'orders', 'products']
        },
        {
            'db_id': 'database_2',
            'table_names': ['customers', 'transactions', 'accounts']
        },
        {
            'db_id': 'database_3',
            'table_names': ['employees', 'departments']
        }
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
construct_foreign_keys_from_metadata Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/msc-sql/dataset_preprocess.py
code served (permissive licence) · get_code("d519fc62c6ec4345")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Construct a minimal table_data structure matching the function's expectations
table_data = [
    {
        'db_id': 'database_1',
        'table_names': ['users', 'orders', 'products'],
        'column_names': [
            [-1, 'id'],  # special column with table_idx -1
            [0, 'user_id'],
            [0, 'name'],
            [1, 'order_id'],
            [1, 'user_id'],
            [1, 'product_id'],
            [2, 'product_id'],
            [2, 'product_name']
        ],
        'foreign_keys': [
            [4, 1],  # orders.user_id -> users.user_id
            [5, 6]   # orders.product_id -> products.product_id
        ]
    },
    {
        'db_id': 'database_2',
        'table_names': ['customers', 'accounts'],
        'column_names': [
            [-1, 'id'],
            [0, 'customer_id'],
            [0, 'email'],
            [1, 'account_id'],
            [1, 'customer_id']
        ],
        'foreign_keys': [
            [4, 1]   # accounts.customer_id -> customers.customer_id
        ]
    }
]

ARGS = {
    'table_data': table_data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
conversations_formatting_function Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
layer6ai-labs/msc-sql/models/model_base.py
code served (permissive licence) · get_code("723ec472cbc778d8")
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 function. 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 unittest.mock import MagicMock

torch.manual_seed(0)

# Create a minimal tokenizer that implements apply_chat_template
class MinimalTokenizer:
    def apply_chat_template(self, conversations, tokenize=False):
        """
        Mock implementation of apply_chat_template.
        conversations can be a list of message dicts or a list of lists of message dicts.
        Returns formatted string(s).
        """
        if isinstance(conversations[0], dict):
            # Single conversation (list of message dicts)
            formatted = " ".join([msg.get("content", "") for msg in conversations])
            return formatted
        else:
            # This shouldn't happen in the single call case, but handle it
            return " ".join([str(msg) for msg in conversations])

tokenizer = MinimalTokenizer()

ARGS = {
    "tokenizer": tokenizer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
format_results_html Ran
ran on a synthesized input
layer6ai-labs/msc-sql/datautils/sql_results.py
code served (permissive licence) · get_code("b98c2d1d6cd9e90c")
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.

# Setup code for format_results_html

ARGS = {
    'results': [
        ['Alice', 25, 'Engineer', 'NYC', 'Active'],
        ['Bob', 30, 'Manager', 'LA', 'Inactive'],
        ['Charlie', 28, 'Designer', 'Chicago', 'Active'],
        ['Diana', 35, 'Director', 'Boston', 'Active'],
        ['Eve', 27, 'Analyst', 'Seattle', 'Active'],
        ['Frank', 32, 'Developer', 'Austin', 'Active'],
    ],
    'column_names': ['Name', 'Age', 'Position', 'Location', 'Status'],
    'max_rows': 5,
    'max_cols': 5,
    'max_col_width': 20,
}
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
format_results_markdown Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/msc-sql/datautils/sql_results.py
code served (permissive licence) · get_code("ed58f6158c045eda")
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

# Construct valid arguments for format_results_markdown
ARGS = {
    "results": [
        ["Alice", 25, "Engineer", 85000, "NYC"],
        ["Bob", 30, "Manager", 95000, "LA"],
        ["Charlie", 28, "Designer", 80000, "Chicago"],
        ["Diana", 26, "Analyst", 75000, "Boston"],
        ["Eve", 32, "Director", 120000, "Seattle"],
    ],
    "column_names": ["Name", "Age", "Position", "Salary", "Location"],
    "max_rows": 5,
    "max_cols": 5,
    "max_col_width": 20,
}
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
get_col_description Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/msc-sql/dataset_preprocess.py
code served (permissive licence) · get_code("7739a5427ea96e9d")
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 os
import tempfile
import pandas as pd

# Create a temporary directory structure and files for testing
temp_dir = tempfile.mkdtemp()
db_id = "test_db"
db_path = os.path.join(temp_dir, db_id, "database_description")
os.makedirs(db_path, exist_ok=True)

# Create a sample CSV file with column descriptions
table_name = "users"
csv_file = os.path.join(db_path, f"{table_name}.csv")
df = pd.DataFrame({
    'column_description': ['User ID', 'User Name', 'Email Address', 'Account Status']
})
df.to_csv(csv_file, index=False)

# Define the arguments
ARGS = {
    "db_id": db_id,
    "db_prefix_path": temp_dir,
    "table_name": table_name
}
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 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
init_bird_message Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/msc-sql/dataset_gen.py
code served (permissive licence) · get_code("39d1b7e2bc57a6fa")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Construct sql_sample - a single sample from the Bird dataset
sql_sample = {
    'question_id': 'q_001',
    'db_id': 'database_1',
    'question': 'What is the name of the employee with the highest salary?',
    'evidence': 'The employee table contains salary information.',
    'SQL': 'SELECT name FROM employees ORDER BY salary DESC LIMIT 1',
    'difficulty': 'medium'
}

# Construct db_metadata - metadata for databases
# The function accesses db_metadata[db_id], so we need a dict with 'database_1' as a key
db_metadata = {
    'database_1': {
        'tables': [
            {
                'name': 'employees',
                'columns': ['id', 'name', 'salary', 'department']
            },
            {
                'name': 'departments',
                'columns': ['id', 'dept_name', 'manager_id']
            }
        ],
        'foreign_keys': [
            {
                'source_table': 'employees',
                'source_column': 'department',
                'target_table': 'departments',
                'target_column': 'id'
            }
        ]
    }
}

ARGS = {
    'sql_sample': sql_sample,
    'db_metadata': db_metadata
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
init_spider_message Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/msc-sql/dataset_gen.py
code served (permissive licence) · get_code("af91033b3006347a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Construct a valid sql_sample matching Spider dataset format
sql_sample = {
    'question_id': 'q_001',
    'db_id': 'spider_db_1',
    'question': 'What are the names of all employees?',
    'query': 'SELECT name FROM employees;'
}

# Construct db_metadata with minimal structure
# The function accesses db_metadata[db_id], so it should return db_info
db_info = {
    'tables': [
        {
            'name': 'employees',
            'columns': ['id', 'name', 'salary']
        },
        {
            'name': 'departments',
            'columns': ['id', 'name', 'manager_id']
        }
    ],
    'foreign_keys': [
        {'source': ('employees', 'dept_id'), 'target': ('departments', 'id')}
    ]
}

db_metadata = {
    'spider_db_1': db_info
}

ARGS = {
    'sql_sample': sql_sample,
    'db_metadata': db_metadata
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
str2bool Ran
ran, violated the contract we drafted
layer6ai-labs/msc-sql/inference.py
code served (permissive licence) · get_code("64b000099b946d2c")
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 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 argparse

def str2bool(value):
    if isinstance(value, bool):
        return value
    if value.lower() in {'true', '1', 'yes'}:
        return True
    elif value.lower() in {'false', '0', 'no'}:
        return False
    else:
        raise argparse.ArgumentTypeError('Boolean value expected.')

# The function takes a single parameter 'value' which can be:
# - a boolean
# - a string that converts to boolean
# - an invalid value that raises an error

ARGS = {
    'value': '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 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

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

Text-to-SQL generation enables non-experts to interact with databases via natural language. Recent advances rely on large closed-source models like GPT-4 that present challenges in accessibility, privacy, and latency. To address these issues, we focus on developing small, efficient, and open-source text-to-SQL models. We demonstrate the benefits of sampling multiple candidate SQL generations and propose our method, MSc-SQL, to critique them using associated metadata. Our sample critiquing model evaluates multiple outputs simultaneously, achieving state-of-the-art performance compared to other open-source models while remaining competitive with larger models at a much lower cost. Full code can be found at https://github.com/layer6ai-labs/msc-sql.

For agents

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

get_harvested_code_for_paper("2410.12916")
get_code_for_paper("2410.12916")
have("2410.12916")

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

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

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

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

Connect an agent — have() is free.