Knowledge processing method and device, equipment, storage medium and product
By selecting multiple knowledge bases across various industries and basing the results on the overall score of the knowledge bases and the query order, the problem of low knowledge query efficiency was solved, achieving efficient and accurate knowledge query and large-scale model question answering.
Patent Information
- Application Number
- CN202510838384.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-12-16
AI Technical Summary
The low efficiency of knowledge retrieval in existing technologies limits the application of large models and makes it impossible to quickly obtain knowledge texts related to user needs.
By selecting multiple knowledge bases across multiple industries, and based on the overall score of the knowledge bases and the query order, N target knowledge bases are selected for querying, reducing the number of queries and improving query efficiency. A large model is then used to generate question-and-answer results.
It enables efficient and accurate knowledge retrieval, reduces retrieval costs, and improves the quality and efficiency of question answering in large models.
Smart Images

Figure CN121144444A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computers, and in particular, to a knowledge processing method and device, equipment, storage medium and product. BACKGROUND
[0002] At present, the deep integration of large model technology and traditional industries such as transportation, medical treatment and industry has become a new round of development boom of artificial intelligence technology. When a large model is applied, a training and reasoning method is generally used, specifically, the large model can be trained using public training data, and the large model obtained by training is deployed in different industries.
[0003] Before using the large model, knowledge text related to user demand needs to be queried, and the queried knowledge text is summarized to the large model, and the large model generates a corresponding question and answer result.
[0004] However, the current knowledge query efficiency is low, and the time to obtain the knowledge text is long, which limits the application of the large model. SUMMARY
[0005] The present disclosure provides a knowledge processing method, device, equipment, storage medium and product. By selecting a knowledge base for query, the query cost is reduced, the query efficiency is improved, and high-quality intelligent question and answer is realized.
[0006] According to a first aspect of the present disclosure, a knowledge processing method is provided, comprising:
[0007] receiving a knowledge question and answer request sent by a user end, the knowledge question and answer request comprising query content;
[0008] obtaining a plurality of knowledge bases of a plurality of industries, the knowledge base comprising a plurality of text vectors of a plurality of text blocks;
[0009] selecting N target knowledge bases according to overall scores corresponding to the plurality of knowledge bases, N being an integer greater than or equal to 1, the N target knowledge bases being respectively provided with a query order;
[0010] querying target text vectors matching the query content from the N target knowledge bases in turn according to the respective query orders of the N target knowledge bases;
[0011] inputting the target text vectors and the query content into a large model obtained by training to obtain a question and answer result output by the large model.
[0012] According to another aspect of the present disclosure, a knowledge processing device is provided, comprising:
[0013] a request receiving unit configured to receive a knowledge question and answer request sent by a user end, the knowledge question and answer request comprising query content;
[0014] a first obtaining unit configured to obtain a plurality of knowledge bases of a plurality of industries, the knowledge bases comprising a plurality of text vectors of a plurality of text blocks;
[0015] a query path unit configured to select N target knowledge bases according to overall scores respectively corresponding to the plurality of knowledge bases, N being an integer greater than or equal to 1, a query order of the N target knowledge bases being known;
[0016] a text query unit configured to query target text vectors matching the query content from the N target knowledge bases according to the query order respectively corresponding to the N target knowledge bases;
[0017] a question and answer generation unit configured to input a text block corresponding to the target text vector and the query content into a large model trained to obtain a question and answer result output by the large model.
[0018] According to yet another aspect of the present disclosure, there is provided a computing device comprising a memory, a processor, and a computer program stored on the memory, the processor executing the computer program to implement the steps of any of the knowledge processing methods.
[0019] According to yet another aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program, the computer program being executed by a processor to implement the steps of any of the knowledge processing methods.
[0020] According to yet another aspect of the present disclosure, there is provided a computer program product comprising computer programs / instructions, the computer programs being executed by a processor to implement the steps of any of the knowledge processing methods.
[0021] As will be described in detail below, according to the technical solutions of embodiments of the present disclosure, after the server receives the knowledge question and answer request sent by the user end, the server can first obtain a plurality of knowledge bases of a plurality of industries that have been registered to obtain more abundant knowledge bases. Then, according to overall scores respectively corresponding to the plurality of knowledge bases, the server can select N target knowledge bases, and query the N target knowledge bases according to the query order respectively corresponding to the N target knowledge bases, thereby reducing the number of knowledge bases queried, reducing the query cost, and improving the query efficiency. In addition, the selected target knowledge bases have higher query effects than the knowledge bases that are not selected, and the target text vectors are queried from the target knowledge bases, thereby improving the text query accuracy. After the text block corresponding to the target text vector and the query content are input into the large model trained, the question and answer result output by the large model is obtained, and high-quality intelligent question and answer is realized.
[0022] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the subject technology claimed. BRIEF DESCRIPTION OF DRAWINGS
[0023] The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which:
[0024] Figure 1 is a structural schematic diagram illustrating an application of a knowledge processing system according to an embodiment of the present disclosure;
[0025] Figure 2 is a flowchart illustrating a knowledge processing method according to an embodiment of the present disclosure;
[0026] Figure 3 is an application example diagram illustrating a knowledge question and answer page according to an embodiment of the present disclosure;
[0027] Figure 4 is a flowchart illustrating yet another knowledge processing method according to an embodiment of the present disclosure;
[0028] Figure 5 is a flowchart further illustrating yet another knowledge processing method according to an embodiment of the present disclosure;
[0029] Figure 6 is an example diagram further illustrating a dataset of a knowledge base according to an embodiment of the present disclosure;
[0030] Figure 7 is a block diagram illustrating a knowledge processing apparatus according to an embodiment of the present disclosure;
[0031] Figure 8 is a hardware block diagram of a computing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] In order to make the objects, technical solutions and advantages of the present disclosure more apparent, the following will describe example embodiments according to the present disclosure in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited by the example embodiments described herein.
[0033] The embodiment of the present disclosure provides a knowledge processing method, device, equipment, medium and product. When a knowledge text is queried, a plurality of industries and a plurality of knowledge bases are used to obtain more abundant knowledge bases. However, when there are more knowledge bases, a higher query cost is required. In order to improve the query efficiency of the knowledge base, N target knowledge bases can be selected according to the overall scores of the plurality of knowledge bases, and the N target knowledge bases are queried in a respective query order, so as to reduce the query cost and improve the query efficiency.
[0034] The technical solutions of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0035] The following Figure 1 A structural schematic diagram of a knowledge processing system provided by the embodiment of the present disclosure is provided. The knowledge processing system may, for example, include a user terminal 10 and a server 20.
[0036] The user terminal 10 can detect an input operation performed by a user, obtain a knowledge question and answer request, and send the knowledge question and answer request to the server 20. The server 20 can receive the knowledge question and answer request sent by the user terminal.
[0037] The server 20 can be configured with the knowledge processing method provided by the embodiment of the present disclosure to execute the knowledge processing method provided by the embodiment of the present disclosure after receiving the knowledge question and answer request sent by the user terminal.
[0038] The server 20 can refer to a server or a server cluster. The server may, for example, be a cloud server.
[0039] The server 20 can include a plurality of knowledge bases 20a, and each knowledge base can include a plurality of text vectors of a plurality of text blocks. The server 20 can also select N target knowledge bases 20b according to the overall scores of the plurality of knowledge bases, N being an integer greater than or equal to 1, and the query order of the N target knowledge bases being known. Then, the target text vectors 20c matching the query content are sequentially queried from the N target knowledge bases according to the respective query order of the N target knowledge bases. Then, the text block corresponding to the target text vector 20c and the query content are input into a large model 20d obtained by training to obtain a question and answer result 20e output by the large model.
[0040] It can be understood that the service end 20 can include a plurality of computing nodes, and the computing nodes can be used to store the related information of the knowledge base, so as to initiate a query command to the knowledge base through the related information of the knowledge base, and obtain the target text vector from the knowledge base through the query command. In addition, the service end 20 can also include a center node, and the center node can be used to receive the registration of the knowledge base, and after the registration is verified, it is determined that the knowledge base stored in different computing nodes can be used. In addition, the center node can also configure the knowledge processing device provided by the embodiment of the application to execute the knowledge processing method.
[0041] Figure 2 A flowchart of a knowledge processing method provided by the embodiment of the application can include the following steps:
[0042] S201, receiving a knowledge question and answer request sent by a user end, the knowledge question and answer request including query content.
[0043] Optionally, the user end can display a knowledge question and answer interface, and the knowledge question and answer interface can include an input box. The user end can detect a trigger operation performed by the user on the input box to obtain query content corresponding to the trigger operation, so as to generate a knowledge question and answer request according to the query content.
[0044] Optionally, the query content can be a question input by the user and requiring an answer or content to be queried by the user. The query content can be, for example, query text, images, formulas, documents in various formats, etc. The specific type of the query content is not limited in the embodiment.
[0045] S202, determining a plurality of knowledge bases of a plurality of industries, and the knowledge base including a plurality of text vectors of a plurality of text blocks.
[0046] Optionally, the service end can receive a registration request sent by a management party of the knowledge base, and the registration request carrying registration information. The registration information can include, for example, knowledge base information such as version, name, description content, knowledge field to which the knowledge base belongs, and function. The registration information can also include verification information of the management party, which can be used for verification of registration identity or registration authority.
[0047] After the service end detects the registration request of the registration party, the verification information in the registration request can be obtained, and the verification information is used to perform registration verification on the registration party. After the verification is successful, the knowledge base information in the registration information can be stored in the corresponding computing node.
[0048] Optionally, the knowledge base can be stored in the node corresponding to the knowledge base management party, so as to avoid excessive diffusion of the knowledge base and improve the storage security of the knowledge base.
[0049] It can also be understood that the plurality of text vectors of the plurality of text blocks contained in the knowledge base can be extracted by the terminal of the manager of the knowledge base, or can be extracted by the server. The extraction mode of the text vector is not limited in the embodiment of the application.
[0050] Optionally, the text vector can refer to a vector obtained by extracting the features of the text block through an embedding model. Specifically, the text block can be input into the embedding model, and the vector output by the embedding model is the text vector corresponding to the text block.
[0051] The text chunk refers to the segmentation of text into smaller, fixed-length continuous paragraphs or units for efficient processing of text. That is, the text chunk is a subsequence obtained by block processing of the original text, which can be composed of multiple text characters / tokens.
[0052] For example, the original text can be split into a length that can be accommodated by the embedding model, such as setting the size of the text chunk to 512 tokens / chunk.
[0053] Each text chunk can correspond to one or more text vectors. Specifically, each text chunk can be further split to obtain a plurality of sub-text chunks, so as to extract the text vector of each sub-text chunk through the embedding model, thereby establishing the association between the text chunk and the text vector corresponding to each sub-text chunk.
[0054] In the application scenario of large models, many industries such as communication, finance, e-commerce, virtual companionship, office, marketing, etc. will be involved. The number and type of industries involved in the knowledge base are not limited in the embodiment of the application. Any manager of any industry can register a knowledge base to realize data sharing.
[0055] Of course, in order to facilitate the management of the knowledge base, an information list of the knowledge base can be established, such as the information list can summarize the registration information corresponding to a plurality of knowledge bases respectively, so as to facilitate the query and use of the knowledge base.
[0056] S203, according to the overall score corresponding to the plurality of knowledge bases respectively, selecting N target knowledge bases, N is an integer greater than or equal to 1, and the N target knowledge bases are respectively set with a query order.
[0057] Optionally, the overall score of the knowledge base can refer to the score corresponding to the query effect of the knowledge base.
[0058] According to the overall scores corresponding to the plurality of knowledge bases respectively, selecting the N target knowledge bases can include: sorting the overall scores corresponding to the plurality of knowledge bases respectively to obtain a plurality of query orders corresponding to the plurality of knowledge bases respectively, and selecting the first N target knowledge bases with the highest overall scores according to the plurality of query orders corresponding to the plurality of knowledge bases respectively. The target knowledge base can refer to a knowledge base participating in the text query.
[0059] Optionally, before S203, the method can further include: obtaining the overall scores corresponding to the plurality of knowledge bases respectively. Specifically, the association degrees of the knowledge bases with the query content can be determined, and the overall scores corresponding to the plurality of knowledge bases respectively can be determined according to the association degrees of the knowledge bases with the query content.
[0060] S204, querying the target text vectors matching the query content from the N target knowledge bases in turn according to the query orders of the N target knowledge bases respectively.
[0061] Optionally, S204 can include: converting the query content into a query vector by using an embedding model, and querying the target text vectors matching the query vector from the N target knowledge bases in turn according to the query orders of the N target knowledge bases respectively.
[0062] Specifically, one or more target text vectors matching the query vector can be selected from the plurality of text vectors of each target knowledge base, and the one or more target text vectors selected from each target knowledge base are determined as the target text vectors matching the query vector.
[0063] Specifically, one or more target text vectors matching the query vector can be selected from the plurality of text vectors of each target knowledge base, and the one or more target text vectors selected from each target knowledge base are determined as the target text vectors matching the query vector.
[0064] Optionally, querying the target text vectors matching the query content from the target knowledge bases can include: sending a query command to the nodes corresponding to the target knowledge bases, the query command can include the query content, and the nodes can receive the query command and query the candidate text vectors matching the query content. The computing device receives the candidate text vectors sent by the nodes storing the target knowledge bases. Then, the computing device can further select the N target text vectors with the highest similarity according to the similarity of the candidate text vectors with the query content.
[0065] S205, inputting the target text vector and the query content into the large model trained to obtain the question and answer result output by the large model.
[0066] Optionally, the large model can refer to an artificial intelligence model with a large parameter scale (such as containing a parameter scale of tens of billions or hundreds of billions) trained by a large amount of training data. The specific training process of the large model in the embodiments of the present application is not paid too much attention, and can be referred to the related technical content, which will not be repeated here.
[0067] Optionally, inputting the target text vector and the query content into the trained large model can specifically refer to inputting the text block corresponding to the target text vector and the query content into the trained large model, or inputting the query vector corresponding to the target text vector and the query content into the trained large model.
[0068] Specifically, the text block corresponding to the target text vector and the query content can be spliced to obtain a prompt word, and the prompt word is input into the trained large model to obtain the question and answer result output by the large model.
[0069] The question and answer result output by the large model can refer to the content obtained after the large model processes the input target text vector and query content.
[0070] In the embodiments of the present application, after receiving the knowledge question and answer request sent by the user end, a plurality of registered industry knowledge bases can be obtained to obtain more rich knowledge bases. Then, according to the overall scores of the plurality of knowledge bases respectively corresponding, N target knowledge bases can be selected, and the query order of each of the N target knowledge bases is queried, so as to reduce the number of knowledge base queries, reduce the query cost, and improve the query efficiency. In addition, the selected target knowledge base has higher query effect compared with the knowledge base that is not selected, and the target text vector is queried from the target knowledge base, which improves the text query accuracy. After inputting the text block corresponding to the target text vector and the query content into the trained large model, the question and answer result output by the large model is obtained, and high-quality intelligent question and answer is realized.
[0071] In order to facilitate understanding of the embodiments of the present application, as Figure 3As shown, an application example diagram of a knowledge Q&A page provided by the embodiment of the present application is shown. The knowledge Q&A page 300 can include an input box 301, and a text display area 302 can be arranged above the input box 301. The user end can detect an input operation performed by the user on the input box 301 of the knowledge Q&A page 300 to obtain query content corresponding to the input operation. For example, the user can input the query content "Please analyze the current economic situation" in the input box 301. Then, the user end can generate a knowledge Q&A request based on the query content and send the knowledge Q&A request to the server 303. The server 303 can perform the knowledge processing method of the embodiment of the present application on the knowledge Q&A request, for example, obtain two target knowledge bases, i.e., a financial knowledge base and an economic knowledge base 304. It is assumed that the query order of the economic knowledge base is higher than that of the financial knowledge base. The server 303 can first query a target text vector from the economic knowledge base and then from the financial knowledge base. Then, the target text vector and the query content are input into a large model obtained by training to obtain a Q&A result output by the large model. Then, the server 303 can send the Q&A result to the user end. The user end can display the Q&A result in the text display area 302. For example, the Q&A result can be "The current economic situation is as follows: …". The text display area 302 can display the query content and the Q&A result in the form of a dialogue.
[0072] As shown in Figure 4 Another flowchart of a knowledge processing method provided by the embodiment of the present application is shown, which is different from the embodiment shown in Figure 2 The difference between the embodiment shown in
[0073] S401, according to the ranking model, the overall score corresponding to each of the plurality of knowledge bases is scored and optimized to obtain a ranking score corresponding to each of the plurality of knowledge bases.
[0074] The ranking model is a probability model for data comparison or data ranking, for example, a Plackett-Luce model.
[0075] S402, the ranking scores corresponding to each of the plurality of knowledge bases are sorted from high to low to obtain a query order corresponding to each of the plurality of knowledge bases.
[0076] S403, according to the query order corresponding to each of the plurality of knowledge bases, the top N target knowledge bases with the highest ranking are selected from the knowledge bases, and the query order of each target knowledge base is obtained.
[0077] In the embodiments of the present application, the overall score is first converted into a ranking score to make the selection of different knowledge bases fair, and thus the multiple knowledge bases are ranked from high to low according to the ranking scores corresponding to the multiple knowledge bases respectively, to obtain the query order corresponding to the multiple knowledge bases respectively, so that the ranking of each knowledge base is more accurate, the priority ranking problem in the multi-knowledge base scenario is solved, and the ranking efficiency and accuracy are improved.
[0078] Further, based on any of the above embodiments, S401, according to the ranking model, performing score optimization on the overall scores corresponding to the multiple knowledge bases respectively to obtain ranking scores corresponding to the multiple knowledge bases respectively, can include:
[0079] According to the ranking model, calculating the sampling probability of the overall score corresponding to each knowledge base;
[0080] According to the sampling probability of each knowledge base, determining the ranking score of each knowledge base.
[0081] Optionally, taking the Plackett-Luce model as an example of the ranking model, the sampling probability of each knowledge base can be predicted according to the overall score of each knowledge base and the preference parameter of each database.
[0082] Illustratively, according to the ranking model, calculating the sampling probability of the overall score corresponding to each knowledge base can include: determining the input data of the Plackett-Luce model, i.e., the overall scores corresponding to the multiple knowledge bases, inputting the overall scores corresponding to the multiple knowledge bases into the Plackett-Luce model as input data, and obtaining the sampling probability of each knowledge base output by the Plackett-Luce model.
[0083] Regarding the calculation steps of the Plackett-Luce model, the steps can specifically include:
[0084] In the case where the first to i-1th positions in the ranking have been selected, the i th position L i The formula for selecting the sampling probability of the knowledge base d is:
[0085]
[0086] wherein, denotes the set of all registered multiple knowledge bases. denotes that if the knowledge base d is not placed in the previous ranking, the value is 1, otherwise the value is 0. (That is, if the knowledge base d has been placed in any of the 1th to i-1th positions, the sampling probability of the knowledge base d is 0, otherwise it is non-zero). s represents the knowledge base overall score after min-max normalization processing, which can be represented using the following normalization formula:
[0087] wherein s d is the overall score of the knowledge base, max is the maximum overall score of the knowledge base, and min is the minimum overall score of the knowledge base.
[0088] α is used to control the degree of randomization, and a smaller α can reduce the weight of the ranking score of the knowledge base, thereby increasing the probability of selection of a lower score and strengthening the direct fairness of each knowledge base.
[0089] Optionally, according to the ranking model, calculating the sampling probability corresponding to the overall score of each of the plurality of knowledge bases can include: performing normalization calculation on the overall score of each knowledge base according to a normalization formula to obtain a normalized score of each knowledge base. According to the normalized score of each knowledge base, the i-th L i The formula for selecting the sampling probability of the knowledge base d is used to calculate the sampling probability of each knowledge base.
[0090] Optionally, determining the ranking score of each knowledge base according to the sampling probability of each knowledge base can include: taking the sampling probability of each knowledge base as the ranking score, or performing normalization processing on the sampling probability of each knowledge base to obtain the ranking score of each knowledge base, that is, the normalized calculation result of the sampling probability of each knowledge base is the ranking score of the knowledge base.
[0091] The normalization calculation method of the sampling probability of each knowledge base can refer to a related normalization calculation formula, such as a maximum-minimum normalization formula, a logarithmic normalization formula, etc., which is not limited in the present application.
[0092] In the embodiments of the present application, according to the ranking model, the overall score corresponding to each of the plurality of knowledge bases is converted into a sampling probability, and the ranking score is determined through the sampling probability of each knowledge base to perform ranking. In this process, the ranking model is used to convert the sampling probability, so that the probability of selection of each knowledge base is more accurate, and compared with directly using the overall score for ranking, it is more accurate and robust.
[0093] As Figure 5 shown, another flowchart of a knowledge processing method provided by the embodiments of the present application is different from other embodiments in that, before the step of selecting N target knowledge bases according to the overall score corresponding to each of the plurality of knowledge bases, the method further includes:
[0094] S501, obtaining the evaluation score corresponding to each of the at least one evaluation index of each knowledge base.
[0095] Optionally, the evaluation index can be an index used to evaluate the effect of the knowledge base participating in knowledge screening. For example, the relevance to the query content can be used as an evaluation index.
[0096] In order to meet the personalized needs of users on the evaluation process, a selection page of the evaluation index can be displayed, which can include a plurality of candidate indexes. Then, a selection operation of the user on the plurality of candidate indexes in the selection page is detected to obtain at least one evaluation index. The selected candidate index is the evaluation index. The setting flexibility of the evaluation index is improved.
[0097] Of course, the at least one evaluation index can be pre-set, thereby realizing unified management of the index and improving the management efficiency of the evaluation index.
[0098] S502, the evaluation scores of each knowledge base corresponding to the at least one evaluation index are weighted and summed to obtain the overall score of each knowledge base.
[0099] Optionally, S502 can include: obtaining the weight of the knowledge base corresponding to the at least one evaluation index, multiplying the weight of the knowledge base corresponding to the at least one evaluation index by the evaluation score, obtaining the weight score corresponding to the at least one evaluation index, and adding and summing the weight scores corresponding to the at least one evaluation index to obtain the overall score of the knowledge base.
[0100] Optionally, the sum of the weights corresponding to the at least one evaluation index is 1.
[0101] In which, the weight corresponding to the at least one evaluation index can be pre-set, for example, the user can configure or select the evaluation index, and increase the configuration operation of the weight of the evaluation index, to realize the acquisition of the weight of the evaluation index.
[0102] In addition, the weight corresponding to the at least one evaluation index can also be calculated according to the number of indexes of the at least one evaluation index, for example, the quotient of 1 and the number of indexes can be used as the weight of each evaluation index.
[0103] Alternatively, the weight corresponding to the at least one evaluation index can also be randomly set, as long as the sum of the weights corresponding to the at least one evaluation index is 1.
[0104] In the embodiments of the present application, when scoring each knowledge base, one or more evaluation indexes are used to obtain the evaluation scores of the knowledge base on each evaluation index, to realize multi-dimensional comprehensive evaluation and avoid inaccurate evaluation caused by too single evaluation index. Then, the evaluation scores of each evaluation index are weighted and summed to realize comprehensive acquisition of the overall score of the knowledge base and improve the accuracy of the knowledge base evaluation.
[0105] Optionally, the evaluation score corresponding to the at least one evaluation index includes at least one of the following:
[0106] The relevance score corresponding to the relevance of the knowledge base and the query content;
[0107] a performance score corresponding to a query performance of the knowledge base;
[0108] a network latency score corresponding to a network latency performance of the knowledge base;
[0109] a query cost score corresponding to a query cost of the knowledge base.
[0110] The relevance of the knowledge base to the query content can refer to the degree of association between the knowledge base and the query content. The higher the degree of association between the knowledge base and the query content, the higher the relevance score. For example, if the query content is in the field of communication, the knowledge base in the field of communication has higher relevance to the query content, while the knowledge base in the field of finance or education has lower relevance to the query content.
[0111] The query performance can refer to the speed, efficiency, accuracy, stability, etc. of the knowledge base query text vector. The higher the query performance, the higher the performance score, and vice versa.
[0112] The network latency performance can refer to the degree of network data transmission delay of the knowledge base, for example, it can refer to the time delay between the sending end and the receiving end. The delay can be physical delay (such as transmission distance directly affecting transmission time) or network delay (such as network topology, bandwidth, communication protocol and algorithm affecting network transmission time). In order to maintain the consistency of the score, the network latency performance can be inversely proportional to the network latency score, that is, the higher the network latency performance, the slower the data transmission efficiency, the smaller the network latency score, and vice versa.
[0113] The query cost of the knowledge base can refer to the resources consumed by the knowledge base in executing knowledge queries, such as computing resources, storage resources, time overhead, labor cost, etc. The query cost and the query cost score can be inversely proportional, that is, the higher the query cost, the smaller the query cost score, and vice versa.
[0114] It can be understood that the relevance and the relevance score are directly proportional, the performance and the performance score are directly proportional, the network latency performance and the network latency score are inversely proportional, and the query cost and the query score are inversely proportional. The evaluation index and the evaluation process of the knowledge base can be more detailed, and the evaluation accuracy of the knowledge base can be improved.
[0115] For example, it is assumed that the at least one evaluation index includes relevance of the knowledge base to the query content, query performance of the knowledge base, network delay performance of the knowledge base, and query cost of the knowledge base. In this case, the evaluation scores corresponding to the at least one evaluation index respectively include a relevance score corresponding to the relevance of the knowledge base to the query content, a performance score corresponding to the query performance of the knowledge base, a network delay score corresponding to the network delay performance of the knowledge base, and a query cost score corresponding to the query cost of the knowledge base.
[0116] Therefore, the weighted sum of the evaluation scores corresponding to the at least one evaluation index of each knowledge base respectively to obtain the overall score of each knowledge base can include that for any knowledge base, the relevance score, the performance score, the network delay score, and the query cost score of the knowledge base can be weighted and summed to obtain the overall score of the knowledge base.
[0117] In the embodiments of the present application, one or more of the query content, the query performance, the network delay performance, or the query cost is taken as an evaluation index to participate in the performance evaluation scene of the knowledge base, so as to maintain the accuracy of the knowledge base from a more detailed granularity and improve the evaluation accuracy of the knowledge base.
[0118] As described above, the evaluation score corresponding to the evaluation index can include a relevance score corresponding to the relevance of the knowledge base to the query content. The embodiments of the present application also provide a method for obtaining the relevance score, and therefore, on the basis of any of the above embodiments, the embodiments of the present application can further include:
[0119] A, obtaining the relevance scores between the plurality of knowledge bases and the query content respectively.
[0120] Optionally, step A can include calculating the relevance scores of the knowledge bases to the query content to obtain the relevance scores between the plurality of knowledge bases and the query content respectively.
[0121] The relevance score can be a score representing the relevance between the knowledge base and the query text.
[0122] In the embodiments of the present application, the relevance to the query content can be taken as an evaluation index of the knowledge base, so that the knowledge query is related to the user demand, more accurate knowledge related to the user demand is obtained, and the user experience is improved.
[0123] Specifically, step A can include:
[0124] A1, obtaining a plurality of representative data sets corresponding to the plurality of knowledge bases respectively, the representative data set including at least one representative vector.
[0125] It can be understood that the representative dataset of the knowledge base can refer to a set formed by text vectors representing the knowledge of the knowledge base, and the representative dataset can include one or more representative text vectors. The representative text vector can refer to a vector extracted from a representative text block representing the knowledge of the knowledge base.
[0126] To obtain the representative dataset of the knowledge base, a text block corresponding to the representative knowledge can be obtained from the knowledge base first, a representative text block is obtained, and then a text vector of the representative text block is extracted by an embedding model to obtain a representative text vector.
[0127] Specifically, the knowledge can be classified to determine whether the knowledge belongs to the representative knowledge. The classification of the representative classification is the knowledge belonging to the representative knowledge or not belonging to the representative knowledge. For example, a knowledge classification model can be trained to classify the knowledge. The training data of the knowledge classification model can be, for example, knowledge and a representative label. The specific training steps of the knowledge classification model can refer to the training steps of the machine learning model, which will not be described here.
[0128] A2, according to the representative dataset of the knowledge base, calculating the relevance score between the knowledge base and the query content, obtaining the relevance score between the plurality of knowledge bases and the query content.
[0129] Optionally, A2 can include: calculating the relevance score between the knowledge base and the query text according to at least one representative text vector in the representative dataset of the knowledge base.
[0130] Specifically, the relevance score between the representative dataset of the knowledge base and the query content can be calculated by a relevance algorithm.
[0131] The correlation algorithm or model can be a distance-based correlation algorithm, a set-based correlation algorithm, a statistical-based correlation algorithm, or a deep learning-based semantic correlation algorithm. For example, the distance-based correlation algorithm can be a cosine distance, Euclidean distance, or Manhattan distance-based correlation algorithm. The set-based correlation algorithm can be a Jaccard Similarity, Hamming Distance-based correlation algorithm. The statistical-based correlation algorithm can be a Pearson Correlation Coefficient, Spearman Rank Correlation, Covariance, or the like. The deep learning-based semantic correlation algorithm can be a semantic similarity calculation-based correlation algorithm. The specific type of correlation algorithm is not limited in the embodiments of the present application.
[0132] In the embodiments of the present application, the representative dataset of the knowledge base is used to calculate the correlation score between the knowledge base and the query content, to obtain the correlation scores between the plurality of knowledge bases and the query content. Through the design of the representative dataset, the correlation calculation between the knowledge base and the query content can be more convenient and fast.
[0133] Optionally, the representative dataset includes a seed dataset and a short-term memory set. The seed dataset includes at least one first text vector, and the short-term memory set includes at least one second text vector. The first text vector is a text vector representing the overall content tendency of the knowledge base, and the second text vector is a text vector representing the knowledge related to the user query history record.
[0134] The seed dataset can be a dataset formed by static and core knowledge in the knowledge base. The knowledge in the seed dataset can be standard knowledge that is long-term effective and verified in the field. For example, the knowledge in the seed dataset can be expert-annotated or input knowledge, such as legal provisions, product manuals, operation guides, and drug instructions.
[0135] The short-term memory set can be a dataset formed by interactive knowledge that is recently obtained and dynamically updated in the knowledge base. The knowledge in the short-term memory set can be temporary knowledge that is recently updated. For example, the knowledge in the short-term memory set can be user behavior data, temporary data, or intermediate results of system operation, such as browsing records and user question and answer interaction data.
[0136] In a possible design, to obtain the seed data set and the short-term memory set, a plurality of representative text vectors can be first screened from the knowledge base, and then the representative text vectors are classified according to preset knowledge attributes, the preset knowledge attributes can include a seed attribute and a short-term memory attribute, at least one representative text vector corresponding to each knowledge attribute is obtained, and then at least one representative text vector of each knowledge attribute is determined as a corresponding data set. That is, at least one representative text vector belonging to the seed attribute is determined as the seed data set, and at least one representative text vector belonging to the short-term memory attribute is determined as the short-term memory set.
[0137] In another possible design, at the beginning of knowledge formation, whether the knowledge belongs to representative knowledge can be determined, and after the representative knowledge is formed, the attribute of the knowledge is classified, and the seed data set and the short-term memory set are directly and continuously updated. For example, the knowledge that needs to be stored in the knowledge base can be determined first, and it is determined whether the knowledge belongs to representative knowledge. If yes, the knowledge attribute of the knowledge is determined, and the knowledge attribute can be a seed attribute and a short-term memory attribute. If the knowledge attribute of the knowledge is a seed attribute, the knowledge is divided into the seed data set. If the knowledge attribute of the knowledge is a short-term memory attribute, the knowledge is divided into the short-term memory set.
[0138] For ease of understanding, Figure 6 An example diagram of a data set of a knowledge base provided by an embodiment of the present application is shown. Referring to Figure 6 For a plurality of knowledge bases 60, each knowledge base can be associated with a representative data set, and the representative data set can include a seed data set 601 and a short-term memory set 602.
[0139] The seed data set 601 can include at least one first text vector, and the short-term memory set 602 can include at least one second text vector.
[0140] In a possible design, A2: according to the representative data set of the knowledge base, a correlation score between the knowledge base and the query content is calculated, including:
[0141] According to the seed data set and the short-term memory set in the representative data set of the knowledge base, a first similarity between the query content and each first text vector is calculated, and a second similarity between the query content and each second text vector is calculated;
[0142] According to that at least one first text vector in the seed data set respectively corresponds to the first similarity, a first average similarity of the seed data set is calculated;
[0143] According to that at least one second text vector in the short-term memory set respectively corresponds to the second similarity, a second average similarity of the short-term memory set is calculated;
[0144] The relevance score of the knowledge base is obtained by weighted summation of the first mean similarity and the second mean similarity.
[0145] Optionally, calculating the first similarity between the query content and each first text vector may include: extracting the text vector of the query content using an embedding model, and calculating the first similarity between the text vector of the query content and the first text vector.
[0146] Specifically, a distance similarity algorithm can be used to calculate the first similarity between the text vector of the query content and the first text vector.
[0147] For example, the distance similarity algorithm can be cosine similarity, Euclidean distance, Pearson correlation coefficient, Spearman rank correlation coefficient, covariance, Jaccard similarity, Hamming distance, etc. In this application embodiment, the specific type of distance similarity algorithm is not limited.
[0148] In this embodiment, when calculating the relevance score between the knowledge base and the query content, a seed dataset and a short-term memory set representing the dataset can be obtained. The dataset is acquired from two dimensions: basic knowledge and recent interaction knowledge of the knowledge base. The first text vector from the seed dataset is used to calculate the first mean similarity between the seed dataset and the query content, and the second text vector from the short-term memory set is used to calculate the second mean similarity between the short-term memory set and the query content, improving the accuracy and robustness of the similarity calculation. Then, the first mean similarity and the second mean similarity are weighted and summed to obtain the relevance score of the knowledge base, allowing for flexible adjustment of the weights of the two dimensions. This decomposes the relevance problem between the knowledge base and the query content into a quantifiable and controllable calculation, improving the efficiency and accuracy of relevance calculation.
[0149] like Figure 7 The diagram shown is a structural schematic of a knowledge processing device 700 provided in an embodiment of this application. The knowledge processing device 700 may include:
[0150] The request receiving unit 701 is used to receive a knowledge question and answer request sent by the user terminal, wherein the knowledge question and answer request includes query content.
[0151] The first acquisition unit 702 is used to acquire multiple knowledge bases registered in multiple industries, wherein the knowledge bases include multiple text vectors of multiple text blocks.
[0152] The query path unit 703 is used to select N target knowledge bases based on the overall scores corresponding to the multiple knowledge bases, where N is an integer greater than or equal to 1, and the query order of the N target knowledge bases is known.
[0153] The text query unit 704 is configured to query target text vectors matching the query content from the N target knowledge bases according to respective query orders of the N target knowledge bases.
[0154] The question and answer generation unit 705 is configured to input the text block corresponding to the target text vector and the query content into a large model obtained by training, to obtain a question and answer result output by the large model.
[0155] As an embodiment, the query path unit 703 can include:
[0156] The score optimization module is configured to perform score optimization on the overall scores respectively corresponding to the plurality of knowledge bases according to the ranking model, to obtain ranking scores respectively corresponding to the plurality of knowledge bases.
[0157] The query ranking module is configured to rank the ranking scores respectively corresponding to the plurality of knowledge bases from high to low, to obtain the query orders respectively corresponding to the plurality of knowledge bases.
[0158] The target selection module is configured to select the top N target knowledge bases with the highest ranking from the knowledge bases according to the query orders respectively corresponding to the plurality of knowledge bases, and obtain the query order of each target knowledge base.
[0159] As another embodiment, the score optimization module includes:
[0160] The probability calculation submodule is configured to calculate sampling probabilities of the overall scores respectively corresponding to the plurality of knowledge bases according to the ranking model.
[0161] The score determination submodule is configured to determine the ranking scores of the knowledge bases according to the sampling probabilities of the knowledge bases.
[0162] As another embodiment, the method further includes:
[0163] The index score unit is configured to obtain evaluation scores respectively corresponding to at least one evaluation index of each knowledge base.
[0164] The score weighting unit is configured to weight and sum the evaluation scores respectively corresponding to the at least one evaluation index of each knowledge base, to obtain the overall score of each knowledge base.
[0165] As another embodiment, the evaluation scores respectively corresponding to the at least one evaluation index include at least one of:
[0166] A relevance score corresponding to the relevance of the knowledge base to the query content;
[0167] A performance score corresponding to the query performance of the knowledge base;
[0168] a network latency score corresponding to a network latency performance of the knowledge base;
[0169] a query cost score corresponding to a query cost of the knowledge base.
[0170] As a further example, the evaluation score corresponding to the evaluation indicator includes a relevance score corresponding to a relevance between the knowledge base and the query content;
[0171] The method further includes:
[0172] a relevance calculation unit configured to obtain a relevance score between each of the plurality of knowledge bases and the query content.
[0173] As a further example, the relevance calculation unit includes:
[0174] a representative acquisition module configured to obtain a representative data set corresponding to each of the plurality of knowledge bases, the representative data set including at least one representative vector;
[0175] a relevance calculation module configured to calculate a relevance score between the knowledge base and the query content according to the representative data set of the knowledge base, to obtain the relevance score between each of the plurality of knowledge bases and the query content.
[0176] As a further example, the representative data set includes a seed data set and a short-term memory set, the seed data set including at least one first text vector, the short-term memory set including at least one second text vector, the first text vector being a text vector representing an overall content tendency of a representative knowledge base, and the second text vector being a text vector representing a relevance to a user query history record.
[0177] As a further example, the relevance calculation module includes:
[0178] a first calculation sub-module configured to calculate a first similarity between the query content and each first text vector according to a seed data set and a short-term memory set in the representative data set of the knowledge base, and to calculate a second similarity between the query content and each second text vector;
[0179] a second calculation sub-module configured to calculate a first average similarity of the seed data set according to the first similarity corresponding to each of the at least one first text vector in the seed data set;
[0180] a third calculation sub-module configured to calculate a second average similarity of the short-term memory set according to the second similarity corresponding to each of the at least one second text vector in the short-term memory set;
[0181] A similarity weighting sub-module is configured to sum the first mean similarity and the second mean similarity to obtain a relevance score of the knowledge base.
[0182] The specific steps performed by each unit, module, and sub-module in the device in the embodiment, and the technical effects are the same as those of the method embodiment, and will not be described here.
[0183] Figure 8 A structural schematic diagram of a computing device is shown, which can include a memory 801, a processor 802, and a computer program stored on the memory, and the processor executes the computer program to implement any one of the knowledge processing methods in the above embodiments.
[0184] The basic principles of the present disclosure are described above in combination with specific embodiments, but it should be pointed out that the advantages, advantages, effects mentioned in the present disclosure are only examples and not limitations, and these advantages, advantages, effects cannot be considered as the must-have of each embodiment of the present disclosure. In addition, the above specific details are only for the purpose of example and understanding, and the above details do not limit the present disclosure to the above specific details.
[0185] The block diagrams of the devices, apparatuses, equipment, systems involved in the present disclosure are only illustrative examples and are not intended to require or imply the connection, arrangement, configuration shown in the block diagram. As those skilled in the art will recognize, these devices, apparatuses, equipment, systems can be connected, arranged, configured in any manner. Words such as "include", "contain", "have" and the like are open-ended words, which mean "including but not limited to", and can be used interchangeably. The words "or" and "and" used herein mean the word "and / or", and can be used interchangeably unless the context clearly indicates otherwise. The word "such as" used herein means the phrase "such as but not limited to", and can be used interchangeably.
[0186] In addition, as used herein, "or" used in the list of items starting with "at least one of indicates a separate list, so that, for example, "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). In addition, the phrase "exemplary" does not mean that the described example is preferred or better than other examples.
[0187] It should also be noted that in the systems and methods of the present disclosure, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be considered as equivalent solutions of the present disclosure.
[0188] Various changes, modifications, and alterations to the techniques described herein can be made without departing from the teachings of the attached claims. Moreover, the scope of the claims of the present disclosure is not limited to the particular aspects described herein. Rather, the scope of the claims of the present disclosure includes all alternatives, modifications, and equivalents falling within the scope of the claims of the present disclosure. Accordingly, the attached claims are incorporated into this Detailed Description by reference.
[0189] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0190] The above description has been presented for the purpose of illustration and description. Furthermore, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although various example aspects and embodiments have been discussed above, those of ordinary skill in the art will appreciate a variety of modifications, alternatives, permutations, and equivalents thereof. Accordingly, the disclosure is intended to embrace all such alterations, modifications, and permutations of the aspects described herein, including other aspects falling within the scope of the appended claims.
Claims
1. A knowledge processing method characterized by, The method comprises the following steps: receiving a knowledge question and answer request sent by a user terminal, wherein the knowledge question and answer request comprises query content; determining a plurality of knowledge bases of a plurality of industries, wherein the knowledge base comprises a plurality of text vectors of a plurality of text blocks; selecting N target knowledge bases according to overall scores corresponding to the plurality of knowledge bases, wherein N is an integer greater than or equal to 1, and the N target knowledge bases are respectively provided with query orders; querying target text vectors matching the query content from the N target knowledge bases in sequence according to the respective query orders of the N target knowledge bases; inputting the target text vectors and the query content into a large model obtained by training to obtain a question and answer result output by the large model.
2. The method of claim 1, wherein, The step of selecting N target knowledge bases according to overall scores corresponding to the plurality of knowledge bases comprises the following steps: performing score optimization on the overall scores corresponding to the plurality of knowledge bases according to a ranking model to obtain ranking scores corresponding to the plurality of knowledge bases; ranking the ranking scores corresponding to the plurality of knowledge bases from high to low to obtain query orders corresponding to the plurality of knowledge bases; and selecting the top N target knowledge bases with the highest ranking scores from the knowledge bases according to the query orders corresponding to the plurality of knowledge bases, and obtaining the query orders of the target knowledge bases.
3. The method of claim 2, wherein, The step of performing score optimization on the overall scores corresponding to the plurality of knowledge bases according to the ranking model to obtain ranking scores corresponding to the plurality of knowledge bases comprises the following steps: calculating sampling probabilities of the overall scores corresponding to the plurality of knowledge bases according to the ranking model; and determining ranking scores of the knowledge bases according to the sampling probabilities of the knowledge bases.
4. The method according to any one of claims 1 to 3, characterized in that, The method further comprises the following steps: obtaining evaluation scores corresponding to at least one evaluation index of each knowledge base; weighting and summing the evaluation scores corresponding to the at least one evaluation index of each knowledge base to obtain an overall score of each knowledge base.
5. The method of claim 4, wherein, The evaluation scores corresponding to the at least one evaluation index comprise at least one of the following: a relevance score corresponding to the relevance of the knowledge base to the query content; a performance score corresponding to the query performance of the knowledge base; a network delay score corresponding to the network delay performance of the knowledge base; a query cost score corresponding to the query cost of the knowledge base.
6. The method of claim 4, wherein, The evaluation scores corresponding to the evaluation index comprise a relevance score corresponding to the relevance of the knowledge base to the query content. The method further comprises the following steps: obtaining relevance scores between the plurality of knowledge bases and the query content.
7. The method of claim 6, wherein, The step of obtaining relevance scores between the plurality of knowledge bases and the query content comprises the following steps: obtaining representative data sets corresponding to the plurality of knowledge bases, wherein the representative data set comprises at least one representative vector; and calculating the relevance scores between the knowledge bases and the query content according to the representative data sets of the knowledge bases to obtain the relevance scores between the plurality of knowledge bases and the query content.
8. The method of claim 7, wherein, The representative data set includes a seed data set and a short-term memory set, the seed data set includes at least one first text vector, and the short-term memory set includes at least one second text vector, the first text vector is a text vector representing the overall content tendency of the knowledge base, and the second text vector is a text vector representing the related content of the user query history.
9. The method of claim 8, wherein, The correlation score between the knowledge base and the query content is calculated according to the representative data set of the knowledge base, including: According to the seed data set and the short-term memory set in the representative data set of the knowledge base, the first similarity of the query content and each first text vector is calculated, and the second similarity of the query content and each second text vector is calculated; According to the first similarity corresponding to at least one first text vector in the seed data set, the first average similarity of the seed data set is calculated; According to the second similarity corresponding to at least one second text vector in the short-term memory set, the second average similarity of the short-term memory set is calculated; The first average similarity and the second average similarity are weighted and summed to obtain the correlation score of the knowledge base.
10. A knowledge processing apparatus characterized by comprising: Including: The request receiving unit is configured to receive a knowledge question and answer request sent by a user terminal, the knowledge question and answer request including query content; The first acquisition unit is configured to acquire a plurality of knowledge bases of a plurality of industries registered, the knowledge base including a plurality of text vectors of a plurality of text blocks; The query path unit is configured to select N target knowledge bases according to overall scores corresponding to the plurality of knowledge bases, N being an integer greater than or equal to 1, and the query order of the N target knowledge bases being known; The text query unit is configured to query target text vectors matching the query content from the N target knowledge bases in the query order of the N target knowledge bases respectively; The question and answer generation unit is configured to input the target text vector corresponding text block and the query content into a large model obtained by training to obtain a question and answer result output by the large model.
11. A computing device, comprising: Including a memory and a processor; The memory is configured to store a computer program; The processor is configured to execute the computer program to implement the knowledge processing method of any one of claims 1-9.
12. A computer readable storage medium having stored thereon computer programs / instructions, characterized in that, The computer program is executed by the processor to implement the steps of the method of any one of claims 1-9.
13. A computer program product comprising a computer program, characterized in that, The computer program / instruction is executed by the processor to implement the steps of the method of any one of claims 1-9.