Service-oriented Text-to- SQL Parsing (2020)

Abstract: The information retrieval from relational database requires professionals who has an understanding of structural query language such as SQL. TEXT2SQL models apply natural language inference to enable user interacting the database via natural language utterance. Current TEXT2SQL models normally focus on generating complex SQL query in a precise and complete fashion while certain features of real-world application in the production environment is not fully addressed. This paper is aimed to develop a service-oriented Text-to-SQL parser that translates natural language utterance to structural and executable SQL query. We introduce a algorithmic framework named Semantic-Enriched SQL generator (SE-SQL) that enables flexibly access database than rigid API in the application while keeping the performance quality for the most commonly used cases. The qualitative result shows that the proposed model achieves 88.3% execution accuracy on WikiSQL task, outperforming baseline by 13% error reduction. Moreover, the framework considers several service-oriented needs including low-complexity inference, out-of-table rejection, and text normalization.

## introduction the relational database stores a vast of information then support applications in various areas. api and query language normally enforce access to this data. to help retrieving information from database based on utterance, one conventional solution is applying natural language understanding (nlu) model firstly to extract entities as attributes to call the downstream apis. the extracted entities fulfill the required slot in the pre-defined query templates to retrieve information from the database. such a rule-based mechanism ensures the input value at runtime while limiting the information retrieval in two major aspects. first, the entity extraction might be constrained under closed domains. it is challenging to apply one trained nlu model when the database is modified, e.g., the new schema or new table. second, creating or modifying the query template requires numerous human labor and limits the requested query by fixed knowledge of api's designer. for example, as query the weekly average temperature via date range constraint and aggregation operation, users won't get the result if there is no such pre-defined query template in the scheme. to address such issues, text2sql models @xcite @xcite @xcite @xcite @xcite are aimed to map natural language utterance to executable sql query with or without the known database. one example of text2sql task can be found in this paper aims to develop a service-oriented text-to-sql parser translating natural language utterance to structural and executable sql query without the limitation above. we introduce an algorithmic framework named semantic-enriched sql generator (se-sql) with the following key contributions: enable flexibly to access the database while keeping the performance quality for the most commonly used cases, such as select, from, and where, including aggregators and operators. therefore, the coverage of the primary query is supported. consider service-oriented needs, including lowcomplexity inference and confidence measure for quality when dealing with real-life scenarios. better user experience is obtained by improved algorithm performance from both questions by text normalization and schema by semantic enrichment. documents and codes can be found at: github.com/nicholasadam/sesql. ## semantic-enriched sql generator for the natural language questions collected across users' utterances and the table schema collected from the database, the proposed algorithmic framework processes such two types of data into sql query, organized by context-aware question encoding layer, semantic-enriched table schema encoding layer, out-of-table prediction layer, text2sql decoding layer, and sql execution layer as shown in figure 1 . ## experiments and results experiment setup as motivated by developing a service-oriented solution, we determine the benchmark dataset based on the following criteria. first, the benchmark task should meet the basic requirement of real-world text2sql application, e.g., spider @xcite and wikisql @xcite . second, the numbers of questiontable-query instances should be large enough to ensure the generality of the model. third, the generated sql should cover the potential sessions in the production environment, while high complexity parser might introduce the processing latency in real-world inference procedures. here we train and evaluate our models on wikisql ver. 1.1 that was firstly introduced by zhong et al. @xcite . wikisql contains a large corpus of question-table-sql instances from wikipedia, then divided into train (55k instances), dev (8k instances), and test sets (16k instances). we applied a negative sampling method to create the sub-dataset for out-of- ## conclusion in this paper, we proposed a novel algorithmic framework named se-sql that not only enables access database flexibly while keeping the performance quality for the most commonly used cases but more importantly offer the solution towards meeting product requirement from the lab research. we reconstructed the previous text2sql framework to introduce question-table separate contextualization in a low-complexity fashion. an improved algorithm performance obtains better user experience that the proposed model outperforms the baseline by a 13% error reduction in the wik-isql task. moreover, the properties, including out-of-table rejection, confidence measurement for quality, and fast online inference, are considered toward the production environment.