---
title: "Coarse-to-Fine Decoding for Neural Semantic Parsing (2018)"
description: "Coarse-to-fine decoding turns natural language into logical forms, Python code, or SQL by predicting a sketch and then filling in its details."
canonical: "https://research.elamur.ai/free/en/papers/dong-2018-coarse-fine-decoding-neural-semantic/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/dong-2018-coarse-fine-decoding-neural-semantic/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2018](https://md.research.elamur.ai/free/en/papers/2018/) / Coarse-to-Fine Decoding for Neural Semantic Parsing

# Coarse-to-Fine Decoding for Neural Semantic Parsing

Paper · 2018 · Li Dong and Mirella Lapata

**Authors:** [Li Dong](https://md.research.elamur.ai/free/en/authors/li-dong/) and [Mirella Lapata](https://md.research.elamur.ai/free/en/authors/mirella-lapata/) · **Year:** 2018 · **Venue:** Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[**374** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2963357517) · [Cited by **145** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/dong-2018-coarse-fine-decoding-neural-semantic/cited-by/) · [Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)](https://aclanthology.org/volumes/P18-1/) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/P18-1068/)
- [PDF](https://aclanthology.org/P18-1068.pdf)
- [DOI 10.18653/v1/p18-1068](https://doi.org/10.18653/v1/p18-1068)
- [arXiv 1805.04793](https://arxiv.org/abs/1805.04793)
- [OpenAlex](https://openalex.org/W2963357517)

Citations: OpenAlex, 2026-10-14.

## Summary

A question about flights can specify where a flight leaves from, where it goes, and how the results should be combined. A system that turns the question into an executable query has to identify the operations the user wants and supply the details that make them apply to the right flights. This paper studies how to divide that work. In its approach to [semantic parsing](https://md.research.elamur.ai/free/en/concepts/semantic-parsing/), a first decoder predicts a sketch of the intended meaning. A second decoder reads the question and the sketch together, preserving the structure already chosen and completing the open parts.

A sketch keeps different information depending on the target. For the logical forms in Geo and Atis, it keeps predicates, operators, and their arrangement while omitting arguments and variable information. For Python lines in Django, it keeps elements such as keywords and punctuation while using types such as `NAME`, `NUMBER`, and `STRING` for specific tokens. For WikiSQL, it records the comparison operators in a `WHERE` clause in a standard order. The complete SQL query still needs a column and a value for each comparison, as well as a decision about what to select. In each task, a rule derives the training sketch from the reference output. At test time, the system must predict the sketch itself.

The experiments compare Coarse2Fine with OneStage, which generates a complete representation directly. Coarse2Fine improves full-output accuracy on Geo, Atis, Django, and WikiSQL. It is competitive with earlier structured approaches on the logical-form tasks and exceeds the strongest previously reported results in the paper’s comparisons on Django and WikiSQL. WikiSQL also measures whether the generated query returns the correct answer when executed. There, the authors trace most of the improvement to completing the `WHERE` clause. Predicting its operators is already relatively reliable, while choosing the corresponding columns and values leaves more room for improvement.

The experiments also distinguish a sketch’s role as a set of instructions from its role as context. Removing the encoder that gives the completion stage a contextual representation of the sketch reduces accuracy. Supplying the reference sketch improves results, with an `8.9` point difference in Django test accuracy between ordinary prediction and completion with the reference sketch. The balance differs by task. In Django, errors in a line’s broad shape leave appreciable room for a better first stage. In WikiSQL, the second stage accounts for most of the improvement even though the first stage predicts the pattern of comparisons slightly more accurately.

## Deep dive: Coarse-to-Fine Decoding for Neural Semantic Parsing

Coarse-to-fine decoding turns natural language into logical forms, Python code, or SQL by predicting a sketch and then filling in its details. · about 39 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### From a request to an executable representation

A semantic parser converts a natural language input into a formal expression whose parts have specified roles. A predicate can indicate that an entity is a flight. A different predicate can connect that flight to a departure city. A logical operator can say that both constraints apply. In source code, punctuation and keywords can determine which tokens belong to a call or a conditional statement. In SQL, selecting a column and using a column to filter rows are different operations, even when the question mentions both columns in the same phrase.

Predicting such an expression involves decisions at different scales. In a flight query, changing the departure city can preserve the entire arrangement of predicates. Changing a conjunction to a different operation can alter how the expression combines several predicates at once. A line of Python may reuse the same sequence of calls and comparisons with a different identifier or literal. Learning these recurring arrangements is part of the job, alongside recovering the individual details that make each expression correct.

Formal expressions can be written as sequences, which makes token-by-token generation an attractive starting point. A logical form can put its operators, arguments, and brackets in a row. A line of code already appears as a sequence of keywords, identifiers, and symbols. The hierarchy is still present in both cases. Brackets identify which arguments belong to an operator, and a dot, parentheses, or brackets in Python carry information about the operation being performed. A decoder that emits tokens in order has to track those relationships while choosing the next token.

That is the setting for the authors’ proposal. A decision about how to combine predicates can be represented directly in an intermediate sequence, and the same intermediate sequence can be used for expressions that name different places. This provides the final decoder with information about parts of the target that would ordinarily still lie ahead in the output. The authors’ motivation rests on three properties of a sketch. It is more compact than the complete expression, it gives examples with the same structure a common training target, and it makes that structure available while the remaining details are generated.

#### How earlier work used structure

The paper describes an earlier line of supervised parsing research that learned rules connecting particular words or phrases to pieces of a formal expression. A parser could assemble an interpretation from these rules and use a scoring function to choose among possible assemblies. Work on probabilistic categorial grammars and on synchronous grammars with lambda calculus illustrates how the connection between language and formal structure could be part of the rules being learned. [Learning to Map Sentences to Logical Form](https://md.research.elamur.ai/free/en/papers/zettlemoyer-2012-learning-map-sentences-logical-form/) and [Learning Synchronous Grammars for Semantic Parsing with Lambda Calculus](https://md.research.elamur.ai/free/en/papers/wong-2007-learning-synchronous-grammars-semantic-parsing/)

Recurrent neural networks offered another way to learn the mapping from paired examples. In a sequence-to-sequence system, an encoder reads the input and a decoder predicts the output one token at a time. Attention lets the decoder draw more heavily on different input words at different steps. The paper places this approach in the context of earlier work on translation, syntactic analysis, and logical forms. That work motivated a learned mapping with fewer hand-engineered input features, while leaving open how much of the target’s structure should be made explicit during decoding. [Neural Machine Translation by Jointly Learning to Align and Translate](https://md.research.elamur.ai/free/en/papers/bahdanau-2014-neural-machine-translation-jointly-learning/) and [Language to Logical Form with Neural Attention](https://md.research.elamur.ai/free/en/papers/dong-2016-language-logical-form-neural-attention/)

Some of the precursors changed the architecture of the decoder. Top-down tree decoders generate parts of a tree under their parents. Grammar-constrained generators use the rules of the target formalism to determine which extensions are admissible. A code generator can produce an abstract syntax tree, which expresses relationships such as which operands belong to an operation, by expanding the tree in a specified order. Another approach composes specialized decoder components as the output tree takes shape. These designs place structured information at the point where the next part of the output is chosen. [A Syntactic Neural Model for General-Purpose Code Generation](https://md.research.elamur.ai/free/en/papers/yin-2017-syntactic-neural-model-general-purpose/) and [Abstract Syntax Networks for Code Generation and Semantic Parsing](https://md.research.elamur.ai/free/en/papers/rabinovich-2017-abstract-syntax-networks-code-generation/)

Other earlier approaches addressed performance through the data or the learning setup. The authors mention augmentation, transfer across tasks, shared parameters across languages or representations, and user feedback. These techniques concern what training evidence a parser can use. For example, recombining data can produce additional language–representation pairs. The question in this paper concerns what targets the parser predicts from the pairs it has, and when it makes each decision about the output. [Data Recombination for Neural Semantic Parsing](https://md.research.elamur.ai/free/en/papers/jia-2016-data-recombination-neural-semantic-parsing/)

#### Where the sketch fits

Coarse-to-fine processing already had precedents in syntactic parsing. The discussion of related work also covers semantic parsers that limit their search using either coarse lexical entries or macro grammars. Here, the coarse object comes from the target expression itself. Several completed expressions map to the same sketch whenever the extraction rule removes the features that distinguish them. The decision to give that sketch its own prediction stage creates an explicit intermediate target for training.

Program synthesis provides a more direct precedent for this use of a sketch. The paper describes an earlier SQL system that maps a sentence to an incomplete query, completes it using program synthesis, and can revise an unsuccessful result. Coarse2Fine also commits to an intermediate form that still has gaps. Its completion stage learns from reference expressions, uses the original question, and reads an encoded version of the sketch. The paper investigates how far that arrangement can serve tasks with different formal languages and different definitions of a gap.

### The method, step by step

#### What happens to a question

The parser starts by turning the words of the input into a sequence of vectors. A first decoder uses those vectors to decide what kind of formal expression the question calls for. In a logical form, for instance, it can specify that a conjunction contains predicates for being a flight and having a departure point. The sketch can preserve the fact that the departure predicate expects a flight and a place, leaving their actual identities open. It therefore acts as a compact description of a family of complete expressions.

The fine decoder then has two sources of information. The words of the question can identify a place mentioned by the user. The sketch can indicate which predicate needs that place and how the predicate relates to the rest of the expression. Elements fixed by the sketch are carried into the output. At open positions, the decoder makes a prediction, with an output type or a number of arguments supplied where the sketch specifies one. The authors also encode the entire sketch before this stage, allowing the representation of one part of the sketch to reflect the parts around it.

The pipeline below describes the common design. The implementation for WikiSQL applies it to the filter conditions, uses a classifier to choose a complete sketch, and predicts the fields of `SELECT` separately. The distinction matters because the paper tests a division of work that allows different implementations of the coarse stage.

Predicting and completing a meaning sketch The steps in order.

#### The probability of a sketch and its completion

In the authors’ notation, `x` is the natural language input sequence, `a` is the sequence representing the sketch, and `y` is the sequence representing the full output. A given reference output determines its sketch under the task’s extraction rule. The paper writes the probability of a complete output as a product for that output and its associated sketch.

```
p(y ∣ x) = p(y ∣ x, a) p(a ∣ x)
```

Here `p` denotes a probability and `∣` means “given.” The term `p(a ∣ x)` scores the sketch `a` for input `x`. The term `p(y ∣ x, a)` scores the completion `y` given both. Their product describes the route through the sketch associated with `y`. Several outputs can share `a`, so the sketch probability can be learned from several examples even when each example requires a different completion.

The sequence version of the first stage makes each sketch prediction depend on what has already been emitted.

```
p(a ∣ x) = ∏ₜ₌₁^{|a|} p(aₜ ∣ a₍₍<t₎₎, x)
```

The symbol `∏` means to multiply the token probabilities. The position `t` runs from `1` through `|a|`, the sketch length. `aₜ` is the current sketch token, and `a₍₍<t₎₎` denotes the prefix strictly before that token. Each factor is a conditional probability given this prefix and the input `x`. The prefix is empty at the beginning of sketch generation.

```
p(y ∣ x, a) = ∏ₜ₌₁^{|y|} p(yₜ ∣ y₍₍<t₎₎, x, a)
```

Here `|y|` is the length of the full output. The token `yₜ` is predicted at position `t`, and `y₍₍<t₎₎` is the full-output prefix already available at that step. The product uses a probability for each successive output position given the prefix, the input `x`, and the whole sketch `a`. In the implemented decoder, a position specified by `a` is forced to agree with it. The predictive choices of interest occur where the sketch leaves details open.

#### Encoding the question

The encoder first looks up a vector for each input token. A vector of this kind is called an embedding. The matrix notation for the lookup shows how each vocabulary entry chooses a column of trainable values. [Word embeddings](https://md.research.elamur.ai/free/en/concepts/word-embeddings/)

```
𝐱ₜ = 𝐖ₓ 𝐨(xₜ)
```

The symbol `xₜ` is the input token at position `t`, while `𝐱ₜ` is its vector. The function `𝐨` makes a one-hot vector, with a `1` in the entry for the token and a `0` elsewhere. The width of `𝐖ₓ` is `|𝒱ₓ|`, the number of entries in the input vocabulary `𝒱ₓ`. Its height is `n`, the embedding dimension in this formulation. Multiplication by the one-hot vector selects the column associated with `xₜ`.

A recurrent encoder updates a state as it moves through the sequence. The authors use long short-term memory units, or LSTMs, to perform these updates. They run one recurrence from the beginning of the input towards its end and another from the end towards its beginning. The resulting representation of a word can incorporate context on both sides.

```
𝐞→ₜ = LSTM(𝐞→₍ₜ₋₁₎, 𝐱ₜ)
```

The arrow `→` marks the forward direction. At position `t`, `𝐞→ₜ` is the new forward state, `𝐞→₍ₜ₋₁₎` is the state from the preceding input position, and `𝐱ₜ` is the embedding at the current position. `LSTM` is the recurrent update. It runs in order from position `1` to position `|x|`, the length of the input.

```
𝐞←ₜ = LSTM(𝐞←₍ₜ₊₁₎, 𝐱ₜ)
```

The arrow `←` marks the backward direction. This time `𝐞←ₜ` depends on `𝐞←₍ₜ₊₁₎`, the state at the next position in the written input, and on the current embedding `𝐱ₜ`. The recurrence visits positions from `|x|` back to `1`.

```
𝐞ₜ = [𝐞→ₜ, 𝐞←ₜ]
```

The square brackets join the two vectors end to end. The result `𝐞ₜ` is the context-sensitive input encoding at position `t`, with `n` dimensions in the paper’s notation. Encodings from all positions remain available. The terminal states of the two recurrences are also used to initialize decoding.

#### Producing the sketch with attention

At the start of sketch generation, the decoder uses a vector derived from the whole input. After that it keeps a recurrent state and updates it using the embedding of the previous sketch token. Earlier choices therefore affect which token the decoder is ready to emit next.

```
𝐝₀ = [𝐞→₍|x|₎, 𝐞←₁]
```

Here `𝐝₀` is the initial coarse decoder state. `𝐞→₍|x|₎` is the final state reached by the forward input encoder, and `𝐞←₁` is the final state reached by the backward encoder. The brackets denote concatenation. Each terminal state has been computed after a pass through the input.

```
𝐝ₜ = LSTM(𝐝₍ₜ₋₁₎, 𝐚₍ₜ₋₁₎)
```

Here `𝐝ₜ` and `𝐝₍ₜ₋₁₎` are the current and preceding coarse decoder states at output steps `t` and `t − 1`. The vector `𝐚₍ₜ₋₁₎` is the embedding of the preceding sketch token. `LSTM` updates the state using this pair of vectors. Input positions and sketch positions use the same letter `t` in their respective recurrences and can have different lengths.

At each step the decoder can focus on the portions of the original question that are most relevant to its current decision. Attention measures the compatibility of each input position with the current decoder state. The paper uses a dot product followed by normalization, a version of the mechanism described in [Effective Approaches to Attention-based Neural Machine Translation](https://md.research.elamur.ai/free/en/papers/luong-2015-effective-approaches-attention-based-neural/).

```
sₜ,ₖ = exp(𝐝ₜ · 𝐞ₖ) / Zₜ
```

The weight `sₜ,ₖ` connects decoder step `t` with input position `k`. The dot `·` means a vector dot product between `𝐝ₜ`, the coarse decoder state, and `𝐞ₖ`, the input encoding at position `k`. The exponential `exp` turns the compatibility score into a positive quantity. Dividing by `Zₜ` makes the weights at that decoder step sum to `1`.

```
Zₜ = ∑ⱼ₌₁^{|x|} exp(𝐝ₜ · 𝐞ⱼ)
```

The normalization constant `Zₜ` adds the exponentiated scores over the full input. The symbol `∑` denotes summation, `j` ranges across the `|x|` input positions, and `𝐞ⱼ` is the corresponding input vector. The state `𝐝ₜ` is the same for all positions within this calculation.

```
𝐞ₜᵈ = ∑ₖ₌₁^{|x|} sₜ,ₖ 𝐞ₖ
```

The decoder’s input context at step `t` is `𝐞ₜᵈ`. The superscript `d` labels the context used by the decoder. Each position contributes its vector `𝐞ₖ` in proportion to the attention weight `sₜ,ₖ`. Summing from `1` through `|x|` lets more than one input word influence the decision, even if the largest weight lands on a single word.

```
𝐝ₜᵃᵗᵗ = tanh(𝐖₁ 𝐝ₜ + 𝐖₂ 𝐞ₜᵈ)
```

The attention-enriched state is `𝐝ₜᵃᵗᵗ`. The matrices `𝐖₁` and `𝐖₂` are learned transformations of the current recurrent state `𝐝ₜ` and the input context `𝐞ₜᵈ`, respectively. Their transformed vectors are added. The hyperbolic tangent `tanh` is applied to each component to produce the state used for prediction.

```
p(aₜ ∣ a₍₍<t₎₎, x) = softmaxₐ₍ₜ₎(𝐖ₒ 𝐝ₜᵃᵗᵗ + 𝐛ₒ)
```

`𝐖ₒ` is the learned matrix mapping `𝐝ₜᵃᵗᵗ` to vocabulary scores, and `𝐛ₒ` adds a learned bias for each entry. The softmax converts scores into probabilities that sum to `1` across the sketch vocabulary. Its subscript selects the entry for candidate token `aₜ`. The conditioning information is the sketch prefix `a₍₍<t₎₎` and input `x`. The decoder ends the sketch when it emits the designated end-of-sequence token.

#### Encoding the sketch and filling its gaps

The next encoder reads the predicted sketch in both directions with LSTMs. It follows the same pattern as the input encoder and yields a contextual vector `𝐯ₖ` for every sketch position `k`. This matters because several positions can use the same sketch symbol. A placeholder next to one operation can call for a different detail from the same placeholder next to another operation. Its contextual vector can carry information about surrounding operations in either direction.

The fine decoder reuses the question encoding, and its initial state is the same concatenation of terminal question encodings used in the coarse stage. At subsequent steps, the source of the vector fed into the recurrence depends on the relationship between the sketch and the immediately preceding output token. This is one route by which the sketch continues to influence decisions after a fixed token has already been emitted.

```
𝐢ₜ = { 𝐯ₖ if aₖ determines y₍ₜ₋₁₎
       𝐲₍ₜ₋₁₎ otherwise
```

`𝐢ₜ` is the vector input to the fine recurrence at step `t`. The output token at the preceding step is `y₍ₜ₋₁₎`. If a sketch token `aₖ` determines it through a one-to-one alignment, the decoder receives the contextual sketch vector `𝐯ₖ`. In other cases it receives `𝐲₍ₜ₋₁₎`, the embedding of the previous output token. The two lines are the two cases of the input rule.

```
𝐡ₜ = LSTM(𝐡₍ₜ₋₁₎, 𝐢ₜ)
```

`𝐡ₜ` is the fine decoder state at the current step, and `𝐡₍ₜ₋₁₎` is its state at the preceding step. The function `LSTM` combines the preceding state with `𝐢ₜ` to produce the new one. The fine decoder attends to the original input from this state. For an open position, it uses the same type of attention and output calculation as the coarse decoder, with the fine state and the full-output prediction in the corresponding roles.

A fixed predicate or delimiter must appear where the sketch places it. A marker can also say how many elements are missing. In the logical-form task, a predicate annotated as `flight@1` requires an argument. In Django, a numeric placeholder calls for a number, and a string can extend across output tokens until the closing quote indicates that generation of that string is complete. These are distinct kinds of constraints. The decoder can be told the exact output token, the type that a predicted token should have, or how to recognize that a span of detail has finished.

#### How sketches are made from logical forms

Geo and Atis use expressions based on lambda calculus. Their bracketed notation represents a hierarchy as a sequence. An operator or predicate occupies the first position in a bracketed expression, and its arguments follow it. Arguments can themselves have internal structure. Keeping composition information is therefore essential to recovering which expressions belong together once specific variables and entities have been removed.

The authors omit arguments where the sketch can summarize them with an arity marker. Arity is the number of arguments a predicate takes. For example, `from@2` retains the departure relation and the information that it needs two arguments. The original example includes Dallas as a city argument. At completion time, the parser has to recover the specific arguments in their respective roles. When the extraction procedure can omit only part of the argument information, `?` marks a gap within the structure that remains.

Variable declarations also contain details the authors choose to omit. For a lambda operator or a quantifier, the `#` marker records how many tokens were left out. The sketch symbol `lambda#2` keeps the operator and specifies the length of the omitted material. Keeping this count lets the fine decoder know how much material to supply at that point. Keeping brackets and operators around such gaps retains the nesting needed to place the generated details.

For these tasks, the authors augment both decoders with information from the parent expression. In a conjunction containing a departure predicate, the conjunction is the parent of that predicate. The parent can be farther back in the sequence than the immediately preceding token. The architecture feeds the parent’s state to the classifier that scores the next token.

```
p(aₜ ∣ a₍₍<t₎₎, x) = softmaxₐ₍ₜ₎(𝐖ₒ [𝐝ₜᵃᵗᵗ, 𝐝₍pₜ₎] + 𝐛ₒ)
```

Here `pₜ` is the index of the parent of the current position `t`. The vector `𝐝₍pₜ₎` is the decoder state at that parent, and `𝐝ₜᵃᵗᵗ` is the current state after attention. The brackets concatenate them. The learned projection `𝐖ₒ` and bias `𝐛ₒ` produce scores for the softmax, whose selected entry gives the probability of `aₜ` given the prefix `a₍₍<t₎₎` and input `x`. The fine decoder applies the same parent-feeding idea with its own states and output vocabulary.

#### How sketches are made from Python

Django pairs a natural language description with a line of Python. The authors use Python’s lexical scanner to split the reference code into tokens and identify their types. A lexical scanner recognizes units such as names, numbers, and delimiters before any larger expression is assembled. To form a sketch, the procedure replaces the tokens that vary from instance to instance with their types while retaining delimiters, operators, and keywords.

The paper illustrates this with a conditional that takes a slice, calls a method on it, and compares the result with a string. Its sketch keeps the conditional keyword, the brackets indicating the slice, the dot and parentheses for the call, the comparison operator, and the final colon. It replaces the identifier being sliced and the method name with `NAME`, the numerical boundary with `NUMBER`, and the literal with `STRING`. A single sequence of types and fixed symbols can thus represent lines that operate on different names, numbers, and strings.

Variable names and other details may be absent from the decoder’s fixed output vocabulary. Django’s fine decoder can recover such a token when it appears in the input description by using attention as a source of copy scores. A learned gate gives this route a weight at the current step. The paper places this mechanism in the line of earlier work on using source tokens directly in sequence generation. [Incorporating Copying Mechanism in Sequence-to-Sequence Learning](https://md.research.elamur.ai/free/en/papers/gu-2016-incorporating-copying-mechanism-sequence-sequence/) and [Pointing the Unknown Words](https://md.research.elamur.ai/free/en/papers/gulcehre-2016-pointing-unknown-words/)

```
gₜ = sigmoid(𝐰g · 𝐡ₜ + b₉)
```

The scalar `gₜ` is the copy gate at fine step `t`. The vector `𝐰g` and scalar `b₉` are learned parameters for the gate, with `b₉` denoting the gate bias. The dot product uses the current fine state `𝐡ₜ`. The sigmoid maps the result to the interval between `0` and `1`.

```
p̃(yₜ ∣ y₍₍<t₎₎, x, a) = (1 − gₜ) p(yₜ ∣ y₍₍<t₎₎, x, a)
                         + 𝟙[yₜ ∉ 𝒱ᵧ] gₜ ∑ₖ:ₓₖ₌ᵧₜ sₜ,ₖ
```

The quantity `p̃` is the modified output probability for the candidate `yₜ`. It conditions on earlier output tokens `y₍₍<t₎₎`, the input `x`, and sketch `a`. The original vocabulary probability is `p`, and `1 − gₜ` is its weight. The indicator `𝟙` is `1` when the candidate is outside the target vocabulary `𝒱ᵧ` and `0` otherwise. The summation runs over input positions `k` where the input token `xₖ` equals `yₜ`, adding their fine-decoder attention weights `sₜ,ₖ`. The copy contribution receives the weight `gₜ`. If the same unknown token occurs several times in the question, each occurrence contributes its attention weight to that token’s score.

#### How WikiSQL supplies the table as context

The SQL task gives the parser the question and the names of the table columns. `SELECT` specifies which column provides the answer and whether to apply an operation such as `COUNT`, `MIN`, `MAX`, `SUM`, or `AVG`. `WHERE` restricts the rows by comparing a column with a value. WikiSQL allows equality and comparisons using `<` and `>`. A query can have no filter or can conjoin several conditions. The sketch retains the comparison operators in a sorted sequence. It represents a choice about the number and kind of comparisons while leaving the fields and values to be supplied.

A table header can contain several words, and the same question wording can refer to different fields under different schemas. A schema is the description of the available columns in this task. The authors join all the column names with a separator and encode the resulting sequence with a bidirectional LSTM. For each column, they concatenate states at the ends of its name to obtain a column vector. This produces a vector for each available column, including columns whose names consist of multiple words.

Question encoding then has an additional attention calculation. Each question position attends to the available column vectors. A learned one-layer network transforms the question state and each column vector before their similarity is scored.

```
uₜ,ₖ ∝ exp(α(𝐞ₜ) · α(𝐜ₖ))
```

The weight `uₜ,ₖ` measures attention from question position `t` to column `k`. The question encoding is `𝐞ₜ`, the column encoding is `𝐜ₖ`, and `α` is the learned transformation applied to both. The dot denotes their transformed vectors’ dot product. The proportionality sign `∝` means that the exponentiated scores are normalized across all columns so that the weights for a given position sum to `1`.

```
𝐜ₜᵉ = ∑ₖ₌₁ᴹ uₜ,ₖ 𝐜ₖ
```

The column context `𝐜ₜᵉ` is the sum of the column vectors weighted by their relevance at question position `t`. The superscript `e` labels the context associated with the question encoding. The index `k` ranges over the `M` columns. The weight for each term is `uₜ,ₖ`, and `𝐜ₖ` supplies the vector being weighted.

At each question position, the authors append its column context to its question vector. They send this sequence of joined vectors through another bidirectional LSTM. The resulting question encodings replace the original ones in the rest of the parser. The architecture can thus use the table when choosing the sketch, when deciding what the answer should select, and when locating or interpreting the details of a condition.

```
𝐞̃ = [𝐞̃→₍|x|₎, 𝐞̃←₁]
```

`𝐞̃` is the vector for the whole question after incorporating column information. `𝐞̃→₍|x|₎` is the forward terminal state at the final input position, and `𝐞̃←₁` is the backward terminal state at the first input position. The brackets concatenate them. The tilde identifies the states computed with column context, and `|x|` denotes the input length.

#### How WikiSQL chooses the answer fields and comparison operators

The `SELECT` clause has slots for the aggregation operator and the selected column. A softmax classifier reads `𝐞̃` to choose the aggregation operator. To choose the column, the parser scores each candidate header in combination with the question. The scoring function applies a learned transformation, an elementwise nonlinearity, and a dot product that produces a scalar.

```
σ(𝐳) = 𝐰₃ · tanh(𝐖₄ 𝐳 + 𝐛₄)
```

`σ` is the scoring function, and `𝐳` is its vector argument. `𝐖₄` transforms that argument, and `𝐛₄` is the bias added before applying `tanh`. The learned vector `𝐰₃` reduces the transformed vector to a scalar through the dot product `·`. Different uses of the function in the SQL decoder have their own learned parameters.

```
p(agg_col = k ∣ x) ∝ exp(σ([𝐞̃, 𝐜ₖ]))
```

`agg_col = k` denotes choosing the `k`-th header as the selected column, including when the aggregation operator is empty. The candidate score comes from applying `σ` to the joined question vector `𝐞̃` and column vector `𝐜ₖ`. The exponential and normalization yield probabilities across the headers of the current table. The notation conditions on question `x`, and the vectors used in the calculation incorporate the schema.

For `WHERE`, the coarse stage can treat each complete sorted sequence of comparison operators as a separate category. The WikiSQL training split contains `35` such sketches. This small collection allows the parser to predict the whole pattern in a single classification decision.

```
p(a ∣ x) = softmaxₐ(𝐖ₐ 𝐞̃ + 𝐛ₐ)
```

This softmax ranges over complete sketches, and its subscript `a` selects the probability for one of them. The learned matrix `𝐖ₐ` and bias `𝐛ₐ` turn the table-aware question vector `𝐞̃` into a score for each sketch. As with the selected-column equation, the conditioning notation uses `x`, while the question vector also reflects the table headers.

#### How WikiSQL completes each condition

With the pattern of comparison operators chosen, the fine decoder needs to fill a column slot and a value slot for each condition. It selects the column from the current table’s headers. The candidate score uses the decoder’s attention-enriched state together with the column vector, in the same form as the `SELECT` column scorer with a separate set of parameters.

```
p(cond_col₍ᵧₜ₎ = k ∣ y₍₍<t₎₎, x, a) ∝ exp(σ([𝐡ₜᵃᵗᵗ, 𝐜ₖ]))
```

`cond_col₍ᵧₜ₎` is the condition-column choice at the current output step. The event `= k` selects the `k`-th available header. The preceding output is `y₍₍<t₎₎`, the question is `x`, and the sketch is `a`. The scorer `σ` reads the concatenation of the fine state after input attention, `𝐡ₜᵃᵗᵗ`, and the header vector `𝐜ₖ`. The exponentiated scores are normalized over the current table’s headers. Once the decoder chooses a column, its vector becomes the input to the next LSTM update.

For the value, the authors observe that a question often contains the words needed for the comparison. The value can be a phrase, as in the paper’s example of a person’s name. The decoder chooses a contiguous span of input words by scoring its earliest and latest positions. The right boundary depends on the choice of left boundary, allowing the two ends to be selected as parts of the same value.

```
p(cond₍ᵧₜ₎ = xₗ … xᵣ ∣ y₍₍<t₎₎, x, a) =
p(L = l ∣ y₍₍<t₎₎, x, a) p(R = r ∣ y₍₍<t₎₎, x, a, L = l)
```

`cond₍ᵧₜ₎` denotes the value slot at output step `t`. The span `xₗ … xᵣ` runs from input position `l` through position `r`. The variable `L` denotes the left boundary and `R` the right boundary. The first factor scores the event that the span starts at `l`, given the output prefix `y₍₍<t₎₎`, question `x`, and sketch `a`. The second factor additionally uses the chosen start to score the event that it ends at `r`.

```
p(L = l ∣ y₍₍<t₎₎, x, a) ∝ exp(σ([𝐡ₜᵃᵗᵗ, 𝐞̃ₗ]))
```

For the left boundary, `σ` scores the joined fine attention state `𝐡ₜᵃᵗᵗ` and the table-aware encoding `𝐞̃ₗ` at candidate start position `l`. Normalizing the exponentiated scores gives a distribution over start positions. The state embodies the current condition and what the decoder has already generated.

```
p(R = r ∣ y₍₍<t₎₎, x, a, L = l) ∝ exp(σ([𝐡ₜᵃᵗᵗ, 𝐞̃ₗ, 𝐞̃ᵣ]))
```

The end scorer has its own parameters. Here `𝐞̃ᵣ` is the encoding of the candidate end position `r`, and `𝐞̃ₗ` is the encoding of the selected start `l`. The brackets join these two encodings with the same fine attention state. The exponentiated scores are normalized over the candidate end positions. After copying the span, the decoder joins its boundary vectors, transforms the result through a one-layer network, and feeds that vector into the next LSTM update. The selected phrase can thereby influence later decoding.

#### How training differs from prediction

The training data pair natural language expressions with their reference outputs. Applying the task-specific extraction procedure to every reference gives a training sketch. The parser learns to predict that sketch and to complete it when it is given as context. Each training example therefore contributes a score for recovering the coarse structure and a score for supplying the full representation under that structure.

```
max ∑₍ₓ,ₐ,ᵧ₎∈𝒟 [log p(y ∣ x, a) + log p(a ∣ x)]
```

`𝒟` is the training collection, written as triples after deriving `a` from each reference `y` paired with input `x`. The summation adds contributions over those triples. `log` is the logarithm, applied to the completion probability and the sketch probability. `max` means the parameters are fitted to maximize this sum. The objective trains the first stage on the structure the reference calls for and trains the second stage on completions of that structure.

For a new input, the parser has to choose its own sketch. The authors describe the desired coarse prediction as the highest-probability candidate under the first stage.

```
â = argmaxₐ′ p(a′ ∣ x)
```

`â` denotes the chosen sketch, `a′` is a candidate sketch, and `argmax` returns the candidate that maximizes its conditional probability given `x`. For a sequential sketch, the paper approximates this choice with greedy search. At each successive token position, the decoder takes the locally preferred token and continues with that prefix.

```
ŷ = argmaxᵧ′ p(y′ ∣ x, â)
```

`ŷ` denotes the final prediction, and `y′` is a candidate complete representation. This second maximization is conditioned on the input `x` and the chosen sketch `â`. Greedy generation again approximates the sequence-level choice, with positions already specified by the sketch constrained accordingly. The procedure commits to the coarse prediction before considering its possible completions. A locally preferred token can lead to a less probable whole sequence, and a preferred sketch can lead to a less successful completed expression.

### Experiments and results

#### The datasets and their preparation

Geo contains `880` natural language queries about U.S. geography. The standard split used in the paper gives it `600` training instances and `280` test instances. Atis uses questions for a flight booking system. It contains `5,410` examples, divided into `4,480` for training, `480` for development, and `450` for testing. The two datasets share the logical-form approach to sketch extraction. They give it different vocabularies and sets of queries to operate on.

For both logical-form datasets, the authors use preprocessed versions from earlier work. Input words are lower-cased and stemmed using NLTK. Stemming reduces words to forms used for matching across related inflections. Entities are replaced by numbered markers, giving the system a representation in which some distinctions among names have already been abstracted away on the input side. In the output, an opening bracket can be joined with the predicate it introduces to make the linear sequence more compact. These steps are separate from deriving the sketch from the full logical form. [Stemming](https://md.research.elamur.ai/free/en/concepts/stemming/)

Django contains descriptions paired with lines from the Django Python codebase. The examples cover tasks such as iteration, handling exceptions, and manipulating strings. The original split assigns `16,000` instances to training, `1,000` to development, and `1,805` to testing. The authors use a previously prepared version in which NLTK splits the language inputs into tokens and quoted strings in those inputs are replaced with placeholders. Python’s own lexical scanner supplies the code token types used in sketch extraction. The two procedures address different sides of the example. [Tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/)

WikiSQL contains `80,654` question and query pairs over `24,241` Wikipedia tables. Its splits reserve `70%` for training, `10%` for development, and `20%` for testing. A table belongs to a single split, so test questions are answered against schemas associated with tables held out during training. The parser sees the column names when it generates a query. The table contents are used to execute the query during evaluation. The authors apply the dataset’s preprocessing script, which lowercases and tokenizes the input with [Stanford CoreNLP](https://md.research.elamur.ai/free/en/papers/manning-2014-stanford-corenlp-natural-language-processing/).

#### Settings, comparisons, and measures

The authors choose Geo’s settings by cross-validation within its training data. For the other datasets they tune on the development split. The candidate hidden-vector sizes are `250` and `300`, and the candidate embedding sizes are `150`, `200`, `250`, and `300`. They consider dropout rates of `0.3` and `0.5`. Dropout omits some activations during training as a form of regularization. Geo and Atis also use label smoothing with a parameter of `0.1`, which spreads some training target probability beyond the reference label.

In the WikiSQL configuration, the hidden size of the column attention and scoring networks is `64`. Question and table encoders share word embeddings initialized with GloVe. The question input also includes `10`-dimensional vectors for part-of-speech tags obtained with spaCy. A tag supplies information about the grammatical category of a word. All tasks use RMSProp, with the learning rate chosen from `0.002` and `0.005`. The WikiSQL batch size is `200`; each of the other datasets uses `64`. Early stopping determines the duration of training. The authors make the implementation and trained parameters available in the `coarse2fine` repository. [GloVe](https://md.research.elamur.ai/free/en/concepts/glove/)

OneStage is the direct comparison for the paper’s central design choice. It decodes the full representation without an intermediate sketch. The published comparisons ask a broader question about how the complete system fares against existing parsers. For logical forms, the authors discuss Seq2Tree and ASN as approaches that incorporate structural information. On Django they compare with earlier code generators, including SNM+COPY. On WikiSQL the comparison includes the systems that introduced the dataset and used its restricted query structure to organize prediction. [Seq2SQL](https://md.research.elamur.ai/free/en/papers/zhong-2017-seq2sql-generating-structured-queries-natural/) and [SQLNet](https://md.research.elamur.ai/free/en/papers/xu-2017-sqlnet-generating-structured-queries-natural/)

Full-output accuracy is the share of examples whose predicted meaning representation matches the reference representation. It measures success on the complete target, giving a partial result no separate credit in that score. On WikiSQL the authors also report execution accuracy. They run the predicted query on the corresponding table and check whether the answer is right. That outcome and a match to the reference expression answer different questions about the prediction. Component accuracy, such as the accuracy of a single `SELECT` decision, measures a narrower part of the same task.

#### How the full outputs compare

On the Geo and Atis test sets, the paper reports higher full logical-form accuracy for Coarse2Fine than for OneStage. It describes the overall performance as competitive with the earlier neural parsers that incorporate syntax or grammar. The result supports the authors’ choice to separate structural and detailed predictions in these two settings. Both datasets use the same broad design for extracting logical-form sketches and passing information from parent expressions to the decoder.

On Django, Coarse2Fine improves more markedly over OneStage. The paper reports that it also surpasses the best earlier result it compares against, SNM+COPY. The comparison is on complete Python outputs from the Django test set. The sketch can organize a line around its keywords, operations, and delimiters, while the copying mechanism gives the completion stage a way to recover an uncommon token mentioned in the description. Full-output accuracy still requires these choices to come together in the same line.

On WikiSQL, the authors report stronger results for Coarse2Fine than for OneStage and the previously strongest systems in their comparison. They identify the `WHERE` decoder as the chief source of the gain. For the WikiSQL test evaluation, Coarse2Fine’s accuracy on the aggregation operator is `90.2%`, and its accuracy on the selected column is `92.0%`. The authors describe those respective slot results as comparable to SQLNet. The chart shows the two `SELECT` prediction settings under the same component accuracy metric. Each bar concerns its own target.

Coarse2Fine SELECT slot accuracy on the WikiSQL test set The selected column is predicted more accurately than the aggregation operator.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Aggregation operator | 90.2 |
| Selected column (this paper) | 92.0 |

The `SELECT` component scores help locate the gain because `WHERE` requires a different set of decisions. The filter can have several conditions, each with an operator, a column, and a value. Even when the answer field and aggregation operator are correct, a wrong filter can produce the wrong rows. The coarse and fine stages of Coarse2Fine give the authors separate opportunities to examine errors in the filter pattern and errors in completing it.

### What the ablations show

#### Removing the sketch encoder

The paper compares the full system with a version that omits the sketch encoder. A sketch has two roles in the full design. Its symbols specify constraints that the fine decoder follows, and its contextual vectors supply information to that decoder as it moves through the output. The ablation removes the contextual encoding. It therefore addresses a narrower question than the comparison with OneStage, which removes the intermediate sketch from prediction altogether.

The authors report that removing the encoder harms full-output accuracy on Geo and Atis, and they find the encoder beneficial on Django as well. In these tasks, a decoder may know which token is fixed or which type it is expected to fill, while the surrounding structure helps determine the concrete detail. A predicate, for example, can take an argument whose interpretation depends on what other predicates surround it. Encoding the sketch gives the fine decoder a way to access that information when it resumes its recurrent predictions after a fixed symbol. The ablation supports the contribution of this contextual signal in the system that was evaluated.

#### Giving the decoder the reference sketch

The oracle experiment hands the fine decoder the sketch extracted from the test reference. An oracle in this context is a comparison setting with access to information ordinary test-time prediction has to infer. The fine decoder still has to recover the missing details. The oracle score therefore measures how accurately that decoder can complete test outputs when the coarse structure supplied to it is correct.

On Geo and Atis, the authors report an increase in full-output accuracy under this setting. On Django, they give an `8.9` point difference in test accuracy between Coarse2Fine with a predicted sketch and the oracle setting. That gap has a concrete interpretation. When a line’s predicted pattern puts the wrong operations or placeholders in place, the fine decoder can be constrained to complete the wrong pattern. Replacing the prediction with the reference corrects those structural decisions before completion starts. The resulting gain measures the benefit of that intervention with the tested decoder. The remaining errors under the oracle reflect the work still required to fill a correct sketch.

The oracle is most informative alongside the ordinary comparison. A gain from Coarse2Fine over OneStage says that the division of work helps the finished system. A gain from supplying the sketch says the first stage still leaves some attainable accuracy unused when its predictions are passed to the second stage. These observations can hold at the same time. In Django, the paper finds both a stronger deployed result than the direct baseline and appreciable scope for improving the input to the completion stage.

#### Comparing sketches across systems

OneStage produces full outputs. The authors apply the same task-specific extraction rule to those predictions to see which sketches the outputs imply. They compare them with the sketches Coarse2Fine predicts directly. This puts the two approaches on a shared test of structure. A OneStage answer with the right arrangement but a wrong argument can still imply a correct sketch. The resulting comparison tells whether an early prediction of structure is more accurate than recovering that structure after direct generation.

The directly predicted sketches are more accurate on Geo, Atis, Django, and WikiSQL. For the logical-form and code datasets, the authors connect stronger sketch predictions to improvements in full-output accuracy. The comparison is consistent with the training design: examples that share a sketch give the coarse decoder repeated supervision on the same target. It is also possible for a correct sketch to accompany a wrong final answer, which is why the sketch result is reported alongside the full result.

WikiSQL shows a different balance. Coarse2Fine’s sketch accuracy is only marginally higher than the accuracy of sketches extracted from OneStage outputs. A sequence of comparison operators carries relatively little of the information needed to reconstruct a query. The gap in full-output performance can therefore coexist with a small change in sketch accuracy. The authors attribute most of the WikiSQL improvement to the fine decoder, where the columns and values for those comparisons are chosen.

#### Removing table awareness and locating the WikiSQL gain

The WikiSQL ablation also removes table awareness from the input encoder. The authors find the schema-conditioned encoding important. Their example concerns a question asking how many presidents attended a college. A table with an individual president column invites a count of matching rows. A table with a column containing the number of presidents can provide that number directly. The wording of the question can remain the same while both the appropriate selected column and the need for aggregation depend on how the table is organized.

This is the distinction the encoder can represent by attending to headers as it reads the question. It can give a question about a count one encoding when the schema names individuals and another when the schema already names a count. Selection among candidate columns and span extraction then use a representation that has incorporated the table. The ablation tests the contribution of that input-side design within the WikiSQL system.

The authors’ explanation of the `WHERE` improvement combines the slot-level and sketch comparisons. The scores on the two `SELECT` slots are similar to SQLNet’s, and there is little change in the accuracy of the operator sequence against OneStage. The completion stage is where Coarse2Fine can focus on matching headers and extracting values after the comparison operators have been settled. The authors propose that freeing this stage from operator prediction helps those decisions, and that sorting the operator sequence supplies a helpful standard order. These explanations are interpretations of the results. The comparisons locate the gain more directly than they separate the effects of condition ordering, column matching, and span selection.

### Limitations

#### Limits the authors identify

The training procedure assumes examples with complete reference representations. The authors obtain supervision for the sketch by transforming these references. They identify learning from question–answer pairs as a future direction. Under that weaker supervision, an observed answer supplies evidence about which expression could have produced it. Deriving the intended sketch would require an additional learning or search procedure because the training pair supplies no formal expression from which to extract it.

The authors also propose investigating other ways of defining sketches. The experiments establish that their task-specific choices work across the representations they test. A new definition could preserve different information, change the number of sketches, or shift the burden between proposing and completing them. The choices in the paper are motivated by the target formalism and benchmark. The paper’s claim about adaptability concerns the overall framework and is illustrated through these concrete designs.

Prediction is approximate in the authors’ formulation. The coarse decision is made first, and the decoder completes the sketch chosen at that stage. Greedy generation approximates a search over sequences. This setup gives a practical way to use the factorization, and the probability equations leave open how much the result would improve if the system compared several sketch and completion combinations. The oracle experiments probe the benefit of obtaining the correct sketch through privileged access to the reference.

#### What the experimental setup leaves open

The breadth of the evaluation comes from applying the same general split to several datasets. The internal mechanics vary by task. The logical-form decoders use parent feeding, Django has a copy gate, and WikiSQL uses a schema-aware encoder with separate predictions for parts of the SQL query. Each setting demonstrates an adaptation of the idea. A conclusion about the effect of a particular component across all target languages would require holding these other design choices fixed.

The SQL experiment covers the query grammar in WikiSQL. Its sketch can be chosen from the patterns present in the training split, and each filter condition combines a column, a comparison operator, and a value. The fixed slots in `SELECT` and the small set of observed operator patterns are important to the architecture. Extending the same treatment to richer query structures would require deciding which parts of those structures to preserve in the sketch and which choices a fine decoder must be able to make. The held-out table split assesses generalization to unseen tables under the benchmark’s grammar. It leaves generalization to unseen query constructions an open question.

A condition value is generated by selecting a contiguous passage in the question. This directly accommodates a name or phrase stated in the input, and the candidate set is limited by the available spans. A task in which the intended filter value must be derived or expressed differently from the words in the question would exercise a different capability. Django’s copy gate has its own boundary: the copy term in the paper’s formula applies to candidates outside the target vocabulary that occur in the input. That addresses a particular kind of unfamiliar identifier or literal. Generating an unfamiliar token absent from both the vocabulary and the input remains outside that mechanism’s reach.

The code task provides evidence about individual annotated Python lines. The success criterion is agreement with the reference code representation, while WikiSQL also checks the result of execution. Equivalent programs or queries can lead to different readings of these measures. Exact agreement asks whether the parser recovered the annotated form. Execution on a corresponding table asks whether it produced the expected answer there. Broader behavioral equivalence would require evidence across the inputs or tables on which competing expressions might differ.

Finally, the sketch itself determines the limits of the fine decoder’s freedom. If an early decision fixes an operator that the reference expression would replace, completing the arguments can leave the underlying mistake intact. Conversely, a highly accurate sketch can be too coarse to explain much about exact-output performance. WikiSQL illustrates this second case, while the Django oracle points to the importance of the first. The usefulness of the decomposition depends on what the representation preserves, how reliably it can be predicted, and which remaining details the fine decoder can recover.

### What came after

#### Broader SQL tasks and different intermediate forms

A later dataset, Spider, puts complex, cross-domain text-to-SQL at the center of the benchmark. That focus broadens the evaluation question raised by WikiSQL. The original experiments pair held-out tables with a restricted kind of query. A benchmark organized around complex SQL gives intermediate representations more structural work to do. The connection is in what a sketch would need to represent when difficulty comes from both the database domain and the form of the query. Spider contributes a human-labeled setting for asking that question. [Spider](https://md.research.elamur.ai/free/en/papers/yu-2018-spider-large-scale-human-labeled/)

*Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representation* takes up the choice of intermediate form directly. Its problem is how to use a representation between natural language and complex cross-domain SQL. This is close to the design decision in Coarse2Fine, where the authors choose an abstraction according to which details can be recovered during completion. An intermediate representation for complex queries addresses a wider target than the sorted pattern of filters used on WikiSQL. The common question is which parts of the eventual query should be exposed at the intermediate stage. [Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representation](https://md.research.elamur.ai/free/en/papers/guo-2019-complex-text-sql-cross-domain/)

SParC makes context part of cross-domain semantic parsing. In Coarse2Fine’s SQL experiment, the sketch organizes the interpretation of a question given the table headers. In a contextual task, the interpretation also depends on language beyond the current question. A sketch and context would then play different roles. Context helps determine what the user is asking now, and the sketch describes the structure the parser assigns to that request. SParC shifts the benchmark toward that dependence. [SParC](https://md.research.elamur.ai/free/en/papers/yu-2019-sparc-cross-domain-semantic-parsing/)

CoSQL places cross-domain database interaction in a conversational setting. Coarse2Fine’s examples ask the parser to recover a formal query from a question in the supplied setting. A conversational interface expands the problem to exchanges with a database. The connection to the earlier design is the question of when the intended structure is sufficiently determined to be expressed as a query. CoSQL frames that question through a conversational text-to-SQL challenge. [CoSQL](https://md.research.elamur.ai/free/en/papers/yu-2019-cosql-conversational-text-sql-challenge/)

#### Representing the question and the schema

The WikiSQL ablation links parsing accuracy to how the input encoder represents question words in light of the table. *A Comprehensive Exploration on WikiSQL with Table-Aware Word Contextualization* pursues this part of the problem on the same benchmark. Its emphasis is on the representations of words when table information is available. That is the upstream counterpart of the sketch question. A coarse stage can organize decisions about query structure, while a table-aware encoder determines what evidence about the current schema is available before those decisions are made. [A Comprehensive Exploration on WikiSQL with Table-Aware Word Contextualization](https://md.research.elamur.ai/free/en/papers/hwang-2019-comprehensive-exploration-wikisql-table-aware/)

RAT-SQL makes relation-aware schema encoding and schema linking central to text-to-SQL parsing. Schema linking concerns associating language in a question with elements of the database schema. In the earlier paper, the fine decoder must choose headers when filling the sketch, and the question encoder uses attention to the header representations. RAT-SQL focuses on improving the representation of the schema and its links to the question. This addresses the evidence available for grounding a query in a particular database, a concern that remains whichever intermediate output form the parser uses. [RAT-SQL](https://md.research.elamur.ai/free/en/papers/wang-2020-rat-sql-relation-aware-schema/)

TaBERT addresses the joint understanding of text and tabular data through pretraining. Its point of contact with Coarse2Fine is the representation of two kinds of input whose meaning depends on their relationship. In the original SQL system, each question position can incorporate a weighted combination of column encodings. TaBERT takes up the joint representation problem at the pretraining stage. The titles and research aims support this connection at the level of input representation, while the particular sketch and completion procedure belongs to Coarse2Fine. [TaBERT](https://md.research.elamur.ai/free/en/papers/yin-2020-tabert-pretraining-joint-understanding-textual/)

#### Learning sketches and testing generalization

*Learning to Infer Program Sketches* takes the sketch itself as the object of study. The earlier paper provides explicit rules for deciding which details to remove from each training output, then learns to predict the resulting abstraction from language. A study of program-sketch inference shares the premise that an incomplete program can be a meaningful target of prediction. It directs attention to the inference of that intermediate structure, the stage whose errors the Django oracle makes visible. [Learning to Infer Program Sketches](https://md.research.elamur.ai/free/en/papers/nye-2019-learning-infer-program-sketches/)

*Improving Compositional Generalization with Latent Structure and Data Augmentation* considers compositional generalization using latent structure and additional training examples. Compositional generalization concerns how a system handles new combinations of elements it has encountered. Coarse2Fine’s extraction rules give examples with the same shape a shared observed target. Latent structure raises a related question about abstractions that are inferred rather than supplied as target annotations. The two lines of work place structure at different points in learning and invite different tests of how a structural representation helps with new combinations. [Improving Compositional Generalization with Latent Structure and Data Augmentation](https://md.research.elamur.ai/free/en/papers/qiu-2022-improving-compositional-generalization-latent-structure/)

*Compositional Generalization and Natural Language Variation* asks whether semantic parsing can handle both new combinations and differences in how people express requests. The earlier paper demonstrates gains on its benchmark splits, including a SQL split that holds out tables. The later work’s framing distinguishes other sources of difficulty. A parser might need to recover a familiar operation from unfamiliar wording or assemble familiar operations in an unfamiliar arrangement. That distinction matters for a two-stage approach because a failure can arise in mapping the wording to a sketch or in using the sketch to construct a complete expression. [Compositional Generalization and Natural Language Variation](https://md.research.elamur.ai/free/en/papers/shaw-2021-compositional-generalization-natural-language-variation/)

## Cite

Cite as Li Dong and Mirella Lapata. 2018. Coarse-to-Fine Decoding for Neural Semantic Parsing. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/p18-1068](https://doi.org/10.18653/v1/p18-1068) · [arXiv 1805.04793](https://arxiv.org/abs/1805.04793)

```bibtex
@inproceedings{dong2018coarse,
  title = {{Coarse-to-Fine Decoding for Neural Semantic Parsing}},
  author = {Li Dong and Mirella Lapata},
  booktitle = {Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2018},
  doi = {10.18653/v1/p18-1068},
  eprint = {1805.04793},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.18653/v1/p18-1068}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
