System, method and computer program for augmenting multiple rounds of natural language to structured query language datasets by self-gaming

By generating and filtering interactions in a self-playing environment and combining dialogue with SQL-to-text and text-to-SQL models, we solve the problems of complex context dependencies and database promotion in multi-round text-to-SQL conversion, and improve Model generalization ability and performance.

CN118696307APending Publication Date: 2024-09-24TENCENT AMERICA LLC
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202380021481.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-08-30
Filing Date
2023-03-23
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

In the existing technology, multi-round text-to-SQL conversion tasks are difficult to effectively handle complex context dependencies and generalize to unseen databases, resulting in challenges in converting user utterances into executable SQL queries in a self-game environment.

Method used

A dialogue between the structured query language to natural language (SQL-to-text) model and the natural language to structured query language (text-to-SQL) model is generated through the self-game method, and the SQL query is sampled as the target query, combined with the current discourse, SQL queries and serializes the database from the previous round of interactions, filters the interactions and retrains the model to improve the model's generalization ability and adaptability.

Benefits of technology

It improves the performance of cross-domain contextual semantic analysis and conversational text-to-SQL, enhances the model's generalization ability and conversational topic relationship simulation, and improves the beam search effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118696307A
    Figure CN118696307A
Patent Text Reader

Abstract

A method and apparatus performed by at least one processor for augmenting multiple rounds of natural language to structured query language (text-to-SQL) datasets is provided. The method and computer program code includes: generating a structured query language to natural language (SQL-to-text) model to converse with a natural language to structured query language (text-to-SQL) model; on the basis of input training data, carrying out pre-training on the SQL-to-text model and the text-to-SQL model, and carrying out pre-training on the SQL-to-text model and the text-to-SQL model; sampling a structured query language (SQL) query as a target query for interaction between the SQL-to-text model and the text-to-SQL model; generating the interaction based on the target query, a current utterance, a previous utterance in the interaction, an SQL query from a previous round of interaction, and a serialized database; and filtering the interaction based on a similarity score between the last round of interaction and the target query, and retraining the SQL-to-text model and the text-to-SQL model based on the input training data and the filtered interaction.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application is based on and claims priority from U.S. patent application No. 17 / 899,080 filed on August 30, 2022, the disclosure of which is incorporated by reference into this application. Technical Field

[0003] Devices and methods consistent with example embodiments of the present disclosure generally relate to the field of semantic parsing. More specifically, the present disclosure relates to context-dependent natural language to structured query language (text-to-SQL) conversion, the purpose of which is to convert multi-turn user utterances into executable structured query language (SQL) queries in a dialogue environment with self-game. Background Art

[0004] Multi-turn text-to-SQL conversion is a powerful semantic parsing paradigm that can transform natural language user utterances into executable SQL queries. Compared with traditional text-to-SQL tasks (e.g., Spider and GeoQuery), conversational text-to-SQL conversion needs to account for coreference and ellipsis that often occur in human conversations. To improve efficiency, traditional text-to-SQL models must reveal complex contextual dependencies while grounding user utterances in task-specific database schemas. In the related art, the architectures and pre-training methods for handling context-dependent text-to-SQL tasks are limited due to the size of the datasets used and the high cost of annotating multi-turn conversations and SQL pairs, which usually requires experts with specialized training. Multi-turn text-to-SQL datasets in the related art also require the model to generalize to unseen databases during testing, but doing so is difficult in the limited training context. Therefore, transforming multi-turn user utterances into formal SQL queries is a challenging task due to the scarcity of training data for learning complex contextual dependencies and the difficulty of generalizing to unseen databases. Therefore, there is a need to provide a processing method that achieves more robust generalization and improved semantic parsing. Summary of the invention

[0005] According to an embodiment, a method for expanding a multi-round text-to-SQL dataset through self-game is provided.

[0006] According to one aspect of the present disclosure, a method for augmenting a multi-round text-to-SQL dataset is performed by at least one processor. The method includes: generating a structured query language to natural language (SQL-to-text) model to dialogue with a natural language to structured query language (text-to-SQL) model; pre-training the SQL-to-text model and the text-to-SQL model based on input training data; sampling SQL queries as target queries for interactions between the SQL-to-text model and the text-to-SQL model; generating interactions based on the target query, current utterances, previous utterances in the interaction, SQL queries from a previous round of interactions, and a serialized database; and filtering interactions based on the last round of interactions and the target query, wherein the interactions are retained or filtered out based on a similarity score between the last round of interactions and the target query.

[0007] The method may also include sampling SQL queries as target queries, including: building an SQL template using the SQL queries in the input training data by replacing column and value mentions in the SQL queries with typed slots; and sampling an unseen database and filling the typed slots with columns and values ​​from the sampled unseen database to form the target query.

[0008] The method may also include: concatenating the target query with the empty context and the schema from the serialized database to generate a first value; and inputting the first value into a SQL-to-text model to produce a first user utterance of the interaction.

[0009] The method may further include: filling the utterance from the last round of interaction with a stop interaction symbol, wherein the interaction ends when the SQL-to-text model decodes the stop interaction symbol.

[0010] In some embodiments, when the similarity score is above a threshold, the interaction is determined to be based on the target query and the interaction is maintained, and when the similarity score is below the threshold, the interaction is determined not to be based on the target query and the interaction is filtered out.

[0011] The method may further include: retraining the SQL-to-text model and the text-to-SQL model based on the input training data and the filtered interactions.

[0012] The method may also include generating a next utterance in the interaction using a SQL-to-text model by concatenating the target query, the SQL query from a previous round of interaction, previous utterances in the interaction, and a schema of the serialized database.

[0013] According to another aspect of the present disclosure, a device for augmenting a multi-round text-to-SQL data set is provided, the device comprising: at least one memory configured to store computer program code; and at least one processor configured to read the computer program code and operate according to instructions of the computer program code. The computer program code includes: generation code configured to cause at least one processor to generate a structured query language to natural language (SQL-to-text) model to dialogue with a natural language to structured query language (text-to-SQL) model; training code configured to cause at least one processor to pre-train the SQL-to-text model and the text-to-SQL model based on input training data; first sampling code configured to cause at least one processor to sample SQL queries as target queries for interactions between the SQL-to-text model and the text-to-SQL model; synthetic interaction generation code configured to cause at least one processor to generate interactions based on the target query, a current utterance, previous utterances in the interaction, SQL queries from a previous round of interactions, and a serialized database; and filtering code configured to cause at least one processor to filter interactions based on a last round of interactions and the target query, wherein interactions are retained or filtered out based on a similarity score between the last round of interactions and the target query.

[0014] The device may also include: a construction code configured to cause at least one processor to build an SQL template using the SQL query in the input training data by replacing column and value mentions in the SQL query with typed slots; and a second sampling code configured to cause at least one processor to sample an unseen database and fill the typed slots with columns and values ​​from the sampled unseen database to form a target query.

[0015] The device may also include: connection code configured to cause at least one processor to connect the target query with the empty context and schema from the serialized database to generate a first value; and first user utterance code configured to cause at least one processor to input the first value into the SQL-to-text model to produce a first user utterance of the interaction.

[0016] The device may also include a stop code configured to cause the at least one processor to populate the utterance from the last round of interaction with a stop interaction symbol, wherein the interaction ends when the SQL-to-text model decodes the stop interaction symbol.

[0017] In some embodiments, when the similarity score is above a threshold, the interaction is determined to be based on the target query and the interaction is maintained, and when the similarity score is below the threshold, the interaction is determined not to be based on the target query and the interaction is filtered out.

[0018] The device may also include: a retraining code configured to cause the at least one processor to retrain the SQL-to-text model and the text-to-SQL model based on the input training data and the filtered interactions.

[0019] The device may also include: an utterance generation code configured to cause at least one processor to generate a next utterance in the interaction using a SQL-to-text model by connecting a target query, an SQL query from a previous round of interaction, previous utterances in the interaction, and a schema of a serialized database.

[0020] According to another aspect of the present disclosure, a non-transitory computer-readable medium stores instructions, which are executed by at least one processor of a device for augmenting a multi-round text-to-SQL data set. The instructions cause the at least one processor to execute: generating a SQL-to-text model to dialogue with a text-to-SQL model; pre-training the SQL-to-text model and the text-to-SQL model based on input training data; sampling SQL queries as target queries for interactions between the SQL-to-text model and the text-to-SQL model; generating interactions based on the target query, current utterances, previous utterances in the interaction, SQL queries from a previous round of interactions, and a serialized database; and filtering interactions based on the last round of interactions and the target query, wherein the interactions are retained or filtered out based on a similarity score between the last round of interactions and the target query.

[0021] In some embodiments, the instructions may also cause at least one processor to perform: building an SQL template using SQL queries in input training data by replacing column and value mentions in the SQL query with typed slots; and sampling an unseen database and filling the typed slots with columns and values ​​from the sampled unseen database to form a target query.

[0022] In some embodiments, the instructions may further cause at least one processor to perform: concatenating the target query with an empty context and pattern from a serialized database to generate a first value; inputting the first value into a SQL-to-text model to produce a first user utterance of an interaction; and filling the utterance from the last round of interaction with a stop interaction symbol, wherein the interaction ends when the SQL-to-text model decodes the stop interaction symbol.

[0023] In some embodiments, when the similarity score is above a threshold, the interaction is determined to be based on the target query and the interaction is maintained, and when the similarity score is below the threshold, the interaction is determined not to be based on the target query and the interaction is filtered out.

[0024] The non-transitory computer-readable medium may also include instructions that further cause the at least one processor to perform: retraining the SQL-to-text model and the text-to-SQL model based on the input training data and the filtered interactions.

[0025] The non-transitory computer-readable medium may also include instructions that cause at least one processor to perform: generating a next utterance in the interaction using a SQL-to-text model by connecting the target query, the SQL query from the previous round of interaction, the previous utterance in the interaction, and the schema of the serialized database.

[0026] Additional embodiments will be set forth in the description which follows and, in part, will be apparent from the description, and / or may be achieved by practicing the embodiments presented in the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The features, advantages, and significance of exemplary embodiments of the present disclosure will be described below with reference to the accompanying drawings, in which like reference numerals represent like elements, and in which:

[0028] Figure 1 An example process used by a system according to an embodiment is shown.

[0029] Figure 2 is a schematic diagram of an environment in which the methods, apparatuses, and systems described herein may be implemented according to an embodiment.

[0030] Figure 3 yes Figure 2 A block diagram of exemplary components of one or more devices of the present invention.

[0031] Figure 4 is an exemplary block diagram of a multi-round text-to-SQL dataset augmentation device according to an embodiment.

[0032] Figure 5 is an example of a synthetic interaction between a SQL-to-text model and a text-to-SQL model according to an embodiment.

[0033] Figure 6 are examples of inputs to a trained SQL-to-text model and a text-to-SQL model, and examples of outputs generated by a trained SQL-to-text model and a text-to-SQL model.

[0034] Figure 7 is an example flow chart illustrating a method for augmenting a multi-round text-to-SQL data set through self-game according to an embodiment.

[0035] Figure 8is a block diagram of an example of computer code for augmenting a multi-round text-to-SQL dataset through self-play according to an embodiment. DETAILED DESCRIPTION

[0036] The following detailed description of example embodiments refers to the accompanying drawings.The same reference numbers in different drawings may identify the same or similar elements.

[0037] The foregoing disclosure provides illustration and description, but is not exhaustive or limits the implementation mode to the accurate form disclosed. According to the above disclosure, modifications and variations are possible, or modifications and variations can be obtained from the practice of the implementation mode. In addition, one or more features or components of an embodiment can be incorporated into another embodiment (or one or more features of another embodiment) or combined with another embodiment (or one or more features of another embodiment). In addition, in the flowcharts and operational descriptions provided below, it should be understood that one or more operations can be omitted, one or more operations can be added, one or more operations can be performed simultaneously (at least partially), and the order of one or more operations can be switched.

[0038] It is apparent that the systems and / or methods described herein can be implemented in various forms of hardware, software, or a combination of hardware and software. The actual dedicated control hardware or software code used to implement these systems and / or methods does not limit these embodiments. Therefore, the operation and behavior of the systems and / or methods are described herein without reference to specific software codes. It should be understood that software and hardware can be designed to implement the systems and / or methods based on the description herein.

[0039] Even though particular combinations of features are recited in the claims and / or disclosed in the specification, these combinations are not intended to limit the disclosure of possible implementations. In fact, many of these features may be combined in ways not specifically recited in the claims and / or disclosed in the specification. Although each dependent claim listed below may directly depend on only one claim, the disclosure of possible implementations includes the combination of each dependent claim with every other claim in the claim set.

[0040] The suggested features discussed below may be used alone or in any combination in any order. In addition, the embodiments may be implemented by processing circuits (e.g., one or more processors or one or more integrated circuits). In one example, one or more processors execute a program stored in a non-transitory computer-readable medium.

[0041] Unless explicitly described, any element, behavior or instruction used herein should not be interpreted as critical or essential. In addition, as used herein, the articles "a" and "an" are intended to include one or more items and can be used interchangeably with "one or more". If only one item is intended to be used, "one" or similar language is used. In addition, as used herein, the terms "have", "have", "have", "include", "include", etc. are intended to be open terms. In addition, unless otherwise explicitly stated, the phrase "based on" means "based at least in part on". In addition, expressions such as "at least one of A and B" or "at least one of A or B" should be understood to include only A, only B, or both A and B.

[0042] The exemplary embodiments of the present disclosure provide a method and apparatus for augmenting a multi-round text-to-SQL dataset through self-playing to achieve improved generalization. The training dataset is augmented through self-playing to synthesize new interactions using contextual information and adapt the model to the new database.

[0043] Figure 1 Flowchart of an exemplary process used by a system according to an embodiment.

[0044] First, at S110, the system designs a SQL-to-text model based on a sampled target query, and designs a text-to-SQL model that generates corresponding SQL for an utterance from the SQL-to-text model. The sampled target query represents the user's intent (e.g., a question that the user may ask). At S120, a new interaction is synthesized using the target query. The text-to-SQL model dialogues with the SQL-to-text model to simulate a new interaction. At S130, the synthesized interaction is filtered based on the accuracy of the synthesized interaction to the sampled target. At S140, the filtered interaction from S130 is augmented with pre-exited training data. Finally, at S150, self-training is performed to retrain the text-to-SQL model and the SQL-to-text model with the augmented data. In this way, according to an embodiment, a new SQL-to-text model can be trained using previous utterances, target queries, and filtered synthesized interactions. This approach of retraining and using self-playing to augment training datasets improves the accuracy of strong baselines (e.g., on Cross-Domain Contextual Semantic Parsing (SParC) and Conversational text-to-SQL (CoSQL); two widely used cross-domain text-to-SQL datasets), models various conversation topic relations, enhances cross-domain generalization, and improves beam search.

[0045] Figure 2is a schematic diagram of an environment 200 in which the methods, apparatuses, and systems described herein may be implemented, according to an embodiment.

[0046] like Figure 2 As shown, environment 200 may include user device 210, platform 220, and network 230. The devices of environment 200 may be interconnected via wired connections, wireless connections, or a combination of wired and wireless connections.

[0047] The user device 210 includes one or more devices that can receive, generate, store, process and / or provide information related to the platform 220. For example, the user device 210 may include a computing device (e.g., a desktop computer, a laptop computer, a tablet computer, a handheld computer, a smart speaker, a server, etc.), a mobile phone (e.g., a smart phone, a wireless phone, etc.), a wearable device (e.g., smart glasses or a smart watch), or a similar device. In some embodiments, the user device 210 can receive information from the platform 220 and / or send information to the platform 220.

[0048] The platform 220 includes one or more devices as described elsewhere herein. In some embodiments, the platform 220 may include a cloud server or a cloud server group. In some embodiments, the platform 220 may be designed to be modular so that software components can be swapped in or out. Therefore, the platform 220 may be easily and / or quickly reconfigured for different uses.

[0049] In some embodiments, as shown, the platform 220 may be hosted in a cloud computing environment 222. It is worth noting that although the embodiments described herein describe the platform 220 as being hosted in a cloud computing environment 222, in some embodiments, the platform 220 may not be cloud-based (i.e., may be implemented outside of a cloud computing environment) or may be partially cloud-based.

[0050] Cloud computing environment 222 includes an environment hosting platform 220. Cloud computing environment 222 can provide computing, software, data access, storage, and other services. These services do not require the user end (e.g., user device 210) to know the physical location and configuration of the system and / or equipment hosting platform 220. As shown, cloud computing environment 222 can include a set of computing resources 224 (collectively referred to as "computing resources (computing resources) 224" and individually referred to as "computing resources (computing resources) 224").

[0051] The computing resources 224 include one or more personal computers, workstation computers, server devices, or other types of computing and / or communication devices. In some embodiments, the computing resources 224 can host the platform 220. Cloud resources can include computing instances executed in the computing resources 224, storage devices provided in the computing resources 224, data transmission devices provided by the computing resources 224, etc. In some embodiments, the computing resources 224 can communicate with other computing resources 224 via wired connections, wireless connections, or a combination of wired and wireless connections.

[0052] like Figure 2 As further shown in the figure, the computing resources 224 include a set of cloud resources, such as one or more application programs ("APPs") 224-1, one or more virtual machines ("VMs") 224-2, virtualized storage ("VS") 224-3, one or more hypervisors ("HYP") 224-4, etc.

[0053] The applications 224-1 include one or more software applications that can be provided to or accessed by the user device 210 and / or the platform 220. The applications 224-1 do not require the software applications to be installed and executed on the user device 210. For example, the applications 224-1 can include software associated with the platform 220, and / or any other software that can be provided through the cloud computing environment 222. In some embodiments, one application 224-1 can send / receive information to / from one or more other applications 224-1 through the virtual machine 224-2.

[0054] Virtual machine 224-2 includes a software implementation of a machine (e.g., a computer) that executes programs, similar to a physical machine. Virtual machine 224-2 can be a system virtual machine or a process virtual machine, depending on the use and correspondence of virtual machine 224-2 to any real machine. System virtual machines can provide a complete system platform that supports the execution of a complete operating system ("OS"). Process virtual machines can execute a single program and can support a single process. In some embodiments, virtual machine 224-2 can execute on behalf of a user (e.g., user device 210) and can manage the infrastructure of cloud computing environment 222, such as data management, synchronization, or long-term data transfer.

[0055] Virtualized storage 224-3 includes one or more storage systems and / or one or more devices that use virtualization technology within the storage system or device of computing resource 224. In some embodiments, in the context of a storage system, the types of virtualization may include block virtualization and file virtualization. Block virtualization may refer to the abstraction (or separation) of logical storage from physical storage so that the storage system can be accessed without considering physical storage or heterogeneous structures. Separation may allow administrators of storage systems to manage user-side storage more flexibly. File virtualization may eliminate the dependency between data accessed at the file level and the location of the physical storage file. This may optimize the performance of storage usage, server consolidation, and / or non-disruptive file migration.

[0056] Hypervisor 224-4 may provide hardware virtualization technology that allows multiple operating systems (e.g., "guest operating systems") to execute simultaneously on a host computer such as computing resource 224. Hypervisor 224-4 may present a virtual operating platform to the guest operating systems and may manage the execution of the guest operating systems. Multiple instances of various operating systems may share virtualized hardware resources.

[0057] The network 230 includes one or more wired and / or wireless networks. For example, the network 230 may include a cellular network (e.g., a fifth generation (5G) network, a long term evolution (LTE) network, a third generation (3G) network, a code division multiple access (CDMA) network, etc.), a public land mobile network (PLMN), a local area network (LAN), a wide area network (WAN), a metropolitan area network (MAN), a telephone network (e.g., a public switched telephone network (PSTN)), a private network, an ad hoc network, an intranet, the Internet, a fiber-based network, etc., and / or a combination of these or other types of networks.

[0058] Figure 2 The number and arrangement of devices and networks shown are provided as examples. Figure 2 There may be more devices and / or networks, fewer devices and / or networks, different devices and / or networks, or differently arranged devices and / or networks than those shown. Figure 2 Two or more of the devices shown may be implemented in a single device, or Figure 2 The described single device may be implemented as multiple distributed devices. Additionally or alternatively, a set of devices (eg, one or more devices) of environment 200 may perform one or more functions described as being performed by another set of devices of environment 200.

[0059] Figure 3 yes Figure 2 A block diagram of exemplary components of one or more devices of the present invention.

[0060] Device 300 may correspond to user device 210 and / or platform 220. Figure 3 As shown, device 300 may include a bus 310 , a processor 320 , a memory 330 , a storage component 340 , an input component 350 , an output component 360 , and a communication interface 370 .

[0061] The bus 310 includes components that allow communication between components of the device 300. The processor 320 is implemented in hardware, software, or a combination of hardware and software. The processor 320 is a central processing unit (CPU), a graphics processing unit (GPU), an accelerated processing unit (APU), a microprocessor, a microcontroller, a digital signal processor (DSP), a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), or another type of processing component. In some embodiments, the processor 320 includes one or more processors that can be programmed to perform functions. The memory 330 includes a random access memory (RAM), a read-only memory (ROM), and / or another type of dynamic or static storage device (e.g., flash memory, magnetic memory, and / or optical memory) that stores information and / or instructions for use by the processor 320.

[0062] Storage component 340 stores information and / or software related to the operation and use of device 300. For example, storage component 340 may include a hard disk (e.g., a magnetic disk, an optical disk, a magneto-optical disk, and / or a solid-state disk), a compact disk (CD), a digital versatile disk (DVD), a floppy disk, a cassette, a magnetic tape, and / or another type of non-transitory computer-readable medium, and a corresponding drive.

[0063] Input components 350 include components that allow device 300 to receive information, such as through user input, such as a touch screen display, a keyboard, a keypad, a mouse, buttons, switches, and / or a microphone. In addition or alternatively, input components 350 may include sensors for sensing information (e.g., global positioning system (GPS) components, accelerometers, gyroscopes, and / or actuators). Output components 360 include components that provide output information from device 300, such as a display, a speaker, and / or one or more light emitting diodes (LEDs).

[0064] The communication interface 370 includes a transceiver-like component (e.g., a transceiver and / or a separate receiver and transmitter) that enables the device 300 to communicate with other devices, for example, via a wired connection, a wireless connection, or a combination of wired and wireless connections. The communication interface 370 can allow the device 300 to receive information from another device and / or provide information to another device. For example, the communication interface 370 can include an Ethernet interface, an optical interface, a coaxial interface, an infrared interface, a radio frequency (RF) interface, a universal serial bus (USB) interface, a Wi-Fi interface, a cellular network interface, etc.

[0065] Device 300 may perform one or more processes described herein. Device 300 may perform these processes in response to processor 320 executing software instructions stored by non-transitory computer-readable media (e.g., memory 330 and / or storage component 340). Computer-readable media is defined herein as non-transitory storage devices. Storage devices include storage space within a single physical storage device or storage space distributed on multiple physical storage devices.

[0066] The software instructions may be read into the memory 330 and / or storage component 340 from another computer-readable medium or from another device through the communication interface 370. When executed, the software instructions stored in the memory 330 and / or storage component 340 may cause the processor 320 to perform one or more processes described herein. Additionally or alternatively, hardwired circuitry may be used in place of or in combination with software instructions to perform one or more processes described herein. Thus, the embodiments described herein are not limited to any specific combination of hardware circuitry and software.

[0067] Figure 3 The number and arrangement of components shown are provided as examples. Figure 3 Compared to the components shown, device 300 may include more components, fewer components, different components, or components arranged differently. Additionally or alternatively, a set of components (e.g., one or more components) of device 300 may perform one or more functions described as being performed by another set of components of device 300.

[0068] In an embodiment, Figure 4-6 Any operation or process can be performed by or using Figure 2 and Figure 3 It can be implemented by any one of the components shown in .

[0069] For self-play for data augmentation in conversational text-to-SQL semantic parsing, an SQL-to-text model is first designed. The user simulator is an SQL-to-text model that is designed to converse with the text-to-SQL model to generate synthetic interactions (i.e., synthetic conversations). The goal of the SQL-to-text model is to generate the next utterance given all the interaction history, while the text-to-SQL model generates the SQL corresponding to the latest utterance from the SQL-to-text model. A parsing model (e.g., incremental parsing for constrained autoregressive decoding (PICARD)) can be used as the basis for the text-to-SQL model.

[0070] In the user simulator for each round t, the user simulator generates a meaningful question that a human user would naturally ask. In each round, the user has a goal to achieve. The SQL-to-text model is conditioned explicitly on the user's goal to encourage the user simulator to ask questions based on that goal. The SQL-to-text model computes the following conditional in each round:

[0071] p(U t |Q t-1 ,C t ,G,D)(Formula 1)

[0072] where U t is the next user utterance, Q t-1 is the last SQL query of the previous round, the context C t contains the previous user utterances U<t, G is the user goal query, and D is the serialized database schema. Figure 4 is an example of a synthetic interaction between the SQL-to-text model and the text-to-SQL model. Utterance 410 represents the question generated by the user simulator. SQL query 420 represents the SQL corresponding to utterance 410. Database 430 represents the serialized database schema. Database 430 can define how to organize data, the relationship between utterances or user queries and SQL queries, data types, labels, etc.

[0073] During the training of the SQL-to-text model, the user goal G is the last round T (i.e., Q T) of the SQL-to-text model). During the reasoning process of the SQL-to-text model, new target queries are sampled. Machine learning (ML) methods are used to process the SQL-to-text model. For example, interactions from SParC to sequence-to-sequence (seq2seq) format. In addition, the Text-to-Text Transfer Transformer (T5) model can be used to parameterize the SQL-to-text model. In SQL-to-text, the next round may ask multiple reasonable questions (i.e., a one-to-many relationship). A trained SQL-to-text model can generate new questions to increase the diversity of user dialogue flows in the dataset, thereby improving generalization ability.

[0074] Figure 5 is an exemplary block diagram of a multi-round text-to-SQL dataset augmentation apparatus 500 according to an embodiment. The apparatus 500 includes a training module 510 , a sampling module 520 , a synthetic interaction generator 530 , and a filtering module 540 .

[0075] The training module 510 trains the text-to-SQL and SQL-to-text models on the golden training data. The golden training data may include conversations, etc. The models are trained by minimizing the negative log-likelihood value. The training module 510 outputs the trained text-to-SQL model and SQL-to-text model. Self-play is used to generate synthetic interactions through the models pre-trained on the golden training data.

[0076] The SQL query is specified by the sampling module 520 as the final target query of the interaction. Specifically, the sampling module 520 samples SQL queries to synthesize the user target query G, and outputs the user target query G to the synthetic interaction generator 530 and the filtering module 540 in a sampled logical form. The sampling module 520 can use the SQL in the training set to build and sample rough SQL templates by replacing the column and value mentions in the query with typed slots. For example, "SELECT T1.id, T2.name" is converted to the template "SELECT key1, text1". In order to adapt the model to an unseen environment, an unseen database is sampled, and the typed slots are filled with the columns and values ​​in the sampled database to form a new SQL query. The new SQL query can be used as the user target query G. This sampling method is used to synthesize targets in new domains for cross-domain generalization.

[0077] The synthetic interaction generator 530 then adjusts the SQL-to-text model based on the user goal query G, and the text-to-SQL model is converted with the adjusted SQL-to-text model to simulate a new interaction. The sampled user goal query G is then concatenated with an empty context and a serialization pattern and provided to the SQL-to-text model to generate a first user utterance. The text-to-SQL model and the SQL-to-text model can continue to simulate the synthetic interaction until the end of the conversation. Its target label is the correct user utterance for the next round. The last sentence of the synthetic interaction is filled with a special stop interaction symbol, indicating the end of the conversation. Figure 6 Blocks 610 and 620 are shown, respectively showing exemplary input / output to a trained text-to-SQL model and a SQL-to-text model in a round of synthetic interaction. Figure 6 As shown, the input of the text-to-SQL model can be: "current utterance | database | previous utterance". Figure 4 For example, in a round of the simulator, the current utterance may be “Of these, which is JetBlue Airways?”, the serialized database schema used in this example may be “fight_2|Airlines:id|airline,…|Airports:…”, and the previous utterance may be “What are all the airlines?”. Using the input parameters, the text-to-SQL model generates an output (i.e., the next SQL): “SELECT+FROMAIRLINES WHERE Airline='JetBlue Airways'”. As defined in Formula 1, the user goal G, the final SQL query Q t-1 , the previous user utterance U <t is connected to the serialized database schema D and used to predict the next user utterance U using the trained SQL-to-text model t In addition, the input of the SQL-to-text model can be: "user goal|previous utterances|last SQLquery|database". Figure 4In the synthetic interaction shown in , for example, the user goal might be “SELECT Country FROM AIRLINES WHERE Airline = “JetBlue Airways””, the previous utterance might be “Where are all the airlines? Of those, which is JetBlue Airlines?”, and the final SQL query might be “SELECT + FROM AIRLINES WHERE Airline = 'JetBlue Airways'”. The serialized database schema used in this example might be “fight_2|Airlines:id|airline,…|Airports:…”. Using the input parameters, the SQL-to-text model generates an output (i.e., the next utterance): “what is the country corresponding to it”. In this way, self-game is used to generate synthetic interactions. The synthetic interaction ends whenever the SQL-to-text model decodes a stop interaction symbol. Once the stop interaction symbol is decoded, the synthesized interaction generator 530 outputs a synthesized interaction, which is used as input to the filtering module 540 .

[0078] Although the SQL-to-text model is conditioned based on the user target query G, the synthetic interactions generated by the self-game may be different from the sampled user target query. To account for potential differences, the filtering module 540 filters out interactions that are not based on the sampled user target query. To filter out these low-quality conversations (i.e., interactions that are not based on the sampled target query), the similarity score score (Q T , G) The last round Q T The generated SQL query is compared with the sampled user target query G. The final round Q T The SQL query and sampled user target query G are decomposed into SQL substructures Q Ts and G S (e.g., "select, where, group_by, order_by" statements). Then, the filter module 540 calculates each substructure Q Ts and G SIn some embodiments, the similarity score may be the average of the accuracies of all substructures. If the similarity score is greater than a threshold value ω, the filtering module 540 keeps the synthesized interaction. A high similarity score means that the synthesized interaction is based on the sampled target query. If the similarity score is less than the threshold value ω, the synthesized interaction is filtered out. A low similarity score means that the synthesized interaction is not based on the sampled target query.

[0079] The filtered synthetic interactions are used to retrain the text-to-SQL and SQL-to-text models. The device 400 uses self-training to retrain the text-to-SQL model and the SQL-to-text model. In this way, the new text-to-SQL model and the new SQL-to-text model are retrained at the end of each iteration using the golden training data and the filtered synthetic interactions through the framework of the device 400 (as described above).

[0080] Table 1 shows the overall procedure (i.e., algorithm) followed by the retraining process. Figure 4-6 Detailed description. Table 1 shows the process of self-training, where the models are retrained using their own outputs. The text-to-SQL model and SQL-to-text model can be retrained in one of two ways. The first approach is to pre-train the text-to-SQL model and SQL-to-text model on synthetic interactions before fine-tuning the models based on the golden interactions. The second approach is to combine the filtered synthetic data with the golden interactions before pre-training the text-to-SQL and SQL-to-text models. Table 1 uses the first approach. The performance of the first approach is slightly better than the second approach.

[0081] Table 1: Retraining algorithm

[0082]

[0083]

[0084] Figure 7 is an exemplary flow chart illustrating a method 700 of augmenting a multi-pass text-to-SQL dataset according to an embodiment.

[0085] In some embodiments, Figure 7 One or more processing blocks of may be executed by platform 220. In some embodiments, Figure 7 One or more processing blocks of may be performed by another device or group of devices separate from or including platform 220 , such as user device 210 .

[0086] like Figure 7As shown, in operation 710, the method includes generating a SQL-to-text model to dialogue with a text-to-SQL model.

[0087] At operation 720 , method 700 includes pre-training a SQL-to-text model and a text-to-SQL model based on input training data.

[0088] In operation 730, method 700 includes sampling SQL queries as target queries for interaction between the SQL-to-text model and the text-to-SQL model. In some embodiments, SQL queries can be sampled by first building SQL templates using SQL queries in input training data. The SQL templates are built by replacing column and value mentions in the SQL queries with typed slots. Then, an unseen database is sampled and the typed slots are filled with columns and values ​​in the sampled unseen database to generate the target query.

[0089] In operation 740, method 700 includes generating an interaction (i.e., a synthesized interaction) based on a target query, a current utterance, a previous utterance in an interaction, a SQL query from a previous round of interaction, and a serialization database. The first user utterance in the interaction is generated by concatenating the target query with an empty context and a schema from the serialization database. The concatenated values ​​are then input into a SQL-to-text model to produce the first user utterance of the interaction. The next utterance in the interaction is generated using the SQL-to-text model by concatenating the target query, the SQL query from a previous round of interaction, the previous utterance in the interaction, and the schema of the serialization database. The last utterance, i.e., the utterance from the last round of interaction, is populated with a stop interaction symbol. The interaction ends when the SQL-to-text model decodes the stop interaction symbol.

[0090] In operation 750, method 700 includes filtering interactions based on the last round of interactions and the target query, wherein the interactions are retained or filtered out based on a similarity score between the last round of interactions and the target query. When the similarity score is above a threshold, the interaction is determined to be based on the target query, and the interaction is retained. When the similarity score is below a threshold, the interaction is determined not to be based on the target query, and the interaction is filtered out. After filtering the generated interactions, the SQL-to-text model and the text-to-SQL model are retrained based on the input training data and the filtered interactions.

[0091] Although Figure 7 Example blocks of the method are shown, but in some embodiments, the method may include Figure 7 More blocks, fewer blocks, different blocks, or differently arranged blocks may be shown. Additionally, or alternatively, two or more blocks of the method may be executed in parallel.

[0092] Figure 8 800 is an example block diagram of a computer program code for augmenting a multi-round text-to-SQL data set according to an embodiment. According to an embodiment of the present disclosure, a device / apparatus including at least one processor having a memory storing computer program code may be provided. The computer program code may be configured to perform any number of aspects of the present disclosure when executed by at least one processor.

[0093] like Figure 8 As shown, computer program code 800 includes generation code 810 , training code 820 , sampling code 830 , synthetic interaction generation code 840 , and filtering code 850 .

[0094] The generation code 810 is configured to cause at least one processor to generate a SQL-to-text model to interact with the text-to-SQL model.

[0095] The training code 820 is configured to cause at least one processor to pre-train the SQL-to-text model and the text-to-SQL model based on input training data.

[0096] The sampling code 830 is configured to cause at least one processor to sample SQL queries as target queries for interaction between the SQL-to-text model and the text-to-SQL model. The computer program code 800 may even further include a construction code and a second sampling code. The construction code is configured to cause at least one processor to use the SQL queries in the input training data to build SQL templates by replacing column and value mentions in the SQL queries with typed slots, and the second sampling code is configured to cause at least one processor to sample an unseen database and fill the typed slots with columns and values ​​from the sampled unseen database to form a target query.

[0097] The synthetic interaction generation code 840 is configured to cause at least one processor to generate an interaction based on a target query, a current utterance, a previous utterance in an interaction, a SQL query from a previous round of interaction, and a serialized database. The computer program code 800 may even further include a connection code, the connection code being configured to cause at least one processor to connect the target query with an empty context and a pattern from a serialized database to generate a first value, and the first user utterance code being configured to cause at least one processor to input the first value into a SQL-to-text model to generate a first user utterance of an interaction. The computer program code 800 may even further include an utterance generation code and a stop code. The utterance generation code is configured to cause at least one processor to generate the next utterance in an interaction using a SQL-to-text model by connecting the target query, the SQL query of a previous round of interaction, the previous utterance in an interaction, and the pattern of a serialized database. The stop code is configured to cause at least one processor to fill the utterance from the last round of interaction with a stop interaction symbol, wherein the interaction ends when the SQL-to-text model decodes the stop interaction symbol.

[0098] The filtering code 850 is configured to cause at least one processor to filter interactions based on the last round of interactions and the target query, wherein the interactions are retained or filtered based on a similarity score between the last round of interactions and the target query. When the similarity score is above a threshold, the interaction is determined to be based on the target query, and the interaction is retained. When the similarity score is below a threshold, the interaction is determined not to be based on the target query, and the interaction is filtered out.

[0099] The computer program code 800 may even further include retraining code configured to cause the at least one processor to retrain the SQL-to-text model and the text-to-SQL model based on the input training data and the filtered interactions.

[0100] Although Figure 8 Example blocks of the device are shown, but in some embodiments, the device may include Figure 8 More blocks, fewer blocks, different blocks, or differently arranged blocks than those shown in FIG. Additionally or alternatively, two or more blocks of the device may be combined. In other words, although Figure 8 Different code blocks are shown, but different code instructions can be separated and mixed together.

[0101] The methods and processes of self-play described in accordance with the embodiments of the present disclosure can be extended to semantic parsing, however, can also be successfully applied to a wide range of tasks (e.g., board games and multiplayer games). When evaluated on two large-scale benchmark datasets (such as the SParC dataset and the CoSQL dataset), as shown in Table 2, the configuration "w / PICARD w / self-play" achieved the best results on both datasets (measured by question matching (QM) and interaction matching (IM)). This demonstrates the benefits of self-play. The benefits of self-play are more significant on SParC than on CoSQL, and "T5-Large w / PICARD w / self-play" outperforms the ordinary T5-3B reported in the related art. Therefore, self-play is an effective data augmentation method that can improve the performance of cross-domain context-related text-to-SQL. Self-play simulates the interaction between multiple artificial agents to generate training signals outside of supervised data, and (as shown in Table 2) the model after self-play outperforms the baseline under different configurations.

[0102] Table 2: Model after self-game and SParC and CoSQL

[0103]

[0104] The above techniques may be implemented as computer software using computer-readable instructions and physically stored in one or more computer-readable media, or implemented by one or more specially configured hardware processors. Figure 2 An environment 200 suitable for implementing various embodiments is shown. In one example, one or more processors execute a program stored in a non-transitory computer-readable medium.

[0105] As used herein, the term component is intended to be broadly interpreted as hardware, software, or a combination of hardware and software.

[0106] It is apparent that the systems and / or methods described herein can be implemented in various forms of hardware, software, or a combination of hardware and software. The actual dedicated control hardware or software code used to implement these systems and / or methods does not limit the implementation. Therefore, the operation and behavior of the systems and / or methods are described herein without reference to specific software code - it should be understood that software and hardware can be designed to implement the systems and / or methods based on the description herein.

[0107] Computer software may be encoded using any suitable machine code or computer language, which may be assembled, compiled, linked, or the like to create code comprising instructions that may be directly executed by a computer central processing unit (CPU), graphics processing unit (GPU), or the like, or executed through decoding, microcode, or the like.

[0108] The instructions may be executed on various types of computers or components thereof, including, for example, personal computers, tablet computers, servers, smartphones, gaming devices, IoT devices, etc.

[0109] Although the present disclosure has described several exemplary embodiments, there are changes, arrangements and various alternative equivalents that fall within the scope of the present disclosure. It should be understood that those skilled in the art can design a variety of systems and methods, which, although not explicitly shown or described herein, embody the principles of the present application and therefore belong to the spirit and scope of the present application.

Claims

1. A method for augmenting a multi-pass natural language to structured query language (text-to-SQL) data set, executed by at least one processor, characterized in that: The method comprises: generating a structured query language to natural language (SQL-to-text) model to talk to a natural language to structured query language (text-to-SQL) model; Pre-training the SQL-to-text model and the text-to-SQL model based on input training data; sampling structured query language (SQL) queries as target queries for interactions between the SQL-to-text model and the text-to-SQL model; generating the interaction based on the target query, a current utterance, a previous utterance in the interaction, an SQL query from a previous round of interactions, and a serialized database; and The interactions are filtered based on a last round of interactions and the target query, wherein the interactions are retained or filtered out based on a similarity score between the last round of interactions and the target query.

2. The method according to claim 1, characterized in that The sampling of the SQL query as the target query includes: constructing a SQL template using the SQL query in the input training data by replacing column and value mentions in the SQL query with typed slots; and An unseen database is sampled, and the typed slots are filled with columns and values ​​from the sampled unseen database to form the target query.

3. The method according to claim 1, characterized in that The method comprises: concatenating the target query with an empty context and a schema from the serialization database to generate a first value; and The first value is input into the SQL-to-text model to generate a first user utterance of the interaction.

4. The method according to claim 1, characterized in that: The method further comprises: The utterance from the last round of interaction is populated with a stop interaction symbol, wherein the interaction ends when the SQL-to-text model decodes the stop interaction symbol.

5. The method according to claim 1, characterized in that When the similarity score is above a threshold, determining that the interaction is based on the target query, and maintaining the interaction, and When the similarity score is lower than the threshold, it is determined that the interaction is not based on the target query, and the interaction is filtered out.

6. The method according to claim 1, characterized in that The method further includes retraining the SQL-to-text model and the text-to-SQL model based on the input training data and the filtered interactions.

7. The method according to claim 1, characterized in that Generating the interaction includes: The next utterance in the interaction is generated using the SQL-to-text model by concatenating the target query, the SQL query of the previous round of interaction, the previous utterance in the interaction, and the schema of the serialization database.

8. A device for augmenting a multi-pass natural language to structured query language (text-to-SQL) data set, characterized in that: The device comprises: at least one memory configured to store computer program code; and at least one processor, the processor being configured to read the computer program code and operate according to instructions of the computer program code, the computer program code comprising: generating code configured to cause the at least one processor to generate a structured query language to natural language (SQL-to-text) model to dialogue with a natural language to structured query language (text-to-SQL) model; training code configured to cause the at least one processor to pre-train the SQL-to-text model and the text-to-SQL model based on input training data; a first sampling code configured to cause the at least one processor to sample a structured query language (SQL) query as a target query for interaction between the SQL-to-text model and the text-to-SQL model; synthetic interaction generation code configured to cause the at least one processor to generate the interaction based on the target query, a current utterance, a previous utterance in the interaction, an SQL query from a previous round of interaction, and a serialized database; and A filtering code is configured to cause the at least one processor to filter the interactions based on a last round of interactions and the target query, wherein the interactions are retained or filtered out based on a similarity score between the last round of interactions and the target query.

9. The device according to claim 8, characterized in that The computer program code also includes: build code configured to cause the at least one processor to build a SQL template using the SQL query in the input training data by replacing column and value mentions in the SQL query with typed slots; and The second sampling code is configured to cause the at least one processor to sample an unseen database and fill the typed slots with columns and values ​​from the sampled unseen database to form the target query.

10. The device according to claim 8, characterized in that The computer program code also includes: concatenate code configured to cause the at least one processor to concatenate the target query with an empty context and a schema from the serialization database to generate a first value; and A first user utterance code is configured to cause the at least one processor to input the first value into the SQL-to-text model to generate a first user utterance of an interaction.

11. The device according to claim 8, characterized in that The computer program code also includes: A stop code is configured to cause the at least one processor to populate an utterance from the last round of interaction with a stop interaction symbol, wherein the interaction ends when the SQL-to-text model decodes the stop interaction symbol.

12. The device according to claim 8, characterized in that When the similarity score is above a threshold, determining that the interaction is based on the target query, and maintaining the interaction, and When the similarity score is lower than the threshold, it is determined that the interaction is not based on the target query, and the interaction is filtered out.

13. The device according to claim 8, characterized in that The computer program code also includes: A retraining code is configured to cause the at least one processor to retrain the SQL-to-text model and the text-to-SQL model based on the input training data and the filtered interactions.

14. The device according to claim 8, characterized in that The computer program code also includes: An utterance generation code is configured to cause the at least one processor to generate a next utterance in the interaction using the SQL-to-text model by connecting the target query, the SQL query of the previous round of interaction, the previous utterance in the interaction, and the schema of the serialized database.

15. A non-transitory computer-readable medium storing instructions, characterized in that: When executed by at least one processor of an apparatus for augmenting a multi-pass natural language to structured query language (text-to-SQL) dataset, the instructions cause the at least one processor to execute: generating a structured query language to natural language (SQL-to-text) model to talk to a natural language to structured query language (text-to-SQL) model; Pre-training the SQL-to-text model and the text-to-SQL model based on input training data; sampling structured query language (SQL) queries as target queries for interactions between the SQL-to-text model and the text-to-SQL model; generating the interaction based on the target query, a current utterance, a previous utterance in the interaction, an SQL query from a previous round of interaction, and a serialized database; and The interactions are filtered based on a last round of interactions and the target query, wherein the interactions are retained or filtered out based on a similarity score between the last round of interactions and the target query.

16. The non-transitory computer readable medium of claim 15, wherein: The instructions further cause the at least one processor to execute: constructing a SQL template using the SQL query in the input training data by replacing column and value mentions in the SQL query with typed slots; and An unseen database is sampled, and the typed slots are filled with columns and values ​​from the sampled unseen database to form the target query.

17. The non-transitory computer readable medium of claim 15, wherein: The instructions further cause the at least one processor to execute: concatenating the target query with an empty context and a schema from the serialization database to generate a first value; inputting the first value into the SQL-to-text model to generate a first user utterance of the interaction; as well as The utterance from the last round of interaction is populated with a stop interaction symbol, wherein the interaction ends when the SQL-to-text model decodes the stop interaction symbol.

18. The non-transitory computer readable medium of claim 15, wherein: When the similarity score is above a threshold, determining that the interaction is based on the target query, and maintaining the interaction, and When the similarity score is lower than the threshold, it is determined that the interaction is not based on the target query, and the interaction is filtered out.

19. The non-transitory computer readable medium of claim 16, wherein: The instructions further cause the at least one processor to execute: The SQL-to-text model and the text-to-SQL model are retrained based on the input training data and the filtered interactions.

20. The non-transitory computer readable medium of claim 15, wherein: The instructions further cause the at least one processor to execute: The next utterance in the interaction is generated using the SQL-to-text model by concatenating the target query, the SQL query of the previous round of interaction, the previous utterance in the interaction, and the schema of the serialization database.

Citation Information

Cited By

  • Data retrieval using query generation models

    US12675475B1