Data processing method, device, equipment and storage medium
By creating independent knowledge bases for different question types and using embedded feature vectors and business features for multi-channel recall, the problem of untimely knowledge update of the question and answer generation model is solved, and the accuracy and timeliness of answer information generation are improved.
Patent Information
- Application Number
- CN202410963791.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-18
AI Technical Summary
The question and answer generation model takes a long time in the process of data collection, pre-training and fine-tuning, resulting in untimely knowledge updates, resulting in a mismatch between the generated answer information and the question information, and reducing the accuracy of generating answer information.
By creating independent knowledge bases for different question types, using embedded feature vectors and business features for multi-channel recall, matching reference knowledge content is generated, and answer information is generated based on these contents through the question and answer generation model to ensure the timeliness of answers.
The retrieval scope is narrowed, retrieval efficiency and recall accuracy are improved, the problem of mismatch between answer information and question information is avoided, and the accuracy and timeliness of generating answer information are improved.
Smart Images

Figure CN118520096B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to fields such as artificial intelligence technology, and in particular to a data processing method, device, equipment and storage medium. Background Art
[0002] With the rapid development of artificial intelligence (AI) technology, question-answering generation models (such as large language models) are widely used in scenarios such as intelligent question-answering (such as intelligent customer service) and knowledge retrieval. However, a question-answering generation model requires a long period of data collection, pre-training, and fine-tuning to achieve the final effect. Even if you are a downstream developer and do not participate in the data collection and pre-training phase of the question-answering generation model, and only fine-tune the existing question-answering generation model, you still need to bear the cost of each fine-tuning. This makes it impossible for downstream developers to frequently fine-tune and replace models, and thus it is impossible to guarantee the timeliness of the knowledge of the question-answering generation model. This makes it easy for the answer information generated by the question-answering generation model to not match the question information, resulting in low accuracy in the generation of answer information. Summary of the invention
[0003] The embodiments of the present application provide a data processing method, apparatus, device and storage medium, which can avoid the problem that the answer information generated by the question and answer generation model does not match the question information, and improve the accuracy of the generation of the answer information.
[0004] An embodiment of the present application provides a data processing method, including:
[0005] Obtain the question information to be retrieved and the question type corresponding to the question information;
[0006] Determine a knowledge base associated with the question type from the knowledge base cluster; the knowledge base includes an embedded feature vector corresponding to the updated knowledge content associated with the question type;
[0007] According to the embedded feature vector in the knowledge base, K updated knowledge contents associated with the embedded feature vector of the question information are selected from the updated knowledge contents corresponding to the embedded feature vector in the knowledge base; K is an integer greater than 1;
[0008] According to the business features respectively corresponding to the K updated knowledge contents, selecting updated knowledge content associated with the business features corresponding to the question information from the K updated knowledge contents as reference knowledge content;
[0009] According to the above reference knowledge content and the above question information, prompt information corresponding to the question and answer generation model is generated, and the answer information of the above question information is generated according to the above prompt information through the above question and answer generation model.
[0010] An embodiment of the present application provides a data processing device, including:
[0011] An acquisition module is used to acquire the question information to be retrieved and the question type corresponding to the question information;
[0012] A determination module, used to determine a knowledge base associated with the above-mentioned question type from the knowledge base cluster; the above-mentioned knowledge base includes an embedded feature vector corresponding to the updated knowledge content associated with the above-mentioned question type;
[0013] A first selection module is used to select K updated knowledge contents associated with the embedded feature vector of the question information from the updated knowledge contents corresponding to the embedded feature vector in the knowledge base according to the embedded feature vector in the knowledge base; K is an integer greater than 1;
[0014] A second selection module is used to select, from the K updated knowledge contents, updated knowledge contents associated with the business characteristics corresponding to the question information as reference knowledge contents according to the business characteristics corresponding to the K updated knowledge contents respectively;
[0015] A generation module is used to generate prompt information corresponding to the question and answer generation model based on the reference knowledge content and the question information, and to generate answer information for the question information based on the prompt information through the question and answer generation model.
[0016] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0017] On one hand, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0018] On one hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0019] The present application has at least the following beneficial effects: (1) A knowledge base with embedded feature vectors for storing updated knowledge content is created in advance for different question types. When it is necessary to generate answer information for question information, it is only necessary to search the knowledge base corresponding to the question type of the question information to obtain updated knowledge content that matches the question information as reference knowledge content. This is conducive to narrowing the search scope, improving search efficiency, and avoiding the problem that the reference knowledge content retrieved does not match the question information, thereby improving the accuracy of obtaining parameter knowledge content. (2) The reference knowledge content is obtained by multi-way recall of question information based on embedded feature vectors and business features, which is conducive to improving the recall accuracy, providing more accurate reference knowledge content for the generation process of question information, avoiding the problem that the answer information generated by the question-answer generation model does not match the question information, and improving the accuracy of answer information generation. (3) Through the question-answer generation model, answer information for question information is generated based on prompt information containing reference knowledge content, which is conducive to ensuring the timeliness of answer information and improving the accuracy of answer information generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 It is a schematic diagram of a data processing system provided by this application;
[0022] Figure 2 This is a schematic diagram of a current RAG system;
[0023] Figure 3 It is a schematic diagram of an improved RAG system provided by the present application;
[0024] Figure 4 It is a flowchart of a data processing method provided by this application;
[0025] Figure 5 It is a flowchart of another data processing method provided by the present application;
[0026] Figure 6 It is a schematic diagram of a scenario for obtaining reference knowledge content provided by this application;
[0027] Figure 7 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;
[0028] Figure 8It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0030] The question-answering generation model in this application may refer to a large language model, which can be widely used in downstream tasks, including text processing, semantic understanding, machine translation, robot question-answering, knowledge graphs, and other tasks; the "large" in the large language model is reflected in the wide training data set, large model parameters and layers, and large amount of calculation. Its value is reflected in its versatility and better generalization ability. The large language model may include a word vector representation method based on a language model (Embeddings from Language Models, ELMO), a pre-trained language model based on Transformer (Bidirectional Encoder Representations from Transformers, BERT), and a Transformer-based autoregressive language model (Generative Pre-Trained Transformer, GPT).
[0031] In order to facilitate a clearer understanding of the present application, the data processing system implementing the present application is first introduced. Figure 1 As shown, the data processing system includes a server 10 and a terminal cluster, and the terminal cluster may include one or more terminals, and the number of terminals is not limited here. Figure 1 As shown, taking the terminal cluster including 4 terminals as an example, the terminal cluster may specifically include terminal 11a, terminal 12a, terminal 13a, and terminal 14a; it can be understood that terminal 11a, terminal 12a, terminal 13a, and terminal 14a can all be connected to the server 10 through the network, so that each terminal can exchange data with the server 10 through the network connection.
[0032] It is understandable that the server can be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or a cloud server that provides cloud services, cloud knowledge bases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal can specifically refer to a vehicle-mounted terminal, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a screen speaker, a smart TV, a smart watch, etc., but is not limited to this. Each terminal and server can be directly or indirectly connected via wired or wireless communication. At the same time, the number of terminals and servers can be one or at least two, and this application does not limit this.
[0033] One or more target applications are installed in the terminal. The target application here may refer to an application with data processing (such as information retrieval, intelligent question and answer) functions. For example, the target application may include an independent application, a web application, a small program in a host application, etc. Specifically, the target application may refer to a browser application, a video playback application, a social application, a content publishing application, an intelligent question and answer application, a game application, etc. The server 10 refers to a device that provides backend services for the target application in the terminal. The server 10 may include multiple knowledge bases and trained question and answer generation models. A knowledge base is used to store an embedded feature vector corresponding to an updated knowledge content associated with a question type, and the question and answer generation model is used to generate answer information for the question information based on the prompt information associated with the question information.
[0034] For example, taking terminal 11a as an example, terminal 11a may include a target application, and terminal 11a may log in to the target application based on the basic information of the user, and display the search interface of the target application. The search interface here may refer to a search page including a search box, a dialogue interface including a dialog box, etc. The user may input the question information to be searched through the search interface displayed in terminal 11a, and terminal 11a may obtain the question information input by the user, and send the question information to server 10. Server 10 may be used to retrieve updated knowledge content matching the question information from the knowledge base corresponding to the question type of the question information based on the embedded feature vector and the business feature, as reference knowledge content, generate prompt information of the question-answer generation model according to the updated reference content and the question information, generate answer information of the question information according to the prompt information through the question-answer generation model, and return the answer information of the question information to terminal 11a, so that terminal 11a displays or plays the answer information of the question information to be searched in the search page.
[0035] The present application includes multiple knowledge bases, one knowledge base is associated with a question type, and the knowledge base is used to store embedded feature vectors of updated knowledge content associated with the corresponding question type. The updated knowledge content may refer to the knowledge content generated after the question and answer generation model is trained, that is, the updated knowledge content may refer to the knowledge content that has not been used to train the question and answer generation model.
[0036] In one embodiment, the question type refers to the business type to which the question information belongs, such as business types may include game business, financial business, office business, etc.; the knowledge base corresponding to the game business stores the embedded feature vectors corresponding to the updated knowledge content associated with the game business (such as new game skins, game equipment, game scenes), the knowledge base corresponding to the financial business stores the embedded feature vectors corresponding to the updated knowledge content associated with the financial business (such as updated digital asset trading trends), and the knowledge base corresponding to the office business stores the embedded feature vectors corresponding to the updated knowledge content associated with the office business (such as the latest meeting content).
[0037] In one embodiment, the question type is determined according to the data type of the answer information corresponding to the question information, and the data type may include text type, code type, image type, etc. When the data type is text type, that is, the question type may include session record questions and answers; when the data type is code type, the question type may include code interface query, code function module query, etc. That is, the knowledge base corresponding to the text type is used to store the embedded feature vector corresponding to the updated knowledge content of the text type (such as session content), and the knowledge base corresponding to the code type stores the embedded feature vector corresponding to the updated knowledge content of the code type (such as the code snippet corresponding to the function module of the latest version of the application).
[0038] In the present application, by creating separate knowledge bases for different question types, it is beneficial to achieve standardized management of updated knowledge content, narrow the search scope, improve search efficiency, and avoid storing the embedded feature vectors corresponding to the updated knowledge content of all question types in the same knowledge base, which causes the reference knowledge content retrieved to be similar to the question information but the content is completely unrelated. This can avoid the problem of mismatch between the reference knowledge content retrieved and the question information, and improve the accuracy of obtaining parameter knowledge content.
[0039] In practice, the question-answering generation model needs to go through a long period of data collection, pre-training, and fine-tuning to achieve the final effect. Even if you are a downstream developer and do not participate in the data collection and pre-training phase of the question-answering generation model, and only fine-tune the existing question-answering generation model, you still need to bear the cost of each fine-tuning. This makes it impossible for downstream developers to frequently fine-tune and replace models, so it is impossible to guarantee the timeliness of the knowledge of the question-answering generation model. It is easy for the answer information generated by the question-answering generation model to not match the question information, resulting in low accuracy in the generation of answer information. Whether in professional fields or in daily life, a large amount of new knowledge content is generated every day, making it difficult for question-answering generation models to use this knowledge content to provide help to users. To address this problem, the commonly used method is to use methods such as Figure 2 The retrieval-augmented generation (RAG) system shown includes an embedding model 21a, a knowledge base 22a, a prompt information template 23a, and a question-answer generation model 24a.
[0040] Among them, the knowledge base is a vector database constructed by offline encoding of the embedding model 21a. Specifically, the received business data can be segmented to obtain multiple business data segments, and the multiple business data segments are used as multiple updated knowledge contents, and one business data segment is an updated knowledge content. The embedded model 21a is used to encode the updated knowledge content to obtain the embedded feature vector of the updated knowledge content, and the embedded feature vector is added to the knowledge base. That is, the updated knowledge content is mapped to a high-dimensional space, and the dimension of the space ranges from hundreds to thousands of dimensions. The distance between the embedded feature vectors in the space can reflect the similarity of the semantic features. The time usually consumed to build a knowledge base is generally much less than the fine-tuning time of the question-answer generation model 24a.
[0041] The embedding model 21a may refer to a model for encoding data to obtain an embedded feature vector. The embedding model 21a includes but is not limited to Erlangshen-SimCSE, bge, an open source Chinese embedding model (Moka MassiveMixed Embedding, M3E), etc.
[0042] The process of generating answer information of question information by the RAG system includes the following steps:
[0043] S11, obtaining reference knowledge content; the computer device can obtain question information, encode the question information through the embedding model 21a, obtain the embedded feature vector of the question information, and recall the reference knowledge content through the embedded feature vector of the question information. Recall refers to calculating the embedded feature vector of the question information and the embedded feature vector in the knowledge base 22a, determining the semantic similarity between the question information and the updated knowledge content, and selecting one or more updated knowledge contents whose semantic similarity is greater than the similarity threshold as the reference knowledge content.
[0044] S12, generate prompt information; add the question information and reference knowledge content to the prompt information template 23a, and obtain the prompt information corresponding to the question and answer generation model, which is used to indicate that the reference knowledge content is rewritten (or adjusted) according to the question information to obtain the answer information of the question information.
[0045] S13, generate answer information; input the prompt information into the question and answer generation model 24a, and adjust the reference knowledge content in the prompt information according to the question information in the prompt information through the question and answer generation model 24a to obtain the answer information of the question information.
[0046] In practice, it is found that the RAG system has the following defects: 1. The question information and the answer information do not match accurately. In actual use, the answer information of the question information raised by the user does not necessarily have a high semantic similarity with the question information, that is, the two are not necessarily synonymous sentences.
[0047] 2. The updated knowledge content in the knowledge base is not standardized and clear, and the large size of the knowledge base leads to the existence of similar updated knowledge content. For example, there are data such as codes and session records in the knowledge base, and not every updated knowledge content has clear semantic features, or the knowledge base contains a large amount of updated knowledge content in different fields, some of which are similar but unrelated.
[0048] 3. Knowledge is dispersed, so a question needs to refer to multiple updated knowledge contents before it can be answered. That is, the answer information of the question raised by the user may appear in multiple places in the knowledge base, and it is necessary to combine them to get the answer information of the question information.
[0049] Based on this, in this application, for application scenarios such as session record Q&A and code interface query, an improved RAG system is proposed. In the knowledge base construction stage, operations such as length load balancing, context splicing, function summary (i.e., obtaining the original function description information), and summary description expansion (i.e., obtaining the adjusted function description information) are performed on session records and code blocks to ensure the construction specification of the updated knowledge content in the knowledge base, and the updated knowledge content in the knowledge base contains actual semantic features. In the online operation stage, based on the original RAG system, algorithms such as question type routing and fine ranking based on business characteristics are added, so that the entire system can still accurately obtain answer information in the case of low semantic similarity between a large number of knowledge bases, question information, and answer information in multiple domains. The process of the improved RAG system obtaining answer information for question information includes a knowledge base establishment stage, and the knowledge base establishment stage includes the following steps S21~S32: Figure 3 As shown, the process of the improved RAG system obtaining answer information for question information includes a knowledge base establishment stage, and the knowledge base establishment stage includes the following steps S21~S32:
[0050] S21. Obtain session records; The computer device can obtain the session records generated after training the Q&A generation model.
[0051] S22. Shard by speaker; For session records, the speaker is an important piece of information. The Q&A generation model needs to know who said each sentence to find the accurate answer information from it. Moreover, the lengths of the contents of session records often vary greatly, ranging from a single character to hundreds of characters, and the length will significantly affect the calculation result of the semantic similarity after encoding. In addition, the answer information of a question information often appears in multiple consecutive session records nearby. Therefore, when constructing the session knowledge base, the computer device can shard the session records by speaker to obtain multiple session fragments, and one session fragment corresponds to one speaker (i.e., object).
[0052] S23. Length load balancing; According to the length threshold, the session fragments are segmented to obtain session sub-fragments corresponding to each object. The length threshold can be the length corresponding to dozens of characters to hundreds of characters. This length threshold can be set in advance, or this length threshold can be determined according to the limit length (i.e., the maximum length) of the data processed by the Q&A generation model. The lengths of each session sub-fragment are less than the length threshold. For example, if the session fragment is "A: AB", it is segmented into "A: A" and "A: B" to balance the length of each session fragment.
[0053] S24. Context splicing; According to the times respectively corresponding to the session sub-fragments of each object, the adjacent m session sub-fragments in the session sub-fragments corresponding to each object are spliced to obtain L spliced session fragments, that is, for each session sub-fragment, its m-1 consecutive upper and lower session sub-fragments are spliced to obtain the spliced session fragments.
[0054] S25, obtaining an embedded feature vector; encoding each spliced session segment through the embedding model to obtain an embedded feature vector of the spliced session segment.
[0055] S26, constructing a conversation knowledge base; taking a concatenated conversation segment as an updated knowledge content, establishing a mapping relationship between the updated knowledge content and the corresponding embedded feature vector, and adding the embedded feature vector of the updated knowledge content to the conversation knowledge base. The personalized construction of the conversation knowledge base is completed, and a personalized conversation knowledge base is obtained.
[0056] S27. Obtain code blocks. The computer device may obtain code blocks generated after training the question-answer generation model. The code blocks may be multiple functional modules of an application in the computer device.
[0057] S28, obtain the original function description information; for the code block, since it uses a special language and the overall function of a piece of code is not reflected in some of its sentences, it is meaningless to encode it directly using an embedding model, and it is impossible to effectively recall the question information when asking questions. Therefore, when building a code knowledge base, the computer device can use large models such as GPT-4, Tongyi Qianwen, etc. to summarize the functions of the code function modules in the code block to obtain the original function description information of multiple code function modules. Such large models can summarize the functions of the code function modules more accurately because they have a large number of parameters and use a large amount of code data during training. This step can also be summarized manually, such as a large number of UI components in front-end development or code function modules that implement fixed requests. Such code function modules are generally large in number, but the structure of each code function module is relatively fixed. Generally, they are used directly as a whole or only with a small amount of changes. Therefore, there is a corresponding original function description information at the beginning of the design, which can be directly used as the original function description information of the code function module.
[0058] S29. Obtaining adjusted functional description information; the same semantic adjustment can be made to the original functional description information of the same code functional module to obtain the adjusted functional description information of the code functional module. The number of adjusted functional description information can range from 3 to 10 depending on the specific situation. This is conducive to expanding the scope of the original functional description information of this code functional module in the high-dimensional space and increasing the hit probability.
[0059] S30, encoding and code bypass storage; since in the process of asking questions about the code function module, the question information is to calculate the semantic similarity with the function description information of the code function module, but the reference knowledge content actually recalled should be the code function module. Therefore, the original function description information and the adjusted function description information of the code function module can be encoded to obtain the embedded feature vector of the original function description information of the code function module and the embedded feature vector of the adjusted function description information, establish the embedded feature vector of the original function description information of the code function module and the embedded feature vector of the adjusted function description information, and the mapping relationship between the embedded feature vector of the original function description information of the code function module and the embedded feature vector of the adjusted function description information and the code function module, and bypass the code function module, that is, store the code function module in other databases.
[0060] S31, code knowledge base; taking the code function module as the updated knowledge content, adding the embedded feature vector of the original function description information of the code function module and the embedded feature vector of the adjusted function description information to the code knowledge base, completing the personalized construction of the code knowledge base, that is, obtaining a personalized code knowledge base.
[0061] S32. Add the code knowledge base and the session knowledge base to the knowledge base cluster.
[0062] In the online operation stage, the user's question information is mainly used to find appropriate reference knowledge content (i.e., supporting materials) from the knowledge base, and the question information and reference knowledge content are input into the question-answering generation model to obtain the answer information of the question information. It can be seen that whether the correct reference knowledge content can be found is crucial to the accuracy of the answer information. This part is often implemented by using the semantic similarity calculation after updating the knowledge content encoding and the refined sorting strategy for business features. The process of obtaining the answer information of the question information in the improved RAG system also includes online operation, which includes the following steps S33~S40:
[0063] S33. Obtain problem information.
[0064] S34. Obtain an embedded feature vector of the question information.
[0065] Steps S33-S34 include: the computer device can obtain question information, encode the question information through the embedding model, and obtain an embedded feature vector of the question information.
[0066] S35, question type routing; after encoding the user's question information using the embedding model, it will pass through the question type routing module of the large language model, and use the large language model to determine which knowledge base should be used to recall the user's question information, or the recall stage can be skipped, without using the reference knowledge content, and the answer information can be directly generated based on the question information by relying on the question and answer generation model. The question type prompt information can be identified by the question type routing module to obtain the question type corresponding to the question information. The question type prompt information includes the question information and multiple candidate question types corresponding to the question information, and the question type of the question information belongs to one of the multiple candidate question types. According to the question type of the question information, the knowledge base associated with the question type is selected from the knowledge base cluster. For example, when the question type of the question information is a session record question and answer, the above-mentioned session knowledge base can be determined as the knowledge base associated with the question type; when the question type of the question information is a code query (such as a code interface query), the above-mentioned code knowledge base can be determined as the knowledge base associated with the question type. By using the question type routing solution, the problem of inaccurate recall results caused by the large scale of the knowledge base can be well solved, and it is very easy to expand, and only incremental coding is required to update the knowledge content.
[0067] It should be noted that after the question-answer generation model is trained, if the knowledge corresponding to a certain question type is not updated, the computer device can skip the recall stage and directly rely on the question-answer generation model to generate answer information based on the question information without using reference knowledge content.
[0068] S36, recall. The computer device can recall K embedded feature vectors whose semantic similarity is less than a similarity threshold from the knowledge base based on the embedded feature vectors of the question information and the embedded feature vectors in the knowledge base, and use the updated knowledge content corresponding to the K embedded feature vectors as the recall result, i.e., the rough sorting result.
[0069] S37, fine sorting based on business features; there are many entries in the rough sorting results. If all the rough sorting results are input into the question-answer generation model as reference knowledge content, there will be two problems: 1. The number of tokens in the question-answer generation model is limited to a few K to a few hundred K, such as 4096, 8192, 128K, etc. Too much reference knowledge content may exceed the maximum number of tokens that the question-answer generation model can accept, resulting in incomplete information received by the question-answer generation model. The maximum number of tokens can be the length limit of the data processed by the question-answer generation model. 2. Content confusion. There may be many irrelevant items in the reference knowledge content, which makes it impossible for the question-answer generation model to extract key information related to the question information. Therefore, in this application, after recall based on the embedded feature vector, fine sorting will continue to be performed to obtain the reference knowledge content of the question-answer generation model. Specifically, the computer device can select the updated knowledge content associated with the business characteristics of the question information from the K updated knowledge contents according to the business characteristics of the updated knowledge contents corresponding to the K embedded feature vectors, as the reference knowledge content. The specific implementation process can refer to the following embodiment.
[0070] S38. Generate prompt information; the computer device can add the question information and reference knowledge content to the prompt information template to obtain prompt information corresponding to the question and answer generation model, and the prompt information is used to indicate that the reference knowledge content is rewritten (or adjusted) according to the question information to obtain the answer information of the question information.
[0071] S39, the question-answer generation model outputs the result. The prompt information is input into the question-answer generation model, and the question-answer generation model adjusts the reference knowledge content in the prompt information according to the question information in the prompt information to obtain the output result.
[0072] S40: Obtain answer information, and determine the output result of the question-answer generation model as answer information of the question information.
[0073] In summary, by creating a separate knowledge base for each question type, standardized management of updated knowledge content is achieved, solving the problem of inaccurate recall results caused by too large a knowledge base, and it is very easy to expand, requiring only incremental coding to update knowledge content. In addition, the reference knowledge content is obtained by multi-way recall of question information based on embedded feature vectors and business features, which is conducive to improving recall accuracy, providing more accurate reference knowledge content for the generation process of question information, avoiding the problem of mismatch between answer information generated by the question-answer generation model and question information, and improving the accuracy of answer information generation.
[0074] For further information, see Figure 4 , is a flow chart of a data processing method provided in an embodiment of the present application. Figure 4 As shown, this method can be Figure 1 It can be executed by any terminal in the terminal cluster in Figure 1 can be executed by the server in Figure 1 The terminals and servers in the terminal cluster are used to perform collaborative execution. The devices used to perform the data processing method in this application can be collectively referred to as computer devices. The method may include the following steps:
[0075] S101. Obtain question information to be retrieved and the question type corresponding to the question information.
[0076] In the present application, the computer device may receive question information to be retrieved input by the user, and determine the question type corresponding to the question information based on the question information.
[0077] For example, the computer device can identify the question type prompt information through the large language model to obtain the question type corresponding to the question information, and the question type prompt information includes the question information and multiple candidate question types corresponding to the question information, and the question type of the question information belongs to one of the multiple candidate question types. For example, the question type prompt information can be "Please determine which of the following candidate question types the question information [query] belongs to, and output the number of the candidate question type: 1. Session record Q&A, 2. Code query, 3. Chat", and the computer device can identify the question type prompt information through the large language model to obtain the number of the candidate question type, and determine the question type of the question information with the candidate question type corresponding to the number. For example, if the number output by the large language model is 1, the session record Q&A is determined as the question type of the question information.
[0078] S102: Determine a knowledge base associated with the question type from the knowledge base cluster; the knowledge base includes an embedded feature vector corresponding to the updated knowledge content associated with the question type.
[0079] It should be noted that the knowledge base cluster includes knowledge bases associated with multiple question types, that is, one question type is associated with one knowledge base, and the knowledge base includes embedded feature vectors corresponding to updated knowledge content associated with the corresponding question type, and the embedded feature vectors reflect the semantic features of the updated knowledge content, and the semantic features of the updated knowledge content reflect the meaning of the updated knowledge content. That is, the updated knowledge content corresponding to the same question type is concentrated in the same knowledge base, which is conducive to the standardized management of the knowledge base and to reducing the retrieval efficiency and retrieval accuracy for the updated knowledge content associated with the question information.
[0080] Among them, updated knowledge content can refer to private domain data and data with an update frequency greater than the frequency threshold. This application can improve the recall accuracy of private domain data, frequently updated data and other data types, and provide a complete and efficient question-answering system for private domain data, which has wide application potential and practical value. Private domain data can refer to privacy data or data with a data volume less than the quantity threshold, that is, the data volume is relatively small and cannot bring obvious fine-tuning effects on the question-answering generation model. Alternatively, it can also be called that updated knowledge content can refer to private domain data generated after the question-answering generation model is trained, and data with an update frequency greater than the frequency threshold.
[0081] In the present application, the computer device may determine, from the knowledge base cluster, a knowledge base associated with the question type of the question information to be retrieved based on the correspondence between the question type and the knowledge base.
[0082] S103. According to the embedded feature vector in the knowledge base, select K updated knowledge contents associated with the embedded feature vector of the question information from the updated knowledge contents corresponding to the embedded feature vector in the knowledge base; K is an integer greater than 1.
[0083] In the present application, the computer device can encode the question information through the embedding model to obtain the embedded feature vector of the question information; according to the embedded feature vector of the question information, the updated knowledge content corresponding to the embedded feature vector in the knowledge base is selected from the updated knowledge content corresponding to the embedded feature vector of the question information, that is, the K updated knowledge content is the updated knowledge content with the top K correlation with the question information in the knowledge base. Only the knowledge base associated with the question type needs to be searched, the search scope is narrowed, the search efficiency is improved, and at the same time, the updated knowledge content retrieved is effectively avoided to be similar to the question information but irrelevant, providing more accurate reference knowledge content for the generation process of the answer information.
[0084] It should be noted that the embedded feature vector of the question information reflects the semantic features of the question information, and the semantic features of the question information reflect the meaning of the question information, that is, the K updated knowledge contents associated with the embedded feature vector of the question information may refer to the K updated knowledge contents associated with the semantic features of the question information, that is, the K updated knowledge contents may refer to: the embedded feature vectors corresponding to the K updated knowledge contents whose semantic features in the knowledge base are closest to the semantic features of the question information.
[0085] S104 . According to the business features respectively corresponding to the K updated knowledge contents, select updated knowledge content associated with the business features corresponding to the question information from the K updated knowledge contents as reference knowledge content.
[0086] In the present application, the computer device can select updated knowledge content associated with the business characteristics corresponding to the question information from the K updated knowledge contents according to the business characteristics corresponding to the K updated knowledge contents, as reference knowledge content, so as to subsequently generate answer information for the question information based on the reference knowledge content. This is conducive to improving the timeliness of the answer information and avoiding the problem of mismatch between the question information and the answer information.
[0087] The business characteristics corresponding to the updated knowledge content may refer to the characteristics of the business type to which the updated knowledge content belongs, and the business characteristics corresponding to the updated knowledge content may include one or more of the generation time of the updated knowledge content, the segmentation words contained in the updated knowledge content, and the semantic characteristics. The business characteristics corresponding to the question information may refer to the characteristics of the question type to which the question information belongs, such as the business characteristics corresponding to the question information may include one or more of the semantic characteristics of the question information and the segmentation words contained in the question information.
[0088] The number of reference knowledge content items may be one or more, and the number of reference knowledge content items may be determined according to the scenario or dynamically set by the user.
[0089] The semantic features of the updated knowledge content may refer to the features in the embedded feature vector of the updated knowledge content, and the semantic features of the question information may refer to the features in the embedded feature vector of the question information. The reference knowledge content here may refer to the updated knowledge content associated with both the semantic features and the business features of the question information.
[0090] S105. Generate prompt information corresponding to the question and answer generation model based on the reference knowledge content and the question information, and generate answer information of the question information based on the prompt information through the question and answer generation model.
[0091] In the present application, the computer device can generate prompt information of the question and answer generation model based on the reference knowledge content and the question information, and the prompt information is used to instruct the question and answer generation model to adjust the reference knowledge content according to the question information to obtain answer information of the question information; therefore, the computer device can adjust the updated knowledge content in the prompt information according to the question information in the prompt information through the question and answer generation model to obtain answer information of the question information.
[0092] Among them, the question and answer generation model may refer to a model used to generate answer information, and the question and answer generation model may refer to a model trained with a large amount of knowledge content.
[0093] In one embodiment, the computer device may obtain the business data to be processed and the data type corresponding to the business data; the data type corresponds to a question type; according to the data type, the business data is segmented to obtain L business data segments, and the L business data segments are determined as L updated knowledge contents. The computer device may input the L updated knowledge contents into the embedding model, and the embedding model may identify the L updated knowledge contents to obtain the embedded feature vectors corresponding to the L updated knowledge contents; L is an integer greater than 1, and the embedded feature vectors corresponding to the L updated knowledge contents are added to the knowledge base corresponding to the data type.
[0094] It should be noted that data types may include game data types, financial data types, and office data types, and question types may include game business, financial business, and office business; that is, game data types correspond to game business, financial data types correspond to financial business, and office data types correspond to office business. Alternatively, data types may include text type (or session type), code type, and image type, and question types may include session record Q&A, code interface query, and image query. Session record Q&A corresponds to text type, code interface query corresponds to code type, and image query corresponds to image type.
[0095] In one embodiment, the business data is segmented according to the data type to obtain L updated knowledge contents, and the embedded feature vectors corresponding to the L updated knowledge contents are generated, including: when the data type is a conversation type, the computer device can extract conversation segments corresponding to N objects from the business data; the conversation segments corresponding to the N objects are segmented to obtain conversation sub-segments corresponding to the N objects, and the length of each conversation sub-segment is less than a length threshold, which can be preset, or the length threshold can be determined according to the limit length (i.e., maximum length) corresponding to the data processed by the question-answer generation model. The computer device can splice the adjacent m conversation sub-segments in the conversation sub-segments corresponding to the N objects according to the generation time corresponding to the conversation sub-segments of the N objects to obtain L spliced conversation segments; m is an integer greater than 1. m can be determined according to the limit length corresponding to the data processed by the question-answer generation model. The computer device can encode the above-mentioned L spliced conversation segments through an embedding model to obtain the embedding feature vectors corresponding to the above-mentioned L spliced conversation segments respectively; determine the above-mentioned L spliced conversation segments as L updated knowledge contents, and determine the embedding feature vectors corresponding to the above-mentioned L spliced conversation segments respectively according to the embedding feature vectors corresponding to the above-mentioned L spliced conversation segments respectively.
[0096] When the data type is a conversation type, the business data may refer to a conversation record, and the N objects may refer to speakers of the conversation record.
[0097] In one embodiment, the above-mentioned business data is segmented according to the above-mentioned data type to obtain L updated knowledge contents, and the embedded feature vectors corresponding to the above-mentioned L updated knowledge contents are generated, including: when the above-mentioned data type is a code type, the computer device can segment the above-mentioned business data into code fragments corresponding to L functional modules respectively, and one code fragment is used to describe a functional module in the business data, and the computer device can encode the original functional description information corresponding to the j-th functional module through the embedding model to obtain the embedded feature vector corresponding to the j-th functional module; j is a positive integer less than or equal to L. The code fragments corresponding to the above-mentioned L functional modules are determined as L updated knowledge contents, and the embedded feature vectors corresponding to the above-mentioned L updated knowledge contents are determined according to the embedded feature vectors corresponding to the above-mentioned L functional modules.
[0098] It should be noted that when the data type is a code type, the business data may refer to a code block.
[0099] In one embodiment, the above-mentioned generation of the embedded feature vector corresponding to the j-th functional module according to the original functional description information corresponding to the j-th functional module includes: the computer device can make the same semantic adjustment to the original functional description information of the j-th functional module to obtain the adjusted functional description information of the j-th functional module; that is, the adjusted functional description information and the original functional description information have the same semantic features. The computer device can encode the original functional description information of the j-th functional module through the embedding model to obtain the embedded feature vector of the original functional description information of the j-th functional module, and encode the adjusted functional description information of the j-th functional module through the embedding model to obtain the embedded feature vector of the adjusted functional description information of the j-th functional module; the embedded feature vector of the original functional description information of the j-th functional module and the embedded feature vector of the adjusted functional description information are determined as the embedded feature vector corresponding to the j-th functional module. By making the same semantic adjustment to the original functional description information, more embedded feature vectors with the same semantic features are expanded, which is conducive to improving the hit probability.
[0100] The present application has at least the following beneficial effects: (1) A knowledge base with embedded feature vectors for storing updated knowledge content is created in advance for different question types. When it is necessary to generate answer information for question information, it is only necessary to search the knowledge base corresponding to the question type of the question information to obtain updated knowledge content that matches the question information as reference knowledge content. This is conducive to narrowing the search scope, improving search efficiency, and avoiding the problem that the reference knowledge content retrieved does not match the question information, thereby improving the accuracy of obtaining parameter knowledge content. (2) The reference knowledge content is obtained by multi-way recall of question information based on embedded feature vectors and business features, which is conducive to improving the recall accuracy, providing more accurate reference knowledge content for the generation process of question information, avoiding the problem that the answer information generated by the question-answer generation model does not match the question information, and improving the accuracy of answer information generation. (3) Through the question-answer generation model, answer information for question information is generated based on prompt information containing reference knowledge content, which is conducive to ensuring the timeliness of answer information and improving the accuracy of answer information generation.
[0101] For further information, see Figure 5 , is a flow chart of another data processing method provided by an embodiment of the present application. Figure 5 As shown, this method can be Figure 1 It can be executed by any terminal in the terminal cluster in Figure 1 can be executed by the server in Figure 1 The terminals and servers in the terminal cluster are used to perform collaborative execution. The devices used to perform the data processing method in this application can be collectively referred to as computer devices. The method may include the following steps:
[0102] S201. Obtain question information to be retrieved and the question type corresponding to the question information.
[0103] S202: Determine a knowledge base associated with the question type from the knowledge base cluster; the knowledge base includes an embedded feature vector corresponding to the updated knowledge content associated with the question type.
[0104] S203: Determine the vector distance between the embedded feature vector of the question information and the embedded feature vector in the knowledge base.
[0105] In the present application, the computer device may use a distance algorithm to calculate the distance between the embedded feature vector of the question information and the embedded feature vector in the knowledge base, recorded as vector distance; the distance algorithm here may include Euclidean distance algorithm, Manhattan algorithm, Euclidean algorithm, etc.
[0106] Among them, the vector distance reflects the semantic similarity between the semantic features of the question information and the semantic features of the updated knowledge content. If the vector distance between the embedded feature vector of the question information and the embedded feature vector of a certain updated knowledge content in the knowledge base is closer, it means that the semantic similarity between the semantic features of the question information and the semantic features of the updated knowledge content is higher. Conversely, if the vector distance between the embedded feature vector of the question information and the embedded feature vector of a certain updated knowledge content in the knowledge base is farther, it means that the semantic similarity between the semantic features of the question information and the semantic features of the updated knowledge content is lower.
[0107] S204: Filter out K embedded feature vectors whose vector distance is less than a distance threshold from the above knowledge base.
[0108] In the present application, the computer device can sort the embedded feature vectors in the knowledge base in the order of vector distance from small to large, and select the K embedded feature vectors ranked in the top K. Alternatively, from the knowledge base, select K embedded feature vectors whose vector distance is less than a distance threshold, and the distance threshold can be determined based on the vector distances corresponding to each embedded feature vector in the knowledge base, or the distance threshold can be determined based on the application scenario. By preliminarily screening the knowledge base based on the embedded feature vectors, multiple updated knowledge contents associated with the semantic features of the question information are obtained, which is conducive to subsequent precise screening to obtain accurate reference knowledge contents.
[0109] It should be noted that after selecting the knowledge base to be used, the computer device can use the vector distance between the embedded feature vector of the question information and the embedded feature vector in the knowledge base, and use the K embedded feature vectors with the closest corresponding vector distance in the knowledge base as the recall result, that is, the rough sorting result. In practical applications, the answer information is usually found from the knowledge base through the question information input by the user, but in reality, the question information and the answer information may not have a high semantic similarity. For example, the question information is "what did you eat", and the updated knowledge content corresponding to the embedded feature vector in the knowledge base includes "what did you play", "the cake I ate today", etc. The semantic similarity between "what did you eat" and "what did you play" is relatively high, but in fact, "the cake I ate today" is the answer information of the question information. Therefore, the computer device can recall multiple updated knowledge contents from the knowledge base to ensure that the correct updated knowledge content appears in the rough sorting result.
[0110] S205 . According to the mapping relationship between the embedded feature vectors and the updated knowledge content, determine the updated knowledge content having a mapping relationship with the K embedded feature vectors.
[0111] In the present application, the computer device may determine the updated knowledge contents having a mapping relationship with the K embedded feature vectors, respectively, based on the mapping relationship between the embedded feature vectors and the updated knowledge contents.
[0112] It should be noted that when a certain embedded feature vector is obtained by encoding updated knowledge content, it can be said that there is a mapping relationship between the updated knowledge content and the obtained embedded feature vector.
[0113] S206. Determine the updated knowledge contents that have mapping relationships with the K embedded feature vectors as K updated knowledge contents associated with the embedded feature vectors of the question information; K is an integer greater than 1.
[0114] In the present application, the computer device may determine the updated knowledge contents having a mapping relationship with the above-mentioned K embedded feature vectors as the K updated knowledge contents associated with the embedded feature vectors of the above-mentioned question information.
[0115] S207 . According to the business features respectively corresponding to the K updated knowledge contents, select updated knowledge content associated with the business features corresponding to the question information from the K updated knowledge contents as reference knowledge content.
[0116] In one embodiment, the business features corresponding to the updated knowledge content include the semantic features and word segmentation of the updated knowledge content, and the business features corresponding to the question information include the semantic features and word segmentation of the question information; the step S207 includes: the embedded feature vector of the question information includes the semantic features of the question information, and the embedded feature vector of the updated knowledge content includes the semantic features of the updated knowledge content. Therefore, the computer device can use the distance algorithm to calculate the vector distance between the embedded feature vector of the question information and the embedded feature vectors corresponding to the K updated knowledge contents, and determine the semantic similarity between the question information and the K updated knowledge contents according to the vector distance between the embedded feature vector of the question information and the embedded feature vectors corresponding to the K updated knowledge contents. The computer device can segment the question information to obtain the segmentation of the question information, segment the K updated knowledge contents to obtain the segmentation corresponding to the K updated knowledge contents, and determine the segmentation similarity between the question information and the K updated knowledge contents according to the segmentation of the question information and the segmentation corresponding to the K updated knowledge contents. The computer device may select, from the K updated knowledge contents, updated knowledge contents associated with the business features corresponding to the question information as reference knowledge contents according to the semantic similarities and word segmentation similarities respectively corresponding to the K updated knowledge contents.
[0117] In one embodiment, the above-mentioned determining the word segmentation similarity between the above-mentioned question information and the above-mentioned K updated knowledge contents respectively according to the word segmentation of the above-mentioned question information and the word segmentation corresponding to the above-mentioned K updated knowledge contents includes: the computer device can sample the word frequency similarity algorithm to determine the word frequency similarity between the i-th updated knowledge content and the above-mentioned question information. Using the above-mentioned distance algorithm, calculate the distance between the semantic keywords in the word segmentation of the above-mentioned question information and the semantic keywords in the word segmentation corresponding to the above-mentioned i-th updated knowledge content, and determine the first keyword similarity between the i-th updated knowledge content and the above-mentioned question information according to the distance between the semantic keywords in the word segmentation of the above-mentioned question information and the semantic keywords in the word segmentation corresponding to the above-mentioned i-th updated knowledge content. Using the above-mentioned distance algorithm, calculate the distance between the non-semantic keywords in the word segmentation of the question information and the non-semantic keywords in the word segmentation corresponding to the above-mentioned i-th updated knowledge content, and determine the second keyword similarity between the above-mentioned i-th updated knowledge content and the above-mentioned question information according to the distance between the non-semantic keywords in the word segmentation of the question information and the non-semantic keywords in the word segmentation corresponding to the above-mentioned i-th updated knowledge content. The word frequency similarity corresponding to the i-th updated knowledge content, the first keyword similarity and the second keyword similarity are summed to obtain the word segmentation similarities between the question information and the K updated knowledge contents.
[0118] Among them, the word frequency similarity algorithm may include the bm25 algorithm, the TF-IDF (word frequency-inverse document frequency) algorithm, etc., such as calculating the number of times the word segment in the question information appears in the word segment of the updated knowledge content, and determining the word frequency similarity between the i-th updated knowledge content and the above question information based on the number, and there is a positive correlation between the number and the word frequency similarity, that is, the more the number, the higher the word frequency similarity between the i-th updated knowledge content and the above question information; the fewer the number, the lower the word frequency similarity between the i-th updated knowledge content and the above question information.
[0119] It should be noted that the summation process may refer to direct summation process and weighted summation process. The direct summation process may refer to: adding the word frequency similarity corresponding to the above-mentioned ith updated knowledge content, the above-mentioned first keyword similarity and the above-mentioned second keyword similarity to obtain the word segmentation similarity between the above-mentioned question information and the above-mentioned K updated knowledge contents. The weighted summation process may refer to: obtaining the first weight corresponding to the word frequency similarity, the second weight corresponding to the above-mentioned first keyword similarity and the third weight corresponding to the above-mentioned second keyword similarity respectively, multiplying the word frequency similarity corresponding to the ith updated knowledge content based on the first weight to obtain the processed word frequency similarity; multiplying the first keyword similarity corresponding to the ith updated knowledge content based on the second weight to obtain the processed first keyword similarity; multiplying the second keyword similarity corresponding to the ith updated knowledge content based on the third weight to obtain the processed second keyword similarity.
[0120] Among them, the first weight, the second weight, and the third weight can be dynamically adjusted according to the application scenario to which the question and answer information belongs. For example, if the application scenario to which the question information belongs is an application scenario that is strongly related to non-semantic keywords (such as name keywords), if the application scenario to which the question information belongs is tourism, if the question information is to query the beautiful scenery or food of a certain place, that is, the application scenario is strongly related to the name keyword (place name), then the value of the third weight corresponding to the similarity of the second keyword can be increased.
[0121] Among them, there is a positive correlation between the number of identical participles and the word frequency similarity. The more identical participles there are in the i-th updated knowledge content and the question information, the higher the word frequency similarity between the i-th updated knowledge content and the above question information; the fewer identical participles there are in the i-th updated knowledge content and the question information, the lower the word frequency similarity between the i-th updated knowledge content and the above question information.
[0122] The word segmentation of the question information includes the semantic keywords in the question information, and the semantic keywords in the question information reflect the semantics of the question information. For example, if the question information is "what did you eat", the semantic keywords of the question information include "eat" and "what". The word segmentation of the updated knowledge content includes the semantic keywords in the updated knowledge content, and the semantic keywords of the updated knowledge content reflect the semantics of the updated knowledge content. For example, if the updated knowledge content is "the cake I ate today", the semantic keywords of the updated knowledge content include "eat" and "cake".
[0123] Among them, the word segmentation of the question information includes non-semantic keywords in the question information, and the word segmentation of the updated knowledge content includes non-semantic keywords in the updated knowledge content. The non-semantic keywords are keywords other than semantic keywords in the word segmentation, and the non-semantic keywords can include at least one of name keywords and foreign keywords.
[0124] The name keywords in the question information reflect the place names and names of people in the question information. For example, if the question information is "Xiao Wang, what delicious food can you recommend in place A?", the name keywords of the question information include "Xiao Wang" and "place A." The name keywords of the updated knowledge content reflect the place names and names of people in the updated knowledge content. For example, if the updated knowledge content is "The hot pot in place A is good," the name keywords of the updated knowledge content include "place A."
[0125] Among them, foreign keywords can refer to word segmentations other than Chinese, such as English word segmentations. The question type of the question information is text type or code type (i.e. code query), and it is necessary to pay attention to keywords. For example, in the conversation record, names of people and places are often crucial. Errors may make the meaning very different. Therefore, it is necessary to extract name keywords (names, place name keywords) separately, which is conducive to improving the accuracy of obtaining reference knowledge content. In the code function module, there is often a large amount of English content, such as functions, interfaces, etc., so it is necessary to extract keywords of English content separately. Such keywords can be called foreign keywords.
[0126] In one embodiment, the above-mentioned determination of the second keyword similarity between the above-mentioned i-th updated knowledge content and the above-mentioned question information based on the non-semantic keywords in the word segmentation of the above-mentioned question information and the non-semantic keywords in the word segmentation corresponding to the above-mentioned i-th updated knowledge content includes: the computer device can obtain historical answer information of the question information, and determine the association between the question information and the above-mentioned name keywords and foreign keywords respectively according to the historical answer information; when the association between the historical answer information and the name keywords is greater than the association threshold, and the association between the historical answer information and the foreign keywords is less than or equal to the association threshold, if the question information is a conversational question and answer type, the computer device can determine the similarity between the name keywords in the question information and the name keywords in the i-th updated knowledge content as the second keyword similarity between the i-th updated knowledge content and the above-mentioned question information. When the correlation between the historical answer information and the name keyword is less than or equal to the correlation threshold, and the correlation between the historical answer information and the foreign keyword is greater than the correlation threshold, if the question information is of code type, the computer device can determine the similarity between the foreign keyword in the question information and the foreign keyword in the i-th updated knowledge content as the second keyword similarity between the i-th updated knowledge content and the above question information. When the correlation between the historical answer information and the name keyword is greater than the correlation threshold, and the correlation between the historical answer information and the foreign keyword is greater than the correlation threshold, if the question information is to query foreign travel information, the computer device can determine the sum of the similarity between the name keyword in the question information and the name keyword in the i-th updated knowledge content and the similarity between the foreign keyword in the question information and the foreign keyword in the i-th updated knowledge content as the second keyword similarity between the i-th updated knowledge content and the above question information. By considering different keywords in different scenarios, it is helpful to obtain the accuracy of the reference knowledge content.
[0127] In one embodiment, the correlation between the question information and the above-mentioned name keywords and foreign keywords is determined based on the historical answer information, including: the computer device can count the number of times the name keywords and foreign keywords appear in the historical answer information, and determine the correlation between the historical answer information and the name keywords based on the number of times the name keywords appear, and determine the correlation between the historical answer information and the foreign keywords based on the number of times the foreign keywords appear.
[0128] In one embodiment, the business features corresponding to the updated knowledge content also include the generation time of the updated knowledge content; the updated knowledge content associated with the business features corresponding to the question information is selected from the K updated knowledge contents as reference knowledge content according to the semantic similarity and word segmentation similarity respectively corresponding to the K updated knowledge contents, including: when the question information is highly correlated with the time information, such as when the question type of the question information is a text type (such as a conversation record question and answer), the computer device can obtain the time score of each updated knowledge content, and select the reference knowledge content based on the time score, semantic similarity, and word segmentation similarity. Specifically, the computer device can obtain the time interval between the generation time corresponding to the K updated knowledge contents and the current time, and determine the time scores corresponding to the K updated knowledge contents according to the time intervals respectively corresponding to the K updated knowledge contents. The time score, semantic similarity, and word segmentation similarity corresponding to the i-th updated knowledge content are summed to obtain the first information similarity between the i-th updated knowledge content and the question information; i is a positive integer less than or equal to K. The updated knowledge contents whose first information similarity is greater than a first similarity threshold among the K updated knowledge contents are determined as reference knowledge contents associated with the business feature corresponding to the question information.
[0129] The first similarity threshold may be determined according to the first information similarities respectively corresponding to the K updated knowledge contents and the number of reference knowledge contents, or the first similarity threshold may be preset.
[0130] Among them, there is a negative correlation between the time interval for updating knowledge content and the time score. The longer the time interval corresponding to the knowledge content update, the lower the time score of the updated knowledge content; the shorter the time interval corresponding to the knowledge content update, the higher the time score of the updated knowledge content.
[0131] In one embodiment, the above-mentioned selection of updated knowledge content associated with the business feature corresponding to the above-mentioned question information from the above-mentioned K updated knowledge content as reference knowledge content according to the semantic similarity and word segmentation similarity respectively corresponding to the above-mentioned K updated knowledge content includes: when the correlation between the question information and the time information is relatively weak, such as when the question type of the question information is a code type, the computing device can sum the semantic similarity and word segmentation similarity corresponding to the i-th updated knowledge content to obtain the second information similarity between the above-mentioned i-th updated knowledge content and the above-mentioned question information; i is a positive integer less than or equal to K. The updated knowledge content whose second information similarity among the above-mentioned K updated knowledge contents is greater than the second similarity threshold is determined as the reference knowledge content associated with the business feature corresponding to the above-mentioned question information.
[0132] The second similarity threshold may be determined according to the second information similarities respectively corresponding to the K updated knowledge contents and the number of reference knowledge contents, or the second similarity threshold may be preset.
[0133] For example, Figure 6 As shown, after obtaining the rough sorting result (i.e., K updated knowledge contents), the computer device can obtain the semantic similarity between the K updated knowledge contents and the question information according to the vector distance between the embedded feature vectors of the K updated knowledge contents and the embedded feature vector of the question information. Obtain the word segmentation of the question information and the word segmentation corresponding to the K updated knowledge contents respectively, and determine the word frequency similarity between the question information and the K updated knowledge contents according to the word frequency similarity algorithm. Extract semantic keywords and non-semantic keywords from the word segmentation of the question information and the word segmentation corresponding to the K updated knowledge contents respectively, match the semantic keywords in the question information and the semantic keywords corresponding to the K updated knowledge contents respectively, and obtain the first keyword similarity between the K updated knowledge contents and the question information respectively; match the non-semantic keywords in the question information and the non-semantic keywords corresponding to the K updated knowledge contents respectively, and obtain the second keyword similarity between the K updated knowledge contents and the question information respectively. According to the time interval between the generation time of the K updated knowledge contents and the current time, the K updated knowledge contents are sorted to obtain the time scores corresponding to the K updated knowledge contents respectively, and the time scores, first keyword similarity, second keyword similarity, word frequency similarity and semantic similarity corresponding to the K updated knowledge contents are weightedly summed to obtain the first information similarity corresponding to the K updated knowledge contents respectively, and the updated knowledge contents whose second information similarity among the above K updated knowledge contents is greater than the second similarity threshold are determined as reference knowledge contents associated with the business features corresponding to the above problem information, and the reference knowledge contents are used as the refined sorting results.
[0134] S208. Generate prompt information corresponding to the question and answer generation model based on the reference knowledge content and the question information, and generate answer information of the question information based on the prompt information through the question and answer generation model.
[0135] In one embodiment, the computer device can obtain a prompt information template corresponding to the question-answer generation model, wherein the prompt information template includes a content field and a question field, wherein the content field can be used to indicate the addition of reference knowledge content, and the question field can be used to indicate the addition of question information. Therefore, the computer device can add the above question information to the position corresponding to the question field in the above prompt information template; arrange the above reference knowledge content at the position corresponding to the content field in the above prompt information template, and obtain the prompt information corresponding to the above question-answer generation model.
[0136] The present application has at least the following beneficial effects: (1) A knowledge base with embedded feature vectors for storing updated knowledge content is created in advance for different question types. When it is necessary to generate answer information for question information, it is only necessary to search the knowledge base corresponding to the question type of the question information to obtain updated knowledge content that matches the question information as reference knowledge content. This is conducive to narrowing the search scope, improving search efficiency, and avoiding the problem that the reference knowledge content retrieved does not match the question information, thereby improving the accuracy of obtaining parameter knowledge content. (2) The reference knowledge content is obtained by multi-way recall of question information based on embedded feature vectors and business features, which is conducive to improving the recall accuracy, providing more accurate reference knowledge content for the generation process of question information, avoiding the problem that the answer information generated by the question-answer generation model does not match the question information, and improving the accuracy of answer information generation. (3) Through the question-answer generation model, answer information for question information is generated based on prompt information containing reference knowledge content, which is conducive to ensuring the timeliness of answer information and improving the accuracy of answer information generation.
[0137] See also Figure 7 , is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. Figure 7 As shown, the data processing device may include:
[0138] The acquisition module 711 is used to acquire the question information to be retrieved and the question type corresponding to the question information;
[0139] A determination module 712 is used to determine a knowledge base associated with the above-mentioned question type from the knowledge base cluster; the above-mentioned knowledge base includes an embedded feature vector corresponding to the updated knowledge content associated with the above-mentioned question type;
[0140] The first selection module 713 is used to select K updated knowledge contents associated with the embedded feature vector of the question information from the updated knowledge contents corresponding to the embedded feature vector in the knowledge base according to the embedded feature vector in the knowledge base; K is an integer greater than 1;
[0141] The second selection module 714 is used to select, from the K updated knowledge contents, updated knowledge contents associated with the business characteristics corresponding to the question information as reference knowledge contents according to the business characteristics corresponding to the K updated knowledge contents respectively;
[0142] The generation module 715 is used to generate prompt information corresponding to the question and answer generation model based on the above reference knowledge content and the above question information, and generate answer information of the above question information according to the above prompt information through the above question and answer generation model.
[0143] Optionally, the first selection module 713 is specifically configured to:
[0144] Determine the vector distance between the embedded feature vector of the question information and the embedded feature vector in the knowledge base;
[0145] From the above knowledge base, select K embedded feature vectors whose vector distance is less than the distance threshold;
[0146] According to the mapping relationship between the embedded feature vector and the updated knowledge content, determining the updated knowledge content having a mapping relationship with the K embedded feature vectors respectively;
[0147] The updated knowledge contents respectively having a mapping relationship with the K embedded feature vectors are determined as the K updated knowledge contents associated with the embedded feature vectors of the question information.
[0148] Optionally, the business features corresponding to the updated knowledge content include semantic features and segmentation of the updated knowledge content, and the business features corresponding to the question information include semantic features and segmentation of the question information;
[0149] Optionally, the second selection module 714 is specifically configured to:
[0150] Determine the semantic similarity between the question information and the K updated knowledge contents according to the semantic features of the question information and the semantic features corresponding to the K updated knowledge contents;
[0151] Determine the similarity between the word segmentation of the question information and the word segmentation of the K updated knowledge contents according to the word segmentation of the question information and the word segmentation of the K updated knowledge contents;
[0152] According to the semantic similarities and word segmentation similarities respectively corresponding to the K updated knowledge contents, updated knowledge contents associated with the business features corresponding to the question information are selected from the K updated knowledge contents as reference knowledge contents.
[0153] Optionally, the second selection module 714 is specifically configured to:
[0154] According to the word segmentation of the question information and the word segmentation corresponding to the i-th updated knowledge content, determine the word frequency similarity between the i-th updated knowledge content and the question information; i is a positive integer less than or equal to K;
[0155] Determine the first keyword similarity between the i-th updated knowledge content and the question information according to the semantic keywords in the segmented words of the question information and the semantic keywords in the segmented words corresponding to the i-th updated knowledge content;
[0156] Determine the second keyword similarity between the i-th updated knowledge content and the question information according to the non-semantic keywords in the word segmentation of the question information and the non-semantic keywords in the word segmentation corresponding to the i-th updated knowledge content;
[0157] The word frequency similarity corresponding to the i-th updated knowledge content, the first keyword similarity and the second keyword similarity are summed to obtain the word segmentation similarities between the question information and the K updated knowledge contents.
[0158] Optionally, the business characteristics corresponding to the updated knowledge content also include the generation time of the updated knowledge content;
[0159] Optionally, the second selection module 714 is specifically configured to:
[0160] Determine the time scores corresponding to the K updated knowledge contents respectively according to the time intervals between the generation times corresponding to the K updated knowledge contents respectively and the current time;
[0161] The time score, semantic similarity, and word segmentation similarity corresponding to the i-th updated knowledge content are summed to obtain the first information similarity between the i-th updated knowledge content and the question information; i is a positive integer less than or equal to K;
[0162] The updated knowledge contents whose first information similarity is greater than a first similarity threshold among the K updated knowledge contents are determined as reference knowledge contents associated with the business feature corresponding to the question information.
[0163] Optionally, the second selection module 714 is specifically configured to:
[0164] The semantic similarity and the word segmentation similarity corresponding to the i-th updated knowledge content are summed to obtain the second information similarity between the i-th updated knowledge content and the question information; i is a positive integer less than or equal to K;
[0165] The updated knowledge content whose second information similarity is greater than a second similarity threshold among the K updated knowledge content is determined as the reference knowledge content associated with the business feature corresponding to the question information.
[0166] Optionally, the device further includes an adding module 716;
[0167] Adding module 716, used to obtain the business data to be processed and the data type corresponding to the business data; the data type corresponds to a question type;
[0168] According to the above data types, the above business data is segmented to obtain L updated knowledge contents, and embedded feature vectors corresponding to the above L updated knowledge contents are generated respectively; L is an integer greater than 1;
[0169] The embedded feature vectors corresponding to the L updated knowledge contents are added to the knowledge base corresponding to the data type.
[0170] Optionally, add module 716, specifically for:
[0171] When the data type is a session type, extracting session fragments corresponding to N objects from the business data;
[0172] Segment the conversation segments corresponding to the N objects to obtain conversation sub-segments corresponding to the N objects.
[0173] According to the generation times of the session sub-segments of the N objects, adjacent m session sub-segments in the session sub-segments corresponding to the N objects are spliced to obtain L spliced session segments; m is an integer greater than 1;
[0174] Encode the L spliced conversation segments to obtain embedded feature vectors corresponding to the L spliced conversation segments respectively;
[0175] The L spliced conversation segments are determined as L updated knowledge contents, and the embedded feature vectors corresponding to the L spliced conversation segments are determined according to the embedded feature vectors corresponding to the L spliced conversation segments.
[0176] Optionally, add module 716, specifically for:
[0177] When the data type is a code type, the business data is divided into code segments corresponding to L functional modules respectively;
[0178] According to the original function description information corresponding to the j-th function module, an embedded feature vector corresponding to the j-th function module is generated; j is a positive integer less than or equal to L;
[0179] The code snippets corresponding to the L functional modules are determined as L updated knowledge contents, and the embedded feature vectors corresponding to the L updated knowledge contents are determined based on the embedded feature vectors corresponding to the L functional modules.
[0180] Optionally, add module 716, specifically for:
[0181] Performing the same semantic adjustment on the original function description information of the j-th function module to obtain the adjusted function description information of the j-th function module;
[0182] Generate an embedded feature vector of the original function description information of the j-th function module and an embedded feature vector of the adjusted function description information of the j-th function module;
[0183] The embedded feature vector of the original function description information of the j-th function module and the embedded feature vector of the adjusted function description information are determined as the embedded feature vector corresponding to the j-th function module.
[0184] Optionally, a generation module 715 is specifically used to obtain a prompt information template corresponding to the question-answer generation model;
[0185] Add the above question information to the position corresponding to the question field in the above prompt information template;
[0186] Arrange the above-mentioned reference knowledge content at the position corresponding to the content field in the above-mentioned prompt information template to obtain the prompt information corresponding to the above-mentioned question and answer generation model.
[0187] The present application has at least the following beneficial effects: (1) A knowledge base with embedded feature vectors for storing updated knowledge content is created in advance for different question types. When it is necessary to generate answer information for question information, it is only necessary to search the knowledge base corresponding to the question type of the question information to obtain updated knowledge content that matches the question information as reference knowledge content. This is conducive to narrowing the search scope, improving search efficiency, and avoiding the problem that the reference knowledge content retrieved does not match the question information, thereby improving the accuracy of obtaining parameter knowledge content. (2) The reference knowledge content is obtained by multi-way recall of question information based on embedded feature vectors and business features, which is conducive to improving the recall accuracy, providing more accurate reference knowledge content for the generation process of question information, avoiding the problem that the answer information generated by the question-answer generation model does not match the question information, and improving the accuracy of answer information generation. (3) Through the question-answer generation model, answer information for question information is generated based on prompt information containing reference knowledge content, which is conducive to ensuring the timeliness of answer information and improving the accuracy of answer information generation.
[0188] See also Figure 8 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 8As shown, the above-mentioned computer device 1000 may refer to a terminal or a server, including: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (DiSPlay), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatileMeMory), such as at least one disk storage. The memory 1005 may also be optionally at least one storage device away from the aforementioned processor 1001. As Figure 8 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a computer program.
[0189] exist Figure 8 In the computer device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the computer program stored in the memory 1005 to implement the steps in the various method embodiments of the present application.
[0190] The present application has at least the following beneficial effects: (1) A knowledge base with embedded feature vectors for storing updated knowledge content is created in advance for different question types. When it is necessary to generate answer information for question information, it is only necessary to search the knowledge base corresponding to the question type of the question information to obtain updated knowledge content that matches the question information as reference knowledge content. This is conducive to narrowing the search scope, improving search efficiency, and avoiding the problem that the reference knowledge content retrieved does not match the question information, thereby improving the accuracy of obtaining parameter knowledge content. (2) The reference knowledge content is obtained by multi-way recall of question information based on embedded feature vectors and business features, which is conducive to improving the recall accuracy, providing more accurate reference knowledge content for the generation process of question information, avoiding the problem that the answer information generated by the question-answer generation model does not match the question information, and improving the accuracy of answer information generation. (3) Through the question-answer generation model, answer information for question information is generated based on prompt information containing reference knowledge content, which is conducive to ensuring the timeliness of answer information and improving the accuracy of answer information generation.
[0191] It should be understood that the computer device described in the embodiments of the present application can execute the description of the above data processing method in the corresponding embodiments above, and can also execute the description of the above data processing device in the corresponding embodiments above, which will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated.
[0192] The collection and processing of relevant data in this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in practice, and the informed consent or separate consent of the personal information subject should be obtained, and subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0193] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing device mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the data processing method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0194] As an example, the above program instructions may be deployed on a computer device for execution, or deployed on at least two computer devices at one location for execution, or executed on at least two computer devices distributed at at least two locations and interconnected through a communication network. At least two computer devices distributed at at least two locations and interconnected through a communication network may constitute a blockchain network.
[0195] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the central storage unit of the computer device, such as a hard disk or a memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SMART Media card, SMC), a secure digital (Secure digital, SD) card, a flash memory card (flaSh card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the central storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0196] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish between contents in different media, rather than to describe a specific order. In addition, the terms "including" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other step units inherent to these processes, methods, devices, products, or equipment.
[0197] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0198] The collection and processing of relevant data in this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in practice, and the informed consent or separate consent of the personal information subject should be obtained, and subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0199] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the description of the above-mentioned data processing method and decoding method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the embodiment of the computer program product involved in the present application, please refer to the description of the method embodiment of the present application.
[0200] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0201] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network connection device to generate a machine, so that the instructions executed by the processor of the computer or other programmable network connection device generate instructions for implementing the process in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable network-connected device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable network connected device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0202] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, characterized in that: include: Obtaining question information to be retrieved and the question type corresponding to the question information; Determine a knowledge base associated with the question type from the knowledge base cluster; the knowledge base includes an embedded feature vector corresponding to the updated knowledge content associated with the question type; one knowledge base corresponds to one question type; According to the embedded feature vector in the knowledge base, K updated knowledge contents associated with the embedded feature vector of the question information are selected from the updated knowledge contents corresponding to the embedded feature vector in the knowledge base; K is an integer greater than 1; Determining the semantic similarity between the question information and the K updated knowledge contents according to the semantic features of the question information and the semantic features corresponding to the K updated knowledge contents; Determine the word frequency similarity between the i-th updated knowledge content and the question information according to the word segmentation of the question information and the word segmentation corresponding to the i-th updated knowledge content; i is a positive integer less than or equal to K; Determining a first keyword similarity between the i-th updated knowledge content and the question information according to the semantic keywords in the segmented words of the question information and the semantic keywords in the segmented words corresponding to the i-th updated knowledge content; Determine the relevance between the question information and the name keyword and the foreign keyword respectively according to the historical answer information of the question information; When the correlation between the historical answer information and the name keyword is greater than the correlation threshold, and the correlation between the historical answer information and the foreign keyword is less than or equal to the correlation threshold, the name keyword in the word segmentation of the question information and the name keyword in the word segmentation corresponding to the i-th updated knowledge content are used to determine the second keyword similarity between the i-th updated knowledge content and the question information; The word frequency similarity corresponding to the i-th updated knowledge content, the first keyword similarity and the second keyword similarity are summed to obtain the word segmentation similarities between the question information and the K updated knowledge contents respectively; Selecting, from the K updated knowledge contents, updated knowledge contents associated with the business features corresponding to the question information as reference knowledge contents according to the semantic similarities and word segmentation similarities respectively corresponding to the K updated knowledge contents; Prompt information corresponding to a question-answer generation model is generated according to the reference knowledge content and the question information, and answer information of the question information is generated according to the prompt information through the question-answer generation model.
2. The method according to claim 1, characterized in that The step of selecting, according to the embedded feature vector in the knowledge base, K updated knowledge contents associated with the embedded feature vector of the question information from the updated knowledge contents corresponding to the embedded feature vector in the knowledge base comprises: Determine a vector distance between an embedded feature vector of the question information and an embedded feature vector in the knowledge base; From the knowledge base, K embedded feature vectors whose vector distance is less than a distance threshold are selected; According to the mapping relationship between the embedded feature vector and the updated knowledge content, determining the updated knowledge content having a mapping relationship with the K embedded feature vectors respectively; The updated knowledge contents respectively having a mapping relationship with the K embedded feature vectors are determined as the K updated knowledge contents associated with the embedded feature vectors of the question information.
3. The method according to claim 1, characterized in that The business characteristics corresponding to the updated knowledge content also include the generation time of the updated knowledge content; The selecting, from the K updated knowledge contents, updated knowledge contents associated with the business features corresponding to the question information as reference knowledge contents according to the semantic similarities and word segmentation similarities respectively corresponding to the K updated knowledge contents, includes: Determine the time scores corresponding to the K updated knowledge contents respectively according to the time intervals between the generation times corresponding to the K updated knowledge contents respectively and the current time; The time score, semantic similarity, and word segmentation similarity corresponding to the i-th updated knowledge content are summed to obtain the first information similarity between the i-th updated knowledge content and the question information; i is a positive integer less than or equal to K; The updated knowledge contents whose first information similarity is greater than a first similarity threshold among the K updated knowledge contents are determined as reference knowledge contents associated with the business feature corresponding to the problem information.
4. The method according to claim 1, characterized in that The selecting, from the K updated knowledge contents, updated knowledge contents associated with the business features corresponding to the question information as reference knowledge contents according to the semantic similarities and word segmentation similarities respectively corresponding to the K updated knowledge contents, includes: The semantic similarity and the word segmentation similarity corresponding to the i-th updated knowledge content are summed to obtain the second information similarity between the i-th updated knowledge content and the question information; i is a positive integer less than or equal to K; The updated knowledge contents whose second information similarity is greater than a second similarity threshold among the K updated knowledge contents are determined as reference knowledge contents associated with the business feature corresponding to the question information.
5. The method according to claim 1, characterized in that The method further comprises: Acquire business data to be processed and a data type corresponding to the business data; the data type corresponds to a problem type; According to the data type, the business data is segmented to obtain L updated knowledge contents, and embedded feature vectors corresponding to the L updated knowledge contents are generated, where L is an integer greater than 1; The embedded feature vectors corresponding to the L updated knowledge contents are added to the knowledge base corresponding to the data type.
6. The method according to claim 5, characterized in that The step of segmenting the business data according to the data type to obtain L updated knowledge contents and generating embedded feature vectors corresponding to the L updated knowledge contents respectively includes: When the data type is a session type, extracting session fragments corresponding to N objects respectively from the business data; Segmenting the conversation segments corresponding to the N objects respectively to obtain conversation sub-segments corresponding to the N objects respectively; According to the generation times of the session sub-segments of the N objects, adjacent m session sub-segments in the session sub-segments corresponding to the N objects are spliced to obtain L spliced session segments; m is an integer greater than 1; Encoding the L spliced session segments to obtain embedded feature vectors corresponding to the L spliced session segments respectively; The L spliced conversation segments are determined as L updated knowledge contents, and the embedded feature vectors corresponding to the L spliced conversation segments are determined according to the embedded feature vectors corresponding to the L spliced conversation segments.
7. The method according to claim 5, characterized in that The step of segmenting the business data according to the data type to obtain L updated knowledge contents and generating embedded feature vectors corresponding to the L updated knowledge contents respectively includes: When the data type is a code type, the business data is divided into code segments corresponding to L functional modules respectively; Generate an embedded feature vector corresponding to the j-th functional module according to the original functional description information corresponding to the j-th functional module; j is a positive integer less than or equal to L; The code snippets corresponding to the L functional modules are determined as L updated knowledge contents, and the embedded feature vectors corresponding to the L updated knowledge contents are determined according to the embedded feature vectors corresponding to the L functional modules.
8. The method according to claim 7, characterized in that The step of generating an embedded feature vector corresponding to the j-th functional module according to the original functional description information corresponding to the j-th functional module comprises: Performing the same semantic adjustment on the original function description information of the j-th function module to obtain the adjusted function description information of the j-th function module; Generate an embedded feature vector of original function description information of the j-th function module and an embedded feature vector of adjusted function description information of the j-th function module; The embedded feature vector of the original function description information of the j-th function module and the embedded feature vector of the adjusted function description information are determined as the embedded feature vector corresponding to the j-th function module.
9. The method according to claim 1, characterized in that Generating prompt information corresponding to the question-answer generation model according to the reference knowledge content and the question information includes: Get the prompt information template corresponding to the question-answer generation model; Add the question information to the position corresponding to the question field in the prompt information template; The reference knowledge content is arranged at a position corresponding to the content field in the prompt information template to obtain prompt information corresponding to the question and answer generation model.
10. A data processing device, characterized in that: include: An acquisition module, used to acquire the question information to be retrieved and the question type corresponding to the question information; A determination module, used to determine a knowledge base associated with the question type from a knowledge base cluster; the knowledge base includes an embedded feature vector corresponding to the updated knowledge content associated with the question type; one knowledge base corresponds to one question type; A first selection module, configured to select, according to the embedded feature vector in the knowledge base, K updated knowledge contents associated with the embedded feature vector of the question information from the updated knowledge contents corresponding to the embedded feature vector in the knowledge base; K is an integer greater than 1; The second selection module is used to determine the semantic similarity between the question information and the K updated knowledge contents respectively according to the semantic features of the question information and the semantic features corresponding to the K updated knowledge contents respectively; determine the word frequency similarity between the i-th updated knowledge content and the question information according to the word segmentation of the question information and the word segmentation corresponding to the i-th updated knowledge content; i is a positive integer less than or equal to K; determine the first keyword similarity between the i-th updated knowledge content and the question information according to the semantic keywords in the word segmentation of the question information and the semantic keywords in the word segmentation corresponding to the i-th updated knowledge content; determine the association between the question information and the name keyword and the foreign keyword respectively according to the historical answer information of the question information; When the correlation between the historical answer information and the name keyword is greater than the correlation threshold, and the correlation between the historical answer information and the foreign keyword is less than or equal to the correlation threshold, the name keyword in the word segmentation of the question information and the name keyword in the word segmentation corresponding to the i-th updated knowledge content are used to determine the second keyword similarity between the i-th updated knowledge content and the question information; the word frequency similarity, the first keyword similarity and the second keyword similarity corresponding to the i-th updated knowledge content are summed to obtain the word segmentation similarities between the question information and the K updated knowledge contents respectively; according to the semantic similarities and word segmentation similarities corresponding to the K updated knowledge contents respectively, the updated knowledge contents associated with the business features corresponding to the question information are selected from the K updated knowledge contents as reference knowledge contents; A generation module is used to generate prompt information corresponding to a question-answer generation model based on the reference knowledge content and the question information, and to generate answer information of the question information based on the prompt information through the question-answer generation model.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
