SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.11454 · EMNLP · 2022

Natural Language to Code Translation with Execution

Marjan Ghazvininejad, Luke Zettlemoyer, Sida Wang, Daniel Fried, Freda Shi

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 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, 3 violated it and 3 have no contract verdict; 2 failures of our instrument; 3 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/2204.11454.json · badge: /api/ran/2204.11454.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
facebookresearch/mbr-exec canonical (classifier label)
classifier basis not recorded on the link
9 ran · 3 no recorded run
FunctionStatusWhere it lives
condition_has_like Ran
ran, violated the contract we drafted
facebookresearch/mbr-exec/utils_sql.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
facebookresearch/mbr-exec/utils_sql.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
facebookresearch/mbr-exec/utils_sql.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
evaluate_spider Ran
ran on a synthesized input
facebookresearch/mbr-exec/evaluate.py
code served (permissive licence) · get_code("684a636f41be9e03")
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

# Create a minimal dataset with the required structure
# The function iterates over dataset and accesses item['trg_prediction']
dataset = [
    {'trg_prediction': 'SELECT * FROM table1;'},
    {'trg_prediction': 'SELECT id FROM table2 WHERE id > 5;'},
]

# Create a temporary file to serve as the gold_path
# The function reads from this path in the external evaluation script
with tempfile.NamedTemporaryFile(mode='w', suffix='.sql', delete=False) as f:
    gold_path = f.name
    f.write('SELECT * FROM table1;\n')
    f.write('SELECT id FROM table2 WHERE id > 5;\n')

eval_mode = 'all'

ARGS = {
    'dataset': dataset,
    'gold_path': gold_path,
    'eval_mode': eval_mode,
}
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
executability_selection_function Ran
ran on a synthesized input
facebookresearch/mbr-exec/sample_selectors.py
code served (permissive licence) · get_code("6a5cb99badd4bfea")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function expects:
# - x: a dict with key 'execution_result' containing a sequence/list
# - good_execution_result: an int (default 0)
# 
# The function checks if x['execution_result'][0] == good_execution_result

# Create a simple execution result list
execution_result = [0, 1, 2, 3]  # First element is 0

x = {
    'execution_result': execution_result
}

good_execution_result = 0

ARGS = {
    'x': x,
    'good_execution_result': good_execution_result
}
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 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
execution_selection_function Ran
ran on a synthesized input
facebookresearch/mbr-exec/sample_selectors.py
code served (permissive licence) · get_code("de850df14e9ba78e")
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 int, ndim 0, dtype family int, 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

torch.manual_seed(0)

# The function expects:
# - x: a dict with 'execution_result' key
# - y: a dict with 'execution_result' key
# - good_execution_result: a value to compare against (default 0)
#
# execution_result should be a tuple/list with at least 2 elements:
#   - [0]: a value to compare with good_execution_result
#   - [1]: a value to compare between exec_x and exec_y

# Create valid execution result tuples
# Format: (execution_status, execution_details)
good_result = (0, "success")
another_result = (0, "success")
bad_result = (1, "error")

x = {
    'execution_result': good_result
}

y = {
    'execution_result': another_result
}

good_execution_result = 0

ARGS = {
    'x': x,
    'y': y,
    'good_execution_result': good_execution_result
}
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 int, ndim 0, dtype family int, 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
get_schema Ran
ran; our contract draft was wrong, not the code
facebookresearch/mbr-exec/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
facebookresearch/mbr-exec/process_sql.py
pointer only (licence: MIT); 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 (MIT), 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.

single_exec_result_matching Ran
ran, honoured the contract we drafted
facebookresearch/mbr-exec/sample_selectors.py
pointer only (licence: MIT); the stored copy get_code serves, from facebookresearch/coder_reviewer_reranking, is pointer only (licence: NOASSERTION) · get_code("e0d0a3c69f5ae939")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from facebookresearch/coder_reviewer_reranking, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

codex Not yet run
unverified (harvested, no recorded run)
facebookresearch/mbr-exec/collectors.py
code served (permissive licence) · get_code("92903e4e5086d7ec")
How it ran

no invocation recorded.

codex_with_info Not yet run
unverified (harvested, no recorded run)
facebookresearch/mbr-exec/collectors.py
code served (permissive licence) · get_code("573e53ead6564561")
How it ran

no invocation recorded.

tokenize Not yet run
unverified (harvested, no recorded run)
facebookresearch/mbr-exec/process_sql.py
code served (permissive licence) · get_code("a906f5de1f5971b0")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 7 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 7 later) and 5 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
condition_has_like 14 other papers
5 dated earlier, 9 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
5 dated earlier, 9 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
3 dated earlier, 10 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
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
condition_has_sql 11 other papers
5 dated earlier, 6 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
3 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
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
tokenize 10 other papers
3 dated earlier, 7 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
2106.01093 (2021-06)
LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relations
and 7 more not named here
single_exec_result_matching 1 other paper
1 later
2211.16490 (2022-11)
Coder Reviewer Reranking for Code Generation

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

Generative models of code, pretrained on large corpora of programs, have shown great success in translating natural language to code (Chen et al., 2021;Austin et al., 2021; Li et al., 2022, inter alia). While these models do not explicitly incorporate program semantics (i.e., execution results) during training, they are able to generate correct solutions for many problems. However, choosing a single correct program from a generated set for each problem remains challenging. In this work, we introduce execution resultbased minimum Bayes risk decoding (MBR-EXEC) for program selection and show that it improves the few-shot performance of pretrained code models on natural-language-tocode tasks. We select output programs from a generated candidate set by marginalizing over program implementations that share the same semantics. Because exact equivalence is intractable, we execute each program on a small number of test inputs to approximate semantic equivalence. Across datasets, execution or simulated execution significantly outperforms the methods that do not involve program semantics. We find that MBR-EXEC consistently improves over all execution-unaware selection methods, suggesting it as an effective approach for natural language to code translation. 1

For agents

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

get_harvested_code_for_paper("2204.11454")
get_code_for_paper("2204.11454")
have("2204.11454")

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

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

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

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

Connect an agent — have() is free.