Answer generation method and device, answer display method and device, computer equipment, storage medium and computer program product
By determining the answer level of user questions and extracting relevant answer data from the published content, the problem of vague user questions and causing messy answers is solved, and the clear display of answers and the improvement of user experience is achieved.
Patent Information
- Application Number
- CN202411901540.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-03-07
AI Technical Summary
In the Q&A business scenario, when the user's questions are blurred, directly extracting answers from the content posted by the user may lead to the messy answers, and users need to spend a lot of energy to find the answers needed, resulting in inefficiency and poor user experience.
By obtaining the target question and determining its corresponding answer levels, the answer data corresponding to each answer level is determined from multiple target publishing contents, the target answer level is determined based on these answer data, and the target answer data is extracted from the answer data at the target answer level. This method generates answer level prompt information through a large language model, extracts answer data, and selects the target answer level based on the answer index.
By determining the answer level and extracting relevant answer data, the answers displayed to users are clearer, reducing the time for users to find the required information in the answer, improving the efficiency of users to find answers, and improving the user experience.
Smart Images

Figure CN119578556A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to an answer generation method and device, an answer display method and device, a computer device, a storage medium, and a computer program product. Background Art
[0002] In the question-and-answer business scenario, users can input questions raised by the users into the question-and-answer service. The question-and-answer service will extract answers from the content posted by other users on the platform based on the questions raised by the users, and summarize the answers and return them to the users. However, when the user's question is vague, the answers extracted from the user's question are sometimes diverse. For example, when the user asks the question "food recommendation", the extracted answer may be a specific dish, a restaurant, or a dish from a restaurant. If the method of directly extracting answers from various posted content based on the user's question is adopted in this case, the answers displayed to the user may be disorganized, and the user will need to spend more energy to find the answer he needs from the answer, resulting in low efficiency in obtaining answers and poor user experience. Summary of the invention
[0003] Based on this, it is necessary to provide an answer generation method and device, an answer display method and device, a computer device, a storage medium and a computer program product to address the above technical problems.
[0004] In a first aspect, the present application provides a method for generating an answer. The method comprises:
[0005] Obtain a target question and determine the levels of answers corresponding to the target question;
[0006] Determine answer data corresponding to each of the answer levels from a plurality of target published contents;
[0007] According to the answer data corresponding to each of the answer levels, a target answer level is determined from each of the answer levels, and from the answer data corresponding to the target answer level, target answer data corresponding to the target question is determined.
[0008] In one embodiment, determining the levels of answers corresponding to the target question includes:
[0009] Generate prompt information for the answer level corresponding to the target question;
[0010] The answer level generation prompt information is input into a large language model to obtain each answer level output by the large language model.
[0011] In one embodiment, generating prompt information of the answer level corresponding to the target question includes:
[0012] Determine a target reference question corresponding to the target question from each reference question, and generate answer level generation example information according to each answer level corresponding to the target reference question;
[0013] Obtaining answer level generation requirement information corresponding to the target question;
[0014] Based on the answer level generation example information and the answer level generation requirement information, answer level generation prompt information corresponding to the target question is obtained.
[0015] In one embodiment, determining the target reference question corresponding to the target question from the reference questions includes:
[0016] Determining the semantic similarity between the target question and each reference question;
[0017] The target reference question is determined from the reference questions according to the semantic similarities corresponding to the reference questions.
[0018] In one embodiment, determining answer data corresponding to each of the answer levels from the plurality of target published contents respectively includes:
[0019] Generate answer extraction prompt information according to the target question, multiple target published contents and each of the answer levels;
[0020] The answer extraction prompt information is input into a large language model to obtain answer data extracted by the large language model from each of the target published contents for each of the answer levels.
[0021] In one embodiment, determining a target answer level from each of the answer levels according to the answer data corresponding to each of the answer levels includes:
[0022] Determine the answer index of each answer level for the target selection dimension according to the answer data corresponding to each answer level;
[0023] A target answer level is determined from among the answer levels according to the answer index.
[0024] In one embodiment, the answer data includes an answer topic, and also includes evaluation information for the answer topic and / or statistical data for the answer topic.
[0025] In a second aspect, the present application also provides an answer display method, the method comprising:
[0026] Send the target question to the server;
[0027] Receiving target answer data for the target question sent by the server;
[0028] The target answer data is displayed in a display interface, the target answer data corresponds to a target answer level, the target answer data is answer data determined for the target answer level from multiple target published contents, the target question corresponds to at least one answer level, and the at least one answer level includes the target answer level.
[0029] In one embodiment, the target answer data includes at least one answer theme, and also includes evaluation information for each answer theme and / or statistical data for the answer theme. The displaying of the target answer data in the display interface includes:
[0030] A target answer page is displayed in a display interface, wherein the target answer page includes at least one answer display item displayed in sequence, wherein the answer display item includes an answer theme, evaluation information of the answer theme and / or statistical data for the answer theme.
[0031] In a third aspect, the present application also provides an answer generation device. The device comprises:
[0032] An acquisition module, used to acquire a target question and determine the levels of answers corresponding to the target question;
[0033] A first determination module is used to determine answer data corresponding to each of the answer levels from a plurality of target published contents;
[0034] The second determination module is used to determine a target answer level from each of the answer levels according to the answer data corresponding to each of the answer levels, and to determine target answer data corresponding to the target question from the answer data corresponding to the target answer level.
[0035] In one embodiment, the acquisition module is further used for:
[0036] Generate prompt information for the answer level corresponding to the target question;
[0037] The answer level generation prompt information is input into a large language model to obtain each answer level output by the large language model.
[0038] In one embodiment, the acquisition module is further used for:
[0039] Determine a target reference question corresponding to the target question from each reference question, and generate answer level generation example information according to each answer level corresponding to the target reference question;
[0040] Obtaining answer level generation requirement information corresponding to the target question;
[0041] Based on the answer level generation example information and the answer level generation requirement information, answer level generation prompt information corresponding to the target question is obtained.
[0042] In one embodiment, the acquisition module is further used for:
[0043] Determining the semantic similarity between the target question and each reference question;
[0044] The target reference question is determined from the reference questions according to the semantic similarities corresponding to the reference questions.
[0045] In one embodiment, the first determining module is further used to:
[0046] Generate answer extraction prompt information according to the target question, multiple target published contents and each of the answer levels;
[0047] The answer extraction prompt information is input into a large language model to obtain answer data extracted by the large language model from each of the target published contents for each of the answer levels.
[0048] In one embodiment, the second determining module is further used to:
[0049] Determine the answer index of each answer level for the target selection dimension according to the answer data corresponding to each answer level;
[0050] A target answer level is determined from among the answer levels according to the answer index.
[0051] In one embodiment, the answer data includes an answer topic, and also includes evaluation information for the answer topic and / or statistical data for the answer topic.
[0052] In a fourth aspect, the present application further provides an answer display device, the device comprising:
[0053] A sending module, used to send target questions to the server;
[0054] A receiving module, used for receiving target answer data for the target question sent by the server;
[0055] A display module is used to display the target answer data in a display interface, the target answer data corresponds to a target answer level, the target answer data is answer data determined for the target answer level from multiple target published contents, the target question corresponds to at least one answer level, and the at least one answer level includes the target answer level.
[0056] In one embodiment, the display module is further used for:
[0057] A target answer page is displayed in a display interface, wherein the target answer page includes at least one answer display item displayed in sequence, wherein the answer display item includes an answer theme, evaluation information of the answer theme and / or statistical data for the answer theme.
[0058] In a fifth aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any of the above methods is implemented.
[0059] In a sixth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements any of the above methods when executed by a processor.
[0060] In a seventh aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.
[0061] The above-mentioned answer generation method and device, answer display method and device, computer equipment, storage medium and computer program product, after obtaining the target question input by the user, determine the answer levels that may correspond to multiple target questions for the target question, extract the answers corresponding to each answer level from the content posted by other users according to the answer level, and determine the target answer level based on these answers, and use the answer corresponding to the target answer level as the target answer displayed to the user. The embodiment of the present application displays the answer to the user according to the determined target answer level, so that the answer displayed to the user can be clearer, reducing the time for the user to find the answer he needs from the answer, thereby improving the efficiency of the user in finding the answer and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 A schematic diagram of a flow chart of an answer generation method in one embodiment;
[0063] Figure 2 is a flow chart of step 102 in one embodiment;
[0064] Figure 3is a flow chart of step 202 in one embodiment;
[0065] Figure 4 is a flow chart of step 302 in one embodiment;
[0066] Figure 5 is a flow chart of step 104 in one embodiment;
[0067] Figure 6 is a flow chart of step 106 in one embodiment;
[0068] Figure 7 A schematic diagram of a flow chart of an answer generation method in one embodiment;
[0069] Figure 8 A flowchart of a method for displaying answers in one embodiment is provided;
[0070] Fig. 9 A schematic diagram showing an interface in an embodiment;
[0071] Fig.10 It is a structural block diagram of an answer generating device in one embodiment;
[0072] Fig.11 It is a structural block diagram of an answer display device in an embodiment;
[0073] Fig.12 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0075] In one embodiment, Figure 1 As shown, a method for generating an answer is provided. This embodiment uses the method applied to a server as an example for illustration. It is understandable that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0076] Step 102, obtain the target question and determine the answer levels corresponding to the target question.
[0077] In an embodiment of the present application, the target question is a question input by the user. The user can input the target question on the user terminal, and the user terminal can then transmit the target question to the server. The server then determines the answer level corresponding to the target question based on the target question. The answer level can be one or more, and each answer level can represent a possible focus of the user when asking the target question. For example, when the target question is "food recommendation", the user's focus when asking this target question may be restaurants, specific dishes in restaurants, or certain dishes, etc. When the target question is "travel guide", the user's focus may be attractions, itineraries, accommodation or catering, etc. By determining the answer level of the target question, the answers displayed to the user can be developed around a focus of the user, making the display logic of the answer clearer, so that the user can quickly obtain the answers they need.
[0078] The answer level corresponding to the target question can be determined by various methods such as keyword extraction, large language model, building a corresponding relationship database between question and answer levels, etc. The following is an exemplary description of some methods for determining the answer level.
[0079] In one example, the answer hierarchy can be constructed by extracting keywords from the published content. This is because the answer finally displayed to the user is extracted from the published content uploaded to the platform by other users (the published content may include text, pictures, videos, etc. uploaded by the user), so the constructed answer hierarchy is related to the published content, and when extracting answers based on the answer hierarchy, answers that are more relevant to the answer hierarchy can be extracted. According to the keywords in the target question (such as food, travel, etc.) and the tags carried by the user's published content, multiple published contents for constructing the answer hierarchy can be matched to the target question, and keywords can be extracted from these published contents using any keyword extraction algorithm. In addition, any text classification method can be used to classify each keyword, and the keywords of each category can be summarized in themes through a large language model or a pre-trained neural network model, and the summarized themes are used as the answer hierarchy corresponding to the target question.
[0080] In another example, a database of correspondence between questions and answer levels can be pre-built. The database stores multiple questions and answer levels corresponding to the questions. These questions and answer levels can be generated by manual annotation or selected from answer levels generated by other methods based on user feedback: for example, after the answer levels corresponding to the questions are generated by the first two methods, the target answer data corresponding to the questions can be fed back to the user, and each answer level can also be displayed to the user, and the user can be prompted to score the accuracy of each answer level generated according to the questions. The combination of questions and answer levels with the highest user scores can be added to the database. After obtaining the target question, the top several questions with the highest similarity ranking to the target question can be matched from the database, and the answer level of the target question can be determined according to the answer levels corresponding to these questions. For example, the number of times each answer level is repeated in the answer levels corresponding to these questions can be counted, and the answer levels with the highest number of repetitions can be used as the answer level of the target question, or these questions can be ranked from high to low according to the scores, and the answer level corresponding to the highest-scoring question can be used as the answer level of the target question. Since the answer levels in the database are all manually annotated or have high user ratings, this method can improve the accuracy of answer level generation.
[0081] It should be noted that the number of answer levels that can be determined based on the target question and the degree of ambiguity of the target question are generally positively correlated. When the target question is relatively clear, only one answer level may be determined. For example, the answer level that can be matched for "movie director recommendation" is the director's name. When the target question is very vague, a large number of answer levels that are not very correlated with each other may be determined for the target question. For example, for "travel guide", multiple answer levels such as attractions, check-in spots, souvenirs, itineraries, travel methods, accommodation, and catering can be matched. In this case, the probability that the answer level finally displayed to the user cannot provide the effective information required by the user will be greatly increased.
[0082] To solve this problem, in one example, an answer level threshold can be set in advance. If the answer level corresponding to the determined target question exceeds the answer level threshold, the server can return a prompt message to the user terminal asking the user to further clarify the question. For example, for the above-mentioned "travel guide" example, the prompt message may be "You may want to search for: 'travel travel guide', 'tourist attraction check-in point', 'travel accommodation guide'", and the user can resend the target question to the server based on the prompt message.
[0083] Step 104, respectively determining answer data corresponding to each answer level from the plurality of target published contents.
[0084] In the embodiment of the present application, the target published content refers to the published content related to the target question. The target label information can be determined from each preset label information by calculating the similarity between the target question and each preset label information for the published content, and then the published content carrying the target label information is used as the target published content.
[0085] Alternatively, the semantic similarity between the target question and each published content may be calculated, and a preset number of published content with the highest semantic similarity may be used as the target published content (when this method is adopted, for published content in the image format, an image semantic recognition algorithm may be used to obtain text information for describing the image; for published content in the video format, video audio may be extracted and the audio may be converted into text to obtain text information for describing the video, so that the semantic similarity between the target question and such published content may be calculated based on the text information).
[0086] In one example, in order to improve the quality of the extracted answer data, the various published contents on the platform can be first screened, and then the target published contents can be determined from the screened published contents: for example, the popularity of each published content can be calculated based on data such as the number of comments, the number of clicks, the number of likes, the number of favorites, and the number of published contents with a popularity higher than a preset popularity threshold, and the published contents with a popularity higher than a preset popularity threshold can be screened out; or the length of the published content can be determined (for text published content, it can be the number of words in the text; for picture published content, it can be the number of pictures; for video published content, it can be the length of the video), and the published contents with a length greater than a preset length threshold can be screened out, etc. The embodiment of the present application does not specifically limit the specific screening criteria.
[0087] According to each answer level, the answer data corresponding to each answer level can be extracted from each target published content. The answer data corresponding to the answer level can be extracted by keyword classification or a large language model. In one example, keywords in each target published content can be extracted, and each keyword can be classified according to each answer level to obtain the answer data corresponding to each answer level. In another example, a large language model can be used to extract answer data from each target published content. The embodiment of the present application does not limit the specific method of extracting answer data.
[0088] It should be noted that the answer data may not only include answers to questions (hereinafter referred to as answer topics). The answer data may also include data such as the number of times each answer topic appears in the target published content, the target published content where the answer is located, etc., to enrich the answer data displayed to users.
[0089] Step 106, determining a target answer level from each answer level according to the answer data corresponding to each answer level, and determining target answer data corresponding to the target question from the answer data corresponding to the target answer level.
[0090] In the embodiment of the present application, one or more target answer levels to be displayed to the user can be selected from each answer level according to the answer data corresponding to each answer level, and the target answer data to be displayed to the user can be selected from the answer data corresponding to the target answer level. The embodiment of the present application does not specifically limit the method of selecting the target answer level, and the target answer level can be selected based on the number of answer data under each answer level, the popularity of the target published content corresponding to the answer data under each answer level, the number of times the answers in the answer data under each answer level appear in the target published content, and other standards. The specific selection method can be determined by those skilled in the art according to actual business needs.
[0091] It should be noted that if there are multiple target answer levels, the target answer data belonging to the same target answer level can be displayed as a group when displayed to the user, for example, the display area of each target answer level is divided separately on the user terminal interface, and the target answer data under the target answer level is displayed separately in the display area of each target answer level. Alternatively, the target answer data of a certain target answer level is first displayed on the user terminal interface, and when the user issues an instruction to switch the interface, the target answer data of the next target answer level is displayed, and so on.
[0092] The embodiment of the present application also does not specifically limit the method of selecting the target answer data, which can be set by those skilled in the art according to actual business needs. In one example, the semantic similarity between the answer topic in each answer data and the target question can be determined, and a preset number of answer data with the highest semantic similarity, or answer data with semantic similarity exceeding a similarity threshold, are selected as target answer data, so that the target answer data finally displayed to the user is more relevant to the user's question.
[0093] In another example, the number of occurrences of the answer theme in each answer data in the target published content can be determined (it can be that each time the answer theme appears in a target published content, it can be recorded as one occurrence, or it can be that each time the answer theme appears in a target published content published by a different user account, it can be recorded as one occurrence), and the answer data with the highest preset number of occurrences, or the answer data with a number of occurrences exceeding a threshold, are used as target answer data, so that the target answer data finally displayed to the user is the answer data mentioned in multiple target published contents, thereby improving the accuracy of the target answer data finally displayed to the user.
[0094] The answer generation method provided in the embodiment of the present application, after obtaining the target question input by the user, determines the answer levels that may correspond to multiple target questions for the target question, extracts the answers corresponding to each answer level from the content posted by other users according to the answer level, and determines the target answer level based on these answers, and uses the answer corresponding to the target answer level as the target answer displayed to the user. The embodiment of the present application displays the answer to the user according to the determined target answer level, so that the answer displayed to the user can be clearer, reducing the time for the user to find the answer he needs from the answer, thereby improving the efficiency of the user in finding the answer and improving the user experience.
[0095] In one embodiment, Figure 2 As shown, in step 102, the answer levels corresponding to the target question are determined, including:
[0096] Step 202, generating prompt information for the answer level corresponding to the target question.
[0097] Step 204, input the prompt information for generating the answer level into the large language model to obtain the answer levels output by the large language model.
[0098] In an embodiment of the present application, prompt information for generating the answer level corresponding to the target question is constructed, and a large language model is used to generate the answer level corresponding to the target question. In one example, the prompt information for generating the answer level corresponding to the target question can be generated based on a pre-constructed prompt information template, and the prompt information template is the same for each target question. For example: "Generate several possible answer levels based on [question]. Requirements: 1. The answer levels are not repeated. 2. The answer levels cannot be specific entities. 3. The answer levels must be related to the question." After obtaining the target question, fill in the target question into the template (in the above example, the target question needs to be filled in the reserved [question] placeholder) to obtain the prompt information for generating the answer level.
[0099] In another example, the prompt information for generating the answer level corresponding to the target question may be different according to the different categories to which the target question belongs. Different prompt information templates may be pre-built for different question categories. Question categories may be divided according to the fields in which the questions are located. For example, multiple categories such as "travel category", "food category", "movie category", and "music category" may be divided. For each question category, the basic prompt information template may be partially adjusted according to actual needs to generate a prompt information template for the question category. For example, the answer level generated for the question suggestion under this question category may be specified in the prompt information template, such as generating the "attraction" level for the travel category, generating the "dish" level for the food category, and so on. After adding this information, the prompt information template corresponding to the travel category may become: "Generate several possible answer levels based on [question]. Requirements: 1. The answer level is not repeated. 2. The answer level cannot be a specific entity. 3. The answer level must be related to the question. 4. If the user question already contains an obvious answer level, the original word in the question is directly returned; if the user question does not contain an obvious answer level, the returned answer level must at least include 'attractions'". After obtaining the target question, determine the question category to which the target question belongs, and fill the target question into the prompt information template corresponding to the question category to obtain the answer level generation prompt information.
[0100] It should be noted that after obtaining the answer levels output by the large language model, these answer levels can be used as the answer levels for the target question, or these answer levels can be further screened, for example, answer levels that are obviously irrelevant to the target question can be screened out based on semantic similarity, or only the first preset number of answer levels given by the large language model can be retained.
[0101] The answer generation method provided in the embodiment of the present application generates the answer hierarchy by accessing a large language model, so that the relevant calculations for generating the answer hierarchy can be performed on a server with a larger language model with stronger performance, thereby improving the generation speed of the answer hierarchy.
[0102] In one embodiment, Figure 3 As shown, in step 202, the answer level corresponding to the target question is generated to generate prompt information, including:
[0103] Step 302, determining a target reference question corresponding to the target question from each reference question, and generating answer level generation example information according to each answer level corresponding to the target reference question;
[0104] Step 304, obtaining answer level generation requirement information corresponding to the target question;
[0105] Step 306, based on the answer level generation example information and the answer level generation requirement information, obtain the answer level generation prompt information corresponding to the target question.
[0106] In an embodiment of the present application, in order to improve the accuracy of the large language model in generating the answer level, some examples of generating the answer level may be added to the prompt information for generating the answer level, so that the large language model can refer to the examples to generate the answer level.
[0107] Reference questions are questions with generated answer levels. Reference questions and their answer levels can be manually generated, or selected from past user questions and their corresponding answer levels based on user ratings. The method for generating user ratings and the specific method for selecting reference questions based on user ratings can refer to the method for selecting questions to be added to the corresponding relationship database of question and answer levels in the aforementioned embodiment, and the embodiments of this application will not be repeated here.
[0108] One or more target reference questions corresponding to the target question can be determined from the various reference questions. Exemplarily, the question categories to which the various reference questions belong can be divided. After obtaining the target question, the question category to which the target question belongs is determined, and the various reference questions under the question category are used as target reference questions corresponding to the target question. Alternatively, the semantic similarity between the target question and the various reference questions under the question category can be calculated, and the reference questions with the highest semantic similarity can be used as target reference questions, etc. This embodiment of the present application does not specifically limit this.
[0109] After obtaining the target reference question, answer level generation example information can be generated according to the target reference question and the answer level. The embodiment of the present application does not specifically limit the format of the answer level generation example information, as long as the answer level generation example information contains the target reference question and the answer level, and indicates which specific part of the target reference question and which specific part of the answer level are in a form that can be read by a large language model. Taking a practical example to illustrate, when the target reference question is "travel guide" and the answer level is "attractions", "itinerary", and "check-in point", the answer level generation example information can be: "[Example]: Question: Travel guide; Output: ["attractions", "itinerary", "check-in point"]". Among them, "question" indicates the target reference question, and "output" indicates the answer level corresponding to the target reference question.
[0110] In order to impose some restrictions on the answer level output by the large language model, the answer level generation prompt information can also include answer level generation requirement information. The answer level generation requirement information for different target questions can be the same, or different answer level generation requirement information can be generated for different target questions. The method of generating different answer level generation requirement information for different target questions can be referred to in the aforementioned embodiment. The method of generating different answer level generation prompt information according to the different categories to which the target question belongs is not repeated here in the embodiments of this application.
[0111] The embodiment of the present application does not specifically limit the format of the answer level generation requirement information, which can be set by technical personnel in this field according to experience or actual business needs. A specific example of the answer level generation requirement information is as follows: "Task: Generate several possible answer levels based on the user's question. Requirements: 1. Return a python list containing several elements, each element represents an answer level. 2. The answer level is not repeated. 3. The answer level cannot be a specific entity. 4. If the user's question already contains an obvious answer level, just return the original word in the question without deriving it to another answer level. 5. The user does not want to know other information gains beyond the main intention of the question. 6. It is forbidden to forcibly increase the answer level, and the answer level must be related to the question." Among them, 1, 2, and 3 are used to limit the output format of the large language model and the specific form of the answer level, and 4, 5, and 6 are used to prevent the large language model from generating outputs that are not related to the task.
[0112] Based on the answer level generation example information and the answer level generation requirement information, the answer level generation prompt information corresponding to the target question can be obtained. For example, the answer level generation example information and the answer level generation requirement information can be spliced in sequence to obtain the answer level generation prompt information. Alternatively, in addition to the answer level generation example information and the answer level generation requirement information, other information that the large language model may need to obtain when generating the answer level (such as the user's historical browsing information, the user account's feature information, etc., which can be used to determine the user's intention expressed through the target question) can be added to obtain the answer level generation prompt information.
[0113] The answer generation method provided in the embodiment of the present application uses a reference question that already has a corresponding answer level to generate answer level generation example information, and splices the answer level generation example information and the answer level generation requirement information to obtain answer level generation prompt information input into the large language model. Therefore, the large language model can take preset restrictions into consideration when generating the answer level, and use the answer levels that have been generated for other questions as a reference, which can improve the accuracy of the answer level generated by the large language model.
[0114] In one embodiment, Figure 4 As shown, in step 302, a target reference question corresponding to the target question is determined from each reference question, including:
[0115] Step 402, determining the semantic similarity between the target question and each reference question;
[0116] Step 404 : determining a target reference question from the reference questions according to the semantic similarities corresponding to the reference questions.
[0117] In the embodiment of the present application, the target reference question is selected based on the semantic similarity between the target question and each reference question. The embodiment of the present application does not limit the specific method for calculating the semantic similarity, and any semantic similarity algorithm is applicable to the embodiment of the present application. Exemplarily, a pre-trained q2q (sequence to sequence) semantic similarity model can be used to calculate the semantic similarity between the target question and each reference question.
[0118] The reference questions may be sorted from high to low according to the semantic similarity, and the reference questions ranked at the front of the preset ranking in the sorted sequence may be used as the target reference questions. Alternatively, a semantic similarity threshold may be preset, and reference questions with semantic similarity greater than the semantic similarity threshold may be used as the target reference questions. Other methods may also be used to select the target reference questions according to the semantic similarity, and the embodiments of the present application do not specifically limit this.
[0119] The answer generation method provided in the embodiment of the present application uses semantic similarity to select a target reference question from various reference questions, which can improve the similarity between the selected target reference question and the target question, and then improve the relevance of the answer level generation example information and the target question, so that the large language model generates more answer levels related to the target question, thereby improving the accuracy of the answer level.
[0120] In one embodiment, Figure 5 As shown, in step 104, answer data corresponding to each answer level is determined from the multiple target published contents, including:
[0121] Step 502, generating answer extraction prompt information according to the target question, multiple target published contents and each answer level;
[0122] Step 504, input the answer extraction prompt information into the large language model, and obtain the answer data extracted by the large language model from each target published content for each answer level.
[0123] In an embodiment of the present application, a large language model can be used to extract answer data. A prompt information (prompt) template input into the large language model can be pre-built. For example, when the answer data only includes the answer topic, the template can be: "Task: Based on the user's question and answer level, extract several answers to the question at each answer level from the following published content. Requirements: 1. Each extracted answer should be an entity word, and do not extract overly abstract words. 2. Each extracted answer must belong to the required answer level. 3. The extracted answer must be related to the question. The question is [question], the answer levels are [answer level], and the published content is [published content]". Fill the target question, each target published content, and each answer level into the template (for the above example, the target question is filled into the [question] placeholder, the answer level is filled into the [answer level] placeholder, and the target published content is filled into the [published content] placeholder), and the answer extraction prompt information can be obtained. In the case where the answer data also includes other data, a prompt indicating that the large language model extracts other content can be added to the template accordingly.
[0124] After the answer extraction prompt information is input into the large language model, the output of the large language model can be used as the answer data corresponding to each answer level, or the output of the large language model can be further filtered, such as calculating the similarity between each answer topic and the answer level and the question at each answer level, and filtering out the answer data belonging to the answer topics with low similarity; or verifying whether the answer topic is included in each target release content, and filtering out the answer data that the large language model does not extract from the target release content as required, but generates by itself, etc.
[0125] The answer generation method provided in the embodiment of the present application extracts answer data from each target published content by accessing a large language model, so that the relevant calculations for extracting the answer data can be performed on a server with a larger language model with stronger performance, thereby improving the speed of extracting the answer data.
[0126] In one embodiment, Figure 6 As shown, in step 106, according to the answer data corresponding to each answer level, a target answer level is determined from each answer level, including:
[0127] Step 602, determining the answer index of each answer level for the target selection dimension according to the answer data corresponding to each answer level;
[0128] Step 604, determining a target answer level from among the answer levels according to the answer index.
[0129] In the embodiment of the present application, the selected dimension is a pre-set dimension for evaluating the answer data under the answer level. For each selected dimension, an answer index for the dimension can be calculated based on each answer data under the answer level. The higher the answer index, the better the performance of each answer data under the answer level in this dimension. The selected dimension may include the answer recognition of the answer data (the answer index can be determined by the proportion of the number of collections, the number of likes, the number of collections and the number of views of each published content to which the answer theme in each answer data belongs), the frequency of occurrence of the answer data (the answer index can be determined by the number of published contents containing the answer theme in any answer data, and the proportion of the total target published content), the number of occurrences of the answer data (the answer index can be determined by the total number of published contents containing the answer theme in any answer data), etc. Which dimensions are specifically set as the selected dimensions, and the calculation method of the answer index corresponding to the selected dimensions can be determined by those skilled in the art according to actual needs.
[0130] The target selection dimension can be one or more selection dimensions. The specific selection dimensions selected as the target selection dimensions can be determined according to the target question. For example, when the target question includes "recommendation", the selection dimensions that tend to judge the quality of the answer data can be selected as the target selection dimension, such as the answer recognition of the answer data. When the target question includes "strategy" or "guide", the selection dimensions that tend to evaluate the frequency of answer occurrence can be selected as the target selection dimension, such as the frequency of occurrence of the answer data, the number of occurrences of the answer data, etc.
[0131] When the target selection dimension is a selection dimension, that is, when there is only one answer index, the answer levels can be sorted from high to low according to the answer index, and the top-ranked answer level can be selected as the target answer level. When the target selection dimension is multiple selection dimensions and therefore there are multiple answer indices, a comprehensive answer index can be calculated based on the multiple answer indices and the weight coefficients corresponding to each target selection dimension, and the answer levels can be sorted from high to low according to the comprehensive answer index, and the top-ranked answer level can be selected as the target answer level.
[0132] The weight coefficient corresponding to each target selection dimension can be fixed or determined according to the target question. For example, when the target question includes "recommendation" and all the selected dimensions are selected as the target selection dimensions, the weight coefficient of the selected dimension that tends to judge the quality of the answer data can be higher, and the weight coefficient of other selected dimensions can be lower. Alternatively, each answer level can be comprehensively sorted according to multiple answer indexes. For example, the importance of each target selection dimension can be determined (can be fixed or determined according to the target question), and each answer level is first sorted according to the target selection dimension with the highest importance, and the answer level with the top preset noun or the top preset proportion is selected to enter the next round of sorting, and then the selected answer level is sorted according to the target selection dimension with the second highest importance, and then the answer level with the top preset noun or the top preset proportion is selected to enter the next round of sorting... and so on, the top answer level in the last round of sorting is used as the target answer level.
[0133] The answer generation method provided in the embodiment of the present application adopts the target selection dimension and the answer index to evaluate the answer data under the answer level, and selects the target answer level according to the answer index. This can quantify the quality of each answer data under the answer level and improve the accuracy of selecting the target answer level.
[0134] In one embodiment, the answer data includes an answer topic, and also includes evaluation information for the answer topic and / or statistical data for the answer topic.
[0135] In the embodiment of the present application, in addition to the answer topic, the answer data may also include evaluation information (evaluation of the answer topic by the published content containing the answer topic, such as whether the emotion on the answer topic is positive or negative, evaluative statements on the answer topic, etc.) and statistical data (information related to the number of published content containing the answer topic, such as the total number of such published content, the proportion of such published content in all target published content, etc.). When displaying each target answer data, the evaluation information and statistical data corresponding to the target answer data may also be displayed.
[0136] It should be noted that for the same target answer data, the evaluation information of different published contents may be different. When displaying, some target evaluation information can be selected from all the evaluation information for display. For example, the evaluation information corresponding to the most popular published content is selected as the target evaluation information, etc., and this embodiment of the application does not specifically limit this.
[0137] The answer generation method provided in the embodiment of the present application adds evaluation information and statistical data on the answer topic to the answer data, which can enrich the content displayed to the user and further improve the user experience.
[0138] In one embodiment, Figure 7 The figure shows a flow chart of the answer generation method. In the embodiment of the present application, each reference question is stored in a question-level knowledge base, and the reference questions and their corresponding answer levels are pre-selected manually from the answer levels generated by the large language model according to each training question. After the user inputs the target question, the server determines the target reference question of the target question based on the semantic similarity between the target question and each reference question, and then generates answer level generation example information based on the answer levels corresponding to each target reference question. The answer level generation example information and the preset fixed answer level generation requirement information are spliced to obtain the answer level generation prompt information. The answer level generation prompt information is input into the large language model to obtain the answer levels corresponding to the target question.
[0139] After obtaining the answer level, we can further generate answer extraction prompt information based on the target question, answer level and target published content, and input the answer extraction prompt information into the large language model to obtain the answer data corresponding to each answer level. According to each answer data, we determine the target answer level that needs to be displayed to the user, and then select the target answer data from the answer data corresponding to the target answer level to obtain the answer that is finally displayed to the user.
[0140] In one embodiment, Figure 8 As shown, a method for displaying an answer is provided. The embodiment of the present application is described by applying the method to a user terminal, and includes the following steps:
[0141] Step 802: Send the target question to the server.
[0142] In the embodiment of the present application, the target question is a question input by the user on the user terminal, and the user can input the target question on the user terminal in the form of text or voice, etc. After receiving the target question, the user terminal sends the target question to the server.
[0143] Step 804: Receive target answer data for the target question sent by the server. The target answer data corresponds to a target answer level, the target answer data is answer data determined for the target answer level from at least one target published content, the target question corresponds to at least one answer level, and multiple answer levels include the target answer level.
[0144] In the embodiment of the present application, after receiving the target question, the server can determine the target answer data to be displayed to the user according to the target question. The target answer data is selected from the answer data under the target answer hierarchy after the server generates the answer hierarchy according to the target question, extracts the answer data under each answer hierarchy according to the answer hierarchy, and determines the target answer hierarchy according to the answer data of each answer hierarchy. The specific selection process can be referred to the relevant description of the aforementioned embodiment, and the embodiment of the present application will not be repeated.
[0145] Step 806: Display the target answer data in the display interface.
[0146] In the embodiment of the present application, the target answer data can be displayed in the display interface of the user terminal. The embodiment of the present application does not specifically limit how to display the target answer data. For example, each target answer data can be displayed in a list form, or in a page turning form.
[0147] The answer display method provided in the embodiment of the present application, after obtaining the target question input by the user, sends the target question to the server, so that the server returns the target answer data determined according to the target answer level to the user terminal, and then displays the target answer data. The embodiment of the present application displays the answer to the user according to the determined target answer level, so that the answer displayed to the user can be clearer, reducing the time for the user to find the answer he needs from the answer, thereby improving the efficiency of the user in finding the answer and improving the user experience.
[0148] In one embodiment, the target answer data includes at least one answer theme, and also includes evaluation information for each answer theme and / or statistical data for the answer theme. In step 806, the target answer data is displayed in the display interface, including:
[0149] The target answer page is displayed in the display interface, and the target answer page includes at least one answer display item displayed in sequence, and the answer display item includes the answer theme, evaluation information of the answer theme and / or statistical data for the answer theme.
[0150] In an embodiment of the present application, the target answer page is a page used to display answer data on a user terminal, and each target answer data corresponds to an answer display item, and the answer display item refers to an area for display. Each answer display item can be displayed in order on the target answer page, and each answer display item can be arranged in order according to the quality of the answer data corresponding to the target answer data in the answer display item from high to low, or the amount of evaluation information corresponding to the target answer data from high to low, or the statistical data corresponding to the target answer data from high to low. The embodiment of the present application does not make specific limitations on this. Among them, the source of the evaluation information and statistical data, as well as the method for determining the quality of the answer data can refer to the description of the aforementioned embodiment, and the embodiment of the present application will not be repeated.
[0151] The user finally sees the display interface that displays the answer topic, evaluation information and statistical data. Fig. 9 shown. Fig. 9 “High-scoring movie recommendations” is the target question, movies 1, 2, 3, and 4 are answer topics, reviews are review information, and “xx% of people mentioned” is statistical data, calculated based on the proportion of published content containing the answer topic in all target published content.
[0152] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0153] Based on the same inventive concept, the embodiment of the present application also provides an answer generation device for implementing the answer generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more answer generation device embodiments provided below can refer to the limitations of the answer generation method above, and will not be repeated here.
[0154] In one embodiment, Fig.10 As shown, an answer generation device 1000 is provided, comprising: an acquisition module 1002, a first determination module 1004, and a second determination module 1006, wherein:
[0155] An acquisition module 1002 is used to acquire a target question and determine the levels of answers corresponding to the target question;
[0156] A first determination module 1004 is used to determine answer data corresponding to each of the answer levels from a plurality of target published contents;
[0157] The second determination module 1006 is used to determine a target answer level from each of the answer levels according to the answer data corresponding to each of the answer levels, and to determine target answer data corresponding to the target question from the answer data corresponding to the target answer level.
[0158] The answer generation device provided in the embodiment of the present application, after obtaining the target question input by the user, determines the answer levels that may correspond to multiple target questions for the target question, extracts the answers corresponding to each answer level from the content posted by other users according to the answer level, and determines the target answer level based on these answers, and uses the answer corresponding to the target answer level as the target answer displayed to the user. The embodiment of the present application displays the answer to the user according to the determined target answer level, so that the answer displayed to the user can be clearer, reducing the time for the user to find the answer he needs from the answer, and improving the user experience.
[0159] In one embodiment, the acquisition module 1002 is further used for:
[0160] Generate prompt information for the answer level corresponding to the target question;
[0161] The answer level generation prompt information is input into a large language model to obtain each answer level output by the large language model.
[0162] In one embodiment, the acquisition module 1002 is further used for:
[0163] Determine a target reference question corresponding to the target question from each reference question, and generate answer level generation example information according to each answer level corresponding to the target reference question;
[0164] Obtaining answer level generation requirement information corresponding to the target question;
[0165] The answer level generation example information and the answer level generation requirement information are concatenated to obtain the answer level generation prompt information corresponding to the target question.
[0166] In one embodiment, the acquisition module 1002 is further used for:
[0167] Determining the semantic similarity between the target question and each reference question;
[0168] The target reference question is determined from the reference questions according to the semantic similarities corresponding to the reference questions.
[0169] In one embodiment, the first determining module 1004 is further configured to:
[0170] Generate answer extraction prompt information according to the target question, multiple target published contents and each of the answer levels;
[0171] The answer extraction prompt information is input into a large language model to obtain answer data extracted by the large language model from each of the target published contents for each of the answer levels.
[0172] In one embodiment, the second determining module 1006 is further configured to:
[0173] Determine the answer index of each answer level for the target selection dimension according to the answer data corresponding to each answer level;
[0174] A target answer level is determined from among the answer levels according to the answer index.
[0175] In one embodiment, the answer data includes an answer topic, and also includes evaluation information for the answer topic and / or statistical data for the answer topic.
[0176] In one embodiment, Fig.11 As shown, an answer display device 1100 is provided, comprising: a sending module 1102, a receiving module 1104, and a display module 1106, wherein:
[0177] A sending module 1102 is used to send a target question to a server;
[0178] A receiving module 1104 is used to receive target answer data for the target question sent by the server;
[0179] Display module 1106 is used to display the target answer data in a display interface, the target answer data corresponds to a target answer level, the target answer data is answer data determined for the target answer level from at least one target published content, the target question corresponds to at least one answer level, and the multiple answer levels include the target answer level.
[0180] The answer display device provided in the embodiment of the present application, after obtaining the target question input by the user, sends the target question to the server, so that the server returns the target answer data determined according to the target answer level to the user terminal, and then displays the target answer data. The embodiment of the present application displays the answer to the user according to the determined target answer level, so that the answer displayed to the user can be clearer, reducing the time for the user to find the answer he needs from the answer, thereby improving the efficiency of the user in finding the answer and improving the user experience.
[0181] In one embodiment, the display module 1106 is further used to:
[0182] A target answer page is displayed in a display interface, wherein the target answer page includes at least one answer display item displayed in sequence, wherein the answer display item includes an answer theme, evaluation information of the answer theme and / or statistical data for the answer theme.
[0183] Each module in the above device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0184] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.12 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an answer generation method or an answer display method is implemented.
[0185] Those skilled in the art will understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0186] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0187] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0188] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0189] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0190] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0191] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0192] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for generating an answer, characterized in that: The method comprises: Obtain a target question and determine the levels of answers corresponding to the target question; Determine answer data corresponding to each of the answer levels from a plurality of target published contents; According to the answer data corresponding to each of the answer levels, a target answer level is determined from each of the answer levels, and from the answer data corresponding to the target answer level, target answer data corresponding to the target question is determined.
2. The method according to claim 1, characterized in that Determining the levels of answers corresponding to the target question includes: Generate prompt information for the answer level corresponding to the target question; The answer level generation prompt information is input into a large language model to obtain each answer level output by the large language model.
3. The method according to claim 2, characterized in that The step of generating prompt information of the answer level corresponding to the target question includes: Determine a target reference question corresponding to the target question from each reference question, and generate answer level generation example information according to each answer level corresponding to the target reference question; Obtaining answer level generation requirement information corresponding to the target question; Based on the answer level generation example information and the answer level generation requirement information, answer level generation prompt information corresponding to the target question is obtained.
4. The method according to claim 3, characterized in that The step of determining a target reference question corresponding to the target question from the reference questions includes: Determining the semantic similarity between the target question and each reference question; The target reference question is determined from the reference questions according to the semantic similarities corresponding to the reference questions.
5. The method according to claim 1, characterized in that The step of respectively determining answer data corresponding to each of the answer levels from the plurality of target published contents includes: Generate answer extraction prompt information according to the target question, multiple target published contents and each of the answer levels; The answer extraction prompt information is input into a large language model to obtain answer data extracted by the large language model from each of the target published contents for each of the answer levels.
6. The method according to claim 1, characterized in that Determining a target answer level from each of the answer levels according to the answer data corresponding to each of the answer levels includes: Determine the answer index of each answer level for the target selection dimension according to the answer data corresponding to each answer level; A target answer level is determined from among the answer levels according to the answer index.
7. The method according to claim 1, characterized in that The answer data includes an answer topic, and also includes evaluation information for the answer topic and / or statistical data for the answer topic.
8. A method for displaying an answer, characterized in that: The method comprises: Send the target question to the server; Receiving target answer data for the target question sent by the server; The target answer data is displayed in a display interface, the target answer data corresponds to a target answer level, the target answer data is answer data determined for the target answer level from multiple target published contents, the target question corresponds to at least one answer level, and the at least one answer level includes the target answer level.
9. The method according to claim 8, characterized in that The target answer data includes at least one answer theme, and also includes evaluation information for each answer theme and / or statistical data for the answer theme. The displaying of the target answer data in the display interface includes: A target answer page is displayed in a display interface, wherein the target answer page includes at least one answer display item displayed in sequence, wherein the answer display item includes an answer theme, evaluation information of the answer theme and / or statistical data for the answer theme.
10. An answer generation device, characterized in that: The device comprises: An acquisition module, used to acquire a target question and determine the levels of answers corresponding to the target question; A first determination module is used to determine answer data corresponding to each of the answer levels from a plurality of target published contents; The second determination module is used to determine a target answer level from each of the answer levels according to the answer data corresponding to each of the answer levels, and to determine target answer data corresponding to the target question from the answer data corresponding to the target answer level.
11. An answer display device, characterized in that: The device comprises: A sending module, used to send target questions to the server; A receiving module, used for receiving target answer data for the target question sent by the server; A display module is used to display the target answer data in a display interface, the target answer data corresponds to a target answer level, the target answer data is answer data determined for the target answer level from multiple target published contents, the target question corresponds to multiple answer levels, and the multiple answer levels include the target answer level.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Cited By
Intelligent assistant answer generation method, device and equipment based on large language model
CN120317379A
Methods, apparatus, and devices for generating answers for intelligent assistants based on large language models
CN120317379B