Source-linked AI summary

TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generation

Pengcheng Yin, Graham Neubig

arXiv:1810.02720v1cs.CLcs.PL

TL;DR

Neural semantic parsers have difficulty generalizing across diverse meaning-representation grammars while preserving syntactic validity. TRANX uses a transition system over ASTs, guided by ASDL grammars, and achieves strong results across four semantic parsing and code-generation tasks, including outperforming existing neural approaches on three datasets.

  • Problem

    Neural semantic parsers are often designed for limited task subsets because diverse meaning-representation grammars must be reflected to ensure well-formed outputs.

  • Method

    TRANX uses a neural transition system to construct ASTs under user-defined ASDL grammars, then converts each AST into a domain-specific meaning representation.

  • Results

    TRANX outperforms existing neural network-based approaches on three of four datasets: GEO, ATIS, and DJANGO.

  • Takeaways & Limitations

    ASTs and externally supplied grammars make TRANX generalizable across MR types, while its transition system supports extensions with minimal engineering.

Abstract

from arXiv · show

We present TRANX, a transition-based neural semantic parser that maps natural language (NL) utterances into formal meaning representations (MRs). TRANX uses a transition system based on the abstract syntax description language for the target MR, which gives it two major advantages: (1) it is highly accurate, using information from the syntax of the target MR to constrain the output space and model the information flow, and (2) it is highly generalizable, and can easily be applied to new types of MR by just writing a new abstract syntax description corresponding to the allowable structures in the MR. Experiments on four different semantic parsing and code generation tasks show that our system is generalizable, extensible, and effective, registering strong results compared to existing neural semantic parsers.

1 Introduction

TRANX addresses the challenge of applying neural semantic parsing across diverse meaning-representation formalisms by using a transition-based parser guided by target syntax. It combines AST-based generalization and extensible transitions with strong results across semantic parsing and code-generation tasks.

  • Motivation: Semantic parsing maps natural-language utterances into formal meaning representations spanning logical forms, executable programs, and programming languages.Examples include λ-calculus, SQL, robotic commands, Python, and Java.
  • Motivation: Existing neural parsers often target limited task subsets because they must reflect domain-dependent MR grammars to ensure syntactic well-formedness.General-purpose grammar models and grammar-guided tree construction had begun addressing this limitation.
  • Design principles: TRANX uses ASTs as a general-purpose intermediate representation while supplying task-dependent grammar as external knowledge to guide parsing.This decouples semantic parsing from grammar-specific details.
  • Design principles: TRANX parses utterances into tree-structured ASTs with a simple transition system designed for minimal-engineering adaptation to additional domain-specific information.The transition system is presented as an extensibility principle rather than a task-specific architecture.
  • Evaluation: TRANX outperforms existing neural approaches on three of four datasets—GEO, ATIS, and DJANGO—while covering semantic parsing and code generation tasks.The evaluated datasets are ATIS, GEO, DJANGO, and WIKISQL.

2 Methodology

TRANX maps NL utterances to domain-specific meaning representations through an AST-based transition system guided by user-defined ASDL grammars. Its neural action model combines tree-structured decoding, attention, parent feeding, and copying to generate valid, extensible representations.

  • Transition-based parsing: TRANX maps an NL utterance x to an intermediate AST z, then converts z into a domain-specific meaning representation y.A neural model scores each hypothesis AST with p(z|x).
  • AST and ASDL representation: ASTs abstract over domain-specific MR structures, while user-defined ASDL grammars guide parsing and constrain allowable tree constructions.ASDL grammars are read from human-readable text files through TRANX APIs.
  • AST and ASDL representation: ASDL grammars define composite types, constructors, strongly typed fields, primitive values, and single, optional, or sequential field cardinalities.For example, constructors such as Call specify typed fields including func, args, and keywords.
  • Tree-construction actions: The transition system expands ASTs top-down and left-to-right using APPLYCONSTR, REDUCE, and GENTOKEN actions.APPLYCONSTR expands typed composite fields, REDUCE closes optional or sequential fields, and GENTOKEN fills primitive fields, including multi-token strings.
  • Tree-construction actions: Generation ends when no frontier fields remain, after which AST to MR(·) converts the completed AST into the target representation.TRANX supplies helper and built-in conversion functions for this step.
  • Neural action model: TRANX parameterizes p(z|x) with a neural encoder-decoder whose recurrent connections reflect AST topology and whose action probabilities factorize over the construction sequence.The encoder is bidirectional LSTM-based, while the decoder uses action embeddings and attention.
  • Task adaptation: TRANX reuses the transition framework with task-specific ASDL grammars for λ-calculus GEO/ATIS representations and WIKISQL.The supplied materials identify the GEO and ATIS grammar and describe a simple SQL grammar extension for WIKISQL.
  • Neural action model: Parent feeding incorporates the frontier field and the decoder state that generated its constructor, improving performance on complex Python meaning representations.GENTOKEN actions combine generation and copying, allowing out-of-vocabulary names and literals in the input to be copied directly.

3 Experiments

TRANX is evaluated across semantic parsing and code generation tasks to test generalization, extensibility, and effectiveness. It achieves strong results across domains, with targeted extensions and parent feeding helping in settings with more complex structure.

  • Evaluation Settings: TRANX is evaluated on GEO, ATIS, DJANGO, and WIKISQL, spanning semantic parsing plus general-purpose and domain-specific code generation.GEO and ATIS use λ-calculus logical forms; DJANGO uses Python, while WIKISQL uses SQL.
  • Experimental Protocol: The experiments average all results over three runs with different random seeds.
  • Semantic Parsing: On GEO and ATIS, TRANX uses configurations with or without parent feeding and outperforms existing neural network-based approaches.The model without parent feeding achieves slightly better accuracy on GEO, where the grammar is relatively simple.
  • Code Generation: On DJANGO, TRANX achieves state-of-the-art results, while parent feeding yields a +1 point accuracy gain.The gain suggests that modeling parent connections helps with complex domain grammars such as Python.
  • Code Generation: On WIKISQL, simple extensions adapt TRANX to SQL and answer pruning significantly improves results against task-specific models using table contents.The pruning strategy executes beam candidates against the input table and removes queries with empty execution results.

4 Conclusion

TRANX is a transition-based abstract syntax parser that is generalizable, extensible, and effective. It achieves strong results on semantic parsing and code generation tasks.

  • Conclusion: TRANX is a transition-based abstract syntax parser that is generalizable, extensible, and effective.
  • Conclusion: TRANX achieves strong results on semantic parsing and code generation tasks.
Loading 1810.02720v1…