Answer generation method and device, equipment and readable storage medium

By using clustered standard questions and similar questions in the knowledge problem system, the similarity of the question information is calculated, and the problem of long answer generation time in the existing technology is solved, fast and reliable answer generation is achieved, and user experience is improved.

CN119807382APending Publication Date: 2025-04-11创优数字科技(广东)有限公司
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

When handling user questions, the existing knowledge problem system needs to compare similarity with all questions in the knowledge base, resulting in a longer time to generate answers and affecting the user experience.

Method used

By obtaining clustered standard questions and similar questions from the Q&A knowledge base, the similarity between the question and answer information and these questions is calculated, the overall similarity is calculated based on the weight, and if the threshold is exceeded, the standard question and answer with the highest similarity is selected.

Benefits of technology

The similarity calculation process is reduced, the answer generation speed is improved, the one-sidedness caused by a single similarity is avoided, the answer is reliable, the user wait time is reduced, and the user experience is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807382A_ABST
    Figure CN119807382A_ABST
Patent Text Reader

Abstract

The invention discloses an answer generation method and device, equipment and a readable storage medium, and the method comprises the steps: obtaining each standard question and all similar questions of each standard question from a question and answer knowledge base, the similarity between each standard question and the corresponding similar question meets a preset similarity range, and each standard question corresponds to a standard answer; calculating a standard similarity between the question information and each standard question, and a similar similarity between the question information and each similar question; based on the standard similarity and the first weight corresponding to the same standard question, and the similar similarity and the second weight, calculating the overall similarity corresponding to the standard question; and if any total similarity exceeds a similarity threshold, taking the standard answer corresponding to the standard question with the highest total similarity as a target answer of the question information. Therefore, the answer generation speed can be increased, the answer generation reliability is ensured, the answer waiting time of the user is further shortened, and the use experience of the user is improved.
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 more specifically, to an answer generation method, device, equipment and readable storage medium. Background Art

[0002] In today's era, information is exploding and becoming increasingly complex. In this context, more and more people tend to use knowledge question systems to find answers to various questions.

[0003] In the prior art, the knowledge question system compares the similarity between the user's question and each question stored in the corresponding knowledge base one by one, selects the answer to the question with the highest similarity to the user's question as the most suitable answer to the user's question, and provides it to the user.

[0004] However, this approach has obvious drawbacks. Since the user's questions need to be compared with all the questions in the knowledge base for similarity, as the number of questions in the knowledge base increases, the time spent on the entire comparison process will also increase. As a result, users often have to wait for a long time before they can get the answer to their questions. This delay makes it impossible to respond to user questions in a timely manner, which greatly affects the user's experience in using the knowledge question system. Summary of the invention

[0005] In view of this, the present application provides an answer generation method, apparatus, device and readable storage medium to solve the shortcoming of long answer generation time in the prior art.

[0006] In order to achieve the above objectives, the proposed solution is as follows:

[0007] A method for generating an answer, comprising:

[0008] Respond to the user's question operation and determine the question information;

[0009] Obtain each standard question and all similar questions of each standard question from the question-answering knowledge base. Each standard question is generated based on each clustered question in the question-answering knowledge base. The similarity between each standard question and the corresponding similar question meets a preset similarity range. Each standard question has a corresponding standard answer.

[0010] Calculating the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question;

[0011] Determine a first weight based on the representation degree of the standard question to the question semantics, and determine a second weight based on the representation degree of the similar question to the question semantics;

[0012] Based on the standard similarity and the first weight corresponding to the same standard question, and the similarity of the same type and the second weight, calculate the overall similarity of the corresponding standard question;

[0013] If any overall similarity exceeds the similarity threshold, the standard answer corresponding to the standard question with the highest overall similarity is used as the target answer to the question information.

[0014] Optionally, after calculating the overall similarity of the corresponding standard question based on the standard similarity and the first weight corresponding to the same standard question and the similarity of the same type and the second weight, the method further includes:

[0015] If all the overall similarities are lower than the similarity threshold, it is determined that the question information cannot find an answer, and the question information is written into the question-answering knowledge base as an unsolvable question.

[0016] Optionally, obtaining each standard question and all similar questions of each standard question from the question-answer knowledge base includes:

[0017] Clustering each question in the question-answering knowledge base to generate a plurality of cluster subsets, wherein each cluster subset contains a plurality of questions;

[0018] Select the central question for each cluster subset;

[0019] Optimize the central question of each cluster subset to form the standard question of the corresponding cluster subset;

[0020] Generate multiple similar questions to be selected corresponding to each standard question, and select all similar questions to be selected whose discrimination degree with the corresponding standard question meets a preset discrimination threshold and whose similarity degree meets a preset similarity condition as the various similar questions of the corresponding standard question.

[0021] Optionally, the central question of selecting each cluster subset includes:

[0022] For each cluster subset, the sum of similarities between each question in the cluster subset and other questions in the cluster subset is calculated; and the question with the largest sum of similarities is selected as the central question.

[0023] Optionally, the optimizing the central question of each cluster subset to form a standard question corresponding to the cluster subset includes:

[0024] Obtaining a problem processing model, wherein the problem processing model is trained to simplify input problems;

[0025] The problem processing model is used to simplify the central question of each cluster subset to obtain the standard question of the corresponding cluster subset.

[0026] Optionally, generating a plurality of similar questions to be selected corresponding to each standard question includes:

[0027] For each cluster subset, calculate the discrimination degree between the standard question corresponding to the cluster subset and other questions in the cluster subset except the central question, and take other questions whose discrimination degree exceeds the preset discrimination threshold as the similar questions to be selected;

[0028] Get the trained question generation model;

[0029] The question generation model is used to combine each standard question to generate multiple similar questions to be selected corresponding to each standard question.

[0030] Optionally, obtaining a trained question generation model includes:

[0031] Obtaining an initial large language model and multiple training samples, each training sample includes a training question annotated with multiple similar question data, and the degree of distinction between each training question and any corresponding similar question data satisfies the distinction threshold and the degree of similarity satisfies a preset similarity condition;

[0032] The initial large language model is trained using each training sample in turn until the discrimination between the generated questions of the initial large language model and the corresponding training questions for multiple consecutive times meets the discrimination threshold and the similarity meets the preset similarity condition, and the final initial large language model is used as the trained question generation model.

[0033] An answer generating device, comprising:

[0034] A determination module, used to respond to the user's question operation and determine the question information;

[0035] An acquisition module is used to acquire each standard question and all similar questions of each standard question from the question-answering knowledge base. Each standard question is generated based on each clustered question in the question-answering knowledge base. The similarity between each standard question and the corresponding similar question meets a preset similarity range. Each standard question has a corresponding standard answer.

[0036] A calculation module, used for calculating the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question;

[0037] A representation module, configured to determine a first weight based on the representation degree of the standard question to the question semantics, and determine a second weight based on the representation degree of the similar question to the question semantics;

[0038] An adding module, used for calculating the overall similarity of the corresponding standard question based on the standard similarity and the first weight corresponding to the same standard question, and the similarity of the same type and the second weight;

[0039] A generation module is used to use the standard answer corresponding to the standard question with the highest overall similarity as the target answer of the question information if any overall similarity exceeds a similarity threshold.

[0040] An answer generating device, comprising a memory and a processor;

[0041] The memory is used to store programs;

[0042] The processor is used to execute the program to implement the various steps of the above-mentioned answer generation method.

[0043] A readable storage medium stores a computer program, which, when executed by a processor, implements the various steps of the above-mentioned answer generation method.

[0044] It can be seen from the above technical solutions that the answer generation method provided by the present application can respond to the user's question operation and determine the question information; based on this, the present application can capture user needs and generate question information; then, each standard question and all similar questions of each standard question can be obtained from the question and answer knowledge base, and each standard question is generated based on each clustered question in the question and answer knowledge base, and the similarity between each standard question and the corresponding similar question meets the preset similarity range, and each standard question corresponds to a standard answer; calculate the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question; determine the first weight based on the degree of representation of the question semantics by the standard question, and determine the second weight based on the degree of representation of the question semantics by the similar question; calculate the overall similarity of the corresponding standard question based on the standard similarity and the first weight corresponding to the same standard question, and the similarity and the second weight; based on this, the present application compares the question information with The comparison process of each question in the question-answering knowledge base is converted into a comparison process between the question information and different types of standard questions and similar questions, which further reduces the similarity calculation process, thereby speeding up the answer generation speed; at the same time, in this process, the present application avoids the one-sidedness caused by a single similarity by combining the similarity of similar questions and assigning weights corresponding to standard questions and similar questions; using similar questions of each standard question can expand the semantic coverage, optimize the flexibility and practicality of semantic understanding, and further ensure the reliability of the semantic similarity between the question information represented by the overall similarity and the corresponding standard question; finally, if there is any overall similarity that exceeds the similarity threshold, the standard answer corresponding to the standard question with the highest overall similarity is used as the target answer of the question information; based on this, the present application can ensure the semantic similarity and matching degree between the selected standard question and the question information through the calculation of the overall similarity, thereby ensuring the similarity and matching degree between the target answer and the question information. It can be seen that the present application can ensure the reliability of the generated answer while speeding up the answer generation speed, further reduce the user's answer waiting time, and improve the user's user experience. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0046] Figure 1 A flow chart of an answer generation method disclosed in an embodiment of the present application;

[0047] Figure 2 This is a structural block diagram of an answer generation device disclosed in an embodiment of the present application;

[0048] Figure 3 This is a hardware structure block diagram of an answer generation device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0050] The embodiment of the present application provides an answer generation method, which can be applied to various knowledge question-answering systems or knowledge management systems, and can also be applied to various computer terminals or smart terminals. The execution subject can be a processor or server of the computer terminal or smart terminal. The method flow chart of the answer generation method is as follows: Figure 1 As shown, specifically including:

[0051] Step S1, responding to the user's question operation and determining the question information.

[0052] Specifically, the system can respond to questioning operations performed by users in a variety of ways.

[0053] For example, the user's voice audio can be collected through a microphone in response to a user's voice question operation;

[0054] It can extract acoustic features from speech audio, and convert speech audio into text information by combining language model and acoustic features;

[0055] Extract keywords from text information and determine question information.

[0056] Among them, keywords can be extracted from text information through a variety of algorithms to determine question information.

[0057] For example, the Term Frequency-Inverse Document Frequency (TF-IDF) algorithm, the TextRank algorithm, or the topic model algorithm.

[0058] It can also respond to the user's keyboard input operation to obtain the question information entered by the user through the keyboard.

[0059] Step S2: Obtain each standard question and all similar questions of each standard question from the question-answering knowledge base. Each standard question is generated based on the clustered questions in the question-answering knowledge base. The similarity between each standard question and the corresponding similar question satisfies a preset similarity range. Each standard question has a corresponding standard answer.

[0060] Specifically, standard questions of different question types and their corresponding multiple similar questions can be obtained from the question-answering knowledge base.

[0061] Each standard question in the question-and-answer knowledge base can be generated based on each question of the corresponding question type, and the similarity between each standard question and its corresponding questions of the same type satisfies a preset similarity range; questions of the same type have a unique corresponding standard answer, which is the answer to the corresponding standard question.

[0062] Each standard question and its corresponding similar question correspond to the same question type, but the degree of distinction between each standard question and its corresponding similar question meets the distinction threshold;

[0063] Therefore, the similarity range can be set according to the actual distinction requirements, so that each standard question and its corresponding similar question correspond to the same question type, but the distinction between each standard question and its corresponding similar question meets the distinction threshold.

[0064] Step S3: Calculate the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question.

[0065] Specifically, the similarity between the question information and each standard question may be calculated, and the calculated similarity may be used as the standard similarity between the question information and the corresponding standard question.

[0066] The similarity between the question information and each similar question can be calculated, and the calculated similarity is used as the similarity between the question information and the corresponding similar question.

[0067] The similarity between the question information and each standard question may be calculated in a variety of ways, such as by using an edit distance algorithm, a cosine distance algorithm or a semantic vector model.

[0068] Similarly, the similarity between the question information and each similar question can also be calculated through the edit distance algorithm, cosine distance algorithm or semantic vector model.

[0069] Step S4: Determine a first weight based on the representation degree of the question semantics by the standard question, and determine a second weight based on the representation degree of the question semantics by similar questions.

[0070] Specifically, the first weight may correspond to each standard question in the question-answering knowledge base; and the second weight may correspond to each similar question in the question-answering knowledge base.

[0071] The first weight and the second weight may be the same value or different values.

[0072] Step S5: Calculate the overall similarity of the corresponding standard question based on the standard similarity and the first weight corresponding to the same standard question and the similarity of the same type and the second weight.

[0073] Specifically, the standard similarity of the standard question of each question type may be multiplied by the first weight to obtain a standard value;

[0074] Calculate the sum of the similarities of each question type, and multiply the sum of the similarities of each question type by the second weight to obtain a similarity value;

[0075] The sum of the standard value and similar values ​​of each question type can be calculated to obtain the overall similarity of the standard questions of the corresponding question type.

[0076] Step S6: If any overall similarity exceeds the similarity threshold, the standard answer corresponding to the standard question with the highest overall similarity is used as the target answer to the question information.

[0077] Specifically, the overall similarity of each question type may be compared with a preset similarity threshold. If any overall similarity exceeds the similarity threshold, the standard answer corresponding to the standard question with the highest overall similarity is selected as the target answer for the question information.

[0078] The similarity threshold can be obtained based on user feedback.

[0079] It can be seen from the above technical solutions that the answer generation method provided by the present application can respond to the user's question operation and determine the question information; based on this, the present application can capture user needs and generate question information; then, each standard question and all similar questions of each standard question can be obtained from the question and answer knowledge base, and each standard question is generated based on each clustered question in the question and answer knowledge base, and the similarity between each standard question and the corresponding similar question meets the preset similarity range, and each standard question corresponds to a standard answer; calculate the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question; determine the first weight based on the degree of representation of the question semantics by the standard question, and determine the second weight based on the degree of representation of the question semantics by the similar question; calculate the overall similarity of the corresponding standard question based on the standard similarity and the first weight corresponding to the same standard question, and the similarity and the second weight; based on this, the present application compares the question information with The comparison process of each question in the question-answering knowledge base is converted into a comparison process between the question information and different types of standard questions and similar questions, which further reduces the similarity calculation process, thereby speeding up the answer generation speed; at the same time, in this process, the present application avoids the one-sidedness caused by a single similarity by combining the similarity of similar questions and assigning weights corresponding to standard questions and similar questions; using similar questions of each standard question can expand the semantic coverage, optimize the flexibility and practicality of semantic understanding, and further ensure the reliability of the semantic similarity between the question information represented by the overall similarity and the corresponding standard question; finally, if there is any overall similarity that exceeds the similarity threshold, the standard answer corresponding to the standard question with the highest overall similarity is used as the target answer of the question information; based on this, the present application can ensure the semantic similarity and matching degree between the selected standard question and the question information through the calculation of the overall similarity, thereby ensuring the similarity and matching degree between the target answer and the question information. It can be seen that the present application can ensure the reliability of the generated answer while speeding up the answer generation speed, further reduce the user's answer waiting time, and improve the user's user experience.

[0080] In some embodiments of the present application, considering that the overall similarity may be less than the similarity threshold, the processing process of the above situation will be described in detail below. The steps are as follows:

[0081] S7. If all the overall similarities are lower than the similarity threshold, it is determined that the question information cannot find an answer, and the question information is written into the question-answering knowledge base as an unsolvable question.

[0082] Specifically, when the overall similarity corresponding to each type is less than a similarity threshold, the question information can be written into the question-and-answer knowledge base as an unsolvable question for which no answer can be found, so that back-end users can supplement the standard answers to the unsolvable questions.

[0083] Furthermore, after providing the target answer, the user's feedback on the target answer can be received. When the user's feedback indicates that the target answer cannot meet the needs, the question information can also be written into the question-answering knowledge base as an unsolvable question that cannot be answered, so that the back-end users can supplement the standard answers to the unsolvable questions. When the user's feedback indicates that the target answer meets their needs, the question information can be written into the question-answering knowledge base as a similar question of the corresponding standard question.

[0084] It can be seen from the above technical solution that compared with the previous embodiment, this embodiment newly adds a processing process corresponding to when the overall similarity is less than the similarity threshold. Through the above method, new questions can be collected in real time and the question and answer knowledge base can be updated to meet the needs of different users and further ensure the reliability of the answers of this application.

[0085] In some embodiments of the present application, the process of obtaining each standard question and all similar questions of each standard question from the question-answer knowledge base in step S2 is described in detail, and the steps are as follows:

[0086] S20. Clustering the questions in the question-answer knowledge base to generate a plurality of cluster subsets, wherein each cluster subset includes a plurality of questions.

[0087] Specifically, all questions in the question-answering knowledge base may be clustered, and after clustering, cluster subsets corresponding to different question types may be obtained.

[0088] Each cluster subset contains multiple questions of the corresponding question type.

[0089] Among them, all questions in the question-answering knowledge base can be clustered in a variety of ways. For example, a K-Means algorithm or a K-Medoids algorithm can be used to cluster all questions in the question-answering knowledge base.

[0090] S21. Select the central question for each cluster subset.

[0091] Specifically, a question representing the corresponding cluster subset can be selected from each cluster subset as the central question.

[0092] S22. Optimize the central question of each cluster subset to form a standard question corresponding to the cluster subset.

[0093] Specifically, for the purpose of simplification and clarification, the central question of each cluster subset can be optimized, and after optimization, the standard question corresponding to each cluster subset can be obtained.

[0094] S23, generating multiple similar questions to be selected corresponding to each standard question, and selecting all similar questions to be selected whose discrimination degree with the corresponding standard question meets a preset discrimination threshold and whose similarity degree meets a preset similarity condition as the similar questions of the corresponding standard question.

[0095] Specifically, a large language model may be used to generate multiple candidate similar questions corresponding to each standard question, and all candidate similar questions that meet a distinction threshold and a preset similarity condition are selected from the candidate similar questions as the corresponding standard questions.

[0096] The discrimination threshold is used to ensure the discrimination between standard questions and similar questions, and the similarity condition is used to ensure that the standard questions and similar questions have the same semantics.

[0097] Among them, the following method can be used to select all the similar questions to be selected as the respective similar questions of the corresponding standard question whose discrimination degree with the corresponding standard question meets the preset discrimination threshold and whose similarity degree meets the preset similarity condition:

[0098] The edit distance between each standard question and its corresponding similar questions is calculated, and the candidate similar questions whose edit distance does not meet the distance range are deleted; for example, the distance range can be [0.2, 0.6].

[0099] The semantic similarity between each standard question and its corresponding similar questions is calculated, and the candidate similar questions whose semantic similarity is less than a preset semantic threshold are deleted; for example, the semantic threshold may be 0.8.

[0100] Each standard question and the remaining similar questions can be input into the language model, and the language model is used to determine whether each candidate similar question is similar to its corresponding standard question, and similar candidate similar questions are retained;

[0101] The remaining similar questions to be selected for each standard question can be used as its corresponding similar questions.

[0102] It can be seen from the above technical solution that this embodiment provides an optional method for obtaining each standard question and all similar questions of each standard question from the question and answer knowledge base. Through the above method, standard questions and similar questions corresponding to different question types can be generated from the question and answer knowledge base, and the semantic similarity problem is further introduced to expand the semantic relevance and semantic scope of the question and answer knowledge base, thereby improving the reliability of the target answer.

[0103] In some embodiments of the present application, the process of S21, selecting the central problem of each cluster subset, is described in detail, and the steps are as follows:

[0104] S210 . For each cluster subset, calculate the sum of similarities between each question in the cluster subset and other questions in the cluster subset; and select the question with the largest sum of similarities as the central question.

[0105] Specifically, the question with the highest similarity to other questions in each cluster subset can be selected as the central question.

[0106] It can be seen from the above technical solution that this embodiment provides an optional method for selecting a central question, and the representativeness of the central question can be further improved through the above method, thereby improving the representativeness of the standard question.

[0107] In some embodiments of the present application, the process of optimizing the central question of each cluster subset to form the standard question of the corresponding cluster subset in step S22 is described in detail, and the steps are as follows:

[0108] S220: Obtain a problem processing model, wherein the problem processing model is trained with the goal of simplifying input problems.

[0109] Specifically, a large language model can be constructed and multiple optimized samples can be obtained, each of which contains a real user question and its corresponding simplified question text;

[0110] Each optimized sample is used to train the large language model, and the final large language model is used as the problem processing model.

[0111] S221. Using the problem processing model, simplify the central question of each cluster subset to obtain a standard question corresponding to the cluster subset.

[0112] Specifically, the central question of each cluster subset can be input into the problem processing model to simplify the central question, and then the standard question of the corresponding cluster subset can be obtained after simplification.

[0113] It can be seen from the above technical solution that this embodiment provides an optional method for optimizing the central question. Through the above method, the central question can be simplified, and the standard question is the simplified central question. The key question points of each question type are further refined, thereby improving the clarity and scenario coverage of the standard question.

[0114] In some embodiments of the present application, the process of generating multiple similar questions to be selected corresponding to each standard question in step S23 is described in detail, and the steps are as follows:

[0115] S230. For each cluster subset, calculate the discrimination between the standard question corresponding to the cluster subset and other questions in the cluster subset except the central question, and take other questions whose discrimination exceeds a preset discrimination threshold as similar questions to be selected.

[0116] Specifically, multiple questions whose degree of distinction from the corresponding standard question exceeds a preset distinction threshold may be selected from each cluster subset as multiple similar questions to be selected for the corresponding standard question.

[0117] S231. Obtain a trained question generation model.

[0118] Specifically, a pre-trained question generation model may be obtained, where the question generation model is trained with the goal of generating similar questions to be selected.

[0119] S232. Utilize the question generation model and combine each standard question to generate a plurality of similar questions to be selected corresponding to each standard question.

[0120] Specifically, the standard question can be input into the question generation model to obtain multiple similar questions to be selected corresponding to each standard question.

[0121] The same standard question can be input into the question generation model repeatedly to obtain multiple similar questions to be selected corresponding to the standard question.

[0122] It can be seen from the above technical solution that this embodiment provides an optional method for obtaining multiple similar questions to be selected for each standard question. Through the above method, multiple questions with a certain degree of distinction from the standard question can be selected from the corresponding cluster subset as similar questions to be selected. It is also possible to use a trained question generation model to generate multiple similar questions to be selected, thereby further ensuring the source richness of the similar questions to be selected, thereby improving the semantic coverage of the obtained similar questions.

[0123] In some embodiments of the present application, the process of S231, obtaining a trained question generation model, is described in detail, and the steps are as follows:

[0124] S2310, obtaining an initial large language model and multiple training samples, each training sample including a training question annotated with multiple similar question data, the discrimination degree between each training question and any corresponding similar question data satisfies the discrimination threshold and the similarity degree satisfies a preset similarity condition.

[0125] Specifically, an initial large language model may be constructed, and multiple simplified questions may be collected as multiple training questions;

[0126] In each training question, multiple similar question data with the same semantics and a degree of distinction exceeding a distinction threshold are annotated to construct multiple training samples.

[0127] S2311. Use each training sample in turn to train the initial large language model until the discrimination between the generated questions of the initial large language model and the corresponding training questions for multiple consecutive times meets the discrimination threshold and the similarity meets the preset similarity condition, and use the final initial large language model as the trained question generation model.

[0128] Specifically, each training sample can be input into the initial large language model in turn to obtain the generation problem of the output of the initial large language model;

[0129] The discrimination degree and semantic similarity between each generated question and the corresponding training question are calculated, and the parameters of the initial large language model are adjusted according to the discrimination degree and semantic similarity between each generated question and the corresponding training question, until the discrimination degree between the generated questions of the initial large language model and the corresponding training questions for multiple consecutive times meets the discrimination threshold and the semantic similarity meets the preset similarity condition, and the final initial large language model is used as the trained question generation model.

[0130] It can be seen from the above technical solution that this embodiment provides an optional method for training a question generation model. Through the above method, the question generation model can be better trained and the reliability of similar questions can be improved.

[0131] Next, we will combine Figure 2 The answer generation device provided in the present application is introduced in detail. The answer generation device provided below can be compared with the answer generation method provided above.

[0132] See also Figure 2 It can be found that the answer generating means may include:

[0133] The determination module 10 is used to respond to the user's question operation and determine the question information;

[0134] An acquisition module 20 is used to acquire each standard question and all similar questions of each standard question from a question-answering knowledge base, wherein each standard question is generated based on each clustered question in the question-answering knowledge base, and the similarity between each standard question and the corresponding similar question satisfies a preset similarity range, and each standard question has a corresponding standard answer;

[0135] A calculation module 30, used for calculating the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question;

[0136] The characterization module 40 is used to determine a first weight based on the characterization degree of the standard question to the question semantics, and to determine a second weight based on the characterization degree of the similar question to the question semantics;

[0137] An adding module 50, for calculating the overall similarity of the corresponding standard question based on the standard similarity and the first weight corresponding to the same standard question, and the similarity of the same type and the second weight;

[0138] The generating module 60 is used to use the standard answer corresponding to the standard question with the highest overall similarity as the target answer of the question information if any overall similarity exceeds the similarity threshold.

[0139] Furthermore, the answer generating device may further include:

[0140] The writing module is used to determine that the question information cannot find an answer if all the overall similarities are lower than the similarity threshold, and write the question information into the question-answering knowledge base as an unsolvable question.

[0141] Further, the acquisition module 20 may include:

[0142] A cluster subset generating unit, used for clustering each question in the question-answer knowledge base to generate a plurality of cluster subsets, wherein each cluster subset contains a plurality of questions;

[0143] A central question selection unit, used to select the central question of each cluster subset;

[0144] The central question optimization unit is used to optimize the central question of each cluster subset to form a standard question of the corresponding cluster subset;

[0145] The candidate similar question generating unit is used to generate multiple candidate similar questions corresponding to each standard question, and select all candidate similar questions whose discrimination degree with the corresponding standard question meets the preset discrimination threshold and whose similarity degree meets the preset similarity condition as the respective similar questions of the corresponding standard question.

[0146] Furthermore, the central question selection unit may include:

[0147] The similarity sum calculation subunit is used to calculate the sum of similarities between each question in the cluster subset and other questions in the cluster subset for each cluster subset; and select the question with the largest similarity sum as the central question.

[0148] Further, the central problem optimization unit may include:

[0149] A problem processing model acquisition subunit is used to acquire a problem processing model, wherein the problem processing model is trained to simplify input problems;

[0150] The problem processing model utilizing subunit is used to utilize the problem processing model to simplify the central question of each cluster subset to obtain the standard question of the corresponding cluster subset.

[0151] Further, the to-be-selected similar question generation unit may include:

[0152] A discrimination calculation subunit is used to calculate, for each cluster subset, the discrimination between the standard question corresponding to the cluster subset and other questions in the cluster subset except the central question, and to take other questions whose discrimination exceeds a preset discrimination threshold as similar questions to be selected;

[0153] A question generation model acquisition subunit, used to acquire a trained question generation model;

[0154] The question generation model utilizing subunit is used to utilize the question generation model and combine each standard question to generate a plurality of similar questions to be selected corresponding to each standard question.

[0155] Furthermore, the question generation model acquisition subunit may include:

[0156] A training sample acquisition component is used to acquire an initial large language model and multiple training samples, each training sample includes a training question annotated with multiple similar question data, and the degree of distinction between each training question and any corresponding similar question data satisfies the distinction threshold and the degree of similarity satisfies a preset similarity condition;

[0157] The initial large language model component is used to train the initial large language model by using each training sample in turn, until the discrimination between the generated questions of the initial large language model and the corresponding training questions for multiple consecutive times meets the discrimination threshold and the similarity meets the preset similarity condition, and the final initial large language model is used as the trained question generation model.

[0158] The answer generation device provided in the embodiment of the present application can be applied to answer generation devices, such as PC terminals, cloud platforms, servers and server clusters. Figure 3 The hardware structure diagram of the answer generation device is shown in FIG. Figure 3 ,The hardware structure of the answer generating device may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4;

[0159] In the embodiment of the present application, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 communicate with each other through the communication bus 4;

[0160] The processor 1 may be a central processing unit CPU, or an application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.;

[0161] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory;

[0162] The memory stores a program, and the processor can call the program stored in the memory, wherein the program is used to:

[0163] Respond to the user's question operation and determine the question information;

[0164] Obtain each standard question and all similar questions of each standard question from the question-answering knowledge base. Each standard question is generated based on each clustered question in the question-answering knowledge base. The similarity between each standard question and the corresponding similar question meets a preset similarity range. Each standard question has a corresponding standard answer.

[0165] Calculating the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question;

[0166] Determine a first weight based on the representation degree of the standard question to the question semantics, and determine a second weight based on the representation degree of the similar question to the question semantics;

[0167] Based on the standard similarity and the first weight corresponding to the same standard question, and the similarity of the same type and the second weight, calculate the overall similarity of the corresponding standard question;

[0168] If any overall similarity exceeds the similarity threshold, the standard answer corresponding to the standard question with the highest overall similarity is used as the target answer to the question information.

[0169] Optionally, the detailed functions and extended functions of the program may refer to the above description.

[0170] The embodiment of the present application further provides a readable storage medium, which may store a program suitable for execution by a processor, wherein the program is used to:

[0171] Respond to the user's question operation and determine the question information;

[0172] Obtain each standard question and all similar questions of each standard question from the question-answering knowledge base. Each standard question is generated based on each clustered question in the question-answering knowledge base. The similarity between each standard question and the corresponding similar question meets a preset similarity range. Each standard question has a corresponding standard answer.

[0173] Calculating the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question;

[0174] Determine a first weight based on the representation degree of the standard question to the question semantics, and determine a second weight based on the representation degree of the similar question to the question semantics;

[0175] Based on the standard similarity and the first weight corresponding to the same standard question, and the similarity of the same type and the second weight, calculate the overall similarity of the corresponding standard question;

[0176] If any overall similarity exceeds the similarity threshold, the standard answer corresponding to the standard question with the highest overall similarity is used as the target answer to the question information.

[0177] Optionally, the detailed functions and extended functions of the program may refer to the above description.

[0178] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0179] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0180] The above description of the disclosed embodiments enables professionals and technicians in the field to implement or use the present application. Various modifications to these embodiments will be apparent to professionals and technicians in the field, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. The various embodiments of the present application can be combined with each other. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating an answer, characterized in that: include: Respond to the user's question operation and determine the question information; Obtain each standard question and all similar questions of each standard question from the question-answering knowledge base. Each standard question is generated based on each clustered question in the question-answering knowledge base. The similarity between each standard question and the corresponding similar question meets a preset similarity range. Each standard question has a corresponding standard answer. Calculating the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question; Determine a first weight based on the representation degree of the standard question to the question semantics, and determine a second weight based on the representation degree of the similar question to the question semantics; Based on the standard similarity and the first weight corresponding to the same standard question, and the similarity of the same type and the second weight, calculate the overall similarity of the corresponding standard question; If any overall similarity exceeds the similarity threshold, the standard answer corresponding to the standard question with the highest overall similarity is used as the target answer to the question information.

2. The answer generation method according to claim 1, characterized in that: After calculating the overall similarity of the corresponding standard question based on the standard similarity and the first weight corresponding to the same standard question and the similarity of the same type and the second weight, the method further includes: If all the overall similarities are lower than the similarity threshold, it is determined that the question information cannot find an answer, and the question information is written into the question-answering knowledge base as an unsolvable question.

3. The answer generation method according to claim 1, characterized in that: The step of obtaining each standard question and all similar questions of each standard question from the question-answering knowledge base includes: Clustering each question in the question-answering knowledge base to generate a plurality of cluster subsets, wherein each cluster subset contains a plurality of questions; Select the central question for each cluster subset; Optimize the central question of each cluster subset to form the standard question of the corresponding cluster subset; Generate multiple similar questions to be selected corresponding to each standard question, and select all similar questions to be selected whose discrimination degree with the corresponding standard question meets a preset discrimination threshold and whose similarity degree meets a preset similarity condition as the various similar questions of the corresponding standard question.

4. The answer generation method according to claim 3, characterized in that: The central issues in selecting each cluster subset include: For each cluster subset, the sum of similarities between each question in the cluster subset and other questions in the cluster subset is calculated; and the question with the largest sum of similarities is selected as the central question.

5. The answer generation method according to claim 3, characterized in that: The central question of each cluster subset is optimized to form a standard question corresponding to the cluster subset, including: Obtaining a problem processing model, wherein the problem processing model is trained to simplify input problems; The problem processing model is used to simplify the central question of each cluster subset to obtain the standard question of the corresponding cluster subset.

6. The answer generation method according to claim 3, characterized in that: The step of generating a plurality of similar questions to be selected corresponding to each standard question includes: For each cluster subset, calculate the discrimination degree between the standard question corresponding to the cluster subset and other questions in the cluster subset except the central question, and take other questions whose discrimination degree exceeds the preset discrimination threshold as the similar questions to be selected; Get the trained question generation model; The question generation model is used to combine each standard question to generate multiple similar questions to be selected corresponding to each standard question.

7. The answer generation method according to claim 6, characterized in that: The step of obtaining a trained question generation model includes: Obtaining an initial large language model and multiple training samples, each training sample includes a training question annotated with multiple similar question data, and the degree of distinction between each training question and any corresponding similar question data satisfies the distinction threshold and the degree of similarity satisfies a preset similarity condition; The initial large language model is trained using each training sample in turn until the discrimination between the generated questions of the initial large language model and the corresponding training questions for multiple consecutive times meets the discrimination threshold and the similarity meets the preset similarity condition, and the final initial large language model is used as the trained question generation model.

8. An answer generation device, characterized in that: include: A determination module, used to respond to the user's question operation and determine the question information; An acquisition module is used to acquire each standard question and all similar questions of each standard question from the question-answering knowledge base. Each standard question is generated based on each clustered question in the question-answering knowledge base. The similarity between each standard question and the corresponding similar question meets a preset similarity range. Each standard question has a corresponding standard answer. A calculation module, used for calculating the standard similarity between the question information and each standard question, and the similarity between the question information and each similar question; A representation module, configured to determine a first weight based on the representation degree of the standard question to the question semantics, and determine a second weight based on the representation degree of the similar question to the question semantics; An adding module, used for calculating the overall similarity of the corresponding standard question based on the standard similarity and the first weight corresponding to the same standard question, and the similarity of the same type and the second weight; A generation module is used to use the standard answer corresponding to the standard question with the highest overall similarity as the target answer of the question information if any overall similarity exceeds a similarity threshold.

9. An answer generating device, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the answer generation method as described in any one of claims 1-7.

10. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the answer generation method according to any one of claims 1 to 7 is implemented.