A question-answering method, device, equipment and medium based on a large language model

By using similarity algorithm and sub-task decomposition technology in large language models, the problem of poor reply effect of large language models when dealing with multi-intention problem texts is solved, achieving higher accuracy and effect.

CN119739815AInactive Publication Date: 2025-04-01QINGDAO HISENSE ELECTRONICS TECH CONSULTANCY CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411595290.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-04-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When dealing with complex multi-intention problem texts, the large language model cannot effectively understand each intention, resulting in poor response effect and low accuracy.

Method used

The similarity between the target problem text and the complex problem text is determined through a preset similarity algorithm. If the threshold is exceeded, the corresponding subtasks and execution order will be obtained, and each subtask will be processed in sequence using a large language model and the results will be summarized to generate a reply.

Benefits of technology

It realizes effective processing of complex problem texts, improves the accuracy and effectiveness of text processing, and makes the reply more comprehensive and accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739815A_ABST
    Figure CN119739815A_ABST
Patent Text Reader

Abstract

The present application relates to the field of data processing technology, and in particular to a question-answering method, apparatus, device and medium based on a large language model. In an embodiment of the present application, the complex question text is disassembled in advance, and the complex question text is divided into individual subtasks and saved. In the question-answering process, the similarity between the target question text to be processed and the pre-configured complex question text can be determined first, so as to determine whether the target question text is a complex question text. If it is a complex question text, the target reply text of the target question text is determined according to each subtask corresponding to the saved target complex question text with the highest similarity and the corresponding execution order, thereby realizing the processing of the complex question text and improving the accuracy and effect of text processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a question-answering method, apparatus, device and medium based on a large language model. Background Art

[0002] In recent years, the technology of large language models has developed rapidly, its capabilities have become increasingly mature, and its applications have penetrated deeply into all walks of life. Among them, large language models are widely used in the field of question answering. Users can input question text into the large language model, and the large language model will analyze the question text and output the corresponding reply text. In addition, the large language model can create new and innovative reply texts instead of just repeating existing information.

[0003] In scenarios where complex tasks are required, large language models need to process complex multi-intent question texts. However, large language models cannot understand each intent in the question text very well, which leads to poor response effects and low accuracy in response to multi-intent question texts. Summary of the invention

[0004] The present application provides a question-answering method, apparatus, device and medium based on a large language model, which is used to solve the problem that the large language model in the prior art cannot well understand each intention in the question text, thereby resulting in poor response effect and low accuracy to multi-intent question texts.

[0005] In a first aspect, an embodiment of the present application provides a question-answering method based on a large language model, the method comprising:

[0006] Determine the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm;

[0007] If the highest similarity exceeds a preset threshold, each subtask corresponding to the target complex question text with the highest similarity and the corresponding execution order are obtained;

[0008] According to each subtask and the corresponding execution order, each subtask is processed in sequence using a large language model to obtain a sub-processing result corresponding to each subtask;

[0009] The large language model is used to summarize the sub-processing results corresponding to each sub-task to obtain the target response text corresponding to the target question text.

[0010] The above technical solution has the following advantages or beneficial effects: the complex question text is disassembled in advance, and the complex question text is divided into subtasks and saved. In the question-answering process, the similarity between the target question text to be processed and the pre-configured complex question text can be determined first, so as to determine whether the target question text is a complex question text. If it is a complex question text, the target reply text of the target question text is determined according to each subtask corresponding to the saved target complex question text with the highest similarity and the corresponding execution order, so as to realize the processing of the complex question text and improve the accuracy and effect of text processing.

[0011] In some embodiments of the present application, before using the large language model to sequentially process each of the subtasks to obtain a sub-processing result corresponding to each subtask, the method further includes:

[0012] Performing intent recognition on each of the subtasks respectively;

[0013] If it is determined that each of the subtasks has a corresponding target subtask with at least two intentions, then the target subtask is decomposed according to the at least two intentions to determine the execution order of each candidate subtask and each candidate subtask in the target subtask;

[0014] According to each candidate subtask and the execution order of each candidate subtask in the target subtask, each subtask corresponding to the target complex question text and the corresponding execution order are updated.

[0015] The above technical solution has the following advantages or beneficial effects: since each task corresponding to each complex question text is configured by a technician, and in order to improve the reuse rate, some subtasks can be composed of multiple subtasks. Based on this, in order to improve the accuracy of question and answer, in the embodiment of the present application, the electronic device will perform intent decomposition on each subtask separately, and split the subtasks with multiple intents, so that each subtask used in the question and answer is a single-intent text.

[0016] In some embodiments of the present application, performing intention decomposition on the target subtask according to the at least two intentions, and determining the execution order of each candidate subtask and each candidate subtask in the target subtask includes:

[0017] The target subtask and the first prompt word for prompting the large language model to perform intent decomposition are input into the large language model, and each candidate subtask corresponding to the target subtask output by the large language model and the execution order of each candidate subtask in the target subtask are obtained.

[0018] The above technical solution has the following advantages or beneficial effects: using a large language model to perform intent recognition and decomposition on multi-intention target subtasks can improve the efficiency and accuracy of intent recognition and decomposition compared to traditional intent recognition and decomposition methods.

[0019] In some embodiments of the present application, the adopting of the large language model to sequentially process each of the subtasks to obtain a sub-processing result corresponding to each subtask includes:

[0020] For each subtask in turn, the subtask, other sub-processing results of other subtasks before the subtask, and a pre-configured second prompt word are input into the large language model to obtain the sub-processing result corresponding to the subtask output by the large language model.

[0021] The above technical solution has the following advantages or beneficial effects: according to each subtask corresponding to the saved target complex question text with the highest similarity and the corresponding execution order, the target reply text of the target question text is determined, the processing of the complex question text is realized, and the accuracy and effect of text processing are improved.

[0022] In some embodiments of the present application, the using of the large language model to summarize the sub-processing results corresponding to each subtask to obtain the target reply text corresponding to the target question text includes:

[0023] Inputting the sub-processing results corresponding to each sub-task and the third prompt word used for the prompt word large language model to perform text fusion and summarization into the large language model;

[0024] The text output by the large language model is determined as the target reply text.

[0025] The above technical solution has the following advantages or beneficial effects: a large language model is used to summarize the sub-processing results corresponding to each sub-task, so that the final output target reply text integrates each sub-processing result, and the reply is more comprehensive and accurate.

[0026] In some embodiments of the present application, determining the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm includes:

[0027] Using a preset text embedding algorithm to determine a target feature vector corresponding to the target question text;

[0028] Obtain each candidate feature vector corresponding to each complex question text saved in advance;

[0029] The cosine similarity algorithm is used to determine each similarity between the target feature vector and each candidate feature vector.

[0030] The above technical solution has the following advantages or beneficial effects: In order to improve the efficiency of judging whether the target question text is a complex question text, in an embodiment of the present application, the electronic device may also pre-adopt a text embedding algorithm to determine each candidate feature vector corresponding to each candidate question text, and save each candidate feature vector into a vector database. In this way, when calculating the similarity in the application stage, the electronic device may directly obtain each candidate feature vector corresponding to each complex question text saved in advance from the vector database. The electronic device only needs to calculate one target feature vector of the target question text, thereby reducing the calculation amount of the electronic device and improving the question-answering efficiency.

[0031] In some embodiments of the present application, if the highest similarity does not exceed a preset threshold, the method further includes:

[0032] Determining that the target question text is a single-intent text, and inputting the target question text into the large language model;

[0033] The text output by the large language model is determined as the target response text corresponding to the target question text.

[0034] The above technical solution has the following advantages or beneficial effects: if the electronic device determines that the highest similarity between the target question text and each complex question text does not exceed the preset threshold, the electronic device determines that the target question text is a single-intent text, and the electronic device will directly use the large language model to answer the target question text, thereby improving the efficiency of question answering.

[0035] In a second aspect, an embodiment of the present application provides a question-answering device based on a large language model, the device comprising:

[0036] A processing module is used to determine the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm; if the highest similarity exceeds a preset threshold, each subtask corresponding to the saved target complex question text with the highest similarity and the corresponding execution order are obtained;

[0037] The question-answering module is used to use a large language model to process each subtask in sequence according to each subtask and the corresponding execution order, so as to obtain a sub-processing result corresponding to each subtask; and use the large language model to summarize the sub-processing results corresponding to each subtask to obtain a target reply text corresponding to the target question text.

[0038] In a third aspect, an embodiment of the present application further provides an electronic device, comprising at least a processor and a memory, wherein the processor is used to implement the steps of any of the above-mentioned question-answering methods based on a large language model when executing a computer program stored in the memory.

[0039] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned question-answering methods based on a large language model.

[0040] In an embodiment of the present application, the electronic device determines the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm; if the highest similarity exceeds a preset threshold, each subtask corresponding to the target complex question text with the highest similarity and the corresponding execution order are obtained; according to each subtask and the corresponding execution order, each subtask is processed in sequence using a large language model to obtain the sub-processing result corresponding to each subtask; the sub-processing result corresponding to each subtask is summarized using a large language model to obtain the target reply text corresponding to the target question text. In an embodiment of the present application, the complex question text is disassembled in advance, and the complex question text is split into subtasks and saved. In the question-answering process, the similarity between the target question text to be processed and the pre-configured complex question text can be determined first, so as to determine whether the target question text is a complex question text. If it is a complex question text, the target reply text of the target question text is determined according to each subtask corresponding to the target complex question text with the highest similarity and the corresponding execution order saved, so as to realize the processing of the complex question text and improve the accuracy and effect of text processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1 A schematic diagram of a question-answering process based on a large language model provided in an embodiment of the present application;

[0043] Figure 2 A schematic diagram of configuring a complex question text provided in an embodiment of the present application;

[0044] Figure 3 A schematic diagram of complex question text decomposition provided in an embodiment of the present application;

[0045] Figure 4 The overall architecture diagram of the question-answering based on the large language model provided in the embodiment of the present application;

[0046] Figure 5 A schematic diagram of an application of an interactive cockpit provided in an embodiment of the present application;

[0047] Figure 6 A schematic diagram of the structure of a question-answering device based on a large language model provided in an embodiment of the present application;

[0048] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0050] In order to improve the response effect and accuracy to complex question texts, the embodiments of the present application provide a question-answering method, apparatus, device and medium based on a large language model.

[0051] In an embodiment of the present application, the electronic device determines the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm; if the highest similarity exceeds a preset threshold, each subtask corresponding to the saved target complex question text with the highest similarity and the corresponding execution order are obtained; according to each subtask and the corresponding execution order, each subtask is processed in turn using a large language model to obtain a sub-processing result corresponding to each subtask; the sub-processing result corresponding to each subtask is summarized using a large language model to obtain a target reply text corresponding to the target question text

[0052] Figure 1 A schematic diagram of a question-answering process based on a large language model provided in an embodiment of the present application, the process includes:

[0053] S101: Determine the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm; if the highest similarity exceeds a preset threshold, obtain each subtask corresponding to the saved target complex question text with the highest similarity and the corresponding execution order.

[0054] A question-answering method based on a large language model provided in an embodiment of the present application is applied to an electronic device, which may be a PC or a server.

[0055] In the application of large language models, users hope that large language models can create new and innovative responses rather than just repeating existing information. However, in scenarios where complex tasks are required, especially when performing multi-step coordination tasks, users hope to get a complete and orderly execution result.

[0056] To address this problem, the embodiment of the present application proposes to decompose the complex task corresponding to the complex problem text into multiple subtasks based on process orchestration design and actual business, and plan the execution route, that is, determine the execution order of each subtask, and execute each subtask in sequence, so as to ensure global orderliness and retain local diversity.

[0057] Among them, business personnel compile a list of complex problem texts according to actual business needs, and sort out and configure their decomposition relationships one by one. In this process, two key points need to be paid attention to. The first is the composition of subtasks, which requires a comprehensive and detailed decomposition of the complex tasks corresponding to the complex problem texts; the second is the execution order of subtasks, which needs to be arranged reasonably to ensure the smooth completion of the entire task.

[0058] Take the traffic scenario as an example. "What is the current traffic situation in the city?" is a complex question text. If the large language model is allowed to answer freely, it may get a variety of different answers, but this is not actually necessary. Therefore, this question can be broken down into the following subtasks: "Query the current traffic index, regional ranking, and congested sections of the city", "Compare with yesterday's situation", "Query the top 3 congested sections", "Turn on the cameras on these sections", and "Develop improvement measures based on the current situation."

[0059] Among them, technicians can configure complex question texts and corresponding subtasks through the large language model common technology display platform. Specifically, technicians can create complex question texts in the large language model common technology display platform and add subtasks corresponding to the complex question texts.

[0060] Figure 2 A schematic diagram of configuring complex question text provided in an embodiment of the present application, such as the Figure 2As shown, the technician can create a complex question text in the large language model common technology display platform as "How is the current traffic operation in the city?" The large language model common technology display platform assigns an id to the complex question text and records the creator and creation time. If the technician updates the existing complex question text, the large language model common technology display platform records the updater and update time. The subtasks corresponding to the complex question text created by the technician include "Query the current traffic index, regional ranking, and congested sections of the city", "How does it compare with yesterday", "Open the secondary interface of the operating status", and "Summarize and generate feedback information." The large language model common technology display platform assigns an id to the complex question text and records the creator and creation time. If the technician updates the existing complex question text, the large language model common technology display platform records the updater and update time. The id of the subtask is the order in which the subtask is executed.

[0061] Based on this, in the embodiment of the present application, each complex question text, each subtask corresponding to each complex question text, and the execution order corresponding to each subtask are pre-configured in the electronic device. After receiving the target question text to be answered, the electronic device can determine whether the target question text is a complex question based on each pre-configured complex question text, so as to formulate an execution strategy for the target question text.

[0062] In this embodiment of the present application, different complex question texts can share a subtask.

[0063] Specifically, the electronic device determines each similarity between the target question text and each pre-configured complex question text according to a preset similarity algorithm. The electronic device determines the highest similarity among each similarity. If the highest similarity exceeds a preset threshold, the electronic device determines that the target question text is a complex question text. The electronic device then obtains each subtask corresponding to the target complex question text with the highest similarity and the corresponding execution order, thereby formulating an execution strategy for the target question text according to each subtask and the corresponding execution order.

[0064] S102: According to each subtask and the corresponding execution order, use the large language model to process each subtask in sequence to obtain a sub-processing result corresponding to each subtask; use the large language model to summarize the sub-processing results corresponding to each subtask to obtain a target reply text corresponding to the target question text.

[0065] In an embodiment of the present application, after the electronic device determines each subtask and the corresponding execution order corresponding to the target complex question text with the highest similarity, the electronic device determines each subtask and the corresponding execution order as each subtask and the corresponding execution order corresponding to the target question text, and the electronic device executes each subtask in sequence according to the execution order, thereby obtaining the target reply text corresponding to the target question text.

[0066] Specifically, the electronic device uses the large language model to process each subtask in turn according to each subtask and the corresponding execution order, and obtains the sub-processing result corresponding to each subtask. The electronic device uses the large language model to summarize the sub-processing result corresponding to each subtask to obtain the target reply text corresponding to the target question text.

[0067] In the embodiment of the present application, the complex question text is disassembled in advance, and the complex question text is divided into individual subtasks and saved. In actual application, the similarity between the target question text to be processed and the pre-configured complex question text can be determined first, so as to determine whether the target question text is a complex question text. If it is a complex question text, the target reply text of the target question text is determined according to each subtask corresponding to the saved target complex question text with the highest similarity and the corresponding execution order, so as to realize the processing of the complex question text and improve the accuracy and effect of text processing.

[0068] In order to improve the response effect and accuracy of complex question texts, based on the above embodiments, in the embodiment of the present application, before the large language model is used to process each subtask in sequence and obtain the sub-processing result corresponding to each subtask, the method further includes:

[0069] Performing intent recognition on each of the subtasks respectively;

[0070] If it is determined that each of the subtasks has a corresponding target subtask with at least two intentions, then the target subtask is decomposed according to the at least two intentions to determine the execution order of each candidate subtask and each candidate subtask in the target subtask;

[0071] According to each candidate subtask and the execution order of each candidate subtask in the target subtask, each subtask corresponding to the target complex question text and the corresponding execution order are updated.

[0072] In the embodiment of the present application, since each task corresponding to each complex question text is configured by a technician, and in order to improve the reuse rate, some subtasks can be composed of multiple subtasks. For example, the complex question text is "How is the current traffic operation situation in the city?" The complex question text corresponds to the following four sub-steps: "Query the current traffic index, regional ranking, and congested sections of the city", "Compare with yesterday's situation", "Open the cameras of the top 3 congested sections", and "Formulate improvement measures based on the current situation." Among them, the subtask of "Open the cameras of the top 3 congested sections" can be decomposed into two subtasks: "Query the top 3 congested sections" and "Open the cameras of these sections."

[0073] Figure 3 A schematic diagram of the decomposition of complex question text provided in the embodiment of the present application, such as the Figure 3 As shown, complex question text 1 (complex task 1) is decomposed into three subtasks, namely decomposition task A, decomposition task B and decomposition task C, wherein decomposition task A can be decomposed into decomposition task A1, decomposition task A2 and decomposition task A3, and decomposition task B can be decomposed into decomposition task B1 and decomposition task B2; complex question text 2 (complex task 2) is decomposed into five subtasks, namely decomposition task B, decomposition task C, decomposition task D, decomposition task E and decomposition task F. Among them, complex question text 1 and complex question text 2 share decomposition task B.

[0074] Based on this, in order to improve the accuracy of question and answer, in an embodiment of the present application, the electronic device will decompose the intent of each subtask separately, and split the subtasks with multiple intents, so that each subtask used in the question and answer is a single-intent text.

[0075] Specifically, the electronic device performs intent recognition on each subtask corresponding to the target question text. Based on the number of recognized intents corresponding to each subtask, the electronic device determines whether there is a target subtask with at least two corresponding intents in each subtask. If the electronic device determines that the target subtask exists, the electronic device performs intent decomposition on the target subtask based on at least two intents, and determines each candidate subtask and the order in which each candidate subtask should be executed in the target subtask. One candidate subtask corresponds to one intent, and all intents corresponding to each candidate subtask are equal to all intents corresponding to the target subtask. Figure 1 To.

[0076] The electronic device updates each subtask corresponding to the target complex question text and the corresponding execution order according to each candidate subtask and the execution order of each candidate subtask in the target subtask.

[0077] Specifically, the electronic device constructs a subtask string according to the execution order of each subtask, and constructs a candidate subtask string according to the execution order of each candidate subtask. The electronic device replaces the target subtask in the subtask string with the candidate subtask string, and updates the execution order of each subtask in the replaced subtask string.

[0078] For example, the electronic device determines that the target question text corresponds to three subtasks, namely subtask A, subtask B and subtask C, where the execution order of subtask A is 1, the execution order of subtask B is 2, and the execution order of subtask C is 3, then the electronic device determines the subtask string to be [A, B, C]. The electronic device determines that subtask C corresponds to multiple intentions, and decomposes subtask C into candidate subtask D and candidate subtask E, where the sub-execution order of candidate subtask string D is 1, and the sub-execution order of candidate subtask string E is 2, then the electronic device determines the candidate subtask string to be [D, E].

[0079] On this basis, the electronic device replaces subtask C with candidate subtasks D and E, and obtains an updated subtask string of [A, B, D, E]. That is, the four subtasks corresponding to the target question text finally determined by the electronic device are subtask A, subtask B, subtask D, and subtask E. Among them, the execution order corresponding to subtask A is 1, the execution order corresponding to subtask B is 2, the execution order corresponding to subtask D is 3, and the execution order corresponding to subtask E is 4.

[0080] In order to improve the response effect and accuracy of complex question texts, based on the above embodiments, in the embodiment of the present application, the intention decomposition of the target subtask according to the at least two intentions, and the determination of the execution order of each candidate subtask and each candidate subtask in the target subtask include:

[0081] The target subtask and the first prompt word for prompting the large language model to perform intent decomposition are input into the large language model, and each candidate subtask corresponding to the target subtask output by the large language model and the execution order of each candidate subtask in the target subtask are obtained.

[0082] In an embodiment of the present application, the electronic device can realize the intent recognition and decomposition of subtasks through a large language model.

[0083] Specifically, the electronic device inputs the target subtask and the first prompt word used to prompt the large language model to perform intent decomposition into the large language model, obtains each candidate subtask corresponding to the target subtask output by the large language model and the execution order of each candidate subtask in the target subtask.

[0084] In addition, the electronic device may also use other methods to identify and decompose the intent of subtasks, such as identifying and decomposing the intent of subtasks based on keywords, based on database comparison, based on neural network models, etc., which are not limited here.

[0085] In order to improve the response effect and accuracy of complex question texts, based on the above embodiments, in the embodiment of the present application, the large language model is used to process each subtask in turn, and the sub-processing results corresponding to each subtask are obtained, including:

[0086] For each subtask in turn, the subtask, other sub-processing results of other subtasks before the subtask, and a pre-configured second prompt word are input into the large language model to obtain the sub-processing result corresponding to the subtask output by the large language model.

[0087] In an embodiment of the present application, after the electronic device obtains each subtask corresponding to the target problem and the corresponding execution order, the electronic device uses a large language model to process each subtask in turn to obtain a sub-processing result corresponding to each subtask.

[0088] Specifically, for each subtask in turn, the electronic device inputs the subtask, other sub-processing results of other subtasks before the subtask, and a pre-configured second prompt word into the large language model, and obtains the sub-processing result corresponding to the subtask output by the large language model.

[0089] The purpose of the prompt word is to help the model understand the user's needs and provide corresponding information or perform corresponding tasks according to the prompt word. Since the intent type corresponding to each subtask is different, in order for the large language model to work better, the second prompt word corresponding to each subtask will also be different.

[0090] Specifically, intent types include text-to-SQL, device control, information extraction, etc.

[0091] For example, under the text-to-SQL intent, the subtasks are assembled with prompt words, and the SQL statement is obtained through the large language model. After adding the authentication information, the query operation is performed on the dedicated database, and the execution result is temporarily stored as an intermediate result. Under the device control intent, the subtasks are assembled with prompt words, and the slots are extracted through the large language model. The slot information is put into the device control table for matching and encapsulation to obtain the operation instructions, and finally sent to the device monitoring interface. Under the information extraction intent, the subtasks are assembled with prompt words in combination with the intent type, and the large language model is called to obtain the information extraction results.

[0092] In order to improve the response effect and accuracy of complex question texts, based on the above embodiments, in the embodiment of the present application, the large language model is used to summarize the sub-processing results corresponding to each subtask, and the target response text corresponding to the target question text is obtained, including:

[0093] Inputting the sub-processing results corresponding to each sub-task and the third prompt word used for the prompt word large language model to perform text fusion and summarization into the large language model;

[0094] The text output by the large language model is determined as the target reply text.

[0095] In an embodiment of the present application, after the electronic device determines the sub-processing results corresponding to each sub-task, the electronic device inputs these sub-processing results and the third prompt word used for the prompt word large language model to perform text fusion and summarization into the large language model, so that the large language model performs text fusion and summarization to obtain the final target reply text.

[0096] In addition, in the embodiment of the present application, each subtask of the decomposition configuration can be re-evaluated through the target reply text to further optimize the entire execution process. The optimization strategy includes changing the execution order of subtasks, refining the execution content of subtasks, rewriting the execution content of subtasks, etc. In this way, the execution strategy of the entire task can be flexibly adjusted and optimized according to the actual execution results, thereby improving the efficiency and accuracy of task execution.

[0097] In order to improve the response effect and accuracy of complex question texts, based on the above embodiments, in the embodiment of the present application, the similarity between the target question text to be responded to and each pre-configured complex question text is determined according to a preset similarity algorithm, including:

[0098] Using a preset text embedding algorithm to determine a target feature vector corresponding to the target question text;

[0099] Obtain each candidate feature vector corresponding to each complex question text saved in advance;

[0100] The cosine similarity algorithm is used to determine each similarity between the target feature vector and each candidate feature vector.

[0101] In order to determine the similarity between the target question text and each pre-configured complex question text, in an embodiment of the present application, the electronic device may use a text embedding algorithm and a cosine similarity algorithm to determine each similarity between the target question text and each pre-configured complex question text. The text embedding algorithm may be deployed in an Embedding tool, and the electronic device may embed the target question text and the complex question text by calling the Embedding tool to obtain the corresponding feature vector.

[0102] Specifically, the electronic device uses a text embedding algorithm to determine a target feature vector of a target question text and to determine each candidate feature vector corresponding to each candidate question text. The electronic device uses a cosine similarity algorithm to determine each similarity between the target feature vector and each candidate feature vector.

[0103] Among them, in order to improve the efficiency of judging whether the target question text is a complex question text, in an embodiment of the present application, the electronic device can also pre-adopt a text embedding algorithm to determine each candidate feature vector corresponding to each candidate question text, and save each candidate feature vector into a vector database. In this way, when calculating the similarity in the application stage, the electronic device can directly obtain each candidate feature vector corresponding to each complex question text saved in advance from the vector database. The electronic device only needs to calculate one target feature vector of the target question text, thereby reducing the calculation amount of the electronic device and improving the question-answering efficiency.

[0104] It should be noted that the vector database stores each complex question text and the corresponding candidate feature vector. For example, the vector database stores “A1: How is the traffic situation in the whole city”: [1.3568, -0.2584, …, 0.5841]; “A2: How is the change in vehicles entering the city today”: [0.6531, -1.2004, …, -0.2389]; “A3: Analyze the accident sections in the whole city”: [-0.9521, 0.8521, …, 1.4912], etc.

[0105] Among them, the electronic device can determine the similarity through the following formula:

[0106]

[0107] Among them, A represents the candidate feature vector of the complex question text, B represents the target feature vector of the target question text, and Similarity(A, B) represents the similarity between A and B, with a value range of [-1,1], where -1 represents complete dissimilarity and 1 represents complete similarity.

[0108] In order to improve the reply effect and accuracy of complex question texts, based on the above embodiments, in the embodiment of the present application, if the highest similarity does not exceed the preset threshold, the method further includes:

[0109] Determining that the target question text is a single-intent text, and inputting the target question text into the large language model;

[0110] The text output by the large language model is determined as the target response text corresponding to the target question text.

[0111] In the embodiment of the present application, if the electronic device determines that the highest similarity between the target question text and each complex question text does not exceed the preset threshold, the electronic device determines that the target question text is a single-intent text. The electronic device will directly use the large language model to answer the target question text.

[0112] Specifically, if the electronic device determines that the highest similarity does not exceed the preset threshold, the electronic device determines that the target question text is a single-intent text, and inputs the target question text into the large language model. The electronic device obtains the text output by the large language model, and determines the text output by the large language model as the target reply text corresponding to the target question text.

[0113] For example, the electronic device sorts the similarities from large to small, selects the maximum similarity max, sets a preset threshold p, and when max>p, the electronic device determines that the target question text hits the complex intent, otherwise the target question text is processed as a common intent.

[0114] Figure 4 The overall architecture diagram of the question-answering based on the large language model provided in the embodiment of the present application is shown in the figure. Figure 4 As shown, the Embedding Similarity module matches the input target question text with each pre-configured complex question text for similarity, and determines whether the highest similarity exceeds the preset threshold. If the highest similarity exceeds the preset threshold, it is determined that the target question text hits the complex intent, and the electronic device obtains the task string corresponding to the target question text from the process arrangement design module, and determines the prompt word corresponding to each subtask according to the intent corresponding to each subtask in the task string, and executes each subtask in sequence according to the execution order and intent of each subtask, so as to determine and output the corresponding target question text. If it is determined that the highest similarity does not exceed the preset threshold, it is determined that the target question text does not hit the complex intent, and the electronic device determines the prompt word corresponding to the intent of the target question text, and determines and outputs the target question text based on the prompt word.

[0115] The question-answering method provided in the embodiment of the present application can be applied to various fields, and the following is an illustration using an interactive cockpit as an example:

[0116] Figure 5 The application diagram of the interactive cockpit provided in the embodiment of the present application is shown in FIG. Figure 5 As shown, the user inputs the target question text "What is the current traffic operation status of the whole city?" Based on the method provided in this application, the server matches the subtasks corresponding to the target question text as "1. Query the current traffic index, regional ranking, and congested sections of the whole city", "2. Compare with yesterday's situation", "3. Open the cameras of the top 3 congested sections" and "4. Specify improvement measures according to the current situation". The server executes each subtask in turn and obtains the sub-processing results corresponding to each subtask.

[0117] Based on the above embodiments, Figure 6 A schematic diagram of the structure of a question-answering device based on a large language model provided in an embodiment of the present application, the device comprising:

[0118] Processing module 601 is used to determine the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm; if the highest similarity exceeds a preset threshold, each subtask corresponding to the target complex question text with the highest similarity and the corresponding execution order are obtained;

[0119] The question-and-answer module 602 is used to use a large language model to process each subtask in sequence according to each subtask and the corresponding execution order, so as to obtain a sub-processing result corresponding to each subtask; and use the large language model to summarize the sub-processing results corresponding to each subtask to obtain a target reply text corresponding to the target question text.

[0120] In a possible implementation, the processing module 601 is also used to perform intent recognition on each of the subtasks respectively; if it is determined that there is a target subtask corresponding to at least two intentions in each of the subtasks, the target subtask is decomposed into intent according to the at least two intentions, and each candidate subtask and the order in which each candidate subtask is to be executed in the target subtask are determined; and each subtask corresponding to the target complex problem text and the corresponding execution order are updated according to each candidate subtask and the order in which each candidate subtask is to be executed in the target subtask.

[0121] In a possible implementation, the processing module 601 is specifically used to input the target subtask and the first prompt word for prompting the large language model to perform intent decomposition into the large language model, obtain each candidate subtask corresponding to the target subtask output by the large language model and the execution order of each candidate subtask in the target subtask.

[0122] In a possible implementation, the question-and-answer module 602 is specifically used to input each subtask, other sub-processing results of other subtasks before the subtask, and a pre-configured second prompt word into the large language model in turn, and obtain the sub-processing result corresponding to the subtask output by the large language model.

[0123] In a possible implementation, the question-and-answer module 602 is specifically used to input the sub-processing results corresponding to each sub-task and the third prompt word used for the prompt word large language model to perform text fusion and summarization into the large language model; and determine the text output by the large language model as the target reply text.

[0124] In a possible implementation, the processing module 601 is specifically used to use a preset text embedding algorithm to determine the target feature vector corresponding to the target question text; obtain each candidate feature vector corresponding to each complex question text saved in advance; and use a cosine similarity algorithm to determine each similarity between the target feature vector and each candidate feature vector.

[0125] In a possible implementation, the processing module 601 is further used to determine that the target question text is a single-intent text if the highest similarity does not exceed a preset threshold, and input the target question text into the large language model; and determine the text output by the large language model as the target reply text corresponding to the target question text.

[0126] Based on the above embodiments, the present application also provides an electronic device, Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, it includes: a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704;

[0127] The memory 703 stores a computer program. When the program is executed by the processor 701, the processor 701 executes the steps of the question-answering method based on a large language model as provided in the above embodiments.

[0128] Since the principle of solving the problem by the above electronic device is similar to the question-answering method based on a large language model, the implementation of the above electronic device can refer to the embodiment of the method, and the repeated parts will not be repeated.

[0129] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 702 is used for communication between the above electronic device and other devices. The memory may include a random access memory (RAM) and may also include a non-volatile memory (NVM), such as at least one disk storage. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

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

[0131] On the basis of the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program executable by a processor. When the program runs on the processor, the processor implements the steps of the question-answering method based on the large language model provided in the above embodiments.

[0132] Since the principle of solving the problem by the above-mentioned computer-readable storage medium is similar to that of the question-answering method based on a large language model, the implementation of the above-mentioned computer-readable storage medium can refer to the embodiment of the method, and the repeated parts will not be repeated.

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

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

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

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

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

Claims

1. A question-answering method based on a large language model, characterized in that: The method comprises: Determine the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm; If the highest similarity exceeds a preset threshold, each subtask corresponding to the target complex question text with the highest similarity and the corresponding execution order are obtained; According to each subtask and the corresponding execution order, each subtask is processed in sequence using a large language model to obtain a sub-processing result corresponding to each subtask; The large language model is used to summarize the sub-processing results corresponding to each sub-task to obtain the target response text corresponding to the target question text.

2. The method according to claim 1, characterized in that Before using the large language model to sequentially process each of the subtasks to obtain a sub-processing result corresponding to each subtask, the method further includes: Performing intent recognition on each of the subtasks respectively; If it is determined that each of the subtasks has a corresponding target subtask with at least two intentions, then the target subtask is decomposed according to the at least two intentions to determine the execution order of each candidate subtask and each candidate subtask in the target subtask; According to each candidate subtask and the execution order of each candidate subtask in the target subtask, each subtask corresponding to the target complex question text and the corresponding execution order are updated.

3. The method according to claim 2, characterized in that The step of performing intention decomposition on the target subtask according to the at least two intentions, and determining the execution order of each candidate subtask and each candidate subtask in the target subtask comprises: The target subtask and the first prompt word for prompting the large language model to perform intent decomposition are input into the large language model, and each candidate subtask corresponding to the target subtask output by the large language model and the execution order of each candidate subtask in the target subtask are obtained.

4. The method according to claim 1, characterized in that: The adopting of the large language model to sequentially process each of the subtasks to obtain a sub-processing result corresponding to each subtask includes: For each subtask in turn, the subtask, other sub-processing results of other subtasks before the subtask, and a pre-configured second prompt word are input into the large language model to obtain the sub-processing result corresponding to the subtask output by the large language model.

5. The method according to claim 1, characterized in that The adopting of the large language model to summarize the sub-processing results corresponding to each sub-task to obtain the target reply text corresponding to the target question text includes: Inputting the sub-processing results corresponding to each sub-task and the third prompt word used for the prompt word large language model to perform text fusion and summarization into the large language model; The text output by the large language model is determined as the target reply text.

6. The method according to claim 1, characterized in that Determining the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm includes: Using a preset text embedding algorithm to determine a target feature vector corresponding to the target question text; Obtain each candidate feature vector corresponding to each complex question text saved in advance; The cosine similarity algorithm is used to determine each similarity between the target feature vector and each candidate feature vector.

7. The method according to claim 1, characterized in that If the highest similarity does not exceed a preset threshold, the method further includes: Determining that the target question text is a single-intent text, and inputting the target question text into the large language model; The text output by the large language model is determined as the target response text corresponding to the target question text.

8. A question-answering device based on a large language model, characterized in that: The device comprises: A processing module is used to determine the similarity between the target question text to be answered and each pre-configured complex question text according to a preset similarity algorithm; if the highest similarity exceeds a preset threshold, each subtask corresponding to the saved target complex question text with the highest similarity and the corresponding execution order are obtained; The question-answering module is used to use a large language model to process each subtask in sequence according to each subtask and the corresponding execution order, so as to obtain a sub-processing result corresponding to each subtask; and use the large language model to summarize the sub-processing results corresponding to each subtask to obtain a target reply text corresponding to the target question text.

9. An electronic device, characterized in that: The electronic device comprises at least a processor and a memory, and the processor is used to implement the steps of the question-answering method based on a large language model as described in any one of claims 1 to 7 when executing a computer program stored in the memory.

10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the steps of the question-answering method based on a large language model as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Answer generation method and device, equipment, storage medium and product

    CN121009991A

  • Answer generation method and device, equipment, storage medium and product

    CN121009991B