SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.05093 · EMNLP · 2021

PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Models

Dzmitry Bahdanau, Torsten Scholak, Nathan Schucher

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 3 violated it and 2 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2109.05093.json · badge: /api/ran/2109.05093.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
ElementAI/picard canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
servicenow/picard community (classifier label)
classifier basis: plan_row
0 ran · 1 no recorded run
FunctionStatusWhere it lives
cosql_get_input Ran
ran on a synthesized input
ElementAI/picard/seq2seq/utils/cosql.py
code served (permissive licence) · get_code("96f7360bd80c6f00")
How it ran

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

import torch
import numpy as np
from typing import List

# Analyze the function:
# - utterances: List[str] - needs multiple strings to test the > 1 condition
# - serialized_schema: str - a schema string that gets stripped
# - prefix: str - a prefix string
# - sep: str - separator string (has default ' | ')

ARGS = {
    'utterances': [
        "What is the name of the employee?",
        "Who works in sales?",
        "Show me all departments"
    ],
    'serialized_schema': '  table1 ( id , name ) | table2 ( dept_id , dept_name )  ',
    'prefix': 'Question: ',
    'sep': ' | '
}
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
is_commonword Ran
ran, violated the contract we drafted
ElementAI/picard/seq2seq/utils/bridge_content_encoder.py
code served (permissive licence) · get_code("b724cc2d4066a429")
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 is_commonword takes a single string parameter 's'
# and checks if its stripped version is in the _commonwords set
# No complex objects needed - just a simple string

ARGS = {
    's': 'yes'
}
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
is_number Ran
ran, violated the contract we drafted
ElementAI/picard/seq2seq/utils/bridge_content_encoder.py
code served (permissive licence) · get_code("f39fdc1ce6cffe08")
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 numpy as np

torch.manual_seed(0)

# The function is_number takes a single string parameter 's'
# It tries to convert the string to a float after removing commas
# We need to provide valid test cases

ARGS = {
    "s": "123.45"
}
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 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
is_stopword Ran
ran, violated the contract we drafted
ElementAI/picard/seq2seq/utils/bridge_content_encoder.py
code served (permissive licence) · get_code("d56a1f9221823a48")
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 numpy as np

# The function is_stopword takes a single parameter: s (a string)
# It checks if s.strip() is in the _stopwords set
# So we need to provide a string argument

ARGS = {
    "s": "hello"
}
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 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
normalize Ran
ran; our contract draft was wrong, not the code
ElementAI/picard/seq2seq/utils/dataset.py
code served (permissive licence) · get_code("448eab4c7249a72c")
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 normalize(query: str) -> str:

    def comma_fix(s):
        return s.replace(' , ', ', ')

    def white_space_fix(s):
        return ' '.join(s.split())

    def lower(s):
        return re.sub('\\b(?<![\'\\"])(\\w+)(?![\'\\"])\\b', lambda match: match.group(1).lower(), s)
    return comma_fix(white_space_fix(lower(query)))

# The function takes a single string parameter and performs text normalization
# Test with a sample query that has mixed case, extra spaces, and spacing around commas
ARGS = {
    "query": "Hello  WORLD , this IS a Test"
}
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
spider_get_input Ran
ran on a synthesized input
ElementAI/picard/seq2seq/utils/spider.py
code served (permissive licence) · get_code("b83f0da29c886b71")
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

ARGS = {
    "question": "What is the name of the student?",
    "serialized_schema": "CREATE TABLE students (id INT, name VARCHAR(100), age INT);",
    "prefix": "SELECT * FROM "
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
prepare_splits Not yet run
unverified (harvested, no recorded run)
servicenow/picard/seq2seq/utils/dataset.py
code served (permissive licence) · get_code("d3c1fa9d710cc4ff")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 2 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
is_commonword 5 other papers
5 later
2212.09741 (2022-12)
One Embedder, Any Task: Instruction-Finetuned Text Embeddings
2306.08891 (2023-06)
Interleaving Pre-Trained Language Models and Large Language Models for Zero-Shot NL2SQL Generation
2310.13659 (2023-10)
Benchmarking and Improving Text-to-SQL Generation under Ambiguity
and 2 more not named here
is_number 5 other papers
5 later
2212.09741 (2022-12)
One Embedder, Any Task: Instruction-Finetuned Text Embeddings
2306.08891 (2023-06)
Interleaving Pre-Trained Language Models and Large Language Models for Zero-Shot NL2SQL Generation
2310.13659 (2023-10)
Benchmarking and Improving Text-to-SQL Generation under Ambiguity
and 2 more not named here
is_stopword 5 other papers
5 later
2212.09741 (2022-12)
One Embedder, Any Task: Instruction-Finetuned Text Embeddings
2306.08891 (2023-06)
Interleaving Pre-Trained Language Models and Large Language Models for Zero-Shot NL2SQL Generation
2310.13659 (2023-10)
Benchmarking and Improving Text-to-SQL Generation under Ambiguity
and 2 more not named here
normalize 2 other papers
2 later
2306.08891 (2023-06)
Interleaving Pre-Trained Language Models and Large Language Models for Zero-Shot NL2SQL Generation
2406.12288 (2024-06)
An Investigation of Neuron Activation as a Unified Lens to Explain Chain-of-Thought Eliciting Arithmetic Reasoning of LLMs
prepare_splits 1 other paper
1 later
2406.12288 (2024-06)
An Investigation of Neuron Activation as a Unified Lens to Explain Chain-of-Thought Eliciting Arithmetic Reasoning of LLMs

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large pre-trained language models for textual data have an unconstrained output space; at each decoding step, they can produce any of 10,000s of sub-word tokens. When fine-tuned to target constrained formal languages like SQL, these models often generate invalid code, rendering it unusable. We propose PICARD 1 , a method for constraining auto-regressive decoders of language models through incremental parsing. PICARD helps to find valid output sequences by rejecting inadmissible tokens at each decoding step. On the challenging Spider and CoSQL text-to-SQL translation tasks, we show that PICARD transforms fine-tuned T5 models with passable performance into stateof-the-art solutions.

For agents

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

get_harvested_code_for_paper("2109.05093")
get_code_for_paper("2109.05093")
have("2109.05093")

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

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

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

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

Connect an agent — have() is free.