Knowledge processing method and device combining user feedback and context learning

By combining user feedback and context learning knowledge processing methods, the problem of insufficient timeliness and generalization caused by the knowledge base update mechanism of large language model is solved, and the timeliness and scope of the knowledge base is improved.

CN119443248AActive Publication Date: 2025-02-14BEIJING DP TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411502361.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-02-14
Estimated Expiration
2044-10-25

AI Technical Summary

Technical Problem

The knowledge base update mechanism of the existing large language model leads to weakening of knowledge timeliness, and the knowledge retrieval mechanism is based on the maximum similarity, resulting in insufficient knowledge scope and insufficient generalization.

Method used

Combining the knowledge processing methods of user feedback and context learning, context knowledge learning is performed after receiving the instruction text input by the user, a knowledge sequence is generated, and input it into a large language model for task processing. Based on user satisfaction feedback on the generated text, knowledge extraction and update processing are carried out to ensure the timeliness and scope of the knowledge base.

Benefits of technology

Improve the timeliness and generalization of knowledge, expand the scope of knowledge, and ensure that the knowledge base matches the latest user feedback and context information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443248A_ABST
    Figure CN119443248A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a knowledge processing method and device combining user feedback and context learning. The method comprises the steps that a knowledge base used by a first-class large language model is marked as a first knowledge base; performing context knowledge learning according to an instruction text input by a user and the first knowledge base, inputting a knowledge sequence obtained by learning as instruction prompt text information and the instruction text into the first model for task processing, and outputting a corresponding generated text; when the user is satisfied with the current generated text, inputting the instruction text and the generated text into a knowledge extraction instruction template to perform instruction assembly, inputting the obtained instruction text into a first model to perform knowledge extraction, performing old knowledge record query on a knowledge base based on extracted knowledge, and identifying whether the obtained query record is null or not; if yes, adding knowledge to the knowledge base based on the extracted knowledge, and if not, updating the query record based on the extracted knowledge. According to the method, the timeliness and generalization of knowledge can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a knowledge processing method and device combining user feedback and context learning. Background Art

[0002] Large Language Models (LLMs) are widely used in a variety of natural language processing (NLP) tasks, such as translation tasks, question-answering tasks, etc. In order to improve the prediction accuracy of large language models, it is often necessary to configure a knowledge base for knowledge query. At present, most of the knowledge editing (addition, modification, etc.) methods for such knowledge bases are implemented by a regular batch update processing mechanism, and most of the knowledge retrieval methods for such knowledge bases are based on the maximum similarity between knowledge and query text. Through practical applications, we found that: 1) the conventional batch update mechanism will lead to a weakening of the timeliness of knowledge; 2) the conventional maximum similarity retrieval mechanism will lead to insufficient knowledge scope and insufficient generalization. Summary of the invention

[0003] The purpose of the present invention is to address the defects of the prior art and provide a knowledge processing method, device, electronic device and computer-readable storage medium that combine user feedback and context learning. The present invention records any type of large language model that uses a knowledge base in the process of knowledge reasoning and has completed model pre-training and directional field fine-tuning as a first model; and constructs a corresponding collection knowledge set based on the continuously collected knowledge information, and regularly performs batch knowledge addition and update processing on the knowledge base according to the collected knowledge set; and after receiving the first instruction text (translation or question-answering instruction text) input by the user, firstly performs context knowledge learning according to the first instruction text and the knowledge base to obtain a knowledge sequence, and then inputs the knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform corresponding translation or question-answering task processing to obtain the corresponding first generated text and feed it back to the current user, and then identifies the first generated text when receiving user satisfaction feedback on the first generated text, and if satisfied, inputs the first instruction text and the first generated text into a knowledge extraction instruction template to perform knowledge extraction instruction assembly to obtain a second instruction text, and then inputs the second instruction text into the first model to perform knowledge extraction processing to obtain extracted knowledge, and then queries the old knowledge records matching the extracted knowledge in the knowledge base, and if the old knowledge records matching therewith exist, the old knowledge records are updated based on the extracted knowledge, and if the old knowledge records matching therewith do not exist, knowledge addition is performed to the knowledge base based on the extracted knowledge. The present invention can improve the timeliness of knowledge, expand the scope of knowledge, and improve the generalization of knowledge.

[0004] To achieve the above objectives, a first aspect of an embodiment of the present invention provides a knowledge processing method combining user feedback and context learning, the method comprising:

[0005] Any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and directional domain fine-tuning is recorded as the corresponding first model; and the knowledge base used by the first model is recorded as the corresponding first knowledge base;

[0006] Receive the translation or question-answering instruction text input by the user as the corresponding first instruction text; perform contextual knowledge learning processing based on the first instruction text and the first knowledge base to obtain the corresponding first knowledge sequence; input the first knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform the corresponding translation or question-answering task processing and feed back the translation or answer text generated by the model as the corresponding first generated text to the current user;

[0007] receiving satisfaction feedback of the current user on the first generated text as a corresponding first satisfaction; and when the first satisfaction is satisfactory, inputting the first instruction text and the first generated text into a preset knowledge extraction instruction template to perform corresponding knowledge extraction instruction assembly to obtain a corresponding second instruction text; and inputting the second instruction text into the first model to perform corresponding knowledge extraction processing to obtain corresponding first extracted knowledge; the first satisfaction includes satisfaction and dissatisfaction;

[0008] Based on the first extracted knowledge, the first knowledge base is queried for old knowledge records to obtain a corresponding first query record; and whether the first query record is empty is identified; if so, knowledge addition processing is performed on the first knowledge base based on the first extracted knowledge; if not, knowledge update processing is performed on the first query record based on the first extracted knowledge.

[0009] Preferably, the first knowledge base is composed of a plurality of first knowledge records; each of the first knowledge records includes a first knowledge purpose, a first knowledge subject, a first knowledge content, a first coding vector, a second coding vector and a first update time; the first knowledge purpose includes at least translation and question-answering; the first and second coding vectors are respectively the embedded coding vectors of the corresponding first knowledge subject and the first knowledge content, and the embedded coding rules corresponding to the first and second coding vectors are both preset first embedded coding rules; the first embedded coding rules include at least N-gram coding rules and Word2vec coding rules;

[0010] The knowledge extraction instruction template is a formatting template; the knowledge extraction instruction template is used to record the input instruction text and the generated text as the corresponding current instruction text and the current generated text, and sequentially splice the current instruction text and the current generated text to obtain the corresponding current spliced ​​text, and inform the first model through a narrative natural language text to perform knowledge extraction processing on the current spliced ​​text in a formatted extraction method of knowledge subject-knowledge content, and to form the corresponding current extracted knowledge from the extracted subject text and content text, and output the current extracted knowledge as the corresponding model generated text;

[0011] The first extracted knowledge includes a first subject text and a first content text.

[0012] Preferably, the performing context knowledge learning processing according to the first instruction text and the first knowledge base to obtain the corresponding first knowledge sequence specifically includes:

[0013] Step 31, taking the translation or question-answering task type corresponding to the first instruction text as the corresponding current knowledge usage;

[0014] Wherein, the current knowledge usage includes translation and question answering;

[0015] Step 32, based on the first embedded coding rule, the first instruction text is embedded and coded to obtain the corresponding current coding vector; and the first knowledge records in the first knowledge base whose vector similarity with the current coding vector exceeds a preset first similarity threshold are extracted to form a corresponding first record set; and the total number of records in the first record set is counted to obtain a corresponding first total number N; and the vector similarity corresponding to each of the first knowledge records in the first record set is recorded as the corresponding first similarity d i , 1≤i≤N;

[0016] Step 33: calculate the first task weight wa corresponding to each of the first knowledge records in the first record set that matches the first knowledge usage with the current knowledge usage. i Set as the preset related task weight coefficient wa high ; and the first task weight wa corresponding to each of the first knowledge records in the first record set whose first knowledge usage does not match the current knowledge usage i Set to the preset irrelevant task weight coefficient wa low ;

[0017] Among them, the irrelevant task weight coefficient wa low <Related task weight coefficient wa high ;

[0018] Step 34, extract the earliest and latest first update time in the first record set to form a corresponding first time period; identify the time period length of the first time period to obtain the corresponding first time period length L; and calculate the time difference between the first update time of each first knowledge record and the start time of the first time period to obtain the corresponding first time difference △t i , and based on each of the first time differences △t i The first time weight wb corresponding to the first time period length L is calculated i =△t i / L;

[0019] Step 35, the first similarity d corresponding to each of the first knowledge records in the first record set is i 、The first task weight wa i and the first time weight wb i Calculate the corresponding first knowledge weight

[0020] Step 36: extract the first knowledge subject and the first knowledge content of each of the first knowledge records in the first record set to form a corresponding first learning knowledge c i ; and according to the first knowledge weight kw i The first learned knowledge c is sorted from low to high i Sorting is performed to obtain the corresponding first knowledge sequence.

[0021] Preferably, the querying of the first knowledge base for old knowledge records based on the first extracted knowledge to obtain the corresponding first query record specifically includes:

[0022] Step 41, taking the translation or question-answering task type corresponding to the first instruction text corresponding to the first extracted knowledge as the corresponding current knowledge usage;

[0023] Step 42, performing embedding coding processing on the first knowledge subject of the first extracted knowledge based on the first embedding coding rule to obtain a corresponding current coding vector;

[0024] Step 43, extracting the first knowledge records in the first knowledge base whose first knowledge usage matches the current knowledge usage and whose vector similarity between the first encoding vector and the current encoding vector exceeds a preset second similarity threshold to form a corresponding second record set;

[0025] Wherein, the first similarity threshold < the second similarity threshold;

[0026] Step 44, identifying whether the second record set is empty; if so, setting the corresponding first query record to empty; if not, extracting the first knowledge record with the greatest similarity in the second record set as the corresponding first query record.

[0027] Preferably, the step of adding knowledge to the first knowledge base based on the first extracted knowledge specifically includes:

[0028] The translation or question-and-answer task type corresponding to the first instruction text corresponding to the first extracted knowledge is taken as the corresponding first knowledge purpose; and the first subject text and the first content text of the first extracted knowledge are taken as the corresponding first knowledge subject and the first knowledge content; and based on the first embedded coding rule, the first knowledge subject and the first knowledge content obtained this time are respectively embedded and coded to obtain the corresponding first coding vector and the second coding vector; and the current time is taken as the corresponding first update time; and the first knowledge purpose, the first knowledge subject, the first knowledge content, the first coding vector, the second coding vector and the first update time obtained this time form a corresponding first knowledge record and add it to the first knowledge base.

[0029] Preferably, the performing knowledge updating processing on the first query record based on the first extracted knowledge specifically includes:

[0030] The first content text of the first extracted knowledge is used as the corresponding updated content; and the updated content is embedded and encoded based on the first embedded coding rule to obtain the corresponding updated vector; and the current time is used as the corresponding updated time; and the first knowledge content, the second coding vector and the first update time of the first query record are updated to the corresponding updated content, the updated vector and the updated time.

[0031] Preferably, the method further comprises:

[0032] Continuously collect knowledge information and construct a corresponding first collected knowledge set based on the collected information; and regularly perform batch knowledge addition and update processing on the first knowledge base according to the first collected knowledge set.

[0033] A second aspect of an embodiment of the present invention provides a device for implementing the knowledge processing method combining user feedback and context learning as described in the first aspect, the device comprising: a knowledge base selection module, a knowledge retrieval module, a knowledge extraction module and a knowledge base update module;

[0034] The knowledge base selection module is used to record any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and directional domain fine-tuning as a corresponding first model; and record the knowledge base used by the first model as the corresponding first knowledge base;

[0035] The knowledge retrieval module is used to receive a translation or question-answering instruction text input by a user as a corresponding first instruction text; and perform contextual knowledge learning processing based on the first instruction text and the first knowledge base to obtain a corresponding first knowledge sequence; and input the first knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform corresponding translation or question-answering task processing and feed back the translation or answer text generated by the model as the corresponding first generated text to the current user;

[0036] The knowledge extraction module is used to receive the satisfaction feedback of the current user on the first generated text as the corresponding first satisfaction; and when the first satisfaction is satisfied, the first instruction text and the first generated text are input into a preset knowledge extraction instruction template to perform corresponding knowledge extraction instruction assembly to obtain a corresponding second instruction text; and the second instruction text is input into the first model to perform corresponding knowledge extraction processing to obtain corresponding first extracted knowledge; the first satisfaction includes satisfied and dissatisfied;

[0037] The knowledge base update module is used to perform old knowledge record query on the first knowledge base based on the first extracted knowledge to obtain the corresponding first query record; and to identify whether the first query record is empty; if so, perform knowledge addition processing on the first knowledge base based on the first extracted knowledge; if not, perform knowledge update processing on the first query record based on the first extracted knowledge.

[0038] A third aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;

[0039] The processor is used to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;

[0040] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

[0041] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect above.

[0042] The embodiments of the present invention provide a knowledge processing method, device, electronic device and computer-readable storage medium that combine user feedback and contextual learning. As can be seen from the above content, the embodiments of the present invention record any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and directional field fine-tuning as the first model; and construct a corresponding collection knowledge set based on the continuously collected knowledge information, and regularly perform batch knowledge addition and update processing on the knowledge base based on the collected knowledge set; and after receiving the first instruction text (translation or question-and-answer instruction text) input by the user, first perform contextual knowledge learning based on the first instruction text and the knowledge base to obtain a knowledge sequence, and then input the knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform the corresponding translation or question-and-answer task. The service processing obtains the corresponding first generated text and feeds back to the current user, and then identifies it when receiving the user's satisfaction feedback on the first generated text. If satisfied, the first instruction text and the first generated text are input into the knowledge extraction instruction template to assemble the knowledge extraction instruction to obtain the second instruction text, and then the second instruction text is input into the first model to perform knowledge extraction processing to obtain extracted knowledge, and then the old knowledge records matching the extracted knowledge in the knowledge base are queried. If the matching old knowledge records exist, the old knowledge records are updated based on the extracted knowledge. If the matching old knowledge records do not exist, knowledge is added to the knowledge base based on the extracted knowledge. The embodiments of the present invention not only improve the timeliness of knowledge, but also expand the scope of knowledge and improve the generalization of knowledge. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of a knowledge processing method combining user feedback and context learning provided in the first embodiment of the present invention;

[0044] Figure 2 A module structure diagram of a knowledge processing device combining user feedback and context learning provided in the second embodiment of the present invention;

[0045] Figure 3 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] Embodiment 1 of the present invention provides a knowledge processing method combining user feedback and context learning, such as Figure 1As shown in the schematic diagram of a knowledge processing method combining user feedback and context learning provided in the first embodiment of the present invention, the method mainly includes the following steps:

[0048] Step 1: any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and directional domain fine-tuning is recorded as the corresponding first model; and the knowledge base used by the first model is recorded as the corresponding first knowledge base.

[0049] Here, the first model of the embodiment of the present invention is any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and targeted domain fine-tuning, which should at least include common BERT series models, BART series models, GPT series models, T5 series models, Wenxin series models, etc., and may also include large language models that meet other specific application requirements.

[0050] The first knowledge base of the embodiment of the present invention is composed of multiple first knowledge records; each first knowledge record includes a first knowledge purpose, a first knowledge topic, a first knowledge content, a first coding vector, a second coding vector and a first update time; the first knowledge purpose includes at least translation and question and answer; the first and second coding vectors are respectively embedded coding vectors of the corresponding first knowledge topic and first knowledge content, and the embedded coding rules corresponding to the first and second coding vectors are both preset first embedded coding rules; the first embedded coding rules include at least N-gram coding rules and Word2vec coding rules.

[0051] Step 2, receiving the translation or question-answering instruction text input by the user as the corresponding first instruction text; performing contextual knowledge learning processing according to the first instruction text and the first knowledge base to obtain the corresponding first knowledge sequence; and inputting the first knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform the corresponding translation or question-answering task processing and feeding back the translation or answer text generated by the model as the corresponding first generated text to the current user;

[0052] Specifically, it includes: step 21, receiving a translation or question-and-answer instruction text input by a user as a corresponding first instruction text;

[0053] Step 22, performing context knowledge learning processing according to the first instruction text and the first knowledge base to obtain a corresponding first knowledge sequence;

[0054] Specifically, it includes: step 221, taking the translation or question-answering task type corresponding to the first instruction text as the corresponding current knowledge usage;

[0055] Among them, current knowledge uses include translation and question-answering;

[0056] Step 222, based on the first embedded coding rule, the first instruction text is embedded and coded to obtain the corresponding current coding vector; and the first knowledge records whose vector similarity between the first or second coding vector in the first knowledge base and the current coding vector exceeds the preset first similarity threshold are extracted to form a corresponding first record set; and the total number of records in the first record set is counted to obtain the corresponding first total number N; and the vector similarity corresponding to each first knowledge record in the first record set is recorded as the corresponding first similarity d i , 1≤i≤N;

[0057] Wherein, the first similarity threshold is a preset threshold parameter;

[0058] Step 223: calculate the first task weight wa corresponding to each first knowledge record in the first record set that matches the first knowledge usage with the current knowledge usage. i Set as the preset related task weight coefficient wa high ; and the first task weight wa corresponding to each first knowledge record in the first record set that does not match the current knowledge usage i Set to the preset irrelevant task weight coefficient wa low ;

[0059] Among them, the irrelevant task weight coefficient wa low , weight coefficient of related tasks wa high are two pre-set weight coefficients, and 0 < irrelevant task weight coefficient wa low <Related task weight coefficient wa high ≤1;

[0060] Step 224, extract the earliest and latest first update time in the first record set to form a corresponding first time period; identify the time period length of the first time period to obtain the corresponding first time period length L; and calculate the time difference between the first update time of each first knowledge record and the start time of the first time period to obtain the corresponding first time difference △t i , and based on each first time difference △t i The first time weight wb corresponding to the first time period length L is calculated i =△t i / L;

[0061] Here, each first time weight is actually a normalized time weight;

[0062] Step 225, the first similarity d corresponding to each first knowledge record in the first record set is i , the first task weight wa i and the first time weight wb i Calculate the corresponding first knowledge weight

[0063] Here, the first knowledge weight is actually a normalized knowledge weight. The greater the relevance to the instruction text content (the higher the similarity), the greater the first knowledge weight; the better the task relevance (the greater the task weight), the greater the first knowledge weight; the better the timeliness (the greater the time weight), the greater the first knowledge weight;

[0064] Step 226: extract the first knowledge subject and the first knowledge content of each first knowledge record in the first record set to form the corresponding first learning knowledge c i ; and according to the first knowledge weight kw i The N first learning knowledge c is sorted from low to high i Sorting to obtain a corresponding first knowledge sequence;

[0065] Here, from the above steps 221-226, it can be seen that the embodiment of the present invention expands the knowledge scope and improves the generalization of knowledge by expanding the number of knowledge items when performing knowledge retrieval, and refines the degree of association between the sequence knowledge items and the instruction text through multiple types of weights (similarity, task weight, time weight);

[0066] Step 23, the first knowledge sequence is input as instruction prompt text information together with the first instruction text into the first model for corresponding translation or question-answering task processing, and the translation or answer text generated by the model is fed back to the current user as the corresponding first generated text.

[0067] Step 3, receiving the satisfaction feedback of the current user on the first generated text as the corresponding first satisfaction; and when the first satisfaction is satisfactory, inputting the first instruction text and the first generated text into a preset knowledge extraction instruction template to perform corresponding knowledge extraction instruction assembly to obtain the corresponding second instruction text; and inputting the second instruction text into the first model to perform corresponding knowledge extraction processing to obtain the corresponding first extracted knowledge;

[0068] Specifically, it includes: step 31, receiving satisfaction feedback of the current user on the first generated text as the corresponding first satisfaction;

[0069] Among them, the first satisfaction includes satisfaction and dissatisfaction;

[0070] Step 32, when the first satisfaction level is satisfactory, inputting the first instruction text and the first generated text into a preset knowledge extraction instruction template to perform corresponding knowledge extraction instruction assembly to obtain a corresponding second instruction text;

[0071] Here, the knowledge extraction instruction template of the embodiment of the present invention is a formatting template; the knowledge extraction instruction template is used to record the input instruction text and the generated text as the corresponding current instruction text and the current generated text, and sequentially splice the current instruction text and the current generated text to obtain the corresponding current spliced ​​text, and inform the first model through a narrative natural language text to perform knowledge extraction processing on the current spliced ​​text according to the formatted extraction method of knowledge subject-knowledge content, and to form the corresponding current extracted knowledge from the extracted subject text and content text, and output the current extracted knowledge as the corresponding model generated text;

[0072] Step 33, input the second instruction text into the first model to perform corresponding knowledge extraction processing to obtain corresponding first extracted knowledge;

[0073] The first extracted knowledge includes a first subject text and a first content text.

[0074] Step 4: perform old knowledge record query on the first knowledge base based on the first extracted knowledge to obtain the corresponding first query record; and identify whether the first query record is empty; if so, perform knowledge addition processing on the first knowledge base based on the first extracted knowledge; if not, perform knowledge update processing on the first query record based on the first extracted knowledge;

[0075] Specifically, it includes: step 41, performing old knowledge record query on the first knowledge base based on the first extracted knowledge to obtain a corresponding first query record;

[0076] Specifically, it includes: step 411, taking the translation or question-answering task type corresponding to the first instruction text corresponding to the first extracted knowledge as the corresponding current knowledge usage;

[0077] Step 412, performing embedding coding processing on the first knowledge subject of the first extracted knowledge based on the first embedding coding rule to obtain a corresponding current coding vector;

[0078] Step 413, extracting first knowledge records in the first knowledge base whose first knowledge usage matches the current knowledge usage and whose first encoding vector and the current encoding vector have a vector similarity exceeding a preset second similarity threshold to form a corresponding second record set;

[0079] Here, the second similarity threshold is a preset threshold parameter, and the first similarity threshold < the second similarity threshold;

[0080] Step 414, identifying whether the second record set is empty; if so, setting the corresponding first query record to be empty; if not, extracting the first knowledge record with the greatest similarity in the second record set as the corresponding first query record;

[0081] Step 42, identifying whether the first query record is empty;

[0082] Step 43: if the first query record is empty, then performing knowledge addition processing on the first knowledge base based on the first extracted knowledge;

[0083] Specifically, it includes: taking the translation or question-answering task type corresponding to the first instruction text corresponding to the first extracted knowledge as the corresponding first knowledge purpose; taking the first subject text and the first content text of the first extracted knowledge as the corresponding first knowledge subject and the first knowledge content; and based on the first embedding coding rule, respectively performing embedding coding processing on the first knowledge subject and the first knowledge content obtained this time to obtain the corresponding first coding vector and the second coding vector; and taking the current time as the corresponding first update time; and forming a corresponding first knowledge record with the first knowledge purpose, the first knowledge subject, the first knowledge content, the first coding vector, the second coding vector and the first update time obtained this time to add to the first knowledge base;

[0084] Step 44: if the first query record is not empty, then perform knowledge update processing on the first query record based on the first extracted knowledge;

[0085] Specifically, it includes: taking the first content text of the first extracted knowledge as the corresponding updated content; and embedding and encoding the updated content based on the first embedded coding rule to obtain the corresponding updated vector; and taking the current time as the corresponding updated time; and updating the first knowledge content, the second coding vector and the first update time of the first query record to the corresponding updated content, the updated vector and the updated time.

[0086] Here, from the above steps 41-44, it can be known that the embodiment of the present invention can perform a corresponding knowledge extraction after each text generation process that satisfies the user feedback in the large language model, i.e., the first model, and can perform a knowledge update when the extracted knowledge does not match the old knowledge in the knowledge base, or perform a knowledge addition when the extracted knowledge does not exist in the knowledge base; thereby, the timeliness of the knowledge base can be timely and effectively improved under the premise of combining user feedback.

[0087] It should also be noted that the embodiment of the present invention is also compatible with conventional batch update mechanisms, that is: the embodiment of the present invention will continuously collect knowledge information and build a corresponding first collected knowledge set based on the collected information, and regularly perform batch knowledge addition and update processing on the first knowledge base based on the first collected knowledge set.

[0088] Figure 2This is a module structure diagram of a knowledge processing device that combines user feedback and context learning provided in the second embodiment of the present invention. The device is a terminal device or server that implements the aforementioned method embodiment, and can also be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiment. For example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 2 As shown, the device includes: a knowledge base selection module 201, a knowledge retrieval module 202, a knowledge extraction module 203 and a knowledge base update module 204.

[0089] The knowledge base selection module 201 is used to record any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and directional domain fine-tuning as the corresponding first model; and record the knowledge base used by the first model as the corresponding first knowledge base.

[0090] The knowledge retrieval module 202 is used to receive the translation or question-and-answer instruction text input by the user as the corresponding first instruction text; and perform contextual knowledge learning processing based on the first instruction text and the first knowledge base to obtain the corresponding first knowledge sequence; and input the first knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform corresponding translation or question-and-answer task processing and feed back the translation or answer text generated by the model as the corresponding first generated text to the current user.

[0091] The knowledge extraction module 203 is used to receive the satisfaction feedback of the current user on the first generated text as the corresponding first satisfaction; and when the first satisfaction is satisfied, the first instruction text and the first generated text are input into the preset knowledge extraction instruction template to perform corresponding knowledge extraction instruction assembly to obtain the corresponding second instruction text; and the second instruction text is input into the first model to perform corresponding knowledge extraction processing to obtain the corresponding first extracted knowledge; the first satisfaction includes satisfaction and dissatisfaction.

[0092] The knowledge base update module 204 is used to perform old knowledge record query on the first knowledge base based on the first extracted knowledge to obtain the corresponding first query record; and to identify whether the first query record is empty; if so, perform knowledge addition processing on the first knowledge base based on the first extracted knowledge; if not, perform knowledge update processing on the first query record based on the first extracted knowledge.

[0093] An embodiment of the present invention provides a knowledge processing device that combines user feedback and context learning, which can execute the method steps in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0094] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the knowledge base selection module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above determination module. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0095] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0096] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the above method embodiments are generated. The above computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above-mentioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the above-mentioned computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, Bluetooth, microwave, etc.) methods. The above-mentioned computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The above-mentioned available medium can be a magnetic medium (such as a floppy disk, a hard disk, a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0097] Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device may be a terminal device or a server for implementing the method of the aforementioned embodiment, or may be a terminal device or a server for implementing the method of the aforementioned embodiment connected to the aforementioned terminal device or server. Figure 3 As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303. Various instructions may be stored in the memory 302 to complete various processing functions and implement the processing steps described in the aforementioned embodiment method. Preferably, the electronic device involved in the embodiment of the present invention also includes: a power supply 304, a system bus 305 and a communication port 306. The system bus 305 is used to realize the communication connection between components. The above-mentioned communication port 306 is used for connecting and communicating between the electronic device and other peripherals.

[0098] exist Figure 3The system bus 305 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory (Non-Volatile Memory), such as at least one disk storage.

[0099] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (Network Processor, NP), a graphics processing unit (Graphics Processing Unit, GPU), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0100] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method and processing process provided in the above embodiments.

[0101] The embodiments of the present invention provide a knowledge processing method, device, electronic device and computer-readable storage medium that combine user feedback and contextual learning. As can be seen from the above content, the embodiments of the present invention record any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and directional field fine-tuning as the first model; and construct a corresponding collection knowledge set based on the continuously collected knowledge information, and regularly perform batch knowledge addition and update processing on the knowledge base based on the collected knowledge set; and after receiving the first instruction text (translation or question-and-answer instruction text) input by the user, first perform contextual knowledge learning based on the first instruction text and the knowledge base to obtain a knowledge sequence, and then input the knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform the corresponding translation or question-and-answer task. The service processing obtains the corresponding first generated text and feeds back to the current user, and then identifies it when receiving the user's satisfaction feedback on the first generated text. If satisfied, the first instruction text and the first generated text are input into the knowledge extraction instruction template to assemble the knowledge extraction instruction to obtain the second instruction text, and then the second instruction text is input into the first model to perform knowledge extraction processing to obtain extracted knowledge, and then the old knowledge records matching the extracted knowledge in the knowledge base are queried. If the matching old knowledge records exist, the old knowledge records are updated based on the extracted knowledge. If the matching old knowledge records do not exist, knowledge is added to the knowledge base based on the extracted knowledge. The embodiments of the present invention not only improve the timeliness of knowledge, but also expand the scope of knowledge and improve the generalization of knowledge.

[0102] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0103] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A knowledge processing method combining user feedback and contextual learning, characterized in that: The method comprises: Any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and directional domain fine-tuning is recorded as the corresponding first model; and the knowledge base used by the first model is recorded as the corresponding first knowledge base; Receive the translation or question-answering instruction text input by the user as the corresponding first instruction text; perform contextual knowledge learning processing based on the first instruction text and the first knowledge base to obtain the corresponding first knowledge sequence; input the first knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform the corresponding translation or question-answering task processing and feed back the translation or answer text generated by the model as the corresponding first generated text to the current user; receiving satisfaction feedback of the current user on the first generated text as a corresponding first satisfaction; and when the first satisfaction is satisfactory, inputting the first instruction text and the first generated text into a preset knowledge extraction instruction template to perform corresponding knowledge extraction instruction assembly to obtain a corresponding second instruction text; and inputting the second instruction text into the first model to perform corresponding knowledge extraction processing to obtain corresponding first extracted knowledge; the first satisfaction includes satisfaction and dissatisfaction; Based on the first extracted knowledge, the first knowledge base is queried for old knowledge records to obtain a corresponding first query record; and whether the first query record is empty is identified; if so, knowledge addition processing is performed on the first knowledge base based on the first extracted knowledge; if not, knowledge update processing is performed on the first query record based on the first extracted knowledge.

2. The knowledge processing method combining user feedback and context learning according to claim 1, characterized in that: The first knowledge base is composed of a plurality of first knowledge records; each of the first knowledge records includes a first knowledge purpose, a first knowledge subject, a first knowledge content, a first encoding vector, a second encoding vector and a first update time; The first knowledge usage includes at least translation and question-answering; the first and second coding vectors are respectively the embedding coding vectors of the corresponding first knowledge subject and the first knowledge content, and the embedding coding rules corresponding to the first and second coding vectors are both preset first embedding coding rules; the first embedding coding rules include at least N-gram coding rules and Word2vec coding rules; The knowledge extraction instruction template is a formatting template; The knowledge extraction instruction template is used to record the input instruction text and the generated text as the corresponding current instruction text and the current generated text, and sequentially splice the current instruction text and the current generated text to obtain the corresponding current spliced ​​text, and inform the first model through a narrative natural language text to perform knowledge extraction processing on the current spliced ​​text according to the formatted extraction method of knowledge subject-knowledge content, and to form the corresponding current extracted knowledge with the extracted subject text and content text, and output the current extracted knowledge as the corresponding model generated text; The first extracted knowledge includes a first subject text and a first content text.

3. The knowledge processing method combining user feedback and context learning according to claim 2, characterized in that: The performing context knowledge learning processing according to the first instruction text and the first knowledge base to obtain the corresponding first knowledge sequence specifically includes: Step 31, taking the translation or question-answering task type corresponding to the first instruction text as the corresponding current knowledge usage; Wherein, the current knowledge usage includes translation and question answering; Step 32, based on the first embedded coding rule, the first instruction text is embedded and coded to obtain the corresponding current coding vector; and the first knowledge records in the first knowledge base whose vector similarity with the current coding vector exceeds a preset first similarity threshold are extracted to form a corresponding first record set; and the total number of records in the first record set is counted to obtain a corresponding first total number N; and the vector similarity corresponding to each of the first knowledge records in the first record set is recorded as the corresponding first similarity d i , 1≤i≤N; Step 33: calculate the first task weight wa corresponding to each of the first knowledge records in the first record set that matches the first knowledge usage with the current knowledge usage. i Set as the preset related task weight coefficient wa high ; and the first task weight wa corresponding to each of the first knowledge records in the first record set whose first knowledge usage does not match the current knowledge usage i Set to the preset irrelevant task weight coefficient wa low ; Among them, the irrelevant task weight coefficient wa low <Related task weight coefficient wa high ; Step 34, extract the earliest and latest first update time in the first record set to form a corresponding first time period; identify the time period length of the first time period to obtain the corresponding first time period length L; and calculate the time difference between the first update time of each first knowledge record and the start time of the first time period to obtain the corresponding first time difference △t i , and based on each of the first time differences △t i The first time weight wb corresponding to the first time period length L is calculated i =△t i / L; Step 35, the first similarity d corresponding to each of the first knowledge records in the first record set is i 、The first task weight wa i and the first time weight wb i Calculate the corresponding first knowledge weight Step 36: extract the first knowledge subject and the first knowledge content of each of the first knowledge records in the first record set to form a corresponding first learning knowledge c i ; and according to the first knowledge weight kw i The first learned knowledge c is sorted from low to high i Sorting is performed to obtain the corresponding first knowledge sequence.

4. The knowledge processing method combining user feedback and context learning according to claim 2, characterized in that: The querying of the first knowledge base for old knowledge records based on the first extracted knowledge to obtain a corresponding first query record specifically includes: Step 41, taking the translation or question-answering task type corresponding to the first instruction text corresponding to the first extracted knowledge as the corresponding current knowledge usage; Step 42, performing embedding coding processing on the first knowledge subject of the first extracted knowledge based on the first embedding coding rule to obtain a corresponding current coding vector; Step 43, extracting the first knowledge records in the first knowledge base whose first knowledge usage matches the current knowledge usage and whose vector similarity between the first encoding vector and the current encoding vector exceeds a preset second similarity threshold to form a corresponding second record set; Wherein, the first similarity threshold < the second similarity threshold; Step 44, identifying whether the second record set is empty; if so, setting the corresponding first query record to empty; if not, extracting the first knowledge record with the greatest similarity in the second record set as the corresponding first query record.

5. The knowledge processing method combining user feedback and context learning according to claim 2, characterized in that: The performing knowledge addition processing on the first knowledge base based on the first extracted knowledge specifically includes: The translation or question-and-answer task type corresponding to the first instruction text corresponding to the first extracted knowledge is taken as the corresponding first knowledge purpose; and the first subject text and the first content text of the first extracted knowledge are taken as the corresponding first knowledge subject and the first knowledge content; and based on the first embedded coding rule, the first knowledge subject and the first knowledge content obtained this time are respectively embedded and coded to obtain the corresponding first coding vector and the second coding vector; and the current time is taken as the corresponding first update time; and the first knowledge purpose, the first knowledge subject, the first knowledge content, the first coding vector, the second coding vector and the first update time obtained this time form a corresponding first knowledge record and add it to the first knowledge base.

6. The knowledge processing method combining user feedback and context learning according to claim 2, characterized in that: The performing knowledge updating processing on the first query record based on the first extracted knowledge specifically includes: The first content text of the first extracted knowledge is used as the corresponding updated content; and the updated content is embedded and encoded based on the first embedded coding rule to obtain the corresponding updated vector; and the current time is used as the corresponding updated time; and the first knowledge content, the second coding vector and the first update time of the first query record are updated to the corresponding updated content, the updated vector and the updated time.

7. The knowledge processing method combining user feedback and contextual learning according to claim 1, characterized in that: The method further comprises: Continuously collect knowledge information and construct a corresponding first collected knowledge set based on the collected information; and regularly perform batch knowledge addition and update processing on the first knowledge base according to the first collected knowledge set.

8. A device for executing the knowledge processing method combining user feedback and context learning as described in any one of claims 1 to 7, characterized in that: The device comprises: a knowledge base selection module, a knowledge retrieval module, a knowledge extraction module and a knowledge base update module; The knowledge base selection module is used to record any type of large language model that uses a knowledge base in the knowledge reasoning process and has completed model pre-training and directional domain fine-tuning as a corresponding first model; and record the knowledge base used by the first model as the corresponding first knowledge base; The knowledge retrieval module is used to receive a translation or question-answering instruction text input by a user as a corresponding first instruction text; and perform contextual knowledge learning processing based on the first instruction text and the first knowledge base to obtain a corresponding first knowledge sequence; and input the first knowledge sequence as instruction prompt text information together with the first instruction text into the first model to perform corresponding translation or question-answering task processing and feed back the translation or answer text generated by the model as the corresponding first generated text to the current user; The knowledge extraction module is used to receive the satisfaction feedback of the current user on the first generated text as the corresponding first satisfaction; and when the first satisfaction is satisfied, the first instruction text and the first generated text are input into a preset knowledge extraction instruction template to perform corresponding knowledge extraction instruction assembly to obtain a corresponding second instruction text; and the second instruction text is input into the first model to perform corresponding knowledge extraction processing to obtain corresponding first extracted knowledge; the first satisfaction includes satisfied and dissatisfied; The knowledge base update module is used to perform old knowledge record query on the first knowledge base based on the first extracted knowledge to obtain the corresponding first query record; and to identify whether the first query record is empty; if so, perform knowledge addition processing on the first knowledge base based on the first extracted knowledge; if not, perform knowledge update processing on the first query record based on the first extracted knowledge.

9. An electronic device, characterized in that: include: memory, processors, and transceivers; The processor is used to couple with the memory, read and execute instructions in the memory, so as to implement the method according to any one of claims 1 to 7; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a computer, the computer is enabled to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for training generative large language model based on knowledge base feedback

    CN117009490A

  • Local knowledge base updating method and system based on large language model and BERT model

    CN117194602A

  • Knowledge retrieval method based on large language model and knowledge base management platform

    CN118210875A

  • Knowledge base generating device and knowledge base generating method thereof

    KR1020140047952A