Information query method
By generating a query statement generation model using a training sample set, the problem of low accuracy in converting text into query statements was solved, achieving more accurate information retrieval.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIBABA (CHINA) CO LTD
- Filing Date
- 2023-04-17
- Publication Date
- 2026-06-02
Smart Images

Figure CN116595026B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of computer technology, and in particular to an information retrieval method. Background Technology
[0002] With the continuous development of computer technology, tables, as a widely used storage method, are used in various application scenarios, such as insurance and healthcare. When data needs to be retrieved from a table, a query statement is required.
[0003] Currently, methods that enable non-technical personnel to query tabular data have been developed to convert user-input text into corresponding query statements, allowing users to search for tabular data. However, the current method of converting text into corresponding query statements is not very accurate, and a more reliable solution is needed to achieve the text-to-query statement conversion. Summary of the Invention
[0004] In view of this, embodiments of this specification provide an information query method. One or more embodiments of this specification also relate to an information query device, a question-answer query method, a training method for a query statement generation model, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.
[0005] According to a first aspect of the embodiments of this specification, an information query method is provided, including:
[0006] Obtain a query request, wherein the query request contains query text;
[0007] The query text is input into a query statement generation model to obtain the target query statement corresponding to the query text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample expansion tasks. The sample text is obtained by inputting the sample query statements into the text generation model.
[0008] Based on the target query statement, the target information is retrieved from the database.
[0009] According to a second aspect of the embodiments of this specification, an information query device is provided, comprising:
[0010] The acquisition module is configured to acquire a query request, wherein the query request contains query text;
[0011] The input module is configured to input the query text into a query statement generation model to obtain the target query statement corresponding to the query text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample augmentation tasks. The sample text is obtained by inputting the sample query statements into the text generation model.
[0012] The search module is configured to search for target information from the database based on the target query statement.
[0013] According to a third aspect of the embodiments of this specification, a method for training a query statement generation model is provided, applied to a cloud-side device, comprising:
[0014] Extract the target text and the target query statement corresponding to the target text from the sample set, wherein the target text is any sample text in the sample set;
[0015] The target text is input into the query statement generation model to obtain the predicted query statement;
[0016] Based on the predicted query statement and the target query statement, calculate the statement loss value;
[0017] The model parameters of the query statement generation model are adjusted based on the statement loss value until the model training stopping condition is met, and the trained query statement generation model is obtained.
[0018] The model parameters of the model generated by the query statement are sent to the end device.
[0019] According to a fourth aspect of the embodiments of this specification, a method for querying question answers is provided, including:
[0020] Obtain an answer query request for a question, wherein the answer query request contains the question text;
[0021] The question text is input into the query statement generation model to obtain the question answer query statement corresponding to the question text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample expansion tasks. The sample text is obtained by inputting the sample query statements into the text generation model.
[0022] Based on the question-answer query statement, the answer to the question is retrieved from the database.
[0023] According to a fifth aspect of the embodiments of this specification, a computing device is provided, comprising:
[0024] Memory and processor;
[0025] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the above-described information query method.
[0026] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the above-described information query method.
[0027] According to a seventh aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described information query method.
[0028] One embodiment of this specification implements obtaining a query request, wherein the query request includes query text; inputting the query text into a query statement generation model to obtain a target query statement corresponding to the query text, wherein the query statement generation model is trained based on a sample set, the sample set includes sample text and sample query statements, the sample query statements are collected based on different sample augmentation tasks, and the sample text is obtained by inputting the sample query statements into the text generation model; based on the target query statement, target information is searched from the database.
[0029] The information retrieval method described in this manual involves inputting the query text into a query statement generation model trained on a sample set to generate a target query statement. Since the sample set is obtained based on a sample augmentation task and a text generation model, the target query statement generated by the query statement generation model trained on a sample set containing rich sample data has higher accuracy. Consequently, the target information obtained based on the target query statement is more accurate. Attached Figure Description
[0030] Figure 1 This is a flowchart illustrating a training sample set generation method provided in one embodiment of this specification;
[0031] Figure 2 This is a flowchart illustrating an information query method provided in one embodiment of this specification;
[0032] Figure 3 This is a flowchart illustrating a training method for a query statement generation model provided in one embodiment of this specification;
[0033] Figure 4 This is a flowchart illustrating a question-answer query method provided in one embodiment of this specification;
[0034] Figure 5This is a flowchart illustrating the processing procedure of an information query method provided in one embodiment of this specification;
[0035] Figure 6 This is a schematic diagram of the structure of an information query device provided in one embodiment of this specification;
[0036] Figure 7 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0037] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0038] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0039] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0040] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0041] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0042] SQL: Structured Query Language.
[0043] Text-To-SQL: Transforms natural language into SQL query statements.
[0044] SQL-To-Text: Converts SQL query statements into natural language.
[0045] SQL-AST: The syntax structure tree corresponding to SQL.
[0046] Fine-tuning: Fine-tuning the parameters of a trained model based on new data.
[0047] Tables are a widely used storage method for storing and displaying structured data. Due to their clear data structure, ease of maintenance, and high timeliness, tables are frequently used to store large amounts of high-value data in industries such as finance, insurance, and healthcare, forming large-scale databases. Semantic parsing technology for tables can quickly adapt to databases, allowing users to automatically obtain answers from the database simply by asking natural language questions, significantly improving the efficiency and experience of database interaction. Text-to-SQL, a technology that converts natural language into queryable SQL statements, has therefore gained widespread attention in the database field.
[0048] Text-to-SQL models need to accurately understand natural language questions posed by users and make precise inferences to find answers within structured tables based on specific requirements. However, in real-world applications, Text-to-SQL models encounter various challenges, such as three prominent ones: domain generalization, combinatorial generalization, and data hunger. Domain generalization refers to training data originating from certain specific domains while test data comes from newer domains; combinatorial generalization refers to the ability of Text-to-SQL models to extend to combinations of elements observed during training; and data hunger refers to the need for neural network models to obtain large amounts of labeled data to achieve higher accuracy.
[0049] To address the aforementioned issues, this specification proposes a solution based on the dual learning approach of Text-to-SQL and SQL-to-Text. This approach automatically samples a large number of task-driven SQL statements and generates corresponding natural language questions, resulting in a wealth of high-quality...<Text,SQL> We continuously enhance the capabilities of Text-to-SQL and SQL-to-Text models based on data.
[0050] This specification provides an information query method, and also relates to an information query device, a question-answer query method, a query statement generation model training method, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0051] See Figure 1 , Figure 1 A flowchart illustrating a training sample set generation method according to an embodiment of this specification is shown, specifically including:
[0052] 1. Obtain labeled sample data from the training sample set; specifically, obtain sample text with query statement labels and query statements with text labels; train the query statement text model based on the sample text with query statement labels, and train the text-to-query statement model based on the query statements with text labels.
[0053] 2. Input the actual query statements collected based on the sampling template into the trained query statement-to-text model to obtain the predicted text corresponding to the actual query statements generated by the model.
[0054] 3. Based on the predicted text and the corresponding metadata, a text-to-query statement model is trained, and the predicted query statement, i.e., the predicted SQL statement, is obtained from the model output.
[0055] 4. Compare the actual query statement with the predicted query statement. If the actual query statement matches the predicted query statement, add the actual query statement and the predicted text as training samples to the training sample set; if the actual query statement does not match the predicted query statement, discard the data.
[0056] Repeat the training steps 1-4 above until the number of samples in the training sample set meets the requirements. Then, the current text-to-query model can be used as the completed query generation model. Furthermore, the generated training sample set can be used to train other untrained query generation models, thereby improving the training effect of the model by enriching the content of the sample set.
[0057] One embodiment of this specification implements obtaining a query request, wherein the query request includes query text; inputting the query text into a query statement generation model to obtain a target query statement corresponding to the query text, wherein the query statement generation model is trained based on a sample set, the sample set includes sample text and sample query statements, the sample query statements are collected based on different sample augmentation tasks, and the sample text is obtained by inputting the sample query statements into the text generation model; based on the target query statement, target information is searched from the database.
[0058] The information retrieval method described in this manual involves inputting the query text into a query statement generation model trained on a sample set to generate a target query statement. Since the sample set is obtained based on a sample augmentation task and a text generation model, the target query statement generated by the query statement generation model trained on a sample set containing rich sample data has higher accuracy. Consequently, the target information obtained based on the target query statement is more accurate.
[0059] See Figure 2 , Figure 2 A flowchart of an information query method according to an embodiment of this specification is shown, which specifically includes the following steps.
[0060] Step 202: Obtain a query request, wherein the query request contains query text.
[0061] A query request is a request to find target information corresponding to text in a database. The query request contains query text, which can be text entered by the user or generated by other tasks. For example, the query text is the text entered by the user: "How many students are in the first grade?"
[0062] Specifically, the terminal generates a query request based on the user's operation of sending query text, wherein the query request contains the query text entered by the user; or the terminal generates a query request based on the user's operation of selecting query text from the query text prompted by the terminal, wherein the query request contains the query text selected by the user.
[0063] In one specific embodiment of this specification, the user enters the query text "What is the total number of students in the first grade?" in a dialog box provided by the terminal; the terminal generates a query request based on the query text entered by the user, and the query request includes the query text "What is the total number of students in the first grade?".
[0064] By obtaining a query request containing the query text, the corresponding query results can be obtained subsequently based on the query text.
[0065] Step 204: Input the query text into the query statement generation model to obtain the target query statement corresponding to the query text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample expansion tasks. The sample text is obtained by inputting the sample query statements into the text generation model.
[0066] In practical applications, after obtaining the query request, the query request is parsed to obtain the query text, so that subsequent steps can be executed based on the query text.
[0067] Among them, the query statement generation model refers to a neural network model that can output a computer-executable query statement based on the input query text; for example, the query statement generation model can output the query statement "SELECT name, person ID FROM student table" based on the input text "find names and person IDs in the student table"; the target query statement refers to the statement that the computer can use to retrieve information from the database; the sample expansion task refers to the task of expanding the sample query statements in the sample set. In practical applications, the sample expansion task can be an expansion task in three dimensions: data domain, query statement form, and data quantity; specifically, the sample expansion task in data domain expansion refers to obtaining sample query thresholds in unexplored domains, that is, obtaining sample query statements from domain 3 when sample query statements from domain 1 and domain 2 are included; the sample expansion task in data quantity expansion refers to obtaining a larger number of sample query statements in the database; the sample expansion task in query statement form expansion refers to obtaining sample query statements with more query statement forms.
[0068] Specifically, the query request is parsed to determine the query text. If the data metadata corresponding to the query text can be directly determined (e.g., the query scenario contains only one data table, so all data is queried from this table), then only the query text needs to be obtained. If the data source information for the query text cannot be directly determined, then both the query text and its corresponding data metadata need to be obtained. The query text, or the query text and its data metadata, is then input into a pre-trained query statement generation model to obtain the target query statement output by the model. Before inputting the query text into the query statement generation model, the model needs to be trained based on a sample set. Specifically: sample query statements are collected based on different sample expansion tasks, and each sample query statement is input into the text generation model to obtain the sample text corresponding to each sample query statement output by the model. The text generation model can output the corresponding query text based on the input query statement. A sample set is constructed based on the sample query statements and their corresponding sample texts, and the query statement generation model is then trained based on this sample set.
[0069] In one specific embodiment of this specification, the received query request is parsed to determine the query text; a pre-trained query statement generation model is obtained; the query text is input into the query statement generation model to obtain the target query statement output by the query statement generation model; wherein, the query statement generation model is trained based on a sample set, the sample set containing sample text and sample query statements, the sample query statements being collected based on different sample expansion tasks, and the sample text being obtained by inputting the sample query statements into the text generation model.
[0070] By inputting the query text into a sample set generated by a sample augmentation task and a text generation model, a query statement generation model is trained to obtain the target query statement. Since the sample data is augmented in different dimensions based on the sample augmentation task and the text generation model, the trained query statement generation model outputs a target query statement with high accuracy, which in turn facilitates the improvement of the query accuracy of subsequent information queries based on the target query statement.
[0071] In practical applications, in order to ensure the accuracy of the query statement generated based on the query text, it is also necessary to input both the data element information and the query text into the query statement generation model to realize the generation of the query statement.
[0072] Specifically, the query request also includes data metadata corresponding to the query text;
[0073] The method for generating a model by inputting the query text into a query statement may include:
[0074] By concatenating the query text and the data metadata, a query sequence is obtained;
[0075] The query sequence is input into the query statement to generate the model.
[0076] Among them, data metadata refers to the location of the information that the query text seeks to find. For example, if the query text seeks the number of students, the data metadata could be a student information table. The query sequence refers to the sequence obtained by concatenating the query text and the corresponding data metadata. The concatenated query sequence is then input into the query statement generation model.
[0077] In one specific embodiment of this specification, the query request is parsed to obtain the query text "total number of first-grade students" and the data element information "student information table a"; the query text and the data element information are concatenated to obtain the query sequence; and the query sequence is input into the query statement generation model.
[0078] By concatenating the query text and the query statement position information, a query sequence is obtained. The query sequence is then input into the query statement generation model, which facilitates the subsequent generation of the query statement corresponding to the query text based on the query sequence, thereby improving the accuracy of the query statement.
[0079] In practical applications, in order for the query statement generation model to output query statements based on the input query text and data metadata, it is usually necessary to train the model based on sample texts carrying query statement labels in the sample set. That is, the sample texts carrying query statement labels are input into the query statement generation model to obtain the predicted query statements output by the model. The loss value is calculated based on the predicted query statements and query statement labels, thereby adjusting the model parameters of the query statement generation model.
[0080] However, the above methods require a certain number of sample texts carrying query statement tags; however, the generation efficiency of sample texts with tags is low, the generation cost is high, and the domain scope of sample texts or query statement tags is relatively limited. Therefore, the solution in this specification extracts easily obtainable sample query statements, generates sample texts based on the sample query statements and the text generation model, and thus the model can be trained based on the generated sample texts and the corresponding sample query statements.
[0081] Specifically, before inputting the query text into the query statement to generate the model, the process also includes:
[0082] Extract the target text and the target query statement corresponding to the target text from the sample set, wherein the target text is any sample text in the sample set;
[0083] The target text is input into the query statement generation model to obtain the predicted query statement;
[0084] Based on the predicted query statement and the target query statement, calculate the statement loss value;
[0085] The model parameters of the query statement generation model are adjusted based on the loss value of the statement until the model training stops, thus obtaining a trained query statement generation model.
[0086] The sample set is generated from sample texts and sample query statements collected by different sample augmentation tasks and text generation models; the query statement model can be a pre-trained model that already has the function of outputting query statements based on text; the target text is any sample text extracted from the sample set, and the target query statement refers to the query statement corresponding to the target text in the sample set; the predicted query statement refers to the query statement output by the query statement generation model based on the target text and the corresponding data metadata; the statement loss value refers to the loss value calculated by predicting the query statement and the target query statement.
[0087] Specifically, target text is selected from the sample set, and the corresponding metadata is obtained; the target text and metadata are concatenated to obtain a query sequence; the query sequence is input into the query statement generation model to obtain the predicted query statement output by the model; the statement loss value is calculated based on the predicted query statement and the target query statement; the model parameters of the query statement generation model are adjusted according to the statement loss value; sample text is obtained from the sample set to further train the query statement generation model, and the above steps are repeated until the model training stopping condition is met to obtain the trained query statement generation model.
[0088] In one specific embodiment of this specification, text A and its corresponding query statement S are selected from the sample set; text A and its corresponding text location information "student table" are concatenated to obtain a query sequence; the query sequence is input into the query statement generation model to obtain the predicted query statement output by the model; the statement loss value is calculated based on the predicted query statement and the query statement S; the model parameters of the query statement generation model are adjusted based on the statement loss value; the above steps are repeated until the query statement generation model is trained based on each text in the sample set, and a trained query statement generation model is obtained.
[0089] By training the query statement model with a sample set containing rich sample content, the accuracy of the query statement model in generating query statements can be improved.
[0090] In practical applications, before training the query statement generation model based on the sample set, it is necessary to sample sample text and sample query statements based on different sample expansion tasks and text generation models to construct the sample set.
[0091] Specifically, before extracting the target text and the corresponding target query statement from the sample set, the process also includes:
[0092] Determine the target sample expansion task and the target statement sampling template corresponding to the target sample expansion task;
[0093] Based on the target statement sampling template, multiple sample query statements are read from the query statement database;
[0094] Each sample query statement is input into the text generation model to obtain the sample text corresponding to each sample query statement.
[0095] A sample set is formed based on the multiple sample query statements and the sample text corresponding to each sample query statement.
[0096] Among them, the target sample expansion task refers to one of the tasks of expanding the sample query statement; the target statement sampling template refers to the sampling template used to execute the target sample expansion task; the query statement database refers to a database that stores query statements. In practical applications, the query statements in the query statement database can be generated in historical tasks, entered by developers, etc.; the sample query statement refers to the query statement read from the query statement database; the sample text refers to the text output by the text generation model based on the sample query statement; the text generation model refers to a model that can generate corresponding text from the input query statement. For example, based on the query statement "SELECT name, person identifier FROM student table", the output sample text "find the name and person identifier in the student table".
[0097] Specifically, in response to a sample expansion request for the sample set, the target sample expansion task is determined; the target statement sampling template corresponding to the target sample expansion task is obtained; query statements that match the template are collected from the query statement database according to the target statement sampling template, and used as sample query statements; each of the obtained sample query statements is input into the text generation model to obtain the sample text corresponding to each sample query statement; sample pairs are generated based on the sample text and the sample query statements corresponding to the sample text; and a sample set is constructed based on the generated sample pairs.
[0098] In one specific embodiment of this specification, a target sample expansion task is determined based on the sample expansion request; a target statement sampling template corresponding to the target sample expansion task is obtained; according to the sampling rules set in the target statement sampling template, query statements are sampled from the query statement library as target query statements; the sampled target query statements are input into a pre-trained text generation model to obtain sample text corresponding to each target query statement; and a sample set is constructed based on the sampled sample query statements.
[0099] By expanding the target sample to include the target statement sampling template corresponding to the target sample, the target query statement is obtained from the query statement database, thereby enriching the query statements in the sample set. Based on the text generation model, the sample query statements are converted into sample text, thereby enriching the text corresponding to the query statements and improving the efficiency of generating sample text.
[0100] In practical applications, the sample set obtained based on the above method can be used to train the query statement generation model. However, in order to further improve the sample quality in the sample set, the sample text can be further verified based on the trained query statement generation model, and then more accurate sample data can be added to the sample set.
[0101] Specifically, the method for constructing a sample set based on the multiple sample query statements and the sample text corresponding to each sample query statement may include:
[0102] Input each sample text and its corresponding metadata into a preset query statement to generate a model and obtain the predicted query statement for each sample text.
[0103] Determine the target prediction query statement and the corresponding sample query statement;
[0104] If the predicted query statement is consistent with the sample query statement, a sample set is constructed based on the target predicted query statement and the sample text corresponding to the target predicted query statement.
[0105] Among them, the preset query statement generation model refers to a model that can generate corresponding query statements from input text; in practical applications, the preset query statement model can be trained based on a small amount of sample data already available in the sample set to enable it to have the required processing functions; the target predicted query statement refers to any query statement output by the preset query statement generation model.
[0106] Specifically, the sample text output by the text generation model is concatenated with its corresponding data metadata to obtain a query sequence; each query sequence is input into a preset query statement generation model to obtain the predicted query statement output by the model; each predicted query statement is compared with its corresponding target query statement. If the comparison is consistent, it can be determined that the target sample text corresponding to the target query statement is correct. Therefore, the sample set can be expanded based on this target query statement and target sample text.
[0107] Further, repeat the above steps, adding matching query statements and their corresponding texts to the sample set until the number of samples in the sample set meets the preset requirements. At this point, the preset query statement generation model has completed training during the above iteration process, and therefore can be used as the trained model. The generated sample set can be used to train other untrained query statement generation models.
[0108] In a specific embodiment of this specification, sample text 'a' output by the text generation model is obtained; sample text 'a' and its corresponding data element information are concatenated to obtain a query sequence; the query sequence is input into a preset query statement generation model to obtain the predicted query statement output by the model; the predicted query statement is compared with the target query statement corresponding to sample text 'a'; if they match, sample text 'a' and the target query statement are added to the sample set; if they do not match, sample text 'a' and the corresponding target query statement are deleted.
[0109] By using a model to generate a pre-defined query statement, a predicted query statement is obtained. Then, based on the comparison between the pre-defined query statement and the target query statement, more accurate sample texts and corresponding query statements are selected and added to the sample set, thereby improving the sample set instructions and thus improving the quality of the query statement generation model trained on the sample set.
[0110] To improve the completeness and accuracy of query sampling, query statements can be sampled by obtaining the statement framework and then obtaining the specific content of the statement based on the framework.
[0111] Specifically, a method for reading multiple sample query statements from a query statement database based on the target statement sampling template may include:
[0112] Based on the query statement specifications, generate preset sampling rules;
[0113] Based on the preset sampling rules, obtain the query statement framework;
[0114] The query statement content is collected according to the query statement framework, and a sample query statement is generated based on the query statement framework and the query statement content.
[0115] Among them, query statement specifications refer to the specifications that query statements must meet; preset sampling rules refer to rules generated based on query statement specifications, such as "min and max aggregate functions can only be combined with numeric and date type columns, and cannot be combined with text type columns" and "the sub-parts corresponding to the ORDER BY clause must not contain duplicate content"; query statement framework refers to the statement structure tree corresponding to the query statement, for example, the statement framework is a structure tree composed of query statement clauses, column names in the database, etc.; query statement content refers to the content of each node in the structure tree, such as the aggregate function corresponding to column sampling, the ascending 0 order and descending order type of the sampled ORDER BY clause, etc.; adding the query statement content into the query statement framework yields the complete query statement tree; converting the query statement tree into a character sequence, i.e., the sample query statement.
[0116] By sampling the query statement framework based on preset sampling rules, and then obtaining the query statement content based on the query statement framework, a complete sample query statement is obtained, thereby improving the completeness and accuracy of the query statement sampling, and making it easier to use the correct query statement for model training.
[0117] In practical applications, the sample set can be expanded from different levels, that is, the sample set can be expanded based on different sample expansion tasks, thereby enriching the sample content in the sample set and making it easier to train a query statement generation model with high accuracy based on the sample set.
[0118] Specifically, before reading multiple sample query statements from the query statement database based on the target statement sampling template, the process also includes:
[0119] Determine the historical database and historical query templates based on historical sample data;
[0120] Accordingly, based on the target statement sampling template, multiple sample query statements are read from the query statement database, including at least one of the following steps:
[0121] Based on the historical query template, multiple sample query statements are read from databases in various fields;
[0122] A new query statement template is generated based on the historical query statement template, and multiple sample query statements are read from the historical database based on the new query statement template.
[0123] Based on the historical sample data and the historical query statement template, obtain multiple sample query statements that are different from the historical sample data from the historical database.
[0124] Among them, historical sample data refers to the sample data used in the process of pre-training the query statement generation model. This sample data includes pre-trained sample text and corresponding pre-trained sample query statements; historical database refers to a database containing sample data; and historical query statement template refers to a template for obtaining pre-trained sample query statements.
[0125] Specifically, when the target sample expansion task is to expand the domain of the sample data, i.e., to obtain sample data from different domains, sample query statements that have not been obtained before can be sampled from the databases of each domain based on historical query templates; when the target sample expansion task is to expand the form of the query statement, new query statement templates can be generated based on historical query templates; when the target sample expansion task is to expand the number of sample data, sample data that is inconsistent with the historical sample data can be obtained from the historical sample database based on historical query templates as data expansion of the sample set.
[0126] In a specific embodiment of this specification, a historical database m and a historical query statement template n are determined based on historical sample data; if the sample expansion task is determined to be expanding the sample data domain, then sample query statements are obtained from databases in different domains such as domain database 1 and domain database 2 based on the historical query statement template n.
[0127] In another specific embodiment of this specification, a historical database m and a historical query statement template n are determined based on historical sample data; the sample expansion task is determined to be expanding the form of sample query statements, and a new query template n1 is generated based on the historical query statement template n; based on the new query template n1, sample query statements are obtained from the historical database m.
[0128] In another specific embodiment of this specification, a historical database m and a historical query statement template n are determined based on historical sample data; if the sample expansion task is determined to be expanding the number of samples, then based on the historical sample data and the historical query statement template n, a query statement different from the historical sample data is obtained from the historical database m and used as a new sample query statement.
[0129] By expanding the sample query statements in different ways based on different types of expansion tasks, the content of the sample set is enriched, which facilitates the training of a query statement generation model with higher accuracy based on the sample set.
[0130] Step 206: Based on the target query statement, retrieve the target information from the database.
[0131] Among them, target information refers to the query results obtained by querying based on the target query statement.
[0132] Specifically, the system obtains the target query statement output by the query statement generation model; if the user's requirement is to obtain the query statement, the target query statement is returned to the user; if the user's requirement is to obtain the query result, the system performs a query in the corresponding database based on the target query statement, obtains the query result, and then returns the query result to the user.
[0133] In a specific embodiment of this specification, the query statement output by the query statement generation model is determined to be "SELECT Department, COUNT(Department) FROM Students GROUP BY Department", which means counting the number of students in each department. Based on the query statement, the database is searched to obtain the target information: 100 students in the Mathematics Department and 100 students in the Physics Department.
[0134] By generating the target query statement based on the query statement and outputting the model, the query results are obtained, thus improving the accuracy of the query results.
[0135] One embodiment of this specification implements obtaining a query request, wherein the query request includes query text; inputting the query text into a query statement generation model to obtain a target query statement corresponding to the query text, wherein the query statement generation model is trained based on a sample set, the sample set includes sample text and sample query statements, the sample query statements are collected based on different sample augmentation tasks, and the sample text is obtained by inputting the sample query statements into the text generation model; based on the target query statement, target information is searched from the database.
[0136] The information retrieval method described in this manual involves inputting the query text into a query statement generation model trained on a sample set to generate a target query statement. Since the sample set is obtained based on a sample augmentation task and a text generation model, the target query statement generated by the query statement generation model trained on a sample set containing rich sample data has higher accuracy. Consequently, the target information obtained based on the target query statement is more accurate.
[0137] See Figure 3 , Figure 3 The flowchart illustrates a training method for a query statement generation model according to an embodiment of this specification, applied to a cloud-side device, and specifically includes the following steps:
[0138] Step 302: Extract the target text and the target query statement corresponding to the target text from the sample set, wherein the target text is any sample text in the sample set.
[0139] Specifically, before extracting the target text and the corresponding target query statement from the sample set, the process also includes:
[0140] Determine the target sample expansion task and the target statement sampling template corresponding to the target sample expansion task; based on the target statement sampling template, read multiple sample query statements from the query statement database; input each sample query statement into the text generation model to obtain the sample text corresponding to each sample query statement; based on the multiple sample query statements and the sample text corresponding to each sample query statement, construct a sample set.
[0141] Further, based on the multiple sample query statements and the sample text corresponding to each sample query statement, a sample set is constructed, including: inputting each sample text and the data element information corresponding to each sample text into a preset query statement generation model to obtain the predicted query statement corresponding to each sample text; determining the target predicted query statement and the sample query statement corresponding to the target predicted query statement; and, if the predicted query statement is consistent with the sample query statement, constructing the sample set based on the target predicted query statement and the sample text corresponding to the target predicted query statement.
[0142] By generating a sample set containing rich sample data on cloud-side devices, it is easier to train the model based on the sample set in the future.
[0143] Step 304: Input the target text into the query statement generation model to obtain the predicted query statement.
[0144] Specifically, the target text and its metadata can be input into the query statement to generate a model and obtain a predicted query statement.
[0145] Step 306: Calculate the statement loss value based on the predicted query statement and the target query statement.
[0146] Step 308: Adjust the model parameters of the query statement generation model according to the statement loss value until the model training stopping condition is met, and obtain the trained query statement generation model.
[0147] Step 310: Send the model parameters of the query statement to the end device.
[0148] Specifically, upon receiving a model retrieval request from the edge device, the system responds to the request by determining the model parameters for generating the model using the query statement; the model parameters are then returned to the edge device, thereby enabling model training and application on the cloud device, avoiding the occupation of the edge device's computing resources, and improving the efficiency of model application and training.
[0149] The training method for the query statement generation model described in this specification involves extracting target text and corresponding target query statements from a sample set, wherein the target text is any sample text in the sample set; inputting the target text into the query statement generation model to obtain a predicted query statement; calculating a statement loss value based on the predicted query statement and the target query statement; adjusting the model parameters of the query statement generation model according to the statement loss value until the model training stops, thus obtaining a trained query statement generation model; and sending the model parameters of the query statement generation model to the edge device. This achieves model training and application on the cloud device, avoiding the occupation of the edge device's computing resources and improving the efficiency of model application and training.
[0150] See Figure 4 , Figure 4 A flowchart of a question-answer lookup method according to an embodiment of this specification is shown, which specifically includes the following steps:
[0151] Step 402: Obtain an answer query request for the question, wherein the answer query request contains the question text.
[0152] Specifically, the question text could be "the total number of first-grade students".
[0153] Step 404: Input the question text into the query statement generation model to obtain the question answer query statement corresponding to the question text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample expansion tasks. The sample text is obtained by inputting the sample query statements into the text generation model.
[0154] Step 406: Based on the question-answer query statement, search for the question answer in the database.
[0155] Specifically, the answer to the question is "30 people".
[0156] Furthermore, after retrieving the answer to the question from the database, it may also include:
[0157] Send the answer to the question to the user; receive feedback from the user regarding the answer to the question; adjust the query generation model based on the feedback.
[0158] The feedback information refers to the feedback on the answer to the question. Since the query results may be deviated in actual applications, the query generation model can be fine-tuned based on the user's feedback information.
[0159] The question-answer query method described in this specification involves obtaining an answer query request for a question, wherein the answer query request includes the question text; inputting the question text into a query statement generation model to obtain a question-answer query statement corresponding to the question text, wherein the query statement generation model is trained based on a sample set, the sample set including sample text and sample query statements, the sample query statements being collected based on different sample augmentation tasks, and the sample text being obtained by inputting the sample query statements into a text generation model; and searching for the question answer from a database based on the question-answer query statement.
[0160] By inputting the question text into the query statement generation model trained on the sample set, a question answer query statement is generated. Since the sample set is obtained based on the sample expansion task and the text generation model, the query statement generation model trained on the sample set containing rich sample data has higher accuracy in generating question answer query statements; thus, the question answer obtained based on the question answer query statement is more accurate.
[0161] The following is in conjunction with the appendix Figure 5 Taking the application of the information retrieval method provided in this specification to text as an example, the information retrieval method will be further explained. Among other things, Figure 5 The present specification shows a flowchart of an information query method according to an embodiment, which includes the following steps.
[0162] Step 502: Determine the target sample expansion task and the target statement sampling template corresponding to the target sample expansion task.
[0163] Step 504: Based on the target statement sampling template, read multiple sample query statements from the query statement database.
[0164] Step 506: Input each sample query statement into the text generation model to obtain the sample text corresponding to each sample query statement.
[0165] Step 508: Input each sample text and the corresponding data element information into the preset query statement to generate the model and obtain the predicted query statement corresponding to each sample text.
[0166] Step 510: Determine the target prediction query statement and the corresponding sample query statement.
[0167] Step 512: If the predicted query statement is consistent with the sample query statement, construct a sample set based on the target predicted query statement and the sample text corresponding to the target predicted query statement.
[0168] Specifically, once the sample set is constructed, a preset query statement generation model can be used as the trained query statement generation model. The generated sample set can be used to train other query statement generation models. The specific training process may include: extracting target text and the target query statement corresponding to the target text from the sample set, wherein the target text is any sample text in the sample set; inputting the target text and the corresponding metadata into the query statement generation model to obtain a predicted query statement; calculating the statement loss value based on the predicted query statement and the target query statement; adjusting the model parameters of the query statement generation model according to the statement loss value until the model training stopping condition is met, thereby obtaining a trained query statement generation model.
[0169] Step 514: Obtain a query request, wherein the query request contains query text;
[0170] Step 516: Input the query text into the query statement generation model to obtain the target query statement corresponding to the query text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample expansion tasks. The sample text is obtained by inputting the sample query statements into the text generation model.
[0171] Step 518: Based on the target query statement, retrieve the target information from the database.
[0172] One embodiment of this specification implements obtaining a query request, wherein the query request includes query text; inputting the query text into a query statement generation model to obtain a target query statement corresponding to the query text, wherein the query statement generation model is trained based on a sample set, the sample set includes sample text and sample query statements, the sample query statements are collected based on different sample augmentation tasks, and the sample text is obtained by inputting the sample query statements into the text generation model; based on the target query statement, target information is searched from the database.
[0173] The information retrieval method described in this manual involves inputting the query text into a query statement generation model trained on a sample set to generate a target query statement. Since the sample set is obtained based on a sample augmentation task and a text generation model, the target query statement generated by the query statement generation model trained on a sample set containing rich sample data has higher accuracy. Consequently, the target information obtained based on the target query statement is more accurate.
[0174] Corresponding to the above method embodiments, this specification also provides embodiments of an information query device. Figure 6A schematic diagram of an information query device according to one embodiment of this specification is shown. Figure 6 As shown, the device includes:
[0175] The acquisition module 602 is configured to acquire a query request, wherein the query request contains query text;
[0176] Input module 604 is configured to input the query text into a query statement generation model to obtain the target query statement corresponding to the query text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample augmentation tasks. The sample text is obtained by inputting the sample query statements into the text generation model.
[0177] The search module 606 is configured to search for target information from the database based on the target query statement.
[0178] In one specific embodiment of this specification, the device further includes a training module, configured as follows:
[0179] Extract the target text and the target query statement corresponding to the target text from the sample set, wherein the target text is any sample text in the sample set;
[0180] The target text is input into the query statement generation model to obtain the predicted query statement;
[0181] Based on the predicted query statement and the target query statement, calculate the statement loss value;
[0182] The model parameters of the query statement generation model are adjusted based on the loss value of the statement until the model training stops, thus obtaining a trained query statement generation model.
[0183] Optionally, the training module is further configured to:
[0184] Determine the target sample expansion task and the target statement sampling template corresponding to the target sample expansion task;
[0185] Based on the target statement sampling template, multiple sample query statements are read from the query statement database;
[0186] Each sample query statement is input into the text generation model to obtain the sample text corresponding to each sample query statement.
[0187] A sample set is formed based on the multiple sample query statements and the sample text corresponding to each sample query statement.
[0188] Optionally, the training module is further configured to:
[0189] Input each sample text and its corresponding metadata into a preset query statement to generate a model and obtain the predicted query statement for each sample text.
[0190] Determine the target prediction query statement and the corresponding sample query statement;
[0191] If the predicted query statement is consistent with the sample query statement, a sample set is constructed based on the target predicted query statement and the sample text corresponding to the target predicted query statement.
[0192] Optionally, the input module 604 is further configured to:
[0193] By concatenating the query text and the data metadata, a query sequence is obtained;
[0194] The query sequence is input into the query statement to generate the model.
[0195] Optionally, the training module is further configured to:
[0196] Based on the query statement specifications, generate preset sampling rules;
[0197] Based on the preset sampling rules, obtain the query statement framework;
[0198] The query statement content is collected according to the query statement framework, and a sample query statement is generated based on the query statement framework and the query statement content.
[0199] Optionally, the training module is further configured to:
[0200] Determine the historical database and historical query templates based on historical sample data;
[0201] Accordingly, based on the target statement sampling template, multiple sample query statements are read from the query statement database, including at least one of the following steps:
[0202] Based on the historical query template, multiple sample query statements are read from databases in various fields;
[0203] A new query statement template is generated based on the historical query statement template, and multiple sample query statements are read from the historical database based on the new query statement template.
[0204] Based on the historical sample data and the historical query statement template, obtain multiple sample query statements that are different from the historical sample data from the historical database.
[0205] The information query device in this specification implements the following: acquiring a query request, wherein the query request includes query text; inputting the query text into a query statement generation model to obtain a target query statement corresponding to the query text, wherein the query statement generation model is trained based on a sample set, the sample set including sample text and sample query statements, the sample query statements being collected based on different sample expansion tasks, and the sample text being obtained by inputting the sample query statements into the text generation model; and searching for target information from a database based on the target query statement.
[0206] By inputting the query text into a query statement generation model trained on a sample set, a target query statement is generated. Since the sample set is obtained based on a sample augmentation task and a text generation model, the target query statement generated by the query statement generation model trained on a sample set containing rich sample data has higher accuracy. Consequently, the target information obtained based on the target query statement is more accurate.
[0207] The above is an illustrative scheme of an information query device according to this embodiment. It should be noted that the technical solution of this information query device and the technical solution of the information query method described above belong to the same concept. For details not described in detail in the technical solution of the information query device, please refer to the description of the technical solution of the information query method described above.
[0208] Figure 7 A structural block diagram of a computing device 700 according to one embodiment of this specification is shown. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and a database 750 is used to store data.
[0209] The computing device 700 also includes an access device 740, which enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 740 may include one or more of any type of wired or wireless network interface (e.g., a network interface controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0210] In one embodiment of this specification, the above-described components of the computing device 700 and Figure 7 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 7 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0211] The computing device 700 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 700 can also be a mobile or stationary server.
[0212] The processor 720 is used to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-described information query method.
[0213] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the information query method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the information query method described above.
[0214] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described information query method.
[0215] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the information query method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the information query method described above.
[0216] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described information query method.
[0217] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the information query method described above belong to the same concept. Details not described in detail in the technical solution of the computer program can be found in the description of the technical solution of the information query method described above.
[0218] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0219] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0220] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0221] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0222] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. An information retrieval method, comprising: Obtain a query request, wherein the query request contains query text; The query text is input into a query statement generation model to obtain the target query statement corresponding to the query text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample expansion tasks. The sample text is obtained by inputting the sample query statements into a text generation model. The method for generating the sample set includes: inputting the actual query statement into a query statement to text conversion model to obtain the predicted text corresponding to the actual query statement; inputting the predicted text and the corresponding data metadata into a trained text to query statement model to obtain the predicted query statement; when the actual query statement and the predicted query statement are consistent, the actual query statement and the predicted text are added to the sample set as training samples. Based on the target query statement, the target information is retrieved from the database.
2. The method as described in claim 1, further comprising, before inputting the query text into the query statement to generate the model: Extract the target text and the target query statement corresponding to the target text from the sample set, wherein the target text is any sample text in the sample set; The target text is input into the query statement generation model to obtain the predicted query statement; Based on the predicted query statement and the target query statement, calculate the statement loss value; The model parameters of the query statement generation model are adjusted based on the loss value of the statement until the model training stops, thus obtaining a trained query statement generation model.
3. The method as described in claim 2, before extracting the target text and the target query statement corresponding to the target text from the sample set, further includes: Determine the target sample expansion task and the target statement sampling template corresponding to the target sample expansion task; Based on the target statement sampling template, multiple sample query statements are read from the query statement database; Each sample query statement is input into the text generation model to obtain the sample text corresponding to each sample query statement. A sample set is formed based on the multiple sample query statements and the sample text corresponding to each sample query statement.
4. The method as described in claim 3, wherein a sample set is constructed based on the plurality of sample query statements and the sample text corresponding to each sample query statement, comprising: Input each sample text and its corresponding metadata into a preset query statement to generate a model and obtain the predicted query statement for each sample text. Determine the target prediction query statement and the corresponding sample query statement; If the predicted query statement is consistent with the sample query statement, a sample set is constructed based on the target predicted query statement and the sample text corresponding to the target predicted query statement.
5. The method as described in claim 1, wherein the query request further includes data metadata corresponding to the query text; The model is generated by inputting the query text into a query statement, including: By concatenating the query text and the data metadata, a query sequence is obtained; The query sequence is input into the query statement to generate the model.
6. The method as described in claim 3, wherein multiple sample query statements are read from the query statement database based on the target statement sampling template, including: Based on the query statement specifications, generate preset sampling rules; Based on the preset sampling rules, obtain the query statement framework; The query statement content is collected according to the query statement framework, and a sample query statement is generated based on the query statement framework and the query statement content.
7. The method as described in claim 3, further comprising, before reading multiple sample query statements from the query statement database based on the target statement sampling template: Determine the historical database and historical query templates based on historical sample data; Accordingly, based on the target statement sampling template, multiple sample query statements are read from the query statement database, including at least one of the following steps: Based on the historical query template, multiple sample query statements are read from databases in various fields; A new query statement template is generated based on the historical query statement template, and multiple sample query statements are read from the historical database based on the new query statement template. Based on the historical sample data and the historical query statement template, obtain multiple sample query statements that are different from the historical sample data from the historical database.
8. A method for training a query statement generation model, applied to cloud-side devices, comprising: Extract target text and corresponding sample query statements from a sample set, wherein the target text is any sample text in the sample set, and the method for generating the sample set includes: inputting the actual query statement into a query statement to text conversion model to obtain the predicted text corresponding to the actual query statement; inputting the predicted text and the corresponding data metadata into a trained text to query statement model to obtain the predicted query statement; and when the actual query statement and the predicted query statement are consistent, adding the actual query statement and the predicted text as training samples to the sample set. The target text is input into the query statement generation model to obtain the predicted query statement; Based on the predicted query statement and the target query statement, calculate the statement loss value; The model parameters of the query statement generation model are adjusted based on the statement loss value until the model training stopping condition is met, and the trained query statement generation model is obtained. The model parameters of the model generated by the query statement are sent to the end device.
9. The method of claim 8, wherein sample text from the sample set is input into a query statement generation model to obtain a predicted query statement, comprising: The target text and its corresponding metadata are input into the query statement generation model to obtain the predicted query statement.
10. The method of claim 8, further comprising, before extracting the target text and the target query statement corresponding to the target text from the sample set: Determine the target sample expansion task and the target statement sampling template corresponding to the target sample expansion task; Based on the target statement sampling template, multiple sample query statements are read from the query statement database; Each sample query statement is input into the text generation model to obtain the sample text corresponding to each sample query statement. A sample set is formed based on the multiple sample query statements and the sample text corresponding to each sample query statement.
11. A method for querying answers to questions, comprising: Obtain an answer query request for a question, wherein the answer query request contains the question text; The question text is input into a query statement generation model to obtain the question answer query statement corresponding to the question text. The query statement generation model is trained based on a sample set, which includes sample text and sample query statements. The sample query statements are collected based on different sample expansion tasks. The sample text is obtained by inputting the sample query statements into a text generation model. The method for generating the sample set includes: inputting the actual query statement into a query statement to text conversion model to obtain the predicted text corresponding to the actual query statement; inputting the predicted text and the corresponding data metadata into a trained text to query statement model to obtain the predicted query statement; when the actual query statement and the predicted query statement are consistent, the actual query statement and the predicted text are added to the sample set as training samples. Based on the question-answer query statement, the answer to the question is retrieved from the database.
12. The method of claim 11, after retrieving the answer to the question from the database, further comprising: Send the answer to the question to the user; Receive user feedback on the answers to questions; The query generation model is adjusted based on the feedback information.
13. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 12.
14. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 12.