Table field recall method and device, equipment and medium

By splicing human query statements and table field information into text sequences and using self-attention and cross-attention calculation methods, the problem of low accuracy and efficiency of existing table field recall methods is solved, and more efficient and accurate table field recall is achieved.

CN119807253APending Publication Date: 2025-04-11WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510002067.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

Existing table field recall methods have low accuracy and low efficiency, especially when considering human query statements and table field context information, there is a lack of effective processing methods.

Method used

By splicing the human query statement and multiple table field information into a text sequence, the word vector is obtained by self-attention calculation, and the matching degree between each table field information and the human query statement is determined through cross-attention calculation.

Benefits of technology

The accuracy and efficiency of table field recall is improved, and the context information of word elements is considered, and multiple word elements are calculated at one time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807253A_ABST
    Figure CN119807253A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of natural language processing, in particular to a pointer table field recall method, device, equipment and medium, in the method, human query statements and multiple pieces of table field information of the same table are spliced into a text sequence, and a lexical element vector of each lexical element in the text sequence is calculated by adopting self-attention; context information of the lexical elements is considered, lexical element vector expression information is richer, multiple lexical elements are calculated at a time, and efficiency is higher; determining a whole sentence semantic vector formed by each lexical element vector corresponding to the human query statement and each lexical element vector corresponding to each piece of table field information; and parallel cross attention calculation is performed on the whole sentence semantic vector and the lexical element vectors corresponding to the multiple pieces of table field information, the matching degree of each piece of table field information and the human query statement is determined, and the accuracy and efficiency of table field recall are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a table field recall method, device, equipment and medium. Background Art

[0002] With the development of artificial intelligence and natural language processing technology, in order to facilitate and quickly query table data, the conversion of human language to structured query language (SQL) has become an increasingly popular research field, generally referred to as text language to structured query language (Text-to-SQL) or natural language to structured query language (NL-to-SQL). In the SQL conversion process, it is first necessary to find the required table fields from a large number of candidate data tables and their fields based on human language, that is, table field recall. The accuracy of this process determines whether the final converted SQL is accurate.

[0003] There are usually two methods for recalling table fields at present: one is to use an embedding model based on a pre-trained natural language processing (Bidirectional Encoder Representations from Transformers, Bert) algorithm to convert human query statements into semantic vectors, and to convert tables and fields into semantic vectors in the same way, and then calculate the vector similarity, and select tables and fields according to the similarity. This method has a low accuracy because it only simply calculates the similarity of two vectors, and the calculation of a single table field semantic vector does not consider the context information of human query statements and table fields; in addition, it only calculates one field at a time, which is inefficient. The other is to use a large language model based on a generative pre-trained transformer (GPT) algorithm, input human query statements and table fields into the large model together, and let the large model select table fields from them in the prompt. This method is prone to generate non-existent table names and field names or output non-table field content due to the hallucination problem of the large language model; in addition, because the GPT algorithm is better at generation tasks and not good at classification tasks, the accuracy is not high.

[0004] Therefore, there is an urgent need for a table field recall method to improve the efficiency and accuracy of table field recall. Summary of the invention

[0005] The present application provides a table field recall method, apparatus, device and medium for improving the efficiency and accuracy of table field recall.

[0006] In a first aspect, the present application provides a table field recall method, the method comprising:

[0007] Concatenate human query statements and multiple table field information of any table into a text sequence;

[0008] Performing self-attention calculation on the text sequence to obtain multiple word element vectors; the multiple word element vectors include each word element vector corresponding to the human query sentence and each word element vector corresponding to each table field information;

[0009] Determining a whole sentence semantic vector of the human query sentence according to each word element vector corresponding to the human query sentence;

[0010] A cross-attention calculation is performed on the whole sentence semantic vector and each word element vector corresponding to the multiple table field information to determine the matching degree between each table field information and the human query sentence.

[0011] In a possible implementation, the step of splicing the human query statement and multiple table field information of any table into a text sequence includes:

[0012] Sequentially concatenate the human query statement and multiple table field information of any table into a text sequence, wherein the human query statement and the first table field information of the multiple table field information are separated by a first separator, and any two adjacent table field information are separated by a second separator;

[0013] After obtaining the multiple word element vectors and before determining the whole sentence semantic vector of the human query sentence, the method further includes:

[0014] Determining, by using the first separator, each word element vector corresponding to the human query sentence from a plurality of word element vectors;

[0015] The word element vectors corresponding to each table field information are determined from the multiple word element vectors by using the second separator.

[0016] In a possible implementation, determining the whole sentence semantic vector of the human query sentence according to each word element vector corresponding to the human query sentence includes:

[0017] The word element vectors corresponding to the human query sentence are summed, or the average value is calculated, or the maximum pooling is performed, or the long short-term memory network algorithm is used for pooling, so as to obtain the whole sentence semantic vector corresponding to the human query sentence.

[0018] In a possible implementation manner, the plurality of table field information includes table information as the first table field information and a plurality of field information in the table; any field information includes a field type;

[0019] Any two adjacent table field information are separated by a second separator, including: the second separator is used between the table information and the first field information of the plurality of field information;

[0020] Use the third separator between every two adjacent fields of information;

[0021] A fourth separator is added before and after any field type.

[0022] In a possible implementation, performing cross attention calculation on the whole sentence semantic vector and each word element vector corresponding to the plurality of table field information respectively includes:

[0023] For any table field information, the whole sentence semantic vector is mapped to a cross-attention query vector Q, and each word element vector corresponding to the table field information is mapped to a key vector K and a value vector V of the cross-attention;

[0024] The representation vector corresponding to the table field information is obtained through the query vector Q, the key vector K and the value vector V.

[0025] In a possible implementation manner, determining the matching degree between each table field information and the human query statement includes:

[0026] For each table field information, a representation vector corresponding to the table field information is mapped to a matching degree between the table field information and the human query statement through a normalization layer, a feedforward neural network layer and a softmax function.

[0027] In a second aspect, the present application provides a table field recall device, the device comprising:

[0028] A concatenation module is used to concatenate a human query statement and multiple table field information of any table into a text sequence; perform self-attention calculation on the text sequence to obtain multiple word element vectors; the multiple word element vectors include each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information; determine the whole sentence semantic vector of the human query statement according to each word element vector corresponding to the human query statement;

[0029] The calculation module is used to perform cross-attention calculation on the whole sentence semantic vector and each word element vector corresponding to the multiple table field information, so as to determine the matching degree between each table field information and the human query sentence.

[0030] In a possible implementation, the splicing module is specifically used to sequentially splice a human query statement and multiple table field information of any table into a text sequence, wherein the human query statement and the first table field information among the multiple table field information are separated by a first separator, and any two adjacent table field information are separated by a second separator; through the first separator, each word element vector corresponding to the human query statement is determined from multiple word element vectors; through the second separator, each word element vector corresponding to each table field information is determined from the multiple word element vectors.

[0031] In a possible implementation, the concatenation module is specifically used to sum the word element vectors corresponding to the human query statement, or calculate the average value or take the maximum pooling, or use the long short-term memory network algorithm for pooling, to obtain the whole sentence semantic vector corresponding to the human query statement.

[0032] In a possible implementation manner, the plurality of table field information includes table information as the first table field information and a plurality of field information in the table; any field information includes a field type;

[0033] The splicing module is specifically used to use a second separator between the table information and the first field information among the multiple field information; use a third separator between every two adjacent field information; and add a fourth separator before and after any field type.

[0034] In a possible implementation, the calculation module is specifically used to map the whole sentence semantic vector into a cross-attention query vector Q for any table field information, and map each word element vector corresponding to the table field information into a key vector K and a value vector V of the cross-attention; through the query vector Q, the key vector K and the value vector V, the representation vector corresponding to the table field information is obtained.

[0035] In a possible implementation, the calculation module is specifically used to map, for each table field information, the representation vector corresponding to the table field information through a normalization layer, a feedforward neural network layer and a softmax function to the matching degree between the table field information and the human query statement.

[0036] In a third aspect, the present application provides an electronic device, which includes at least a processor and a memory, and the processor is used to implement the steps of any method described in the first aspect when executing a computer program stored in the memory.

[0037] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any method described in the first aspect.

[0038] In a fifth aspect, the present application provides a computer program product, comprising: a computer program code, when the computer program code is run on a computer, the computer executes the steps of any method described in the first aspect.

[0039] In an embodiment of the present application, a human query statement and multiple table field information of the same table are spliced ​​into a text sequence, and self-attention is used to calculate the word element vector of each word element in the text sequence; the context information of the word element is taken into account, so that the word element vector expresses richer information, and multiple word elements are calculated at a time, which is more efficient; the whole sentence semantic vector composed of each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information are determined; the whole sentence semantic vector and each word element vector corresponding to the multiple table field information are cross-attention calculated in parallel to determine the matching degree of each table field information with the human query statement, thereby improving the accuracy and efficiency of table field recall. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the implementation methods in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technology descriptions. Obviously, the drawings described below are some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.

[0041] Figure 1 A schematic diagram of a table field recall process provided for some embodiments of the present application;

[0042] Figure 2 A schematic diagram of the structure of a table field recall device provided in some embodiments of the present application;

[0043] Figure 3 A schematic diagram of the structure of an electronic device provided for some embodiments of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solutions and advantages of this application clearer, this application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the embodiments described in this application are only part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0045] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.

[0046] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.

[0047] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0048] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.

[0049] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0050] Before introducing the table field recall method provided in the embodiment of the present application, for ease of understanding, the technical background of the embodiment of the present application is first introduced.

[0051] With the development of artificial intelligence and natural language processing technology, in order to facilitate and quickly query table data, the conversion of human language to structured query language (SQL) has become an increasingly popular research field, generally referred to as text language to structured query language (Text-to-SQL) or natural language to structured query language (NL-to-SQL). In the SQL conversion process, it is first necessary to find the required table fields from a large number of candidate data tables and their fields based on human language, that is, table field recall. The accuracy of this process determines whether the final converted SQL is accurate.

[0052] There are usually two methods for recalling table fields at present: one is to use the embedding model based on the pre-trained natural language processing Bert algorithm to convert human query statements into semantic vectors, and use the same method to convert tables and fields into semantic vectors, and then calculate the vector similarity, and select tables and fields according to the similarity. This method has a low accuracy because it only simply calculates the similarity of two vectors, and the calculation of a single table field semantic vector does not consider the context information of human query statements and table fields; in addition, it only calculates one field at a time, which is inefficient. The other two methods are to use a large language model based on the GPT algorithm, input human query statements and table fields into the large model together, and let the large model select table fields from them in the prompt. This method is prone to generate non-existent table names and field names, or output non-table field content due to the hallucination problem of the large language model; in addition, because the GPT algorithm is better at generation tasks and not good at classification tasks, the accuracy is not high.

[0053] Based on this, in order to improve the efficiency and accuracy of table field recall, the present application provides a table field recall method, device, equipment, medium and computer program product. In this method, a human query statement and multiple table field information of any table are spliced ​​into a text sequence; self-attention calculation is performed on the text sequence to obtain multiple word element vectors; the multiple word element vectors include each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information; according to each word element vector corresponding to the human query statement, the whole sentence semantic vector of the human query statement is determined; the whole sentence semantic vector and each word element vector corresponding to the multiple table field information are cross-attention calculated to determine the matching degree of each table field information with the human query statement.

[0054] Embodiment 1:

[0055] Figure 1 A schematic diagram of a table field recall process provided for some embodiments of the present application, such as Figure 1 As shown, the process includes:

[0056] S101: concatenate a human query statement and multiple table field information of any table into a text sequence.

[0057] The method in the embodiment of the present application is applied to an electronic device, wherein the electronic device may be a PC, a server or other device.

[0058] In the process of converting human language, such as human query statements, into SQL, it is first necessary to find the required table fields from a large number of candidate data tables and their fields based on the human language, that is, table field recall. The accuracy of this process determines whether the final converted SQL is accurate. In order to improve the accuracy and efficiency of table field recall, in an embodiment of the present application, the human query statement and multiple table field information of any table can be spliced ​​into a text sequence to fully integrate the context information of the human query statement and the table field information.

[0059] Among them, the human query statement is a natural language statement, such as "Please extract the total purchase amount of customers in first-tier cities in 2023". The table field information includes a table information such as a table name and multiple field information, that is, the field information contained in the table. The field information may include a field name and a field type, and some field information may also include field value information. For example, the table information is the table name "Transaction Details Table", and the field information includes "Transaction Serial Number (string), Transaction Type (string; Purchase|Refund|Other)", etc., where the transaction serial number is the field name, string is the field type, and some field information such as the field name is the transaction type and the field type is string, and the field value information includes purchase, refund, and other.

[0060] Specifically, in a possible implementation, the input human query statement and all table field information of any table are arranged into a text sequence according to a preset order, and then differentiated according to the order and the number of words.

[0061] In another possible implementation, different tables and field information may be concatenated using specific separators to facilitate subsequent distinction.

[0062] S102: Perform self-attention calculation on the text sequence to obtain multiple word-meta vectors; the multiple word-meta vectors include each word-meta vector corresponding to the human query sentence and each word-meta vector corresponding to each table field information.

[0063] After the human query statement and the table field information are spliced ​​into a text sequence, self-attention calculation can be performed in parallel on each word in the entire text sequence to obtain multiple word-unit semantic vectors, i.e., word-unit vectors. The multiple word-unit vectors include each word-unit vector corresponding to the human query statement and each word-unit vector corresponding to each table field information. The word-unit vector information obtained by the method of splicing text sequences and performing self-attention calculation on the text sequence in the embodiment of the present application is more expressive and has higher conversion efficiency.

[0064] In one possible implementation, a text sequence can be input into a Bert algorithm model, and the self-attention mechanism within the Bert algorithm model can be used to perform self-attention calculations on each word in the entire text sequence in parallel to obtain a dynamic semantic vector of each word that incorporates context information, namely a word vector.

[0065] In an embodiment of the present application, the word-meta segmentation encoding is completed by performing self-attention calculation on the text sequence, and the dynamic semantic vector of each word-meta, i.e., the word-meta vector, is generated. Since the text sequence contains human query statements and all table field information, through the self-attention mechanism of the Bert algorithm itself, such as the bidirectional self-attention mechanism, when calculating the semantic vector of each word-meta, i.e., the word-meta vector, the word-meta of the human query statement and other multiple table field information is used, so that the semantics of the generated word-meta vector is more targeted and more suitable for downstream table field matching calculation. For example, when calculating the "amount" word-meta vector contained in the table field information of "transaction amount", the bidirectional self-attention mechanism of the Bert algorithm will be used to pay attention to the word-meta "total amount" with great correlation in the human query statement "Please extract the total purchase amount of customers in first-tier cities in 2023", and give a greater weight when calculating the word-meta vector self-attention, thereby pulling the distance between the word-meta vector and the word-meta vector of the query statement, and it is easier to obtain a larger value when the matching degree of the table field information and the human query statement is calculated later, thereby improving the accuracy.

[0066] In the embodiment of the present application, the context information of each word is fully considered in the process of converting the word element vector of the human query statement and the table field information. By splicing the human query statement and the table field information into a text sequence, the originally structured table field content is arranged into a character sequence, and spliced ​​with the human query statement into a whole text, and then converted into a table field semantic vector, that is, a word element vector corresponding to the table field information through self-attention calculation, the self-attention mechanism inside Bert can be used for self-attention calculation, and the context information is fully considered in the word element vector conversion, so as to improve the expressiveness and pertinence of the word element vector corresponding to the table field information, and improve the accuracy of subsequent matching.

[0067] S103: Determine a whole sentence semantic vector of the human query sentence according to each word element vector corresponding to the human query sentence.

[0068] After obtaining multiple word element vectors, the entire sentence semantic vector of the human query sentence can be determined according to each word element vector corresponding to the human query sentence.

[0069] Specifically, in a possible implementation, a human query statement can be separated from multiple table field information by a specific separator when concatenating a text sequence. Based on this, after obtaining multiple word element vectors, the word element vectors corresponding to the human query statement can be determined according to the concatenation order of the human query statement and the multiple table field information and the specific separator, and then the whole sentence semantic vector of the human query statement is obtained by performing vector summation on the word element vectors corresponding to the human query statement.

[0070] For example, the word element vectors corresponding to the human query statement are located according to a specific separator, and the word element vectors are obtained and the vectors are summed. For example, there are 8 word elements before the separator "||", namely "please", "extract", "2023", "year", "first-tier", "city", "customer", "of", "purchase", "total", and "amount", which are marked as "token1" to "token8". The word element vectors of these 8 word elements are summed to obtain the semantic vector of the entire sentence of the human query statement "Please extract the total purchase amount of first-tier city customers in 2023".

[0071] Similarly, each table field information can be separated by a specific separator when concatenating text sequences, so as to subsequently locate each word element vector corresponding to the same table field information in multiple word element vectors, and then calculate the matching degree for each word element vector corresponding to each table field information.

[0072] In an embodiment of the present application, specific separators can be used for grouping, the word element vectors of human query sentences can be grouped into one group, and the word element vectors of each table field information can be grouped into one group, which fully considers the context information of each word element, so that the word element vector expresses richer information, and multiple words can be calculated at one time, which is more efficient.

[0073] S104: performing cross-attention calculation on the whole sentence semantic vector and each word element vector corresponding to the plurality of table field information, to determine a matching degree between each table field information and the human query sentence.

[0074] In order to improve the efficiency and accuracy of table field recall, in an embodiment of the present application, the whole sentence semantic vector and the word element vectors corresponding to multiple table field information can be cross-attention calculated in parallel, so as to more accurately and efficiently determine the matching degree between each table field information and the human query statement.

[0075] Through the cross-attention mechanism at the word level, parallel cross-attention calculations can be performed to focus on the connection between each word in the human query statement and the table field information, and the matching degree between the human query statement and each table field information can be calculated more carefully, thereby improving the matching accuracy and efficiency. In addition, the matching degree of multiple table field information can be calculated at the same time. Instead of entering each field separately once, the recall efficiency of the table field is greatly improved, and the matching degree calculation is more detailed and accurate.

[0076] How to more accurately calculate the matching degree between human query statements and each table field is a difficult problem in this technical field. Since the table field information is not a continuous sentence, it includes field name, field type, field value information, etc., and is composed of multiple words with separate meanings. In the embodiment of the present application, the matching degree between each table field information and the human query statement is calculated more carefully by performing word-level cross-attention calculation on each word-element vector of the human query statement and each table field information.

[0077] In an embodiment of the present application, a human query statement and multiple table field information of the same table are spliced ​​into a text sequence, and self-attention is used to calculate the word element vector of each word element in the text sequence; the context information of the word element is taken into account, so that the word element vector expresses richer information, and multiple word elements are calculated at a time, which is more efficient; the whole sentence semantic vector composed of each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information are determined; the whole sentence semantic vector and each word element vector corresponding to the multiple table field information are cross-attention calculated in parallel to determine the matching degree of each table field information with the human query statement, thereby improving the accuracy and efficiency of table field recall.

[0078] Embodiment 2:

[0079] In order to further improve the accuracy and efficiency of table field recall, based on the above embodiments, in the embodiment of the present application, the human query statement and multiple table field information of any table are spliced ​​into a text sequence, including:

[0080] Sequentially concatenate the human query statement and multiple table field information of any table into a text sequence, wherein the human query statement and the first table field information of the multiple table field information are separated by a first separator, and any two adjacent table field information are separated by a second separator;

[0081] After obtaining the multiple word element vectors and before determining the whole sentence semantic vector of the human query sentence, the method further includes:

[0082] Determining, by using the first separator, each word element vector corresponding to the human query sentence from a plurality of word element vectors;

[0083] The word element vectors corresponding to each table field information are determined from the multiple word element vectors by using the second separator.

[0084] In order to further improve the accuracy and efficiency of table field recall, in the process of splicing a human query statement and multiple table field information of any table into a text sequence, in order to facilitate the subsequent rapid and accurate positioning of the word element vector corresponding to the human query statement and each word element vector corresponding to each table field information, the human query statement and the first table field information in the multiple table field information can be separated by a first separator, and any two adjacent table field information can be separated by a second separator. For example, the first separator is "‖" and the second separator is ",". The specific separator can be freely set according to actual needs, and this application does not limit this.

[0085] Based on this, after obtaining multiple word element vectors, the first separator can be used to quickly and accurately determine the word element vectors corresponding to the human query statement from the multiple word element vectors; the second separator can be used to quickly and accurately determine the word element vectors corresponding to each table field information from the multiple word element vectors.

[0086] In the embodiment of the present application, the human query statement and the first table field information in the multiple table field information can be separated by a first separator, and any two adjacent table field information can be separated by a second separator. After obtaining multiple word element vectors, the first separator can be used to quickly and accurately determine the word element vectors corresponding to the human query statement from the multiple word element vectors; the second separator can be used to quickly and accurately determine the word element vectors corresponding to each table field information from the multiple word element vectors. The word element vector corresponding to the human query statement and the word element vector corresponding to each table field information can be quickly and accurately located for subsequent calculations, further improving the accuracy and efficiency of table field recall.

[0087] Embodiment 3:

[0088] In order to further improve the accuracy of table field recall, based on the above embodiments, in the embodiment of the present application, the whole sentence semantic vector of the human query sentence is determined according to each word element vector corresponding to the human query sentence, including:

[0089] The word element vectors corresponding to the human query sentence are summed, or the average value is calculated, or the maximum pooling is performed, or the long short-term memory network algorithm is used for pooling, so as to obtain the whole sentence semantic vector corresponding to the human query sentence.

[0090] In order to determine the whole sentence semantic vector of the human query, in a possible implementation, each word element vector corresponding to the human query may be summed to obtain the whole sentence semantic vector.

[0091] In another possible implementation, the word element vectors corresponding to the human query sentence may be averaged to obtain the semantic vector of the entire sentence.

[0092] In a possible implementation, each word element vector corresponding to the human query sentence may be subjected to maximum pooling or pooling using a long short-term memory network algorithm (Long Short Term Memory, LSTM) to obtain the semantic vector of the entire sentence.

[0093] Specifically, any of the above methods including but not limited to may be adopted according to actual needs, and the ultimate goal is to merge the word element vectors corresponding to the human query sentence into the whole sentence semantic vector.

[0094] In an embodiment of the present application, the word element vectors corresponding to the human query statement can be summed, or the average value or maximum pooling can be calculated, or the long short-term memory network algorithm can be used for pooling to obtain the whole sentence semantic vector corresponding to the human query statement, thereby further improving the accuracy of table field recall.

[0095] Embodiment 4:

[0096] In order to further distinguish each word element vector corresponding to the table field information, on the basis of the above embodiments, in the embodiment of the present application, the multiple table field information includes table information as the first table field information and multiple field information in the table; any field information includes a field type;

[0097] Any two adjacent table field information are separated by a second separator, including: the second separator is used between the table information and the first field information of the plurality of field information;

[0098] Use the third separator between every two adjacent fields of information;

[0099] A fourth separator is added before and after any field type.

[0100] Table field information includes table information such as table name and multiple field information, that is, field information contained in the table. Field information may include field name and field type, and some field information may also include field value information. In order to further distinguish table field information, different table field information and different information within table field information may be separated by specific separators.

[0101] In a possible implementation, any two adjacent table field information are separated by a second separator, and the second separator may be used between the table information and the first field information in the multiple field information. A third separator is used between each two adjacent field information; and a fourth separator is added before and after any field type.

[0102] For example, the first separator is "‖", the second separator is ":", the third separator is "," and the fourth separator is "()". Use "||" to separate human query statements and table field information, use ":" to separate table information and the first field information in multiple field information, use "," to separate different field information, use "()" to separate field types, use "|" to separate different field value information, etc. Specifically, the symbols used for each separator can be freely set according to actual needs, and this application does not limit this.

[0103] For example, the table information, that is, the table name is "Transaction Details Table", and the field information includes "transaction serial number (string), customer ID (string), customer name (string), customer city level (string; first-tier | second-tier | third-tier and below), transaction time (string), transaction type (string; purchase | refund | other), transaction amount (double)", etc., among which the transaction serial number is the field name, string is the field type, and some field information, such as the field name is transaction type, the field type is string, and the field value information includes purchase, refund, and other.

[0104] Let's take a specific example to illustrate. For example, if the human query statement is "Please extract the total purchase amount of customers in first-tier cities in 2023", the table name is "Transaction Details Table", the field name and its field type, field value information include "Transaction Serial Number (string), Customer ID (string), Customer Name (string), Customer City Level (string: first-tier | second-tier | third-tier and below), Transaction Time (string), Transaction Type (string; purchase | refund | other), Transaction Amount (double)", etc., then the concatenated text sequence is "Please extract the total purchase amount of customers in first-tier cities in 2023 || Transaction Details Table: Transaction Serial Number (string), Customer ID (string), Customer Name (string), Customer City Level (string; first-tier | second-tier | third-tier and below), Transaction Time (string), Transaction Type (string; purchase | refund | other), Transaction Amount (double)".

[0105] The tokens corresponding to each table field information are grouped according to specific separators so as to obtain each group of token vectors later. For example, there are three tokens "transaction", "details", and "table" between "||" and ":" in the token sequence, which are marked as "token10" to "token12", indicating the table name "transaction detail table" in the table field information, and they are grouped into one group. Similarly, "," can be used to locate each field information in the table field information, such as "transaction", "type", "(", "string", ":", "purchase", "|", "refund", "|", "other" ")" 11 tokens between two "," are marked as "token31" to "token42", indicating the table field information "transaction type (string; purchase|refund|other)", and they are grouped into one group.

[0106] In the embodiment of the present application, the second separator is used between the table information and the first field information in the multiple field information. The third separator is used between each two adjacent field information. A fourth separator is added before and after any field type, and different table field information and different information within the table field information can be separated by a specific separator, so as to accurately locate each word element vector corresponding to each table field information in the subsequent step, and further improve the efficiency and accuracy of table field recall.

[0107] Embodiment 5:

[0108] In order to further improve the efficiency and accuracy of table field recall, based on the above embodiments, in the embodiment of the present application, the cross-attention calculation of the whole sentence semantic vector and each word element vector corresponding to the plurality of table field information respectively includes:

[0109] For any table field information, the whole sentence semantic vector is mapped to a cross-attention query vector Q, and each word element vector corresponding to the table field information is mapped to a key vector K and a value vector V of the cross-attention;

[0110] The representation vector corresponding to the table field information is obtained through the query vector Q, the key vector K and the value vector V.

[0111] In order to further improve the efficiency and accuracy of table field recall, in the process of cross-attention calculation of the whole sentence semantic vector and the word element vectors corresponding to multiple table field information, for any table field information, the whole sentence semantic vector can be mapped to a cross-attention query vector (Query, Q), and each word element vector corresponding to the table field information can be mapped to a cross-attention key vector (Key, K) and value vector (Value, V); the representation vector corresponding to the table field information is obtained through the query vector Q, the key vector K and the value vector V.

[0112] Specifically, for each word meta-vector corresponding to any table field information, the feature similarity between the word meta-vector and the whole sentence semantic vector is obtained according to the inner product of the query vector Q and the key vector K, and the feature similarity is normalized by the softmax function to obtain the weight ratio of the word meta-vector; according to the weight ratio of each word meta-vector corresponding to the table field information, the value vector V of the corresponding word meta-vector is weighted to obtain the representation vector corresponding to the entire table field information.

[0113] The semantic vector of the whole sentence of the human query and the word vectors corresponding to each table field information are cross-attentionally calculated. The semantic vector of the whole sentence of the human query is used as the query of the attention mechanism, and the word vectors corresponding to the table field information are used as the key and value of the attention mechanism, and the key and value are the same. For example, the table field information "transaction type (string; purchase | refund | other)" corresponds to 11 word vectors, which can be obtained by using Key i and Value i Indicates that the subscript i represents the order of the word vector, with a value of 1 to 11. The calculation process of the attention mechanism is as follows:

[0114] Q=W q *Query

[0115] K i =W k *Key i

[0116] V i =W v *Value i

[0117] e=∑ i softmax(q*k i / m 1 / 2 )*v i

[0118] Among them, W q Represents the Query projection parameter matrix, W k represents the Key projection parameter matrix, W v Represents the Value projection parameter matrix, W q , W k and W v All are obtained by training with historical data; Q is the Query projection vector, K i is the Key projection vector, V i is the Value projection vector, e is the representation vector corresponding to the generated table field information, and m is the dimension of the v vector.

[0119] Since table field information usually contains multiple field value information, sometimes the information is scattered and important information may be diluted, such as "transaction type (string; purchase|refund|other)". If a simple pooling method such as average, maximum value, etc. is used to merge the word element vector into the table field vector, the word element "purchase" that is highly related to the human query sentence "Please extract the total purchase amount of customers in first-tier cities in 2023" will be diluted by other words such as "refund" and "other". The matching degree of the obtained table field vector and the human query sentence vector will be low, thereby reducing the accuracy of table field recall. However, if the cross-attention calculation is performed through the human query sentence vector and each word element vector in the table field information, different weights can be assigned according to the semantic relevance between the human query sentence and each word element vector, thereby highlighting the information of highly relevant words such as "purchase" in this example, and reducing the influence of other low-relevant words, so that the final vector matching degree calculation is more accurate.

[0120] The inner product of the semantic vector of the entire query sentence and each word meta-vector in the table field information is calculated, and the weight of each word meta-vector is obtained through the softmax function. The weighted average of all word meta-vectors of the same table field information is performed to obtain the representation vector corresponding to the table field information. It is then mapped to probability through the normalization layer, feedforward neural network layer and softmax function as the final table field matching degree, which is used to screen table fields for table field recall.

[0121] In a possible implementation, the semantic vector of the entire query sentence of the human being is cross-attended with each word element vector corresponding to a table field information, which can also be extended to a multi-head attention mechanism, that is, multiple groups of W q , W k and W v Cross-attention calculations are performed separately, and then the representation vectors e corresponding to the calculated table field information are concatenated, and then mapped to the probability, that is, the matching degree between the table field information and the human query statement, through the normalization layer, the feedforward neural network layer and the softmax function.

[0122] In an embodiment of the present application, the word meta-vectors corresponding to each table field information are taken as a group, and through the cross-attention mechanism, the whole sentence semantic vector is mapped to the cross-attention query vector. The word meta-vectors of the table field information under the same group are the key vector and the value vector, and the representation vector corresponding to the table field information is calculated, which improves the accuracy of table field recall, and multiple table fields are calculated at the same time, which is more efficient.

[0123] Embodiment 6:

[0124] In order to further improve the efficiency and accuracy of table field recall, based on the above embodiments, in the embodiment of the present application, determining the matching degree between each table field information and the human query statement includes:

[0125] For each table field information, a representation vector corresponding to the table field information is mapped to a matching degree between the table field information and the human query statement through a normalization layer, a feedforward neural network layer and a softmax function.

[0126] In order to further improve the efficiency and accuracy of table field recall, for each table field information, the representation vector corresponding to the table field information is mapped to the matching degree between the table field information and the human query statement through a normalization layer, a feedforward neural network layer and a softmax function.

[0127] Specifically, the normalization layer, feedforward neural network layer and softmax function are used to map to the matching degree, and the calculation process is as follows:

[0128] p=softmax(W o *norm(e))

[0129] Among them, norm is the normalization function, W o is the parameter of the feedforward neural network layer, which is obtained by training with historical data. p is the selection probability, which is used as the matching degree of the final table field information to screen the table fields.

[0130] In a possible implementation, a screening threshold value, such as 0.5, can be set to select table field information with a matching degree higher than the screening threshold value for output. This step can be performed in parallel, and the word element vectors corresponding to multiple different table field information can be processed at the same time to obtain the selection probability, i.e., the matching degree, of each table field information. It should be noted that, in the above embodiment, different separators are used for the table information and the field information in the table field information, and therefore, the matching degree of the table information and the matching degree of each field information can be obtained respectively.

[0131] In the embodiment of the present application, the table field information is converted into the matching degree between the table field information and the human query statement, i.e., the matching probability, through the feedforward neural network layer and the softmax function, and the table field information can be further screened based on the preset threshold. The accuracy of table field recall is improved, and the matching degree of multiple table fields is calculated at the same time, which is more efficient.

[0132] Embodiment 7:

[0133] Based on the same technical concept, on the basis of the above embodiments, in the embodiment of the present application, a table field recall device is provided. Figure 2 A schematic diagram of the structure of a table field recall device provided in some embodiments of the present application. Figure 2 As shown, the device comprises:

[0134] The concatenation module 201 is used to concatenate a human query statement and multiple table field information of any table into a text sequence; perform self-attention calculation on the text sequence to obtain multiple word element vectors; the multiple word element vectors include each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information; determine the whole sentence semantic vector of the human query statement according to each word element vector corresponding to the human query statement;

[0135] The calculation module 202 is used to perform cross-attention calculation on the whole sentence semantic vector and each word element vector corresponding to the multiple table field information, so as to determine the matching degree between each table field information and the human query sentence.

[0136] In a possible implementation, the splicing module 201 is specifically used to sequentially splice a human query statement and multiple table field information of any table into a text sequence, wherein the human query statement and the first table field information among the multiple table field information are separated by a first separator, and any two adjacent table field information are separated by a second separator; through the first separator, each word element vector corresponding to the human query statement is determined from multiple word element vectors; through the second separator, each word element vector corresponding to each table field information is determined from the multiple word element vectors.

[0137] In a possible implementation, the concatenation module 201 is specifically used to sum the word element vectors corresponding to the human query sentence, or calculate the average value or take the maximum pooling, or use the long short-term memory network algorithm for pooling, to obtain the whole sentence semantic vector corresponding to the human query sentence.

[0138] In a possible implementation manner, the plurality of table field information includes table information as the first table field information and a plurality of field information in the table; any field information includes a field type;

[0139] The splicing module 201 is specifically used to use a second separator between the table information and the first field information among the multiple field information; use a third separator between every two adjacent field information; and add a fourth separator before and after any field type.

[0140] In a possible implementation, the calculation module 202 is specifically used to map the whole sentence semantic vector into a cross-attention query vector Q for any table field information, and map each word element vector corresponding to the table field information into a key vector K and a value vector V of the cross-attention; through the query vector Q, the key vector K and the value vector V, the representation vector corresponding to the table field information is obtained.

[0141] In a possible implementation, the calculation module 202 is specifically used to map, for each table field information, the representation vector corresponding to the table field information into a matching degree between the table field information and the human query statement through a normalization layer, a feedforward neural network layer and a softmax function.

[0142] In an embodiment of the present application, a human query statement and multiple table field information of the same table are spliced ​​into a text sequence, and self-attention is used to calculate the word element vector of each word element in the text sequence; the context information of the word element is taken into account, so that the word element vector expresses richer information, and multiple word elements are calculated at a time, which is more efficient; the whole sentence semantic vector composed of each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information are determined; the whole sentence semantic vector and each word element vector corresponding to the multiple table field information are cross-attention calculated in parallel to determine the matching degree of each table field information with the human query statement, thereby improving the accuracy and efficiency of table field recall.

[0143] Embodiment 8:

[0144] Based on the same inventive concept and on the basis of the above embodiments, in an embodiment of the present application, an electronic device is provided, which can implement the functions of the table field recall device mentioned above. Figure 3 A schematic diagram of the structure of an electronic device provided in some embodiments of the present application. Figure 3 As shown, the electronic device includes: a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304;

[0145] The memory 303 stores a computer program. When the program is executed by the processor 301, the processor 301 executes the steps included in the table field recall method in any of the above embodiments.

[0146] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0147] The communication interface 302 is used for communication between the electronic device and other devices.

[0148] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0149] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0150] In an embodiment of the present application, a human query statement and multiple table field information of the same table are spliced ​​into a text sequence, and self-attention is used to calculate the word element vector of each word element in the text sequence; the context information of the word element is taken into account, so that the word element vector expresses richer information, and multiple word elements are calculated at a time, which is more efficient; the whole sentence semantic vector composed of each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information are determined; the whole sentence semantic vector and each word element vector corresponding to the multiple table field information are cross-attention calculated in parallel to determine the matching degree of each table field information with the human query statement, thereby improving the accuracy and efficiency of table field recall.

[0151] Embodiment 9:

[0152] Based on the same inventive concept, on the basis of the above embodiments, in an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program executable by a processor is stored. When the program runs on the processor, the processor implements the steps included in the table field recall method as described in any of the above embodiments.

[0153] The above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in the electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical storage such as CD, DVD, BD, HVD, etc., and semiconductor storage such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD), etc.

[0154] Based on the same inventive concept, the embodiment of the present application also provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes the steps of any of the table field recall methods discussed above. Since the principle of solving the problem by the above computer program product is similar to that of the above table field recall method, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.

[0155] In an embodiment of the present application, a human query statement and multiple table field information of the same table are spliced ​​into a text sequence, and self-attention is used to calculate the word element vector of each word element in the text sequence; the context information of the word element is taken into account, so that the word element vector expresses richer information, and multiple word elements are calculated at a time, which is more efficient; the whole sentence semantic vector composed of each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information are determined; the whole sentence semantic vector and each word element vector corresponding to the multiple table field information are cross-attention calculated in parallel to determine the matching degree of each table field information with the human query statement, thereby improving the accuracy and efficiency of table field recall.

[0156] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0157] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0158] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0159] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0160] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A table field recall method, characterized in that: The method comprises: Concatenate human query statements and multiple table field information of any table into a text sequence; Performing self-attention calculation on the text sequence to obtain multiple word element vectors; the multiple word element vectors include each word element vector corresponding to the human query sentence and each word element vector corresponding to each table field information; Determining a whole sentence semantic vector of the human query sentence according to each word element vector corresponding to the human query sentence; A cross-attention calculation is performed on the whole sentence semantic vector and each word element vector corresponding to the multiple table field information to determine the matching degree between each table field information and the human query sentence.

2. The method according to claim 1, characterized in that The step of splicing the human query statement and multiple table field information of any table into a text sequence includes: Sequentially concatenate the human query statement and multiple table field information of any table into a text sequence, wherein the human query statement and the first table field information of the multiple table field information are separated by a first separator, and any two adjacent table field information are separated by a second separator; After obtaining the multiple word element vectors and before determining the whole sentence semantic vector of the human query sentence, the method further includes: Determining, by using the first separator, each word element vector corresponding to the human query sentence from a plurality of word element vectors; The word element vectors corresponding to each table field information are determined from the multiple word element vectors by using the second separator.

3. The method according to claim 1, characterized in that The determining, according to each word element vector corresponding to the human query sentence, the whole sentence semantic vector of the human query sentence comprises: The word element vectors corresponding to the human query sentence are summed, or the average value is calculated, or the maximum pooling is performed, or the long short-term memory network algorithm is used for pooling, so as to obtain the whole sentence semantic vector corresponding to the human query sentence.

4. The method according to any one of claims 1 to 3, characterized in that The multiple table field information includes table information as first table field information and multiple field information in the table; Any field information includes field type; Any two adjacent table field information are separated by a second separator, including: the second separator is used between the table information and the first field information of the plurality of field information; Use the third separator between every two adjacent fields of information; A fourth separator is added before and after any field type.

5. The method according to any one of claims 1 to 3, characterized in that: The cross-attention calculation of the whole sentence semantic vector and each word element vector corresponding to the plurality of table field information respectively includes: For any table field information, the whole sentence semantic vector is mapped to a cross-attention query vector Q, and each word element vector corresponding to the table field information is mapped to a key vector K and a value vector V of the cross-attention; The representation vector corresponding to the table field information is obtained through the query vector Q, the key vector K and the value vector V.

6. The method according to claim 5, characterized in that Determining the matching degree between each table field information and the human query statement includes: For each table field information, a representation vector corresponding to the table field information is mapped to a matching degree between the table field information and the human query statement through a normalization layer, a feedforward neural network layer and a softmax function.

7. A table field recall device, characterized in that: The device comprises: A concatenation module is used to concatenate a human query statement and multiple table field information of any table into a text sequence; perform self-attention calculation on the text sequence to obtain multiple word element vectors; the multiple word element vectors include each word element vector corresponding to the human query statement and each word element vector corresponding to each table field information; determine the whole sentence semantic vector of the human query statement according to each word element vector corresponding to the human query statement; The calculation module is used to perform cross-attention calculation on the whole sentence semantic vector and each word element vector corresponding to the multiple table field information, so as to determine the matching degree between each table field information and the human query sentence.

8. An electronic device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the steps included in any one of claims 1-6 according to the obtained program instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 6.