PICARD

Constrained beam search that rejects invalid tokens at every decoding step using an incremental Haskell SQL parser and database schema type-checker.

Read the paper

The loop

  1. Proposes

    A sequence-to-sequence language model (T5) proposes top-k next tokens across active beam hypotheses.

  2. Judged by

    An incremental monadic parser and relational schema checker verify lexical, syntactic, and column/table scoping validity on every partial prefix.

  3. Steers

    Invalid token continuations are masked to negative infinity before beam pruning, keeping only grammar- and schema-valid queries in the beam.

Headline result

Boosted T5-3B exact-match and execution accuracy on Spider and CoSQL benchmarks by 4-7 percentage points and eliminated 98% of syntax and schema errors.

What this does not prove

Enforces grammatical and schema well-formedness, but cannot prevent a semantically plausible query that filters on the wrong column value.

How it generalizes the harness

An incremental formal parser and relational type-checker gate every step of beam search, pruning invalid prefixes online.

Classification

Classification of PICARD
What it proposesProgram
Generative modelT5-3B sequence-to-sequence model
Algorithmic authorityIncremental monadic SQL parser and relational schema type-checker
FeedbackVerifier errors
What gets updatedSearch tree
When it runsAt inference time
ValidityFormal (machine-checked)
EvidenceCode released
LineageOriginal system