Abstract
Semantic parsing translates natural language (NL) into machine-readable logical forms (LF). Traditional sequence-to-sequence models often struggle with complex queries due to structural diversity and long-distance dependencies. We propose LASP (Latent Shift-Reduce Parser), a framework that decomposes NL queries into hierarchical spans aligned with LF structures. Using a latent shift-reduce mechanism and Hard EM training, LASP learns to partition sentences without manual annotations. Our approach achieves state-of-the-art results on Geoquery (90.3%) and ComplexWebQuestions (68.3%), demonstrating superior compositional generalization and robustness on complex queries.
Introduction
The goal of semantic parsing is to map natural language queries to structured representations like SQL or SPARQL. While neural sequence-to-sequence models have become standard, they typically treat input sentences as flat structures. This "holonomic" view fails to capture the inherent hierarchy of language, leading to poor generalization on long or structurally complex queries.
As shown in Figure 1, the hierarchical structure of a question often mirrors the nested structure of its corresponding logical form. LASP leverages this observation by "dividing and conquering" complex sentences into manageable, hierarchical pieces.
Methodology
LASP consists of two primary modules operating in an iterative loop:
- Shift-Reduce Splitter: This module processes the NL query token by token. It performs SHIFT actions to push tokens onto a stack and REDUCE actions to collapse a group of tokens into a single span semantic vector once a meaningful semantic unit is identified.
- Base Parser: Upon reduction, a simple seq2seq model converts the identified NL span into a "sub-logical form" (sub-LF). The resulting semantic vector represents the span's meaning and is pushed back onto the stack for higher-level composition.
Latent Trajectory Search
A key challenge is that optimal splitting points are not provided in training data. LASP treats the splitting process as a latent variable. The authors employ a Trajectory Search algorithm to identify the most likely sequence of shift-reduce actions that yield the correct final LF. Training follows a "Hard EM" strategy, where the model iteratively explores trajectories and uses successful ones as pseudo-labels to refine its splitting logic.
Experimental Evaluation
The model was evaluated on two benchmarks: Geoquery (880 geography queries in FunQL) and ComplexWebQuestions (multi-hop reasoning in SPARQL).
Key Results
On the Geoquery dataset, LASP achieved an accuracy of 90.3%, significantly outperforming traditional neural parsers and compositional baselines.
As seen in Figure 2, LASP outperforms strong models like Coarse2Fine and GNN-based approaches. It is only surpassed by GNN+BERT, which utilizes a much larger pre-trained encoder. Notably, an ablation study ("- splitter") shows that removing the hierarchical decomposition leads to a sharp drop in performance (85.5%), validating the importance of the shift-reduce mechanism. On the more challenging ComplexWebQuestions, LASP set a new state-of-the-art with 68.3% accuracy.
Discussion and Conclusion
The success of LASP stems from its ability to align the structural hierarchies of input and output. By decomposing long queries into sub-spans, the base parser only handles short, simple sequences, which enhances compositional generalization. While the model occasionally makes linguistic splitting errors, it remains robust enough to extract correct sub-LFs. Future work includes applying LASP to general-purpose programming languages like Python and integrating pre-trained transformers to further enhance the base parser's capabilities.
Summary updated