Model-based query statement generation method and apparatus, training method and apparatus, and electronic device
By using query prompts to indicate the discarding of historical data during the query generation process, the problem of poor memory stability in large models during multi-turn dialogue questions is solved, thereby improving the accuracy and stability of query statements.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- CHINA UNIONPAY
- Filing Date
- 2025-08-05
- Publication Date
- 2026-05-15
AI Technical Summary
In existing technologies, when users submit multi-turn dialogue-based queries, the large model needs to memorize historical dialogue data during the query generation process, resulting in poor memory stability and affecting the accuracy of the generated query.
By acquiring user-input query questions and historical dialogue questions from multi-turn dialogues, query prompts are determined and input into a pre-built query statement generation model. This process discards historical data, simplifies model memorization, and improves stability.
It improves the accuracy of query statement generation, enhances the stability of large models, and ensures the accuracy and consistency of query statements.
Smart Images

Figure CN2025112729_15052026_PF_FP_ABST
Abstract
Description
The model's query generation methods, training methods, devices, and electronic equipment.
[0001] This application claims priority to Chinese Patent Application No. 202411610176.9, filed on November 11, 2024, entitled “Method, Training Method, Apparatus and Electronic Equipment for Generating Query Statements of a Model”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of data processing technology, and in particular to a method, training method, apparatus, and electronic device for generating query statements for a model. Background Technology
[0003] In the financial technology field, when a user submits a query request, a large-scale model can be used to generate a corresponding query statement to retrieve the information requested. Furthermore, when the user's query request takes the form of a multi-turn dialogue, a large-scale model can also be used to generate a corresponding query statement.
[0004] In existing technologies, if a user's query request is in the form of a multi-turn dialogue, in the process of generating the query statement corresponding to the query request using a large model, the large model needs to memorize the data generated in the process of generating the query statements corresponding to the previous rounds of dialogue, and generate the corresponding query statement based on the memorized data.
[0005] However, the existing methods lead to poor memory stability of large models, resulting in inaccurate query generation. Summary of the Invention
[0006] This application provides a method, training method, apparatus, and electronic device for generating query statements for a model, in order to improve the accuracy of query statement generation.
[0007] In a first aspect, embodiments of this application provide a model-based query statement generation method, including:
[0008] Obtain the query question input by the user; wherein, the query question is the current round of dialogue question in a multi-turn dialogue.
[0009] Based on the query question and the historical rounds of dialogue questions in the multi-round dialogue, the query statement prompt words corresponding to the query question are determined; wherein, the query statement prompt words are used to indicate that the historical data generated during the query statement generation process should be discarded;
[0010] The query query suggestions are input into a pre-built query query generation model to obtain the query query corresponding to the query question.
[0011] In one possible implementation, determining the query statement prompt word corresponding to the query question based on the query question and the historical rounds of dialogue questions in the multi-round dialogue questions includes: performing slot information extraction processing on the query question based on slot extraction technology to obtain slot information corresponding to the query question; obtaining the status bit information corresponding to the previous round of dialogue questions in the historical rounds of dialogue questions; updating the status bit information corresponding to the previous round of dialogue questions based on the slot information corresponding to the query question to obtain the status bit information corresponding to the query question; and determining the query statement prompt word corresponding to the query question based on the status bit information corresponding to the query question.
[0012] In one possible implementation, determining the query statement prompt word corresponding to the query question based on the status bit information corresponding to the query question includes: obtaining the status bit information corresponding to the previous round of dialogue questions, and determining the reference information corresponding to the query question based on the status bit information corresponding to the previous round of dialogue questions; and determining the query statement prompt word corresponding to the query question based on the status bit information corresponding to the query question and the reference information corresponding to the query question.
[0013] In one possible implementation, determining the reference information corresponding to the query question based on the status bit information corresponding to the previous round of dialogue includes: determining the set of related questions corresponding to the query question from a pre-built multi-round dialogue corpus based on the status bit information corresponding to the previous round of dialogue; obtaining the query statement sample corresponding to each related question in the set of related questions from a pre-built query statement sample library; and determining the set consisting of all the query statement samples corresponding to the related questions as the reference information corresponding to the query question.
[0014] In one possible implementation, based on the status bit information corresponding to the previous round of dialogue, the associated question set corresponding to the query question is determined from a pre-built multi-turn dialogue corpus. This includes: vectorizing the status bit information corresponding to the previous round of dialogue to obtain vectorized status bit information corresponding to the previous round of dialogue; and determining the associated question set corresponding to the query question from the pre-built multi-turn dialogue corpus based on vectorized retrieval technology and the vectorized status bit information corresponding to the previous round of dialogue.
[0015] In one possible implementation, the method further includes: determining whether the question intent corresponding to the query is complete based on the status bit information corresponding to the query; if the question intent corresponding to the query is complete, then performing the process of determining the query statement prompt word corresponding to the query based on the status bit information corresponding to the query; otherwise, repeating the following process: obtaining supplementary questions, and determining whether the question intent corresponding to the query is complete again based on the obtained supplementary questions, until the question intent corresponding to the query is complete, and then performing the process of determining the query statement prompt word corresponding to the query based on the status bit information corresponding to the query.
[0016] In one possible implementation, determining whether the question intent corresponding to the query is complete based on the status bit information corresponding to the query includes: obtaining the question intent type corresponding to the query; and under the corresponding question intent type, determining whether the question intent corresponding to the query is complete based on the status bit information corresponding to the query.
[0017] In one possible implementation, obtaining the question intent type corresponding to the query question includes: obtaining the question intent type corresponding to the previous round of dialogue questions in the historical rounds of dialogue questions; determining whether a question intent type jump has occurred based on the status bit information corresponding to the query question; if it is determined that no question intent type jump has occurred, then the question intent type corresponding to the previous round of dialogue questions is determined as the question intent type corresponding to the query question; if it is determined that a question intent type jump has occurred, then the question intent type corresponding to the query question is determined based on the status bit information corresponding to the query question.
[0018] In one possible implementation, obtaining supplementary questions includes: generating and presenting supplementary prompts for questions; and receiving supplementary questions input by the user based on the supplementary prompts.
[0019] In one possible implementation, determining whether the question intent corresponding to the query question is complete again based on the obtained supplementary questions includes: updating the status bit information corresponding to the query question based on the obtained supplementary questions; and determining whether the question intent corresponding to the query question is complete again based on the updated status bit information corresponding to the query question.
[0020] In one possible implementation, the method further includes: if it is determined that the query question is the first round of dialogue question in the multi-turn dialogue, then determining the query statement prompt word corresponding to the query question based on the query question.
[0021] In one possible implementation, determining the query statement suggestion word corresponding to the query question based on the query question includes: performing slot information extraction processing on the query question based on slot extraction technology to obtain slot information corresponding to the query question; generating status bit information corresponding to the query question based on the slot information corresponding to the query question; and determining the query statement suggestion word corresponding to the query question based on the status bit information corresponding to the query question.
[0022] In one possible implementation, the method further includes: obtaining and presenting the response content corresponding to the query question based on the query statement corresponding to the query question.
[0023] Secondly, embodiments of this application provide a method for training a model for generating query statements, comprising:
[0024] Obtain the initial query statement to generate a large model and a model training set;
[0025] The model training set includes multiple training samples; the training samples include: query statement suggestion samples and query statements corresponding to the query statement suggestion samples; wherein, the query statement suggestion samples are used to indicate the discarding of historical data generated during the query statement generation process;
[0026] Based on the training samples included in the model training set, the initial query statement generation model is trained to obtain the query statement generation model.
[0027] In one possible implementation, training the initial query statement generation model based on training samples included in the model training set to obtain a query statement generation model includes: obtaining a training sample from the model training set; inputting the query statement suggestion word samples included in the training sample into the initial query statement generation model, and outputting the initial query statement corresponding to the query statement suggestion word samples; and training the initial query statement generation model based on the initial query statement corresponding to the query statement suggestion word samples and the query statement corresponding to the query statement suggestion word samples to obtain a query statement generation model.
[0028] Thirdly, embodiments of this application provide a model-based query statement generation apparatus, comprising:
[0029] The acquisition module is used to acquire the query question input by the user; wherein, the query question is the current round of dialogue question in a multi-round dialogue question;
[0030] The determining module is used to determine the query statement prompt words corresponding to the query question based on the query question and the historical rounds of dialogue questions in the multi-round dialogue questions; wherein, the query statement prompt words are used to indicate that the historical data generated during the query statement generation process should be discarded;
[0031] The generation module is used to input the query statement prompts into a pre-built query statement generation model to obtain the query statement corresponding to the query question.
[0032] In one possible implementation, the determining module is specifically configured to: extract slot information from the query based on slot extraction technology to obtain slot information corresponding to the query; obtain the status bit information corresponding to the previous round of dialogue in the historical rounds of dialogue; update the status bit information corresponding to the previous round of dialogue based on the slot information corresponding to the query to obtain the status bit information corresponding to the query; and determine the query statement prompt word corresponding to the query based on the status bit information corresponding to the query.
[0033] In one possible implementation, the determining module is further specifically used to obtain the status bit information corresponding to the previous round of dialogue question, and determine the reference information corresponding to the query question based on the status bit information corresponding to the previous round of dialogue question; and determine the query statement prompt word corresponding to the query question based on the status bit information corresponding to the query question and the reference information corresponding to the query question.
[0034] In one possible implementation, the determining module is further specifically configured to determine the set of related questions corresponding to the query question from a pre-built multi-turn dialogue corpus based on the status bit information corresponding to the previous round of dialogue question; obtain the query statement sample corresponding to each related question in the set of related questions from a pre-built query statement sample library; and determine the set of all query statement samples corresponding to related questions as the reference information corresponding to the query question.
[0035] In one possible implementation, the determining module is further specifically used to vectorize the status bit information corresponding to the previous round of dialogue question to obtain the vectorized status bit information corresponding to the previous round of dialogue question; based on vectorized retrieval technology and the vectorized status bit information corresponding to the previous round of dialogue question, the module determines the set of related questions corresponding to the query question from the pre-constructed multi-round dialogue corpus.
[0036] In one possible implementation, the determining module is further configured to determine whether the question intent corresponding to the query question is complete based on the status bit information corresponding to the query question; if the question intent corresponding to the query question is determined to be complete, then the process of determining the query statement prompt words corresponding to the query question based on the status bit information corresponding to the query question is executed; otherwise, the following process is repeated: obtaining supplementary questions, and determining whether the question intent corresponding to the query question is complete again based on the obtained supplementary questions, until the question intent corresponding to the query question is determined to be complete, and then the process of determining the query statement prompt words corresponding to the query question based on the status bit information corresponding to the query question is executed.
[0037] In one possible implementation, the determining module is further specifically used to obtain the question intent type corresponding to the query question; under the corresponding question intent type, it determines whether the question intent corresponding to the query question is complete based on the status bit information corresponding to the query question.
[0038] In one possible implementation, the determining module is further specifically used to obtain the question intent type corresponding to the previous round of dialogue questions in the historical rounds of dialogue questions; determine whether a question intent type jump has occurred based on the status bit information corresponding to the query question; if it is determined that no question intent type jump has occurred, then the question intent type corresponding to the previous round of dialogue questions is determined as the question intent type corresponding to the query question; if it is determined that a question intent type jump has occurred, then the question intent type corresponding to the query question is determined based on the status bit information corresponding to the query question.
[0039] In one possible implementation, the determining module is further specifically configured to generate and present supplementary prompts for the question; and to receive supplementary questions input by the user based on the supplementary prompts.
[0040] In one possible implementation, the determining module is further specifically configured to update the status bit information corresponding to the query question based on the acquired supplementary question; and to determine again whether the question intent corresponding to the query question is complete based on the updated status bit information corresponding to the query question.
[0041] In one possible implementation, the determining module is further configured to, if it is determined that the query question is the first round of the multi-round dialogue question, determine the query statement prompt word corresponding to the query question based on the query question.
[0042] In one possible implementation, the determining module is further specifically used to perform slot information extraction processing on the query based on slot extraction technology to obtain slot information corresponding to the query; generate status bit information corresponding to the query based on the slot information corresponding to the query; and determine the query statement prompt word corresponding to the query based on the status bit information corresponding to the query.
[0043] In one possible implementation, the generation module is further configured to obtain and present the response content corresponding to the query query based on the query statement corresponding to the query query. The model-based query statement generation device provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, so it will not be described in detail here.
[0044] Fourthly, embodiments of this application provide a training apparatus for a model used to generate query statements, comprising:
[0045] The acquisition module is used to acquire the initial query statement to generate the large model and the model training set;
[0046] The model training set includes multiple training samples; the training samples include: query statement suggestion samples and query statements corresponding to the query statement suggestion samples; wherein, the query statement suggestion samples are used to indicate the discarding of historical data generated during the query statement generation process;
[0047] The training module is used to train the large model for generating the initial query statement based on the training samples included in the model training set, so as to obtain the large model for generating the query statement.
[0048] The query statement generates a large model, which is the model described in the first aspect and / or various possible implementations of the first aspect above.
[0049] In one possible implementation, the training module is specifically configured to: obtain a training sample from the model training set; input the query statement suggestion sample included in the training sample into the initial query statement generation model; output the initial query statement corresponding to the query statement suggestion sample; and train the initial query statement generation model based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample to obtain the query statement generation model.
[0050] Fifthly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0051] The memory stores computer-executed instructions;
[0052] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect, or the second aspect and / or various possible implementations of the second aspect.
[0053] In a sixth aspect, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect, or the second aspect and / or various possible implementations of the second aspect.
[0054] In a seventh aspect, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect, or the second aspect and / or various possible implementations of the second aspect.
[0055] The query statement generation method, training method, apparatus, and electronic device provided in this application's embodiments acquire a user-input query question, determine query statement prompts corresponding to the query question based on the query question and historical rounds of dialogue questions in multi-turn dialogue questions, and input the query statement prompts into a pre-built query statement generation model to obtain the query statement corresponding to the query question. Since the query prompts corresponding to the query question are generated based on the query question and historical rounds of dialogue questions in multi-turn dialogue questions, they carry information from the historical dialogue questions. Therefore, when instructing the generation of the query statement corresponding to the query question, it is possible to instruct the discarding of historical data generated during the query statement generation process. This simplifies the memorization of the pre-built query statement generation model, thereby improving the stability of the model and the accuracy of query statement generation. Attached Figure Description
[0056] Figure 1 is a schematic diagram of an application scenario provided in this application;
[0057] Figure 2 is a flowchart illustrating the model-based query statement generation method provided in this application.
[0058] Figure 3 is a flowchart illustrating the model-based query statement generation method provided in this application (II).
[0059] Figure 4 is a flowchart illustrating the model-based query statement generation method provided in this application.
[0060] Figure 5 is a flowchart illustrating the training method of the model for generating query statements provided in this application.
[0061] Figure 6 is a flowchart illustrating the training method of the model for generating query statements provided in this application (II).
[0062] Figure 7 is a schematic diagram of the structure of the model-based query statement generation device provided in this application;
[0063] Figure 8 is a schematic diagram of the training device for the model used to generate query statements provided in this application;
[0064] Figure 9 is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0065] Figure 1 is a schematic diagram of an application scenario provided by this application. As shown in Figure 1, the specific application scenario of this application includes an electronic device 101 and a user 102. The user 102 inputs a query question on the electronic device 101 to instruct the user to obtain the query statement corresponding to the query question. Based on the electronic device 101, according to the query question input by the user 102 and the historical rounds of dialogue questions in the multi-round dialogue, the electronic device 101 determines the query statement prompt words corresponding to the query question and inputs the query statement prompt words into a pre-built query statement generation model to obtain the query statement corresponding to the query question. This allows the electronic device 101 to obtain and present the answer content corresponding to the query question based on the query statement corresponding to the query question.
[0066] Based on the above scenarios, it is clear that in existing technologies, if a user's query request takes the form of a multi-turn dialogue, the large model needs to memorize data from the generation of queries for each turn of the dialogue and then generate the corresponding query based on that memorized data. However, the existing approach suffers from poor memory stability in the large model, leading to inaccurate query generation.
[0067] The model-based query statement generation method provided in this application obtains the user-input query question, determines the corresponding query statement prompts based on the query question and the historical rounds of dialogue in multi-turn dialogue, and inputs the query statement prompts into a pre-built query statement generation model to obtain the query statement corresponding to the query question. Since the query prompts corresponding to the query question are generated based on the query question and the historical rounds of dialogue in multi-turn dialogue, they carry information from the historical dialogue questions. Therefore, when instructing the generation of the query statement corresponding to the query question, it is possible to instruct the historical data generated during the query statement generation process to be discarded, thereby simplifying the memory of the pre-built query statement generation model, improving the stability of the model, and improving the accuracy of query statement generation.
[0068] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0069] Figure 2 is a flowchart illustrating the model-based query statement generation method provided in this application. As shown in Figure 2, the method includes:
[0070] Step S201: Obtain the query question input by the user.
[0071] Specifically, it can retrieve user-input queries. These queries are the current round of a multi-turn dialogue. Multi-turn dialogue refers to users interacting with the electronic device through multiple questions, each question based on previous rounds of dialogue or their corresponding answers. This method allows for more in-depth and detailed questioning, typically used to obtain more specific or detailed information. For example, in interactive data analysis, if a previous round's question was "Query Shanghai's transaction volume in July of this year," the current question could be "How was August?" or "How was Beijing?".
[0072] This application does not limit the process of obtaining user-inputted queries; any process capable of obtaining user-inputted queries can be considered as the process provided in this application. Optionally, it can obtain queries input by the user via voice, text, keywords, or natural language.
[0073] Step S202: Based on the query question and the historical rounds of dialogue questions in the multi-turn dialogue questions, determine the query statement prompt words corresponding to the query question.
[0074] Specifically, based on the query question obtained in step S103 and the historical rounds of dialogue questions in the multi-turn dialogue questions to which the query statement belongs, the query statement prompt words corresponding to the query question can be determined. The query statement prompt words are used to indicate the generation of the query statement corresponding to the query question, and the query statement corresponding to the query question is used to retrieve the answer content corresponding to the query question.
[0075] The query suggestion words are used to instruct the discarding of historical data generated during the query generation process. Specifically, since the query suggestion words corresponding to the query question are generated based on the query question and the historical rounds of dialogue questions in the multi-turn dialogue, they carry information from the historical dialogue questions. Therefore, when instructing the generation of the query statement corresponding to the query question, it is possible to instruct the discarding of historical data generated during the query statement generation process. This simplifies the memorization of the pre-built query statement generation model, thereby improving the stability of the model and the accuracy of query statement generation.
[0076] This application does not limit the process of determining the query statement suggestion words corresponding to the query question based on the query question and the historical rounds of dialogue in multi-turn dialogue. Any process of determining the query statement suggestion words corresponding to the query question based on the query question and the historical rounds of dialogue in multi-turn dialogue can be used as the process provided in this application. Optionally, slot extraction technology can be used to extract slot information from the query question to obtain the slot information corresponding to the query question. The status bit information corresponding to the previous round of dialogue in the historical rounds of dialogue can be obtained. Based on the slot information corresponding to the query question, the status bit information corresponding to the previous round of dialogue can be updated to obtain the status bit information corresponding to the query question. Based on the status bit information corresponding to the query question, the query statement suggestion words corresponding to the query question can be determined.
[0077] Step S203: Input the query statement prompts into the pre-built query statement generation model to obtain the query statement corresponding to the query question.
[0078] Specifically, the query suggestion words determined in step S102 can be input into the pre-built query statement generation model to obtain the query statement corresponding to the query question. The pre-built query statement generation model is a pre-built large model used to generate the query statement corresponding to the query statement based on the query suggestion words. This application does not limit the pre-built query statement generation model; any pre-built large model used to generate the query statement corresponding to the query statement based on the query suggestion words can be used as the pre-built query statement generation model provided in this application.
[0079] The model-based query statement generation method provided in this application obtains the user-input query question, determines the query statement prompt words corresponding to the query question based on the query question and the historical rounds of dialogue questions in the multi-turn dialogue, and inputs the query statement prompt words into a pre-built query statement generation model to obtain the query statement corresponding to the query question. Since the query prompt words corresponding to the query question are generated based on the query question and the historical rounds of dialogue questions in the multi-turn dialogue, they carry information from the historical dialogue questions. Therefore, when instructing the generation of the query statement corresponding to the query question, it is possible to instruct the historical data generated during the query statement generation process to be discarded, thereby simplifying the memory of the pre-built query statement generation model, improving the stability of the model, and improving the accuracy of query statement generation.
[0080] The query statement corresponding to the query question indicates the address where the answer to the query question can be found. For example, in interactive data analysis, the query statement corresponding to the query question indicates the storage address of the data corresponding to the query question. If the query question is "Query the transaction amount in Shanghai this July", then an example query statement could be "Select transaction amount from table A where region = 'Shanghai company' 'this July'", where table A is the table storing the transaction amount in Shanghai this July.
[0081] In one possible embodiment, the model-based query statement generation method further includes: obtaining and presenting the answer content corresponding to the query question based on the query statement corresponding to the query question.
[0082] Specifically, as described above, the query statement corresponding to the query question is used to retrieve the corresponding answer content. Therefore, the answer content corresponding to the query question can be obtained and presented based on the query statement. As shown in the embodiment of Figure 1, the query statement corresponding to the query question can be retrieved based on the query address indicated by the query statement. This application does not limit the method of presenting the answer content corresponding to the query question. Any method capable of presenting the answer content corresponding to the query question can be used as the method provided by this application. Optionally, it may include, but is not limited to, at least one of the following methods: text, table, chart, card, report, document, pop-up, prompt box, voice feedback, and interactive form.
[0083] In one possible embodiment, the model-based query statement generation method further includes: if it is determined that the query question is the first round of a multi-turn dialogue question, then determining the query statement prompt words corresponding to the query question based on the query question.
[0084] Specifically, if the query is determined to be the first round of a multi-turn dialogue, then the multi-turn dialogue corresponding to the query does not include previous rounds of dialogue. Therefore, the process described in step S202 of determining the query statement prompt based on the query and the previous rounds of dialogue in the multi-turn dialogue cannot be executed. In this case, the query statement prompt can be determined based on the query. Similar to the query statement prompt described in step S202, the query statement prompt determined based on the query also instructs the generation of the query statement corresponding to the query, and the query statement prompt also instructs the discarding of historical data generated during the query statement generation process. This application does not limit the process of determining the query statement prompt based on the query; any process of determining the query statement prompt based on the query can be used as the process provided in this application.
[0085] In one possible embodiment, if it is determined that the query is the first round of a multi-turn dialogue, the process of determining the query statement prompts corresponding to the query may include:
[0086] First, based on slot extraction technology, slot information is extracted from the query to obtain the slot information corresponding to the query.
[0087] Slot filling is an important technique in Natural Language Processing (NLP), commonly used in information extraction, dialogue systems, and question-answering systems, especially in tasks involving extracting and identifying key information based on user-input text queries. Specifically, the goal of slot filling is to identify specific entities and their corresponding attributes from user-input natural language and fill predefined "slots" or fields so that the system can better understand the user's intent and generate appropriate responses. In slot filling, a slot refers to a predefined field or attribute within a specific task or system. For example, in interactive dialogue data analysis, if the query is "Query the transaction amount in Shanghai this July," then "date," "region," "indicator name," and "transaction channel" could be slots. A slot value refers to the specific information extracted from the input text, i.e., the content used to fill the slot. For example, in interactive data analysis, if the query is "Query transaction amount in Shanghai this July", then the value of the "Date" slot is "July this year", the value of the "Region" slot is "Shanghai", the value of the "Indicator Name" slot is "Revenue", and the value of the "Transaction Channel" slot is "Offline Transaction". Slot filling technology: This involves identifying the corresponding slots from the natural language text input by the user and extracting the corresponding values.
[0088] Secondly, based on the slot information corresponding to the query, the status information corresponding to the query is generated.
[0089] Status bit information (also known as status information, status flags, etc.) typically refers to the status data recorded during the current operation or processing step in a system, application, or query process. It is usually used to identify or track the current progress, status, or result of a task, operation, or event. This status bit information helps the system understand whether an operation has been completed, whether further user input is required, or whether an error exists.
[0090] In this application, there are no restrictions on the status bit information corresponding to the query; any information that can characterize the current status of the query can be used as the status bit information provided in this application.
[0091] For example, in the process of interactive data analysis, if the slot information corresponding to the query term is: the value of the "Date" slot is "July of this year", the value of the "Region" slot is "Shanghai", the value of the "Indicator Name" slot is "Revenue", and the value of the "Transaction Channel" slot is "Offline Transaction", then the example of the corresponding status information is: "Date: July of this year; Region: Shanghai; Indicator Name: Revenue; Transaction Channel: Offline Transaction".
[0092] This application does not limit the process of generating status information corresponding to a query based on the slot information corresponding to the query. Optionally, a large model can be generated based on the slot information and preset status information to generate the status information corresponding to the query. In the process of generating the status information based on the preset status information, corresponding status information prompts can be constructed first based on the slot information, and then the constructed status information prompts can be input into the preset status information generation model to output the status information corresponding to the query. This application does not limit the process of constructing corresponding status information prompts based on the slot information. Optionally, corresponding status information prompts can be constructed based on the slot information and a preset status information prompt template.
[0093] Optionally, the status information corresponding to the query can be directly determined based on the query. This application does not limit the process of directly determining the status information based on the query; optionally, a model can be generated based on another preset status bit information to generate the status bit information corresponding to the query. In the process of generating the large model based on the other preset status bit information to generate the status bit information corresponding to the query, corresponding status bit information prompts can first be constructed based on the query, and then the constructed status bit information prompts can be input into the preset other status bit information generation large model to output the status bit information corresponding to the query. This application does not limit the process of constructing corresponding status bit information prompts based on the query; optionally, corresponding status bit information prompts can be constructed based on the query and a preset other status bit information prompt template.
[0094] Then, based on the status information corresponding to the query question, determine the query statement prompt words corresponding to the query question.
[0095] Specifically, query suggestion words can be determined based on the status bit information corresponding to the query query. This application does not limit the process of determining query suggestion words based on the status bit information. Optionally, query suggestion words can be constructed based on the status bit information and a preset suggestion word construction strategy. This application does not limit the preset suggestion word construction strategy. Optionally, the preset suggestion word construction strategy may include: preset constraint declarations, such as discarding historical data generated during query statement generation, and preset suggestion word composition content, such as: the status bit information corresponding to the query query, the query query itself, and the slot information corresponding to the query query.
[0096] The following are examples of query suggestion words for the query question:
[0097] "Preset constraint declaration: Discard historical data generated during the query statement generation process;"
[0098] The query question was: "How will August be?"
[0099] The query slot information is as follows: the value of the "Date" slot is "August of this year", the value of the "Region" slot is "empty", the value of the "Indicator Name" slot is "empty", and the value of the "Trading Channel" slot is "empty".
[0100] The status information corresponding to the query is: "Date: August of this year; Region: Shanghai; Indicator Name: Income; Transaction Channel: Offline Transaction";
[0101] Please output the query statement corresponding to the query question according to the above rules.
[0102] Figure 3 is a flowchart illustrating the model-based query statement generation method provided in this application. As shown in Figure 3, this embodiment, based on the embodiment shown in Figure 2, details the process of determining the query statement prompt words corresponding to the query question based on the query question and the historical rounds of dialogue questions in multi-round dialogue questions. The method includes:
[0103] Step S301: Based on slot extraction technology, perform slot information extraction processing on the query to obtain the slot information corresponding to the query.
[0104] Specifically, based on slot extraction technology, slot information can be extracted from the query to obtain the corresponding slot information. For a description of the slot extraction technology, please refer to the description in the above embodiments; it will not be repeated here.
[0105] If the query is not a complete statement, for example, in the process of interactive dialogue data analysis, if the query is "How is August?", then the slot information corresponding to the query includes slots for some keywords. For example, if the query is "How is August?", then based on the slot extraction technology, after extracting the slot information of the query, the slot information corresponding to the query is as follows: the value of the "Date" slot is "This August", the value of the "Region" slot is "Empty", the value of the "Indicator Name" slot is "Empty", and the value of the "Transaction Channel" slot is "Empty".
[0106] Step S302: Obtain the status bit information corresponding to the previous round of dialogue questions in the historical round of dialogue questions.
[0107] Specifically, the status bit information corresponding to the previous round of dialogue questions can be obtained from the historical dialogue questions. The description of the status bit information can be found in the above embodiment, and will not be repeated here.
[0108] In this process, after obtaining the user's input of the previous round of dialogue questions, the corresponding status bit information is determined. Therefore, the status bit information corresponding to the previous round of dialogue questions can be directly obtained from historical data.
[0109] Step S303: Based on the slot information corresponding to the query, update the status information corresponding to the previous round of dialogue to obtain the status information corresponding to the query.
[0110] Specifically, based on the slot information corresponding to the query obtained in step S301, the status bit information corresponding to the previous round of dialogue obtained in step S302 is updated to obtain the status bit information corresponding to the query. This application does not limit the process of updating the status bit information corresponding to the previous round of dialogue based on the slot information corresponding to the query to obtain the status bit information corresponding to the query. Optionally, the information corresponding to empty slot values in the slot information corresponding to the query in the status bit information corresponding to the previous round of dialogue can be retained, and the information corresponding to non-empty slot values in the slot information corresponding to the query in the status bit information corresponding to the previous round of dialogue can be replaced.
[0111] For example, in the process of interactive dialogue data analysis, if the slot information corresponding to the query is: the value of the "Date" slot is "August of this year", the value of the "Region" slot is "empty", the value of the "Indicator Name" slot is "empty", and the value of the "Transaction Channel" slot is "empty", and the status information corresponding to the previous round of dialogue is: "Date: July of this year; Region: Shanghai; Indicator Name: Revenue; Transaction Channel: Offline Transaction". After the retention and replacement processing described above, the status information corresponding to the query is obtained as "Date: August of this year; Region: Shanghai; Indicator Name: Revenue; Transaction Channel: Offline Transaction".
[0112] Step S304: Determine the query statement prompt words corresponding to the query question based on the status bit information corresponding to the query question.
[0113] Specifically, the query statement prompt words corresponding to the query question can be determined based on the status bit information corresponding to the query question obtained in step S303. The description of the process of determining the query statement prompt words corresponding to the query question based on the status bit information can be found in the embodiment shown above, and will not be repeated here.
[0114] The process provided in this application for determining query suggestion words based on the query question and historical rounds of dialogue questions in a multi-round dialogue is as follows: Slot information is extracted from the query question using slot extraction technology to obtain the slot information corresponding to the query question. The status bit information corresponding to the previous round of dialogue questions in the historical rounds of dialogue is obtained. Based on the slot information corresponding to the query question, the status bit information corresponding to the previous round of dialogue questions is updated to obtain the status bit information corresponding to the query question. Based on the status bit information corresponding to the query question, the query suggestion words corresponding to the query question are determined. In the process of determining the status bit information corresponding to the query question, the status bit information corresponding to the previous round of dialogue questions is combined, making the status bit information corresponding to the query question complete. This makes the query suggestion words determined based on the status bit information more accurate, thereby improving the accuracy of query statement generation.
[0115] In one possible embodiment, the model-based query statement generation method further includes: determining whether the query intent corresponding to the query is complete based on the status bit information corresponding to the query query.
[0116] Specifically, after obtaining the status bit information corresponding to the query, the completeness of the query intent can be determined based on this information. This application does not limit the process of determining the completeness of the query intent based on the status bit information; optionally, the query intent type can be obtained first, and then, under that type, the completeness of the query intent can be determined based on the status bit information. The query intent refers to the main purpose or need behind a user's question. Simply put, the query intent is the user's motivation or goal in asking the question, helping the system understand the user's true intention and thus provide a more accurate answer or perform the corresponding operation. The query described in this embodiment can be either the first round of a multi-turn dialogue or a non-first round of a multi-turn dialogue.
[0117] In the above confirmation process, if it is determined that the intent of the query is complete, then the process of determining the query suggestion words based on the status information of the query is executed. The process of determining the query suggestion words based on the status information of the query can be referred to the description in the above embodiment, and will not be repeated here.
[0118] In this process, if it is determined that the intent of the query is incomplete, the following steps are repeated: obtain supplementary questions, and determine the intent of the query again based on the obtained supplementary questions, until the intent of the query is determined to be complete. Then, the status information of the question is executed to determine the query statement prompt words.
[0119] This application does not limit the process of obtaining supplementary questions. Optionally, it may first generate and present supplementary question prompts, and then receive supplementary questions input by the user based on the supplementary question prompts. This application does not limit the process of determining whether the question intent corresponding to the query question is complete based on the obtained supplementary questions. Optionally, the process of determining whether the question intent corresponding to the query question is complete based on the obtained supplementary questions may include: updating the status bit information corresponding to the query question based on the obtained supplementary questions; and determining whether the question intent corresponding to the query question is complete based on the updated status bit information. If the result of the re-determination is that the question intent is complete, then the process of determining the query statement prompt words corresponding to the query question based on the updated status bit information is executed; otherwise, the above process is repeated until it is determined that the question intent corresponding to the query question is complete.
[0120] The process of determining whether the query intent is complete, and the process of refining the query intent by obtaining supplementary questions after determining the query intent, can improve the accuracy of query suggestion words and further improve the accuracy of query generation.
[0121] In one possible embodiment, the process of determining whether the question intent corresponding to a query is complete based on the status bit information corresponding to the query may include: obtaining the question intent type corresponding to the query; and, under the corresponding question intent type, determining whether the question intent corresponding to the query is complete based on the status bit information corresponding to the query. Here, the question intent type refers to the category or type used by the system to understand the user's underlying intent when a user asks a question.
[0122] In the process of determining whether the query intent is complete based on the status bit information of the query, first determining the query intent type can more accurately determine whether the query intent is complete, thus further improving the accuracy of query statement generation.
[0123] In one possible embodiment, if the query is the first round of a multi-turn dialogue, the process of obtaining the question intent type corresponding to the query may include: obtaining slot information corresponding to the query; and determining the question intent type corresponding to the query based on the slot information corresponding to the query.
[0124] In one possible embodiment, the process of obtaining the question intent type corresponding to the query question may include: obtaining the question intent type corresponding to the previous round of dialogue questions in the historical dialogue questions; determining whether a question intent type transition has occurred based on the status bit information corresponding to the query question; if it is determined that no question intent type transition has occurred, then the question intent type corresponding to the previous round of dialogue questions is determined as the question intent type corresponding to the query question; if it is determined that a question intent type transition has occurred, then the question intent type corresponding to the query question is determined based on the status bit information corresponding to the query question.
[0125] In the process of obtaining the question intent type corresponding to the query question, determining whether to jump to the question intent type based on the question intent type corresponding to the previous round of dialogue can improve the efficiency of determining the question intent type corresponding to the query question, and further improve the efficiency of query statement generation.
[0126] In one possible embodiment, the process of obtaining supplementary questions may include: generating and presenting supplementary prompts for the question; and receiving supplementary questions input by the user based on the supplementary prompts.
[0127] The supplementary prompts are used to encourage users to add supplementary questions to their query. These prompts indicate the direction for adding supplementary questions, allowing users to input corresponding supplementary questions based on the directions provided. This application does not limit the process of receiving supplementary questions input by the user based on the supplementary prompts; optionally, the process of obtaining user-inputted query questions described in step S201 can be referenced, and will not be repeated here.
[0128] In the process of obtaining supplementary questions, generating and presenting supplementary information can provide a basis for users to input supplementary questions, thereby improving the accuracy of obtaining supplementary questions and further improving the accuracy of query statement generation.
[0129] Figure 4 is a flowchart illustrating the model-based query statement generation method provided in this application. As shown in Figure 4, this embodiment, based on the embodiment shown in Figure 2 or Figure 3, provides a detailed explanation of the process of determining the query statement prompt words corresponding to the query query based on the status bit information corresponding to the query query. The method includes:
[0130] Step S401: Obtain the status bit information corresponding to the question asked in the previous round of dialogue, and determine the reference information corresponding to the question asked based on the status bit information corresponding to the question asked in the previous round of dialogue.
[0131] Specifically, the status bit information corresponding to the question asked in the previous round of dialogue can be obtained. The description of the status bit information can be found in the above embodiment, and will not be repeated here.
[0132] Specifically, after obtaining the status bit information corresponding to the previous round of dialogue, the reference information corresponding to the query question can be determined based on this information. The reference information is the information used for reference when generating the query statement corresponding to the query question. This application does not limit the process of determining the reference information corresponding to the query question based on the status bit information corresponding to the previous round of dialogue. Optionally, the process may include: first, determining the set of related questions corresponding to the query question from a pre-built multi-round dialogue corpus based on the status bit information corresponding to the previous round of dialogue; then, obtaining query statement samples corresponding to each related question in the related question set from a pre-built query statement sample library, and determining the set of all related query statement samples as the reference information corresponding to the query question.
[0133] The pre-built multi-turn dialogue corpus is a set of questions constructed based on each round of questions in historical multi-turn dialogues. This application does not limit the process of determining the set of related questions corresponding to the query question from the pre-built multi-turn dialogue corpus based on the status bit information corresponding to the previous round of dialogue questions. Optionally, the process of determining the set of related questions corresponding to the query question from the pre-built multi-turn dialogue corpus based on the status bit information corresponding to the previous round of dialogue questions may include: vectorizing the status bit information corresponding to the previous round of dialogue questions to obtain vectorized status bit information corresponding to the previous round of dialogue questions; and determining the set of related questions corresponding to the query question from the pre-built multi-turn dialogue corpus based on vectorized retrieval technology and the vectorized status bit information corresponding to the previous round of dialogue questions.
[0134] The related question set includes at least one related question, which refers to a question in the multi-turn dialogue corpus that is highly related to the question in the previous round of dialogue. This application does not limit the number of related questions included in the related question set; optionally, the number of related questions in the related question set can be preset. If the status information corresponding to the previous round of dialogue is: Date: July of this year; Region: Shanghai; Indicator Name: Revenue; Transaction Channel: Offline Transaction, then the vectorized status information corresponding to the previous round of dialogue is: <Previous Round Dialogue Question: Date: July of this year; Region: Shanghai; Indicator Name: Revenue; Transaction Channel: Offline Transaction>.
[0135] The pre-built query statement sample library is a collection of query statement samples constructed based on each round of dialogue questions in a historical multi-turn dialogue. This application does not limit the process of obtaining the query statement sample corresponding to each related question in the related question set from the pre-built query statement sample library. Optionally, the query statement sample corresponding to each related question in the related question set can be obtained from the pre-built query statement sample library according to a preset mapping relationship. The preset mapping relationship represents the correspondence between questions in the pre-built multi-turn dialogue corpus and query statement samples in the pre-built query statement sample library.
[0136] Specifically, after obtaining the query statement sample corresponding to each related question in the related question set from the pre-built query statement sample library, the set consisting of all the query statement samples corresponding to the related questions can be determined as the reference information corresponding to the query questions.
[0137] Step S402: Based on the status bit information corresponding to the query question and the reference information corresponding to the query question, determine the query statement prompt words corresponding to the query question.
[0138] Specifically, based on the status bit information corresponding to the query question and the reference information corresponding to the query question determined in step S401, the query statement prompt words corresponding to the query question can be determined.
[0139] This application does not limit the process of determining query statement suggestions based on the status bit information and reference information corresponding to the query query. Optionally, query statement suggestions can be constructed based on the status bit information and a preset suggestion construction strategy. This application does not limit the preset suggestion construction strategy. Optionally, the preset suggestion construction strategy may include: preset constraint declarations, such as discarding historical data generated during query statement generation, and preset suggestion content, such as: the status bit information corresponding to the query query, the query query itself, the slot information corresponding to the query query, and the reference information corresponding to the query query.
[0140] The following are examples of query suggestion words for the query question:
[0141] "Preset constraint declaration: Discard historical data generated during the query statement generation process;"
[0142] The query question was: "How will August be?"
[0143] The query slot information is as follows: the value of the "Date" slot is "August of this year", the value of the "Region" slot is "empty", the value of the "Indicator Name" slot is "empty", and the value of the "Trading Channel" slot is "empty".
[0144] The status information corresponding to the query is: "Date: August of this year; Region: Shanghai; Indicator Name: Income; Transaction Channel: Offline Transaction";
[0145] Based on the questions asked in the previous round of dialogue, the query questions may be similar to the following question types, and the corresponding query statements are as follows:
[0146] Related Question 1: "Inquiry about the Beijing branch's July revenue"
[0147] Possible query sample:
[0148] Select transaction amount from table A where region = 'Beijing Branch' 'July of this year'
[0149] Related Question 2: "Inquiry about the Shanghai branch's August revenue"
[0150] Possible query sample:
[0151] Select transaction amount from table A where region = 'Shanghai Company' 'August of this year';
[0152] Please output the query statement corresponding to the query question according to the above rules.
[0153] The process provided in this application for determining query statement prompts based on the status bit information corresponding to the query question involves obtaining the status bit information corresponding to the previous round of dialogue questions and determining the reference information corresponding to the query question based on the status bit information corresponding to the previous round of dialogue questions. The query statement prompts determined based on the status bit information and the reference information can be used to control the generation process when generating query statements in a large model, thereby improving the accuracy of query statement generation.
[0154] Figure 5 is a flowchart illustrating the training method of the model for generating query statements provided in this application. As shown in Figure 5, the method includes:
[0155] Step S501: Obtain the initial query statement to generate a large model and a model training set.
[0156] Specifically, it can obtain the initial query statement to generate a large model and a model training set.
[0157] The initial query statement generation model serves as the initial model for training the overall query statement generation model. The training set includes multiple training samples, which consist of query statement suggestion samples and the corresponding query statements. The query statement suggestion samples are used to indicate the discarding of historical data generated during the query statement generation process.
[0158] The description of the query suggestion words can be found in any of the embodiments shown in Figures 2 to 4, and will not be repeated here.
[0159] Step S502: Based on the training samples included in the model training set, train the initial query statement generation model to obtain the query statement generation model.
[0160] Specifically, based on the training samples included in the model training set, the initial query statement generation model can be trained to obtain the query statement generation model.
[0161] The query statement generates a large model, which is the model described in any of the embodiments shown in Figures 2 to 4.
[0162] In this application, the process of training the initial query statement generation model based on the training samples included in the model training set is not limited. Optionally, a training sample can be obtained from the model training set, and the query statement suggestion sample included in the training sample can be input into the initial query statement generation model. The initial query statement corresponding to the query statement suggestion sample is output. Based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample, the initial query statement generation model is trained to obtain the query statement generation model.
[0163] The training method for a query statement generation model provided in this application involves obtaining an initial query statement generation model and a model training set. Based on the training samples included in the training set, the initial query statement generation model is trained to obtain a new query statement generation model. The training samples in the model training set include query statement suggestion samples. Training the query statement generation model using these suggestion samples improves the accuracy of query statement generation based on the trained model. The query statement suggestion samples indicate the discarding of historical data generated during the query statement generation process, simplifying the memorization of the trained model and thus improving its stability and the accuracy of query statement generation.
[0164] Figure 6 is a flowchart illustrating the second step of the training method for the model used to generate query statements provided in this application. As shown in Figure 6, this embodiment, based on the embodiment shown in Figure 5, details the process of training an initial query statement generation model using training samples included in the model training set to obtain the query statement generation model. The method includes:
[0165] Step S601: Obtain a training sample from the model training set.
[0166] Specifically, a training sample can be obtained from the model training set. This application does not limit the process of obtaining a training sample from the model training set; optionally, a training sample can be randomly obtained from the model training set.
[0167] Step S602: Input the query statement suggestion word samples included in the training samples into the initial query statement generation model, and output the initial query statement corresponding to the query statement suggestion word samples.
[0168] Specifically, the query statement suggestion word samples included in the training samples obtained in step S602 are input into the initial query statement generation model, and the initial query statement corresponding to the query statement suggestion word samples is output.
[0169] Step S603: Based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample, train the large model for generating the initial query statement to obtain the large model for generating the query statement.
[0170] Specifically, based on the initial query statement corresponding to the query statement suggestion sample obtained in step S602, and the query statement corresponding to the query statement suggestion sample, the initial query statement generation model can be trained to obtain the query statement generation model. Specifically, based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample, the loss function value of the initial query statement generation model can be calculated. Based on the calculated loss function threshold, the parameters of the initial query statement generation model can be adjusted to obtain the trained initial query statement generation model.
[0171] Optionally, after obtaining the trained initial query statement generation model, a training sample can be obtained from the model training set, and the query statement suggestion sample included in the training sample can be input into the trained initial query statement generation model. The output is the initial query statement corresponding to the query statement suggestion sample. Then, based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample, it is determined whether the trained initial query statement generation model has completed training. If it is determined that the training has been completed, the trained initial query statement generation model is identified as the query statement generation model. Otherwise, the process described above is repeated until it is determined that the training has been completed.
[0172] In this application, the process of determining whether the initial query statement generation model has completed training is not limited. Optionally, the loss function value of the initial query statement generation model can be calculated based on the initial query statement corresponding to the query statement prompt word sample and the query statement corresponding to the query statement prompt word sample. If the calculated loss function value is greater than the preset loss function threshold, it is determined that the initial query statement generation model has not completed training; otherwise, it is determined that the initial query statement generation model has completed training.
[0173] The embodiments of this application provide a process for training an initial query statement generation model based on training samples included in the model training set, thereby obtaining a large query statement generation model. This involves obtaining a training sample from the model training set, inputting the query statement suggestion sample included in the training sample into the initial query statement generation model, outputting the initial query statement corresponding to the query statement suggestion sample, and training the initial query statement generation model based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample. This training of the initial query statement generation model based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample can improve the accuracy of model training and further improve the accuracy of query statement generation generated by the trained query statement generation model.
[0174] Figure 7 is a schematic diagram of the structure of the model-based query statement generation device provided in this application. As shown in Figure 7, the model-based query statement generation device 70 provided in this embodiment includes:
[0175] The acquisition module 701 is used to acquire the query question input by the user; wherein, the query question is the current round of dialogue question in a multi-turn dialogue.
[0176] The determination module 702 is used to determine the query statement prompt words corresponding to the query question based on the query question and the historical rounds of dialogue questions in the multi-round dialogue question; wherein, the query statement prompt words are used to indicate that the historical data generated during the query statement generation process should be discarded.
[0177] The generation module 703 is used to input query statement prompts into the pre-built query statement generation model to obtain the query statement corresponding to the query question.
[0178] In one possible embodiment, the determining module 702 is specifically used to perform slot information extraction processing on the query based on slot extraction technology to obtain the slot information corresponding to the query; obtain the status bit information corresponding to the previous round of dialogue in the historical round of dialogue; update the status bit information corresponding to the previous round of dialogue according to the slot information corresponding to the query to obtain the status bit information corresponding to the query; and determine the query statement prompt words corresponding to the query based on the status bit information corresponding to the query.
[0179] In one possible embodiment, the determining module 702 is further specifically used to obtain the status bit information corresponding to the previous round of dialogue questions, and determine the reference information corresponding to the query question based on the status bit information corresponding to the previous round of dialogue questions; and determine the query statement prompt words corresponding to the query question based on the status bit information corresponding to the query question and the reference information corresponding to the query question.
[0180] In one possible embodiment, the determining module 702 is further specifically configured to determine the set of related questions corresponding to the query question from a pre-built multi-turn dialogue corpus based on the status bit information corresponding to the previous round of dialogue question; obtain the query statement sample corresponding to each related question in the set of related questions from a pre-built query statement sample library; and determine the set of all the query statement samples corresponding to the related questions as the reference information corresponding to the query question.
[0181] In one possible embodiment, the determining module 702 is further specifically used to perform vectorization processing on the status bit information corresponding to the previous round of dialogue question to obtain the vectorized status bit information corresponding to the previous round of dialogue question; based on the vectorized retrieval technology and the vectorized status bit information corresponding to the previous round of dialogue question, the associated question set corresponding to the query question is determined from the pre-built multi-round dialogue corpus.
[0182] In one possible embodiment, the determining module 702 is further specifically configured to determine whether the question intent corresponding to the query question is complete based on the status bit information corresponding to the query question; if the question intent corresponding to the query question is determined to be complete, then the process of determining the query statement prompt words corresponding to the query question based on the status bit information corresponding to the query question is executed; otherwise, the following process is repeated: obtaining supplementary questions, and determining whether the question intent corresponding to the query question is complete again based on the obtained supplementary questions, until the question intent corresponding to the query question is determined to be complete, and then the process of determining the query statement prompt words corresponding to the query question based on the status bit information corresponding to the query question is executed.
[0183] In one possible embodiment, the determining module 702 is further specifically used to obtain the question intent type corresponding to the query question; under the corresponding question intent type, it determines whether the question intent corresponding to the query question is complete based on the status bit information corresponding to the query question.
[0184] In one possible embodiment, the determining module 702 is further specifically used to obtain the question intent type corresponding to the previous round of dialogue questions in the historical rounds of dialogue questions; determine whether a question intent type jump has occurred based on the status bit information corresponding to the query question; if it is determined that no question intent type jump has occurred, then the question intent type corresponding to the previous round of dialogue questions is determined as the question intent type corresponding to the query question; if it is determined that a question intent type jump has occurred, then the question intent type corresponding to the query question is determined based on the status bit information corresponding to the query question.
[0185] In one possible embodiment, the determining module 702 is further specifically configured to generate and present supplementary prompts for the question; and to receive supplementary questions input by the user based on the supplementary prompts.
[0186] In one possible embodiment, the determining module 702 is further specifically configured to update the status bit information corresponding to the query question based on the acquired supplementary question; and to determine again whether the question intent corresponding to the query question is complete based on the updated status bit information corresponding to the query question.
[0187] In one possible embodiment, the determining module 702 is further configured to determine the query statement prompt words corresponding to the query question based on the query question if it is determined that the query question is the first round of a multi-turn dialogue question.
[0188] In one possible embodiment, the determining module 702 is further specifically used to perform slot information extraction processing on the query based on slot extraction technology to obtain slot information corresponding to the query; generate status bit information corresponding to the query based on the slot information corresponding to the query; and determine the query statement prompt words corresponding to the query based on the status bit information corresponding to the query.
[0189] In one possible embodiment, the generation module 703 is further configured to obtain and present the response content corresponding to the query query based on the query statement corresponding to the query query. The model-based query statement generation device provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, so it will not be described in detail here.
[0190] Figure 8 is a schematic diagram of the structure of the training device for the model of query statement generation provided in this application. As shown in Figure 8, the training device 80 for the model of query statement generation provided in this embodiment includes:
[0191] The acquisition module 801 is used to acquire the initial query statement to generate the large model and the model training set;
[0192] The model training set includes multiple training samples; the training samples include: query statement suggestion samples and query statements corresponding to the query statement suggestion samples; the query statement suggestion samples are used to indicate the discarding of historical data generated during the query statement generation process.
[0193] Training module 802 is used to train the large model for generating the initial query statement based on the training samples included in the model training set, so as to obtain the large model for generating the query statement.
[0194] The query statement generates a large model, which is the model provided by any of the method embodiments shown in Figures 2 to 4.
[0195] In one possible embodiment, the training module 802 is specifically used to obtain a training sample from the model training set; input the query statement suggestion sample included in the training sample into the initial query statement generation model, and output the initial query statement corresponding to the query statement suggestion sample; train the initial query statement generation model based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample, to obtain the query statement generation model.
[0196] The training device for the model used to generate query statements provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0197] Figure 9 is a schematic diagram of the structure of the electronic device provided in this application. As shown in Figure 9, the electronic device 90 provided in this embodiment includes at least one processor 901 and a memory 902. Optionally, the device 90 further includes a communication component 903. The processor 901, the memory 902, and the communication component 903 are connected via a bus 904.
[0198] In a specific implementation, at least one processor 901 executes computer execution instructions stored in memory 902, causing at least one processor 901 to perform the above-described method.
[0199] The specific implementation process of processor 901 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0200] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0201] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0202] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0203] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0204] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0205] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0206] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0207] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0208] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0209] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0210] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0211] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0212] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for generating model-based query statements, characterized in that, include: Obtain the query question input by the user; wherein, the query question is the current round of dialogue question in a multi-turn dialogue. Based on the query question and the historical rounds of dialogue questions in the multi-round dialogue, the query statement prompt words corresponding to the query question are determined; wherein, the query statement prompt words are used to indicate that the historical data generated during the query statement generation process should be discarded; The query query suggestions are input into a pre-built query query generation model to obtain the query query corresponding to the query question.
2. The method according to claim 1, characterized in that, Based on the query question and the historical rounds of dialogue questions in the multi-turn dialogue, determine the query statement prompts corresponding to the query question, including: Based on slot extraction technology, slot information extraction processing is performed on the query to obtain the slot information corresponding to the query. Obtain the status bit information corresponding to the previous round of dialogue questions in the historical rounds of dialogue questions; Based on the slot information corresponding to the query, the status bit information corresponding to the previous round of dialogue is updated to obtain the status bit information corresponding to the query. Based on the status bit information corresponding to the query question, determine the query statement prompt words corresponding to the query question.
3. The method according to claim 2, characterized in that, Based on the status bit information corresponding to the query question, determine the query statement prompt words corresponding to the query question, including: Obtain the status bit information corresponding to the previous round of dialogue questions, and determine the reference information corresponding to the query questions based on the status bit information corresponding to the previous round of dialogue questions; Based on the status bit information corresponding to the query question and the reference information corresponding to the query question, determine the query statement prompt words corresponding to the query question.
4. The method according to claim 3, characterized in that, Based on the status bit information corresponding to the question asked in the previous round of dialogue, the reference information corresponding to the query question is determined, including: Based on the status bit information corresponding to the previous round of dialogue, the set of related questions corresponding to the query question is determined from the pre-built multi-round dialogue corpus. From the pre-built query sample library, obtain the query sample corresponding to each related question in the related question set, and determine the set of query samples corresponding to all related questions as the reference information corresponding to the query question.
5. The method according to claim 4, characterized in that, Based on the status bit information corresponding to the question in the previous round of dialogue, the set of related questions corresponding to the query question is determined from the pre-built multi-round dialogue corpus, including: The state bit information corresponding to the previous round of dialogue questions is vectorized to obtain the vectorized state bit information corresponding to the previous round of dialogue questions. Based on vectorized retrieval technology and the status bit information corresponding to the previous round of dialogue question after vectorization processing, the set of related questions corresponding to the query question is determined from the pre-constructed multi-round dialogue corpus.
6. The method according to claim 2, characterized in that, The method further includes: Based on the status bit information corresponding to the query, determine whether the query intent corresponding to the query is complete; If it is determined that the intent of the query is complete, then the process of determining the query statement prompt words corresponding to the query is executed based on the status bit information of the query. Otherwise, repeat the following process: The process involves obtaining supplementary questions and then re-determining whether the question intent corresponding to the query question is complete based on the obtained supplementary questions. Once the question intent corresponding to the query question is determined to be complete, the process continues until the status bit information corresponding to the question is executed to determine the query statement prompt words corresponding to the query question.
7. The method according to claim 6, characterized in that, Based on the status bit information corresponding to the query question, determine whether the query intent corresponding to the query question is complete, including: Obtain the question intent type corresponding to the query question; Under the corresponding question intent type, the completeness of the question intent corresponding to the query question is determined based on the status bit information corresponding to the query question.
8. The method according to claim 7, characterized in that, Obtain the question intent type corresponding to the query question, including: Obtain the question intent type corresponding to the previous round of questions in the historical rounds of dialogue; Based on the status bit information corresponding to the query question, determine whether a question intent type jump has occurred; If it is determined that no question intent type jump has occurred, then the question intent type corresponding to the previous round of dialogue question is determined as the question intent type corresponding to the query question; If it is determined that a question intent type jump has occurred, then the question intent type corresponding to the query question is determined based on the status bit information corresponding to the query question.
9. The method according to claim 6, characterized in that, To ask further questions, including: Generate and present supplementary prompts for the question; Receive supplementary questions from the user based on the aforementioned supplementary prompts.
10. The method according to claim 6, characterized in that, Based on the obtained supplementary questions, further determine whether the question intent corresponding to the query question is complete, including: Based on the obtained supplementary questions, the status bit information corresponding to the query questions is updated. Based on the updated status bit information corresponding to the query, it is determined again whether the query intent corresponding to the query is complete.
11. The method according to any one of claims 1-10, characterized in that, The method further includes: If it is determined that the query question is the first round of the multi-round dialogue question, then the query statement prompt words corresponding to the query question are determined based on the query question.
12. The method according to claim 11, characterized in that, Based on the query query, the query statement suggestion words corresponding to the query query are determined, including: Based on slot extraction technology, slot information extraction processing is performed on the query to obtain the slot information corresponding to the query. Based on the slot information corresponding to the query, generate the status bit information corresponding to the query; Based on the status bit information corresponding to the query question, determine the query statement prompt words corresponding to the query question.
13. The method according to any one of claims 1-10, characterized in that, The method further includes: Based on the query statement corresponding to the query question, obtain and present the corresponding answer content.
14. A training method for a model used to generate query statements, characterized in that, include: Obtain the initial query statement to generate a large model and a model training set; The model training set includes multiple training samples; the training samples include: query statement suggestion samples and query statements corresponding to the query statement suggestion samples; wherein, the query statement suggestion samples are used to indicate the discarding of historical data generated during the query statement generation process; Based on the training samples included in the model training set, the initial query statement generation model is trained to obtain the query statement generation model. The query statement generates a large model, which is the model described in any one of claims 1-13.
15. The method according to claim 14, characterized in that, Based on the training samples included in the model training set, the initial query statement generation model is trained to obtain the query statement generation model, including: Obtain one training sample from the model training set; The query suggestion word samples included in the training samples are input into the initial query statement generation model, and the initial query statement corresponding to the query suggestion word samples is output. Based on the initial query statement corresponding to the query statement suggestion sample and the query statement corresponding to the query statement suggestion sample, the large-scale query statement generation model is trained to obtain the large-scale query statement generation model.
16. A training apparatus for a model used to generate query statements, characterized in that, include: The acquisition module is used to acquire the query question input by the user; wherein, the query question is the current round of dialogue question in a multi-round dialogue question; The determining module is used to determine the query statement prompt words corresponding to the query question based on the query question and the historical rounds of dialogue questions in the multi-round dialogue questions; wherein, the query statement prompt words are used to indicate that the historical data generated during the query statement generation process should be discarded; The generation module is used to input the query statement prompts into a pre-built query statement generation model to obtain the query statement corresponding to the query question.
17. A model-based query statement generation device, characterized in that, include: The acquisition module is used to acquire the initial query statement to generate the large model and the model training set; The model training set includes multiple training samples; the training samples include: query statement suggestion samples and query statements corresponding to the query statement suggestion samples; wherein, the query statement suggestion samples are used to indicate the discarding of historical data generated during the query statement generation process; The training module is used to train the large model for generating the initial query statement based on the training samples included in the model training set, so as to obtain the large model for generating the query statement. The query statement generates a large model, which is the model described in any one of claims 1-13.
18. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-13 or 14-15.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-13 or 14-15.
20. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-13 or 14-15.