Question answering method, system, computer device and storage medium based on large model
By using multiple answer processing and keyword scoring algorithms in the Q&A system, the problem of inconsistent answers and low accuracy of the big model Q&A system is solved, and higher answer accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202510059537.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2045-01-15
AI Technical Summary
The existing big model-based question and answer system has inconsistent answers due to the randomness of the answer results, and there are certain wrong answers, and the answer accuracy is low.
By obtaining the target question, using the preset big model to perform multiple answer processing, multiple candidate answer texts are obtained. Then, the keyword set of candidate answer text is obtained according to the preset keyword recognition method, and the corresponding weights are given to high-frequency keywords and conventional keywords. The score of each candidate answer text is calculated using the keyword scoring algorithm, and the candidate answer text with the highest answer score is finally determined as the target answer text.
By calculating the answer scores of multiple candidate answer texts and selecting the one with the highest score as the final answer, the randomness and error rate of the big model answers are reduced, and the answer accuracy of the question and answer system is improved.
Smart Images

Figure CN119474278B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a large model-based question-answering method, system, computer device, and storage medium. Background Art
[0002] With the rapid development of artificial intelligence and natural language processing technology, the role of large language models (LLM) in various application scenarios has become increasingly significant. Especially in intelligent customer service systems, LLM has become a cutting-edge technology choice to assist in solving user problems through its powerful language understanding and generation capabilities.
[0003] However, since there is a certain degree of randomness in the results of each answer from the large model, each answer is inconsistent. There will be correct answers among these answers, but some wrong answers may also be produced at the same time. Then the answer from the large model will have a certain probability of producing wrong answers. It can be seen that the answer accuracy of the existing question system based on the large model needs to be improved. Summary of the invention
[0004] The embodiments of the present application provide a question-answering method, system, computer device, and storage medium based on a large model, which can improve the accuracy of answers in the question-answering system.
[0005] In a first aspect, an embodiment of the present application provides a question-answering method based on a large model, which is applied to a question-answering system and includes:
[0006] Get the current target question to be answered;
[0007] The target question is answered a preset number of times using a preset large model to obtain multiple candidate answer texts;
[0008] Obtaining a keyword set of each candidate answer text according to a preset keyword recognition method, wherein the keyword set includes high-frequency keywords and regular keywords;
[0009] Obtaining a first weight of each of the high-frequency keywords, and obtaining a second weight of each of the regular keywords;
[0010] For each of the candidate answer texts, determine the answer score corresponding to the candidate answer text according to a preset keyword score algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight;
[0011] The candidate answer text with the highest answer score among the plurality of candidate answer texts is determined as the target answer text.
[0012] In a second aspect, the embodiment of the present application further provides a question-answering system, which includes:
[0013] A transceiver unit, used to obtain the target question to be answered;
[0014] A processing unit is used to perform answer processing on the target question a preset number of times through a preset large model to obtain multiple candidate answer texts; obtain a keyword set of each candidate answer text according to a preset keyword recognition method, the keyword set including high-frequency keywords and regular keywords; obtain a first weight of each high-frequency keyword, and obtain a second weight of each regular keyword; for each candidate answer text, determine the answer score corresponding to the candidate answer text according to a preset keyword scoring algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight; determine the candidate answer text with the highest answer score among the multiple candidate answer texts as the target answer text.
[0015] In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and wherein the program instructions can implement the above method when executed by a processor.
[0017] The embodiment of the present application provides a question-answering method, system, computer device and storage medium based on a large model. Among them, the method includes: the question-answering system obtains the current target question to be answered; the target question is answered a preset number of times through a preset large model to obtain multiple candidate answer texts; the keyword set of each candidate answer text is obtained according to a preset keyword recognition method, and the keyword set includes high-frequency keywords and regular keywords; the first weight of each high-frequency keyword is obtained, and the second weight of each regular keyword is obtained; for each candidate answer text, the answer score corresponding to the candidate answer text is determined according to the preset keyword score algorithm, the first weight and the second weight corresponding to each keyword in the corresponding keyword set; the candidate answer text with the highest answer score among the multiple candidate answer texts is determined as the target answer text. The embodiment of the present application will further calculate the answer scores of the multiple candidate answer texts output by the large model, and use the candidate answer text with the highest score as the final target answer text, thereby reducing the probability of large model hallucination and improving the answer accuracy of the question-answering system. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A flowchart of a large model-based question-answering method provided in an embodiment of the present application;
[0020] Figure 2 A schematic diagram of a sub-process of a question-answering method based on a large model provided in an embodiment of the present application;
[0021] Figure 3 Another sub-process diagram of the large model-based question-answering method provided in an embodiment of the present application;
[0022] Figure 4 Another sub-process diagram of the large model-based question-answering method provided in an embodiment of the present application;
[0023] Figure 5 A schematic block diagram of a question-answering system provided in an embodiment of the present application;
[0024] Figure 6 A schematic block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] 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 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.
[0026] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0027] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0028] It should be further understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0029] The embodiments of the present application provide a question-answering method, system, computer device, and storage medium based on a large model.
[0030] The executor of the large model-based question-answering method may be the question-answering system provided in the embodiment of the present application, or a computer device integrating the question-answering system, wherein the question-answering system may be implemented in hardware or software, and the computer device may be a terminal or a server.
[0031] Figure 1 is a flow chart of a question-answering method based on a large model provided in an embodiment of the present application. Figure 1 As shown, the method includes the following steps S110-S160.
[0032] S110, obtaining the target question to be answered currently.
[0033] The large model-based question-answering method provided in this embodiment supports users to input questions through text or voice.
[0034] When the user inputs text through the dialog box, the text is the target question. When the user inputs voice through the microphone, the question-answering system obtains the user's voice input, and the user's voice input needs to be converted into text. At this time, obtaining the current target question to be answered includes:
[0035] Acquire the question voice input by the user; perform text conversion processing on the question voice to obtain the target question.
[0036] Specifically, in this embodiment, the acquired speech can be converted into text through an automatic speech recognition (ASR) model to obtain the target question in text form.
[0037] S120, answering the target question a preset number of times using a preset large model to obtain a plurality of candidate answer texts.
[0038] In this embodiment, a large model is required to provide multiple answers to the target question. The questions input into the large model are the same, and the number of answers is N times (preset number), where N is an integer greater than 1. The value of N is generally 5-100, and the specific value is determined according to the specific scenario. Multiple answers can ensure that the question-answering system achieves a balance between generation diversity and accuracy.
[0039] Furthermore, in order to adapt to the requirements of different scenarios, the present application sets different parameter setting schemes (model parameters) for different problem scenario types. At this time, before executing step S120, the method further includes:
[0040] Performing scenario analysis processing on the target problem to obtain a target scenario type corresponding to the target problem; determining a model parameter corresponding to the target scenario type among a plurality of model parameters as a target model parameter; and setting the large model according to the target model parameter.
[0041] The model parameters include a temperature parameter, or a temperature parameter and a top parameter, wherein the top parameter includes a top-k parameter or a top-p (core sampling) parameter.
[0042] The temperature parameter is used to control the randomness of the generated text. The higher the temperature, the more the model tends to explore more possibilities when selecting the next word, thereby generating more diverse text.
[0043] The top-k parameter is used to consider the k most likely candidate words at each step of generating text. By limiting the number of candidate words, the diversity and accuracy of the generated text can be further controlled.
[0044] The Top-p parameter works similarly to Top-k, but it limits the number of candidate words based on cumulative probability. The model considers vocabulary sets whose cumulative probability reaches or exceeds p.
[0045] It can be seen that for scenario types that require higher accuracy, the value of the temperature parameter can be lowered; for scenarios that require more creative answers, the value of the top-k parameter or the top-p parameter can be appropriately increased.
[0046] Furthermore, in order to accelerate the reasoning process of the question-answering system, this embodiment selects VLLM (a Python-based LLM reasoning and service framework) to deploy a large model for the question-answering system. The framework has efficient computing performance and optimized resource usage capabilities, ensuring that the system can maintain fast response even under high concurrent requests.
[0047] S130. Obtain a keyword set of each candidate answer text according to a preset keyword recognition method, wherein the keyword set includes high-frequency keywords and regular keywords.
[0048] See also Figure 2 Specifically, in some embodiments, step S130 includes:
[0049] S1301. Perform word segmentation and stop word filtering on each of the candidate answer texts to obtain multiple word segments corresponding to each of the candidate answer texts.
[0050] Specifically, in this embodiment, considering the complexity of the Chinese language, a Chinese word segmentation tool such as Jieba is used for word segmentation. The word segmentation scheme adopts the accurate mode to ensure that as many complete but non-redundant keywords as possible are captured.
[0051] After word segmentation of the text in each candidate answer text, it is also necessary to remove the interference of stop words (such as "de", "le", "shi", etc.) and retain the substantial words.
[0052] S1302. Obtain the number of word segments of each of the word segments in multiple candidate answer texts, and determine the word segments with the number of word segments greater than the frequency threshold as the high-frequency keywords, where the frequency threshold is half of the number of candidate answer texts.
[0053] Specifically, the occurrence times (frequency of occurrence) can be counted for each word segment, and a mapping table of each word segment and its occurrence times can be constructed.
[0054] If the number of occurrences of a certain word segment exceeds 50% (i.e., N / 2 times) of the total number of inferences N (the number of candidate answer texts), it is considered that the word segment has a significant impact on the result, and the word segment is determined as a high-frequency keyword and participates in the calculation of the answer score.
[0055] S1303. Determine the word segments located in the preset general keyword list among the multiple word segments as the general keywords.
[0056] In this embodiment, the general keyword list includes some high-frequency and significantly tendentious keywords, such as keywords like "correct", "wrong", "yes", "no", "will", "will not", etc. If a word segment contains these keywords, the corresponding word segment is determined as a general keyword.
[0057] S1304. For each of the candidate answer texts, determine the high-frequency keywords and the general keywords among the corresponding multiple word segments as the keyword set.
[0058] Among them, if a certain word segment belongs to both high-frequency keywords and general keywords, by default, the word segment is classified as a general keyword.
[0059] S140. Obtain the first weight of each of the high-frequency keywords and obtain the second weight of each of the general keywords.
[0060] Please refer to Figure 3 , specifically, in some embodiments, step S140 includes:
[0061] S1401. Determine the first weight corresponding to each of the high-frequency keywords according to a preset high-frequency keyword weight determination rule.
[0062] Specifically, the preset high-frequency keyword default weight is determined as the first weight; for example, the high-frequency keyword default weight is set to 1, and the first weight of each high-frequency keyword is 1;
[0063] Or, obtain the number of word segments of the high-frequency keyword in the multiple candidate answer texts; and determine the first weight according to the number of word segments and the number of the candidate answer texts.
[0064] Furthermore, a target ratio between the number of word segments and the number of candidate answer texts is determined, and then a first weight corresponding to the target ratio is determined based on a correspondence between a preset ratio and a weight, wherein in the correspondence between the ratio and the weight, the higher the ratio, the greater the corresponding weight. It can be seen that the more times high-frequency keywords appear, the greater the impact on the answer score.
[0065] S1402: Search in a preset regular keyword table to obtain the second weight corresponding to each regular keyword.
[0066] In this embodiment, the weights of various general keywords are pre-set in the general keyword word list. For example, the weights of the general keywords "yes", "no" and "no" are 3; the weights of the general keywords "cover" and "do not cover" are 2; the weights of the general keywords "specific terms" and "related terms" are 1.5.
[0067] S150. For each candidate answer text, determine the answer score corresponding to the candidate answer text according to a preset keyword scoring algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight.
[0068] See also Figure 4 Specifically, in some embodiments, step S150 includes:
[0069] S1501. For each high-frequency keyword, determine a first keyword score corresponding to the high-frequency keyword according to the corresponding first weight, the number of keywords of the high-frequency keyword in the multiple keyword sets, and the total number of keywords in the multiple keyword sets.
[0070] S1502: For each of the regular keywords, determine a second keyword score corresponding to the regular keyword according to the corresponding second weight, the number of the regular keyword in the multiple keyword sets, and the total number of keywords in the multiple keyword sets.
[0071] S1503: Determine the answer score according to the first keyword score and the second keyword score.
[0072] In this embodiment, for each candidate answer text, the first keyword score of each high-frequency keyword corresponding to the candidate answer text and the second keyword score of each regular keyword are added to obtain the corresponding answer score.
[0073] Specifically, for each candidate answer text, the answer score is calculated using the following formula:
[0074] ;
[0075] Among them, Score is the answer score, wi is the weight of the current keyword, Keywordtimes is the number of times the current keyword appears globally (the number of keywords in the multiple keyword sets of the current keyword), Alltimes is the sum of the frequencies of all keywords appearing globally (the total number of keywords in the multiple keyword sets), and the current keyword is the i-th keyword in the keyword set.
[0076] S160: Determine the candidate answer text with the highest answer score among the multiple candidate answer texts as the target answer text.
[0077] In this embodiment, after obtaining the answer scores corresponding to the candidate answer texts, the candidate answer text with the highest answer score is determined as the target answer text.
[0078] In some embodiments, after the target answer text is generated, the target answer text can also be played by voice.
[0079] For ease of understanding, the question-answering method based on a large model provided by the present application is described in detail below with a specific embodiment:
[0080] The question-answering system receives the question input by the user, "Does the insurance cover the expenses caused by the insured contracting an acute disease while traveling abroad?", and obtains the following multiple candidate answer texts through multiple answers:
[0081] Candidate answer text 1: No, the insurance does not cover the expenses incurred by the insured person if he / she contracts an acute disease during overseas travel;
[0082] Candidate answer text 2: Yes, the insurance covers the expenses incurred by the insured person due to acute diseases contracted during overseas travel, but the specific coverage needs to refer to the relevant terms of the additional travel medical expense compensation insurance;
[0083] Candidate answer text 3: Yes, the insurance covers the expenses caused by the insured person contracting an acute disease during overseas travel, but the specific circumstances must meet the provisions and conditions in the insurance contract;
[0084] Candidate answer text 4: The insurance covers the necessary and reasonable medical expenses caused by the insured person's acute illness during overseas travel, but the deductible and benefit ratio stipulated in the insurance contract must be met;
[0085] Candidate answer text 5: Yes, the insurance covers the necessary and reasonable medical expenses caused by the insured person's acute illness while traveling abroad.
[0086] Through word segmentation and stop word filtering, the keyword sets of each candidate answer text are obtained, among which, the keyword set corresponding to candidate answer text 1 is (no, overseas travel, acute infection), among which "no" is a regular keyword, "overseas travel" and "acute infection" are "high-frequency keywords"; the keyword set corresponding to candidate answer text 2 is (yes, overseas travel, acute infection, related terms), among which "yes" and "related terms" are regular keywords, "overseas travel" and "acute infection" are "high-frequency keywords", the keyword set corresponding to candidate answer text 3 is (yes, overseas travel, acute infection), among which "yes" is a regular keyword, "overseas travel" and "acute infection" are "high-frequency keywords", the keyword set corresponding to candidate answer text 4 is (overseas travel, acute infection), among which "overseas travel" and "acute infection" are "high-frequency keywords", and the keyword set corresponding to candidate answer text 5 is (yes, overseas travel), among which "yes" is a regular keyword and "overseas travel" is a "high-frequency keyword".
[0087] Through the calculation of answer scores, the candidate answer text 2 above obtains the highest score and is output as the final result.
[0088] In summary, the question-answering system obtains the current target question to be answered; the target question is answered a preset number of times through a preset large model to obtain multiple candidate answer texts; a keyword set of each candidate answer text is obtained according to a preset keyword recognition method, and the keyword set includes high-frequency keywords and regular keywords; a first weight of each high-frequency keyword is obtained, and a second weight of each regular keyword is obtained; for each candidate answer text, the answer score corresponding to the candidate answer text is determined according to a preset keyword scoring algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight; the candidate answer text with the highest answer score among the multiple candidate answer texts is determined as the target answer text. The embodiment of the present application will further calculate the answer scores of the multiple candidate answer texts output by the large model, and use the candidate answer text with the highest score as the final target answer text, thereby reducing the probability of large model hallucinations and improving the answer accuracy of the question-answering system.
[0089] Figure 5 is a schematic block diagram of a question-answering system 500 provided in an embodiment of the present application. Figure 5 As shown, corresponding to the above question-answering method based on a large model, the present application also provides a question-answering system 500. The question-answering system 500 includes a unit for executing the above question-answering method based on a large model, and the question-answering system 500 can be configured in a terminal or a server. Figure 5 The question-answering system 500 includes a transceiver unit 501 and a processing unit 502, wherein:
[0090] The transceiver unit 501 is used to obtain the target question to be answered;
[0091] Processing unit 502 is used to perform answer processing on the target question a preset number of times through a preset large model to obtain multiple candidate answer texts; obtain a keyword set of each candidate answer text according to a preset keyword recognition method, the keyword set including high-frequency keywords and regular keywords; obtain a first weight of each high-frequency keyword, and obtain a second weight of each regular keyword; for each candidate answer text, determine the answer score corresponding to the candidate answer text according to a preset keyword scoring algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight; determine the candidate answer text with the highest answer score among the multiple candidate answer texts as the target answer text.
[0092] In some embodiments, when the processing unit 502 executes the step of respectively acquiring the keyword set of each candidate answer text according to the preset keyword recognition method, it is specifically used to:
[0093] Perform word segmentation and stop word filtering processing on each of the candidate answer texts to obtain multiple word segmentations corresponding to each of the candidate answer texts; obtain the number of word segmentations of each of the multiple candidate answer texts, and determine the word segmentations whose number of word segmentations is greater than a number threshold as the high-frequency keyword, wherein the number threshold is half of the number of the candidate answer texts; determine the word segmentations in a preset regular keyword word list among the multiple word segmentations as the regular keyword; for each of the candidate answer texts, determine the high-frequency keywords and the regular keywords in the corresponding multiple word segmentations as the keyword set.
[0094] In some embodiments, when executing the steps of obtaining the first weight of each of the high-frequency keywords and obtaining the second weight of each of the regular keywords, the processing unit 502 is specifically configured to:
[0095] The first weights corresponding to the high-frequency keywords are determined according to a preset high-frequency keyword weight determination rule; and the second weights corresponding to the regular keywords are obtained by searching in a preset regular keyword word list.
[0096] In some embodiments, when the processing unit 502 performs the step of determining the first weights corresponding to the high-frequency keywords according to the preset high-frequency keyword weight determination rule, it is specifically configured to:
[0097] Determine the preset high-frequency keyword default weight as the first weight; or,
[0098] The number of word segments of the high-frequency keyword in the plurality of candidate answer texts is obtained; and the first weight is determined according to the number of word segments and the number of the candidate answer texts.
[0099] In some embodiments, when the processing unit 502 executes the step of determining the answer score corresponding to the candidate answer text according to the preset keyword score algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight, the processing unit 502 is specifically used to:
[0100] For each of the high-frequency keywords, a first keyword score corresponding to the high-frequency keyword is determined based on the corresponding first weight, the number of keywords of the high-frequency keyword in the multiple keyword sets, and the total number of keywords in the multiple keyword sets; for each of the regular keywords, a second keyword score corresponding to the regular keyword is determined based on the corresponding second weight, the number of keywords of the regular keyword in the multiple keyword sets, and the total number of keywords in the multiple keyword sets; the answer score is determined based on the first keyword score and the second keyword score.
[0101] In some embodiments, before executing the step of performing a preset number of answer processing on the target question using a preset large model to obtain a plurality of candidate answer texts, the processing unit 502 is further configured to:
[0102] Performing scenario analysis processing on the target problem to obtain a target scenario type corresponding to the target problem; determining a model parameter corresponding to the target scenario type among a plurality of model parameters as a target model parameter; and setting the large model according to the target model parameter.
[0103] In some embodiments, when executing the step of obtaining the target question to be answered, the transceiver unit 501 is specifically used to:
[0104] Acquire the question voice input by the user; and perform text conversion processing on the question voice through the processing unit 502 to obtain the target question.
[0105] To summarize, the question-and-answer system 500 provided in the embodiment of the present application will further calculate the answer scores of multiple candidate answer texts output by the large model, and use the candidate answer text with the highest score as the final target answer text, thereby reducing the probability of large model hallucinations and improving the answer accuracy of the question-and-answer system 500 based on the large model.
[0106] It should be noted that technicians in the relevant field can clearly understand that the specific implementation process of the above-mentioned question and answer system 500 and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.
[0107] The above question-answering system can be implemented in the form of a computer program. Figure 6 Runs on the computer device shown.
[0108] See also Figure 6 , Figure 6 600 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 600 can be a terminal or a server, wherein the terminal can be an electronic device with communication functions such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device. The server can be an independent server or a server cluster composed of multiple servers.
[0109] See also Figure 6 The computer device 600 includes a processor 602 , a memory and a network interface 605 connected via a system bus 601 , wherein the memory may include a non-volatile storage medium 603 and an internal memory 604 .
[0110] The non-volatile storage medium 603 can store an operating system 6031 and a computer program 6032. The computer program 6032 includes program instructions, which, when executed, can enable the processor 602 to perform a large model-based question-answering method.
[0111] The processor 602 is used to provide computing and control capabilities to support the operation of the entire computer device 600 .
[0112] The internal memory 604 provides an environment for the operation of the computer program 6032 in the non-volatile storage medium 603. When the computer program 6032 is executed by the processor 602, the processor 602 can execute a question-answering method based on a large model.
[0113] The network interface 605 is used to communicate with other devices over the network. Figure 6 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 600 to which the solution of the present application is applied. The specific computer device 600 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0114] The processor 602 is used to run a computer program 6032 stored in the memory to implement the following steps:
[0115] Get the current target question to be answered;
[0116] The target question is answered a preset number of times using a preset large model to obtain multiple candidate answer texts;
[0117] Obtaining a keyword set of each candidate answer text according to a preset keyword recognition method, wherein the keyword set includes high-frequency keywords and regular keywords;
[0118] Obtaining a first weight of each of the high-frequency keywords, and obtaining a second weight of each of the regular keywords;
[0119] For each of the candidate answer texts, determine the answer score corresponding to the candidate answer text according to a preset keyword score algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight;
[0120] The candidate answer text with the highest answer score among the plurality of candidate answer texts is determined as the target answer text.
[0121] It should be understood that in the embodiment of the present application, the processor 602 may be a central processing unit (CPU), and the processor 602 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0122] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0123] Therefore, the present application also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the following steps:
[0124] Get the current target question to be answered;
[0125] The target question is answered a preset number of times using a preset large model to obtain multiple candidate answer texts;
[0126] Obtaining a keyword set of each candidate answer text according to a preset keyword recognition method, wherein the keyword set includes high-frequency keywords and regular keywords;
[0127] Obtaining a first weight of each of the high-frequency keywords, and obtaining a second weight of each of the regular keywords;
[0128] For each of the candidate answer texts, determine the answer score corresponding to the candidate answer text according to a preset keyword score algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight;
[0129] The candidate answer text with the highest answer score among the plurality of candidate answer texts is determined as the target answer text.
[0130] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0131] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0132] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0133] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present application can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0134] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0135] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A question-answering method based on a large model, characterized in that: The method is applied to a question-answering system, and the method comprises: Get the current target question to be answered; The target question is answered a preset number of times using a preset large model to obtain multiple candidate answer texts; Obtaining a keyword set of each candidate answer text according to a preset keyword recognition method, wherein the keyword set includes high-frequency keywords and regular keywords; Obtaining a first weight of each of the high-frequency keywords, and obtaining a second weight of each of the regular keywords; For each of the candidate answer texts, determine the answer score corresponding to the candidate answer text according to a preset keyword score algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight; Determine the candidate answer text with the highest answer score among the plurality of candidate answer texts as the target answer text; The step of determining the answer score corresponding to the candidate answer text according to a preset keyword score algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight includes: For each of the high-frequency keywords, determining a first keyword score corresponding to the high-frequency keyword according to the corresponding first weight, the number of keywords of the high-frequency keyword in the multiple keyword sets, and the total number of keywords in the multiple keyword sets; For each of the conventional keywords, determining a second keyword score corresponding to the conventional keyword according to the corresponding second weight, the number of keywords of the conventional keyword in the plurality of keyword sets, and the total number of keywords in the plurality of keyword sets; The first keyword scores and the second keyword scores are added together to obtain the answer score.
2. The method according to claim 1, characterized in that The step of respectively obtaining a keyword set of each candidate answer text according to a preset keyword recognition method includes: Performing word segmentation and stop word filtering processing on each of the candidate answer texts to obtain a plurality of word segmentations corresponding to each of the candidate answer texts; Obtaining the number of each of the segmented words in the plurality of candidate answer texts, and determining the segmented words whose number of segmented words is greater than a number threshold as the high-frequency keyword, wherein the number threshold is half of the number of the candidate answer texts; Determine the segmented words in the preset regular keyword word list among the multiple segmented words as the regular keyword; For each of the candidate answer texts, the high-frequency keywords and the regular keywords in the corresponding plurality of segmented words are determined as the keyword set.
3. The method according to claim 1, characterized in that The obtaining of the first weight of each of the high-frequency keywords and the obtaining of the second weight of each of the regular keywords include: Determine the first weight corresponding to each of the high-frequency keywords according to a preset high-frequency keyword weight determination rule; The second weights corresponding to the respective conventional keywords are obtained by searching in a preset conventional keyword word list.
4. The method according to claim 3, characterized in that The determining the first weights corresponding to the high-frequency keywords respectively according to a preset high-frequency keyword weight determination rule includes: Determine the preset high-frequency keyword default weight as the first weight; or, Obtaining the number of word segments of the high-frequency keyword in the plurality of candidate answer texts; The first weight is determined according to the number of the segmented words and the number of the candidate answer texts.
5. The method according to claim 1, characterized in that Before the target question is answered a preset number of times by using a preset large model to obtain a plurality of candidate answer texts, the method further includes: Performing scenario analysis on the target problem to obtain a target scenario type corresponding to the target problem; Determine a model parameter corresponding to the target scene type among the plurality of model parameters as a target model parameter; The large model is set according to the target model parameters.
6. The method according to any one of claims 1 to 5, characterized in that The step of obtaining the target question to be answered currently includes: Get the question voice input by the user; The question speech is converted into text to obtain the target question.
7. A question-answering system, characterized in that: include: A transceiver unit, used to obtain the target question to be answered; A processing unit is used to perform a preset number of answer processing on the target question through a preset large model to obtain multiple candidate answer texts; obtain a keyword set of each candidate answer text according to a preset keyword recognition method, the keyword set including high-frequency keywords and regular keywords; obtain a first weight of each high-frequency keyword, and obtain a second weight of each regular keyword; for each candidate answer text, determine the answer score corresponding to the candidate answer text according to a preset keyword scoring algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight; determine the candidate answer text with the highest answer score among the multiple candidate answer texts as the target answer text; When the processing unit executes the step of determining the answer score corresponding to the candidate answer text according to the preset keyword score algorithm, the first weight corresponding to each keyword in the corresponding keyword set, and the second weight, the processing unit is specifically used to: For each of the high-frequency keywords, determining a first keyword score corresponding to the high-frequency keyword according to the corresponding first weight, the number of keywords of the high-frequency keyword in the multiple keyword sets, and the total number of keywords in the multiple keyword sets; For each of the conventional keywords, determining a second keyword score corresponding to the conventional keyword according to the corresponding second weight, the number of keywords of the conventional keyword in the plurality of keyword sets, and the total number of keywords in the plurality of keyword sets; The first keyword scores and the second keyword scores are added together to obtain the answer score.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the large model-based question-answering method according to any one of claims 1 to 6 is implemented.
9. A storage medium, characterized in that: The storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the processor executes the large model-based question-answering method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Large language model test data set generation method, system, equipment and medium
CN119046424A