User question and answer method and device, equipment, storage medium and product
By dynamically adjusting the model parameter threshold and conditional probability clustering blocking method, a knowledge base is generated, and the problem of low accuracy of text blocking in the existing technology is solved, and a higher accuracy question-and-answer result is achieved.
Patent Information
- Application Number
- CN202510429258.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-18
AI Technical Summary
In the existing large-scale model retrieval enhancement technology, text blocking accuracy is low, fixed parameter blocking strategy is weak, and it is impossible to effectively respond to changes in the logical relationship of sentences.
The dynamically adjustable model parameter threshold is used to block text knowledge, and knowledge blocks are generated through the conditional probability clustering method, and a knowledge base is formed for similarity retrieval and question-and-answer generation.
Improve the accuracy and adaptability of text chunking, and generate higher accuracy Q&A results to adapt to dynamic adjustments of different texts and contexts.
Smart Images

Figure CN120336481A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and particularly to a user question-answering method, device, equipment, storage medium and product. Background Art
[0002] Large models often face problems of knowledge update and interpretability. The recent research solution is to use the method of external knowledge bases to enhance the output of large models, and there are already many methods for the retrieval scheme of external knowledge bases. Retrieval-Augmented Generation (RAG), as a cutting-edge technical paradigm, aims to solve the challenges of hallucinations and weak data timeliness faced by large language models.
[0003] Existing retrieval-augmented generation schemes usually perform chunking of document content based on rules or semantic similarity. However, from the perspective of user questions, they are insensitive to changes in the logical relationship between sentences. Fixed-mode chunking strategies usually use static thresholds to determine the belonging of sentences, resulting in weak chunking accuracy and adaptability. Summary of the Invention
[0004] The main purpose of this application is to provide a user question-answering method, device, equipment, storage medium and product, aiming to solve the technical problem of low text chunking accuracy when answering questions according to the large model retrieval enhancement technology.
[0005] To achieve the above object, this application proposes a user question-answering method, and the method includes:
[0006] Parse the obtained knowledge text document to obtain text knowledge;
[0007] Chunk the text knowledge according to the model parameter threshold, and generate a knowledge base according to the obtained knowledge chunks, where the model parameter threshold is a dynamically adjustable threshold;
[0008] Perform a similarity retrieval on the obtained user input question and the knowledge chunks in the knowledge base to obtain associated knowledge chunks;
[0009] Input the associated knowledge chunks and the user input question into a large language generation model to generate a question-answering result.
[0010] In one embodiment, the step of chunking the text knowledge according to the model parameter threshold includes:
[0011] Split the text knowledge to generate a sentence set;
[0012] Generate an initial knowledge group according to the first sentence in the sentence set, and use the next sentence in the sentence set as the current sentence;
[0013] Determine the probability value that the current sentence belongs to the initial knowledge group according to the conditional probability-based clustering and chunking method;
[0014] Judge whether to add the current sentence to the initial knowledge group or generate a new knowledge group according to the current sentence based on the probability value and the model parameter threshold.
[0015] In one embodiment, the step of judging whether to add the current sentence to the initial knowledge group or generate a new knowledge group according to the current sentence based on the probability value and the model parameter threshold includes:
[0016] If the probability value is greater than or equal to the model parameter threshold, add the current sentence to the initial knowledge group;
[0017] If the probability value is less than the model parameter threshold, generate a new knowledge group according to the current sentence;
[0018] Generate a plurality of knowledge chunks according to the initial knowledge group and the new knowledge group;
[0019] Iteratively use the next sentence of the current sentence as the current sentence, and execute the step of determining the probability value that the current sentence belongs to the initial knowledge group or the new knowledge group according to the conditional probability-based clustering and chunking method until each sentence in the sentence set has been judged, and obtain a plurality of knowledge chunks.
[0020] In one embodiment, after the step of iteratively using the next sentence of the current sentence as the current sentence and executing the step of determining the probability value that the current sentence belongs to the initial knowledge group or the new knowledge group according to the conditional probability-based clustering and chunking method, it further includes:
[0021] Determine the similarity distribution and semantic features between each sentence in the initial knowledge group;
[0022] Adjust the model parameter threshold according to the similarity distribution and the semantic features through a preset threshold conversion function.
[0023] In one embodiment, after the step of iteratively using the next sentence of the current sentence as the current sentence and executing the step of determining the probability value that the current sentence belongs to the initial knowledge group or the new knowledge group according to the conditional probability-based clustering and chunking method, it further includes:
[0024] Determine the first similarity between each sentence in each knowledge chunk of the plurality of knowledge chunks and other knowledge chunks in the plurality of knowledge chunks;
[0025] Determine the independence measure of each knowledge block according to the number of sentences in each knowledge block and the first similarity;
[0026] Determine the second similarity between the current sentence and each knowledge block;
[0027] Determine the contribution degree of the current sentence to each knowledge block according to the independence measure and the second similarity;
[0028] Take the knowledge block with the largest contribution degree among the multiple knowledge blocks as the most relevant knowledge block;
[0029] Add the current sentence to the most relevant knowledge block.
[0030] In one embodiment, after the step of determining the independence measure of each knowledge block according to the number of sentences in each knowledge block and the first similarity, the method further includes:
[0031] Determine multiple target knowledge blocks among the multiple knowledge blocks whose difference between the first similarities is less than a difference threshold;
[0032] Orthogonally adjust the independence measures of the multiple target knowledge blocks according to an adjustment factor.
[0033] In addition, to achieve the above object, the present application also proposes a user question and answer device, where the user question and answer device includes:
[0034] A text parsing module, configured to parse the obtained knowledge text document to obtain text knowledge;
[0035] A text chunking module, configured to chunk the text knowledge according to a model parameter threshold and generate a knowledge base based on the obtained knowledge blocks, where the model parameter threshold is a dynamically adjustable threshold;
[0036] A knowledge block retrieval module, configured to perform a similarity retrieval on the obtained user input question and the knowledge blocks in the knowledge base to obtain associated knowledge blocks;
[0037] A result generation module, configured to input the associated knowledge blocks and the user input question into a large language generation model to generate a question and answer result.
[0038] In addition, to achieve the above object, the present application also proposes a user question and answer device, where the device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the user question and answer method as described above.
[0039] In addition, to achieve the above object, the present application further provides a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the user Q&A method described above are implemented.
[0040] In addition, to achieve the above object, the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the user Q&A method described above are implemented.
[0041] The present application provides a user Q&A method. By parsing the obtained knowledge text document, text knowledge is obtained; the text knowledge is chunked according to a model parameter threshold, and a knowledge base is generated based on the obtained knowledge chunks. The model parameter threshold is a dynamically adjustable threshold; the obtained user input question is retrieved for similarity with the knowledge chunks in the knowledge base to obtain associated knowledge chunks; the associated knowledge chunks and the user input question are input into a large language generation model to generate Q&A results. The present application chunks the text knowledge according to a dynamically adjustable model parameter threshold, solves the drawbacks of the existing fixed-parameter chunking strategy, makes the chunking method more flexible and adaptable, and can be dynamically adjusted according to different texts and contexts, thereby improving the accuracy and effectiveness of chunking. Then, a knowledge base is generated based on the knowledge chunks obtained by chunking for retrieval, and Q&A results with higher accuracy are generated. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0043] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0044] Figure 1 It is a schematic flowchart provided for Embodiment 1 of the user Q&A method of the present application;
[0045] Figure 2 It is a schematic overall flowchart of the user Q&A method of the present application;
[0046] Figure 3 It is a schematic flowchart provided for Embodiment 2 of the user Q&A method of the present application;
[0047] Figure 4 It is a schematic flowchart provided for Embodiment 3 of the user Q&A method of the present application;
[0048] Figure 5 It is a schematic diagram of the module structure of the user Q&A device according to an embodiment of the present application;
[0049] Figure 6 It is a schematic diagram of the device structure of the hardware operating environment involved in the user Q&A method according to an embodiment of the present application.
[0050] The implementation, functional features, and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. Specific embodiments
[0051] It should be understood that the specific embodiments described herein are only used to explain the technical solution of the present application and are not used to limit the present application.
[0052] To better understand the technical solution of the present application, the following will be described in detail in conjunction with the accompanying drawings of the specification and specific embodiments.
[0053] The main solution of the embodiment of the present application is: parsing the obtained knowledge text document to obtain text knowledge; dividing the text knowledge according to the model parameter threshold, and generating a knowledge base according to the obtained knowledge blocks, where the model parameter threshold is a dynamically adjustable threshold; performing a similarity search on the obtained user input question and the knowledge blocks in the knowledge base to obtain associated knowledge blocks; inputting the associated knowledge blocks and the user input question into a large language generation model to generate an answer result.
[0054] Since existing retrieval-augmented generation solutions usually perform document content chunking based on rules or semantic similarity. However, from the perspective of user questions, they are insensitive to changes in the logical relationship between sentences. Fixed-mode chunking strategies usually use static thresholds to determine the attribution of sentences, making the accuracy and adaptability of chunking weak.
[0055] The present application provides a solution. By parsing the obtained knowledge text document, text knowledge is obtained; the text knowledge is chunked according to the model parameter threshold, and a knowledge base is generated according to the obtained knowledge blocks, where the model parameter threshold is a dynamically adjustable threshold; performing a similarity search on the obtained user input question and the knowledge blocks in the knowledge base to obtain associated knowledge blocks; inputting the associated knowledge blocks and the user input question into a large language generation model to generate an answer result. The present application chunks the text knowledge according to the dynamically adjustable model parameter threshold, solves the drawbacks of the existing fixed-parameter chunking strategy, makes the chunking method more flexible and adaptable, can be dynamically adjusted according to different texts and contexts, thereby improving the accuracy and effectiveness of chunking. Then, a knowledge base is generated based on the knowledge blocks obtained by chunking for retrieval, and a more accurate answer result is generated.
[0056] It should be noted that the execution subject of the method in this embodiment can be a computing service device with functions of user Q&A, network communication, and program running, such as a tablet computer, a personal computer, a mobile phone, etc.; it can also be a user Q&A device with the same or similar functions. This embodiment and the following embodiments will be described by taking the user Q&A device as an example.
[0057] Based on this, the embodiment of the present application provides a user Q&A method. Refer to Figure 1 , Figure 1 which is a schematic flowchart of the first embodiment of the user Q&A method of the present application.
[0058] In this embodiment, the user Q&A method includes steps S10 to S40:
[0059] Step S10, parse the obtained knowledge text document to obtain text knowledge.
[0060] It is worth noting that the user Q&A method in this solution can generate corresponding Q&A results according to the user's questions, and can be specifically applied to a variety of specific scenarios. For example, it is applied to an intelligent customer service robot to automatically answer common questions of users (for example, customers of a bank can consult an intelligent customer service robot about questions such as the credit card bill repayment date and limit adjustment, and the robot provides accurate answers for users according to the preset answer library and algorithm); it is applied to a learning platform, and students can ask questions to the platform at any time to obtain guidance on course content, homework, exams, etc.; it can also be applied to a health management application. Users record their health data, such as diet, exercise, sleep, etc. in the health management application program, and the health management application program provides corresponding analysis and suggestions according to this solution.
[0061] It can be understood that this solution proposes an effective text chunking strategy in the framework of a retrieval-augmented generation model, which can significantly help the large model improve its performance. The overall process of the user Q&A method can refer to Figure 2 as shown. This process is mainly divided into two major modules. The first is the knowledge base generation stage, and the second is the stage of retrieving relevant knowledge and delivering it to the large model. In the first stage, a large number of knowledge-related text documents provided by the user are obtained, and then all the text knowledge is extracted and parsed from the documents through a text parsing tool, and the parsed text knowledge is loaded into the memory.
[0062] Step S20, chunk the text knowledge according to the model parameter threshold, and generate a knowledge base according to the obtained knowledge chunks, where the model parameter threshold is a dynamically adjustable threshold.
[0063] It can be understood that the text chunking technology has extensive applications in many fields such as information retrieval, question answering systems, and text analysis. Reasonable text chunking can improve the retrieval efficiency and accuracy. Especially when dealing with large-scale documents, it can effectively split long texts into smaller and logically coherent chunks, thus improving the effect of subsequent processing.
[0064] It should be understood that in this solution, the text knowledge obtained by the above parsing is chunked through the text chunking technology combined with the model parameter threshold, respectively forming multiple knowledge chunks, and the obtained knowledge chunks are vectorized and stored in the knowledge base. It should be noted that the model parameter threshold can be adaptively adjusted according to the size and density of the knowledge chunks, making the chunking method more flexible and adaptable, and capable of dynamically adjusting according to different texts and contexts, thereby improving the accuracy and effectiveness of chunking.
[0065] Step S30: Perform a similarity retrieval on the obtained user input question and the knowledge chunks in the knowledge base to obtain associated knowledge chunks.
[0066] It can be understood that the question input by the user is obtained through the front end and the question is vectorized. The vectorized question is subjected to a similarity retrieval with the vectorized knowledge chunks in the knowledge base to obtain associated knowledge chunks with a relatively high degree of association.
[0067] Step S40: Input the associated knowledge chunks and the user input question into a large language generation model to generate a question and answer result.
[0068] It should be understood that the associated knowledge chunks and the user's question are input into the large language generation model together, thereby generating an effective question and answer result.
[0069] This embodiment provides a user question and answer method. The knowledge text document obtained is parsed to obtain text knowledge; the text knowledge is chunked according to the model parameter threshold, and a knowledge base is generated based on the obtained knowledge chunks. The model parameter threshold is a dynamically adjustable threshold; the obtained user input question is subjected to a similarity retrieval with the knowledge chunks in the knowledge base to obtain associated knowledge chunks; the associated knowledge chunks and the user input question are input into a large language generation model to generate a question and answer result. This embodiment chunks the text knowledge according to a dynamically adjustable model parameter threshold, solves the drawbacks of the existing fixed parameter chunking strategy, makes the chunking method more flexible and adaptable, and can be dynamically adjusted according to different texts and contexts, thereby improving the accuracy and effectiveness of chunking. Then, a knowledge base for retrieval is generated based on the knowledge chunks obtained by chunking, and a question and answer result with higher accuracy is generated.
[0070] Based on the first embodiment of the present application, in the second embodiment of the present application, for the same or similar content as in the above-mentioned first embodiment, reference may be made to the above introduction and will not be elaborated hereinafter. On this basis, please refer to Figure 3 , step S20, the user Q&A method further includes steps S201 to S204:
[0071] Step S201, split the text knowledge to generate a set of sentences.
[0072] It can be understood that splitting a text knowledge into a set of sentences, denoted as (x1, x2,..., x n ), is used to group the set of sentences into knowledge chunks.
[0073] Step S202, generate an initial knowledge group according to the first sentence in the set of sentences, and use the next sentence in the set of sentences as the current sentence.
[0074] It should be understood that first, an initial knowledge group is generated according to the first sentence in the set of sentences, and then the next sentence after the first sentence in the set of sentences is used as the current sentence for the following iterative steps.
[0075] Step S203, determine the probability value that the current sentence belongs to the initial knowledge group according to the conditional probability clustering and chunking method.
[0076] It can be understood that the conditional probability clustering and chunking method can be used to determine the probability value that the current sentence belongs to the initial knowledge group. The formula is as follows:
[0077] P(x new |G k ) = P(x new ∈G k |LLM(x new , G k ))
[0078] where G k represents the kth knowledge group, and LLM(x new , G k)It represents using the large model to input the knowledge group and the sentence, and outputting the probability value that the sentence belongs to the knowledge group. The large language model (LLM) is used to calculate the probability value that the new sentence belongs to a certain knowledge block. This method of conditional probability clustering and chunking can capture the semantic association between the sentence and the knowledge block more accurately. This method overcomes the limitation of the existing method that only relies on the surface text similarity and improves the semantic accuracy of chunking. This method adopts the method of conditional probability clustering and chunking, and uses the large language model to calculate the probability value that the new sentence belongs to a certain knowledge block, rather than simply relying on the traditional similarity measure. Thus, it improves the intelligence level of the chunking method and allows the system to determine the belonging of the sentence according to more complex semantic information, rather than just based on the surface text similarity.
[0079] Step S204, judging whether to add the current sentence to the initial knowledge group or generate a new knowledge group according to the current sentence based on the probability value and the model parameter threshold.
[0080] It can be understood that by comparing the probability value and the model parameter threshold θ k judging whether to add the current sentence to the initial knowledge group or take the current sentence alone as a new knowledge group.
[0081] In a feasible implementation manner, step S204 may include steps S2041 to S2044:
[0082] Step S2041, if the probability value is greater than or equal to the model parameter threshold, add the current sentence to the initial knowledge group.
[0083] Step S2042, if the probability value is less than the model parameter threshold, generate a new knowledge group according to the current sentence.
[0084] It should be noted that when P(x new |G k ) is greater than or equal to the model parameter threshold θ k then the sentence can be used as part of the initial knowledge block, otherwise it is taken alone as a knowledge block to generate a new knowledge block.
[0085] Step S2043, generate multiple knowledge blocks according to the initial knowledge group and the new knowledge group.
[0086] It can be understood that in the above steps, the sentence set is grouped to generate the initial knowledge group and the new knowledge group, generating multiple knowledge groups, and each knowledge group represents a knowledge block, that is, multiple knowledge blocks are obtained.
[0087] Step S2044: Iteratively use the next sentence of the current sentence as the current sentence, and execute the step of determining the probability value that the current sentence belongs to the initial knowledge group or the new knowledge group according to the conditional probability clustering and chunking method, until each sentence in the sentence set is judged, and multiple knowledge chunks are obtained.
[0088] It should be noted that iteratively use the next sentence of the current sentence in the sentence set as the current sentence, calculate the probability value that the current sentence belongs to the initial knowledge group and the probability value that the current sentence belongs to the new knowledge group respectively according to the conditional probability clustering and chunking method, and then compare the calculated probability values with the model parameter threshold, so as to determine whether to add the current sentence to the initial knowledge group, or add it to the new knowledge group, or use the current sentence as a separate knowledge group (that is, generate a third knowledge group) until the current sentence is the last sentence, and after judging the probability value of the last sentence and adding it to the corresponding knowledge chunk, the iterative process is terminated.
[0089] In this embodiment, by judging the probability value and the model parameter threshold at that time, it is decided whether to add the sentence to the current knowledge chunk or generate a separate knowledge chunk for the sentence, so as to improve the relevance between sentences in each knowledge chunk. By iteratively executing, each sentence in the sentence set can be added to the most relevant knowledge chunk.
[0090] In another feasible embodiment, after step S2044, steps S205 - S206 may further be included:
[0091] Step S205: Determine the similarity distribution and semantic features between each sentence in the initial knowledge group.
[0092] Step S206: Adjust the model parameter threshold according to the similarity distribution and the semantic features through a preset threshold conversion function.
[0093] It is worth noting that in order to avoid being fixed, the model parameter threshold can be set as a model parameter that can be trained and optimized, and the threshold is dynamically adjusted according to the size and similarity density of the knowledge chunk. For example, for a larger knowledge chunk, the threshold can be increased to avoid excessive expansion; for a smaller knowledge chunk, the threshold can be decreased to promote knowledge aggregation.
[0094] It should be noted that for each knowledge chunk G k , calculate the similarity distribution S k and semantic features M k within it. Set a threshold conversion function A k , and an initial threshold θ0, and adjust the model parameter threshold according to the following formula:
[0095] θ k = A k (S k , θ0, M k )。
[0096] In this embodiment, to avoid the model parameter threshold from being fixed, the threshold is set as a model parameter that can be trained and optimized, and the threshold is dynamically adjusted according to the size and similarity density of the knowledge chunks. For larger knowledge chunks, the threshold can be increased to avoid excessive expansion; for smaller knowledge chunks, the threshold can be decreased to promote knowledge aggregation.
[0097] In this embodiment, it is disclosed that text knowledge is split to generate a sentence set; an initial knowledge group is generated according to the first sentence in the sentence set, and the next sentence in the sentence set is used as the current sentence; the probability value that the current sentence belongs to the initial knowledge group is determined according to the conditional probability clustering and chunking method; it is judged whether to add the current sentence to the initial knowledge group or generate a new knowledge group according to the probability value and the model parameter threshold. In this embodiment, the probability value that each sentence belongs to each knowledge group is calculated by the conditional probability clustering and chunking method, and by comparing the size of the probability value with the model parameter threshold, it is judged whether to add the sentence to the current knowledge group, so that the sentence set can be more reasonably divided into multiple knowledge groups, and then knowledge chunks are generated, improving the accuracy and effectiveness of chunking.
[0098] Based on the first embodiment of this application, in the third embodiment of this application, for the same or similar content as in the above-mentioned embodiment one, reference can be made to the above introduction and will not be repeated hereinafter. On this basis, please refer to Figure 4 , after step S2044, the user question-answering method further includes steps A10 to A60:
[0099] Step A10, determining the first similarity between each sentence in each knowledge chunk among multiple knowledge chunks and other knowledge chunks among the multiple knowledge chunks.
[0100] It can be understood that, in order to make the knowledge chunks have a certain orthogonality, each sentence can only choose one knowledge chunk to join. Ensure that each sentence belongs to only one most relevant knowledge chunk, while maximizing the independence between knowledge chunks. For each knowledge chunk G k among multiple knowledge chunks, calculate each sentence x k in the knowledge chunk G i and the first similarity sim(x k , G j ) between other knowledge chunks G i among the multiple knowledge chunks except the knowledge chunk G j .
[0101] Step A20: Determine the independence measure of each knowledge block according to the number of sentences in each knowledge block and the first similarity.
[0102] It should be noted that for each knowledge block G among multiple knowledge blocks k , define an independence measure I k , and the independence measure can be formalized as:
[0103]
[0104] where |G k | is the number of sentences in each knowledge block G k , and sim(x i , G j ) is the similarity between sentence x i and other knowledge blocks G j .
[0105] Step A30: Determine the second similarity between the current sentence and each knowledge block.
[0106] It can be understood that the second similarity sim(x new , G k ) between the current sentence x new and each knowledge block G k can also be calculated.
[0107] In a feasible implementation manner, after step A20, steps A201 to A202 may be included:
[0108] Step A201: Determine multiple target knowledge blocks among the multiple knowledge blocks where the difference between the first similarities is less than a difference threshold.
[0109] It should be understood that if the first similarities between the current sentence x new and multiple knowledge blocks are all very high, that is, there are multiple target knowledge blocks G j such that sim(x new , G j ) is close (that is, the difference between multiple similarities is less than the difference threshold, and the difference threshold can be set to 0.1 or 0.2, etc. according to the actual situation).
[0110] Step A202: Orthogonally adjust the independence measure of the multiple target knowledge blocks according to an adjustment factor.
[0111] It can be understood that the independence measure I j of multiple target knowledge blocks can be orthogonally adjusted by introducing an adjustment factor to promote orthogonality:
[0112] I j = Ij -α×sim(x new ,G j ),
[0113] Among them, α is an adjustment factor used to control the influence of similarity on the independence measure.
[0114] In this embodiment, multiple knowledge blocks with high similarity are adjusted by adding adjustment factors to control the influence of similarity on the independence measure, thereby promoting the orthogonality between knowledge blocks. By ensuring the orthogonality between knowledge blocks, overlap and confusion between knowledge blocks are avoided, thereby improving the purity and usability of knowledge blocks.
[0115] Step A40, determining the contribution of the current sentence to each knowledge block according to the independence metric and the second similarity.
[0116] It is understandable that for the current sentence x new , calculate its for each knowledge block G k Contribution G k (x new ), which can be based on x new With G k The second similarity sim(x new ,G k ), and G k Independence measure I k Calculate: C k (x new ) = sim(x new ,G k )×I k .
[0117] Step A50: taking the knowledge block with the greatest contribution among the multiple knowledge blocks as the most relevant knowledge block.
[0118] It should be understood that the knowledge block most relevant to the current sentence can be selected based on the contribution. k (x new ) Select x new The most relevant knowledge block G with the highest contribution k* , the knowledge block with the greatest contribution among multiple knowledge blocks is taken as the most relevant knowledge block: k * = argmax k C k (x new ).
[0119] Step A60, adding the current sentence to the most relevant knowledge block.
[0120] It should be understood that the current sentence xnew Add to the most relevant knowledge chunk G k* . When the new sentence x new is added to the most relevant knowledge chunk G k* update G k* 's independence measure I k* :
[0121]
[0122] It can be understood that for each newly added sentence, the above process is repeated until all sentences are assigned to the most appropriate knowledge chunks and the independence between the knowledge chunks reaches the optimum. After the execution of the above optimized data chunking method is completed, each knowledge chunk is vectorized and stored in the knowledge base, which can be used as the retrieval basis for the second stage. Through the iterative optimization process, the independence measure of the knowledge chunks is continuously updated, and the attribution of the new sentences is adjusted until the optimum knowledge chunk independence is achieved. This iterative optimization mechanism can continuously improve the quality of the knowledge chunks and ensure that the newly added sentences can be optimally assigned to each knowledge chunk.
[0123] In this embodiment, in order to make the knowledge chunks have a certain orthogonality, each sentence can only choose one knowledge chunk to add. Therefore, the similarity between the sentence and the knowledge chunk is considered, and the concepts of independence measure and contribution degree are also introduced to ensure that each sentence belongs to only one most relevant knowledge chunk, so as to ensure that each sentence belongs to only one most relevant knowledge chunk while maximizing the independence between the knowledge chunks.
[0124] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the user Q&A method of this application. Based on this technical concept, more forms of simple transformation are within the protection scope of this application.
[0125] This application also provides a user Q&A device. Please refer to Figure 5 , the user Q&A device includes:
[0126] A text parsing module 10 for parsing the obtained knowledge text document to obtain text knowledge;
[0127] A text chunking module 20 for chunking the text knowledge according to the model parameter threshold and generating a knowledge base based on the obtained knowledge chunks, where the model parameter threshold is a dynamically adjustable threshold;
[0128] A knowledge chunk retrieval module 30 for performing a similarity retrieval on the user input question obtained and the knowledge chunks in the knowledge base to obtain associated knowledge chunks;
[0129] The result generation module 40 is configured to input the associated knowledge block and the user input question into a large language generation model to generate a Q&A result.
[0130] The user Q&A device provided by the present application adopts the user Q&A method in the above embodiment and can solve technical problems. Compared with the prior art, the beneficial effects of the user Q&A device provided by the present application are the same as those of the user Q&A method provided by the above embodiment, and other technical features in the user Q&A device are the same as the features disclosed in the above embodiment method, which will not be elaborated here.
[0131] The present application provides a user Q&A device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the user Q&A method in the first embodiment above.
[0132] Next, refer to Figure 6 , which shows a schematic structural diagram of a user Q&A device suitable for implementing the embodiments of the present application. The user Q&A device in the embodiments of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The user Q&A device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0133] As Figure 6As shown, the user Q&A device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1002 or the program loaded from the storage device 1003 into the random access memory 1004. In the random access memory 1004, various programs and data required for the operation of the user Q&A device are also stored. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are connected to each other through a bus 1005. The input / output interface 1006 is also connected to the bus. Generally, the following systems can be connected to the input / output interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the user Q&A device to communicate with other devices wirelessly or wiredly to exchange data. Although the figure shows a user Q&A device having various systems, it should be understood that it is not required to implement or have all the shown systems. Instead, more or fewer systems can be implemented or had.
[0134] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device, or installed from the storage device 1003, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the methods of the embodiments disclosed in the present application are executed.
[0135] The user Q&A device provided by the present application adopts the user Q&A method in the above embodiments and can solve the technical problems of user Q&A. Compared with the prior art, the beneficial effects of the user Q&A device provided by the present application are the same as those of the user Q&A method provided by the above embodiments, and other technical features in the user Q&A device are the same as the features disclosed in the method of the previous embodiment, and will not be elaborated here.
[0136] It should be understood that the various parts disclosed in the present application can be implemented by hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in a suitable manner in any one or more embodiments or examples.
[0137] As described above, it is only the specific implementation manner of the present application. However, the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims described above.
[0138] The present application provides a computer-readable storage medium having computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the user Q&A method in the above embodiments.
[0139] The computer-readable storage medium provided by the present application can be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, device, or device. The program code contained on the computer-readable storage medium can be transmitted by any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0140] The above computer-readable storage medium can be included in the user Q&A device; or it can exist separately without being assembled into the user Q&A device.
[0141] The above computer-readable storage medium carries one or more programs. When the one or more programs are executed by the user Q&A device, the user Q&A device is caused to: parse the obtained knowledge text document to obtain text knowledge; block the text knowledge according to the model parameter threshold, and generate a knowledge base according to the obtained knowledge blocks, where the model parameter threshold is a dynamically adjustable threshold; perform a similarity search on the obtained user input question and the knowledge blocks in the knowledge base to obtain associated knowledge blocks; input the associated knowledge blocks and the user input question into a large language generation model to generate an answer result.
[0142] Computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The above-mentioned programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, by connecting through the Internet using an Internet service provider).
[0143] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and this module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutively represented blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0144] The modules described in the embodiments of this application can be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation to the unit itself in some cases.
[0145] The readable storage medium provided by this application is a computer-readable storage medium. The computer-readable storage medium stores computer-readable program instructions (i.e., computer programs) for performing the above user question-and-answer method and can solve technical problems. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by this application are the same as those of the user question-and-answer method provided in the above embodiments and will not be elaborated here.
[0146] The present application also provides a computer program product, including a computer program which, when executed by a processor, implements the steps of the user question-answering method as described above.
[0147] The computer program product provided by the present application can solve technical problems. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as those of the user question-answering method provided in the above embodiments, and will not be elaborated herein.
[0148] The foregoing are only partial embodiments of the present application, and thus do not limit the patent scope of the present application. Any equivalent structural transformation made by using the content of the specification and drawings of the present application under the technical concept of the present application, or any direct / indirect application in other related technical fields shall be included within the patent protection scope of the present application.
Claims
1. A user Q&A method, characterized in that, The method described above includes: Parsing the obtained knowledge text document to obtain text knowledge; Chunking the text knowledge according to the model parameter threshold, and generating a knowledge base based on the obtained knowledge chunks, where the model parameter threshold is a dynamically adjustable threshold; Performing a similarity search on the obtained user input question and the knowledge chunks in the knowledge base to obtain associated knowledge chunks; Inputting the associated knowledge chunks and the user input question into a large language generation model to generate an answer result.
2. The method according to claim 1, characterized in that, The step of chunking the text knowledge according to the model parameter threshold includes: Splitting the text knowledge to generate a set of sentences; Generating an initial knowledge group based on the first sentence in the set of sentences, and taking the next sentence in the set of sentences as the current sentence; Determining the probability value that the current sentence belongs to the initial knowledge group according to the conditional probability clustering chunking method; Judging whether to add the current sentence to the initial knowledge group or generate a new knowledge group according to the probability value and the model parameter threshold.
3. The method according to claim 2, wherein The step of judging whether to add the current sentence to the initial knowledge group or generate a new knowledge group according to the probability value and the model parameter threshold includes: If the probability value is greater than or equal to the model parameter threshold, adding the current sentence to the initial knowledge group; If the probability value is less than the model parameter threshold, generating a new knowledge group according to the current sentence; Generating multiple knowledge chunks based on the initial knowledge group and the new knowledge group; Iteratively taking the next sentence of the current sentence as the current sentence, and performing the step of determining the probability value that the current sentence belongs to the initial knowledge group or the new knowledge group according to the conditional probability clustering chunking method until each sentence in the set of sentences has been judged, obtaining multiple knowledge chunks.
4. The method according to claim 3, wherein After the step of iteratively taking the next sentence of the current sentence as the current sentence and performing the step of determining the probability value that the current sentence belongs to the initial knowledge group or the new knowledge group according to the conditional probability clustering chunking method, it further includes: Determining the similarity distribution and semantic features among each sentence in the initial knowledge group; Adjusting the model parameter threshold according to the similarity distribution and the semantic features through a preset threshold conversion function.
5. The method according to claim 3, wherein After the step of iteratively taking the next sentence of the current sentence as the current sentence and performing the step of determining the probability value that the current sentence belongs to the initial knowledge group or the new knowledge group according to the conditional probability clustering chunking method, it further includes: Determining the first similarity between each sentence in each knowledge chunk among the multiple knowledge chunks and the other knowledge chunks among the multiple knowledge chunks; Determining the independence measure of each knowledge chunk according to the number of sentences in each knowledge chunk and the first similarity; Determining the second similarity between the current sentence and each knowledge chunk; Determining the contribution degree of the current sentence to each knowledge chunk according to the independence measure and the second similarity; Taking the knowledge chunk with the largest contribution degree among the multiple knowledge chunks as the most relevant knowledge chunk; Add the current sentence to the most relevant knowledge chunk.
6. The method according to claim 5, characterized in that, After the step of determining the independence measure of each knowledge chunk according to the number of sentences in each knowledge chunk and the first similarity, the method further includes: Determine a plurality of target knowledge chunks in the plurality of knowledge chunks where the difference between the first similarities is less than a difference threshold; Orthogonally adjust the independence measures of the plurality of target knowledge chunks according to an adjustment factor.
7. A user Q&A device, characterized in that, The user question-and-answer device includes: A text parsing module, configured to parse the obtained knowledge text document to obtain text knowledge; A text chunking module, configured to chunk the text knowledge according to a model parameter threshold and generate a knowledge base based on the obtained knowledge chunks, where the model parameter threshold is a dynamically adjustable threshold; A knowledge chunk retrieval module, configured to perform a similarity retrieval on the user input question obtained and the knowledge chunks in the knowledge base to obtain associated knowledge chunks; A result generation module, configured to input the associated knowledge chunks and the user input question into a large language generation model to generate a question-and-answer result.
8. A user Q&A device, characterized in that, The device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, where the computer program is configured to implement the steps of the user question-and-answer method according to any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium, where the computer program, when executed by a processor, implements the steps of the user question-and-answer method according to any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program, where the computer program, when executed by a processor, implements the steps of the user question-and-answer method according to any one of claims 1 to 6.
Citation Information
Cited By
Knowledge base block value evaluation method and device
CN121167176A