Introduction
Neural semantic parsers often struggle with compositional generalization—the ability to understand and generate new combinations of familiar concepts. While modern models excel at pattern matching, they often "memorize" specific question templates seen during training rather than learning the underlying logic of how language components combine. For instance, a model might handle "the population of New York" and "the capital of Georgia" correctly but fail on "the population of the capital of Georgia" because it hasn't encountered that specific nested structure.
This failure stems from a reliance on "soft" attention mechanisms that can be easily distracted by irrelevant context changes. To address this, we introduce a two-stage decoding framework that explicitly models word-to-meaning alignments through semantic tagging.
Methodology: Semantic Tagging Framework
The proposed approach reintroduces the concept of a lexicon into modern neural architectures through a two-stage process.
Stage 1: Semantic Tagging
Instead of direct translation to a formal language (like SQL), the model first predicts a "semantic tag" for every word in the input sentence. These tags represent atomic meaning units, such as database column names (state_name, area) or predicates. Since these tags are not explicitly provided in training data, they are treated as latent variables. The model learns these mappings using an Expectation-Maximization (EM) algorithm, transitioning from "soft-EM" for exploration to "hard-EM" to solidify the most probable word-to-tag alignments.
Stage 2: Meaning Representation Generation
A standard sequence-to-sequence model (e.g., LSTM, Transformer, or RoBERTa) then generates the final query. The input to this generator is augmented: for every word, the model receives both the word's embedding and the embedding of its predicted semantic tag. This disentangles the process: the tagger identifies the "what" (semantic components), while the generator focuses on the "how" (structural assembly).
Experimental Evaluation
The framework was evaluated on "query-based splits" of three major benchmarks, where the test set contains query structures never seen during training:
- GEOQUERY: US geography queries (SQL and $\lambda$-calculus).
- ATIS: Flight booking system queries.
- WIKISQL: A large-scale dataset for mapping questions to SQL queries, focusing on a complex compositional subset.
Key Results
The Semantic Tagging (ST) approach consistently outperformed baseline models and data augmentation techniques like GECA across various architectures.
As shown in the results, adding ST to a RoBERTa-based model on the GEOQUERY (SQL) task boosted exact-match accuracy from 58.8% to 69.6%—a significant 10.8 point improvement. Similarly, ATIS ($\lambda$-calculus) accuracy improved from 57.5% to 63.7%. On WIKISQL, the framework improved the accuracy of predicting "WHERE" clauses by 4.3% absolute.
Insights and Limitations
A key insight is that forcing "hard" alignments through tagging provides a strong inductive bias for compositionality, significantly reducing "wrong symbol" errors where the model hallucinations irrelevant database columns.
However, limitations remain. In complex databases like ATIS, many SQL columns used for internal joins do not correspond to specific input words, making them difficult for the tagger to capture. Furthermore, while the model excels at combining known parts, it still faces challenges when the syntactic structure of a query is radically deeper or more nested than anything seen during training. Future work may involve extending this approach to explicitly learn syntactic generalizations by tagging relationships between words.
Summary updated