Large model optimization method and device based on knowledge editing, electronic equipment and medium
Through a loop optimization method based on knowledge editing, combined with expert correction knowledge and knowledge editing judgment model, the accuracy problem of large language models in knowledge processing and understanding is solved, and high-accuracy output results are achieved, which is suitable for black box models. Avoids the need for internal structural adjustments.
Patent Information
- Application Number
- CN202410811742.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing large-scale language models are difficult to maintain accuracy in knowledge processing and understanding, and the internal structure is opaque, resulting in low accuracy of output results. Moreover, fine-tuning methods can easily cause catastrophic forgetting, affecting the general capabilities of the model.
Through the loop optimization method based on knowledge editing, the expert correction knowledge and the knowledge editing judgment model are combined to perform knowledge fusion to generate optimized input text information until the preset requirements are met, and the output results of the large model are optimized.
It can significantly improve the accuracy and controllability of the output results without adjusting the internal structure of the large model, achieve lightweight and low-cost knowledge update, and is suitable for black box models.
Smart Images

Figure CN118708690A
Abstract
Description
Technical Field
[0001] The present application relates to the field of model processing technology, and in particular to a large model optimization method and device based on knowledge editing, electronic equipment and medium. Background Art
[0002] In related technologies, with the advancement of artificial intelligence technology, large language models (LLMs, referred to as large models) are increasingly widely used in all walks of life. With its unique advantages, large models pre-integrate massive amounts of text sequence knowledge into neural networks, and perform refined processing and manipulation of knowledge through parameterized space, fully demonstrating the huge potential of large-scale parameterized neural networks in knowledge acquisition and characterization. However, with the rapid evolution of knowledge, it is difficult for existing large models to maintain accuracy in the processing and understanding of knowledge, and the potential knowledge errors in the model cannot be ignored. These errors may affect the reliability and accuracy of the model, thereby making the accuracy of the output results of the large model low. In addition, since the working principle of the large model is similar to that of the black box model, its internal structure is not transparent, resulting in fine-tuning of the internal structure of the large model, and it is difficult to improve the accuracy of the output results of the large model.
[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a large model optimization method and device, electronic device and medium based on knowledge editing, which can effectively improve the accuracy of the large model output results.
[0005] To achieve the above purpose, one aspect of an embodiment of the present application proposes a large model optimization method based on knowledge editing, the method comprising the following steps:
[0006] Obtaining first input text information of the target object;
[0007] Inputting the first input text information into a preset large model, and processing the output of the preset large model through a loop optimization step until the output meets the preset requirements, thereby obtaining optimized target output text information;
[0008] Wherein, the cycle optimization step comprises the following steps:
[0009] Acquire the to-be-processed output text information of the preset large model, and form a first data pair of the first input text information and the to-be-processed output text information into a first preset database;
[0010] Acquire an expert revised knowledge pair, wherein the expert revised knowledge pair includes a first data pair and a second data pair, wherein the second data pair includes the first input text information and expert revision opinion information;
[0011] According to the second data pair and the knowledge of the second preset database, knowledge fusion is performed through a knowledge editing determination model;
[0012] Inputting the knowledge fusion result into the prompt learning model to generate second input text information;
[0013] The second input text information is input into the preset macro model as the first input text information.
[0014] In some embodiments, the obtaining of expert-corrected knowledge pairs includes:
[0015] Obtain business demand information;
[0016] Sending review request information to the expert terminal according to the business demand information;
[0017] Receive the expert-corrected knowledge pair returned by the expert terminal according to the review request information.
[0018] In some embodiments, the performing knowledge fusion through a knowledge editing determination model based on the knowledge of the second data pair and the second preset database includes:
[0019] Acquire first text information of the second data pair; and acquire second text information of knowledge of the second preset database;
[0020] Converting the first text information into a first vector, and converting the second text information into a second vector;
[0021] Knowledge fusion is performed based on the comparison between the first vector and the second vector.
[0022] In some embodiments, the performing knowledge fusion according to the comparison between the first vector and the second vector includes:
[0023] If it is determined according to the comparison result of the first vector and the second vector that the first input text information in the second data pair is not stored in the second preset database, storing the second data pair in the second preset database;
[0024] If it is determined according to the comparison result of the first vector and the second vector that the first input text information in the second data pair is stored in the second preset database, a conflict judgment is performed between the expert modification opinion information and the knowledge in the second preset database;
[0025] The knowledge in the second preset database is updated according to the conflict determination result.
[0026] In some embodiments, the updating of the knowledge in the second preset database according to the conflict determination result includes:
[0027] If there is a logic problem between the expert modification opinion information and the knowledge in the second preset database, the historical second data pair in the second preset database is updated to the current second data pair.
[0028] In some embodiments, the output of the preset large model is processed through the loop optimization step until the preset requirements are met to obtain the optimized target output text information, including:
[0029] If it is determined according to the logic judgment result that there is no logic problem between the expert modification opinion information and the knowledge in the second preset database, the optimized target output text information is generated.
[0030] In some embodiments, inputting the knowledge fusion result into the prompt learning model to generate the second input text information includes:
[0031] Obtaining an output template of the prompt learning model;
[0032] Generate second input text information according to the knowledge fusion result and the output template.
[0033] To achieve the above purpose, another aspect of the embodiment of the present application provides a large model optimization device based on knowledge editing, the device comprising:
[0034] The first module is used to obtain first input text information of the target object;
[0035] The second module is used to input the first input text information into a preset large model, and process the output of the preset large model through a loop optimization step until it meets the preset requirements, thereby obtaining the optimized target output text information;
[0036] Wherein, the cycle optimization step comprises the following steps:
[0037] Acquire the to-be-processed output text information of the preset large model, and form a first data pair of the first input text information and the to-be-processed output text information into a first preset database;
[0038] Acquire an expert revised knowledge pair, wherein the expert revised knowledge pair includes a first data pair and a second data pair, wherein the second data pair includes the first input text information and expert revision opinion information;
[0039] According to the second data pair and the knowledge of the second preset database, knowledge fusion is performed through a knowledge editing determination model;
[0040] Inputting the knowledge fusion result into the prompt learning model to generate second input text information;
[0041] The second input text information is input into the preset macro model as the first input text information.
[0042] To achieve the above object, another aspect of an embodiment of the present application provides an electronic device, including:
[0043] at least one processor;
[0044] at least one memory for storing at least one program;
[0045] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0046] To achieve the above objective, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0047] The embodiments of the present application include at least the following beneficial effects: The present application provides a large model optimization method and device based on knowledge editing, an electronic device and a medium, which optimizes the output of a preset large model through a cyclic optimization step, combines expert modification opinions in the optimization process, and after knowledge fusion through the knowledge editing judgment model, generates a second input text information corresponding to the first input text information through a prompt learning model, thereby optimizing the output text information of the preset large model until the optimized target output text information is obtained after meeting the preset requirements, thereby obtaining a large model output result with higher accuracy without adjusting the internal structure of the preset large model. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flow chart of a large model optimization method based on knowledge editing provided in an embodiment of the present application;
[0049] Figure 2 is a flow chart of the cycle optimization steps provided in the embodiment of the present application;
[0050] Figure 3 It is provided by the embodiments of the present application;
[0051] Figure 4 It is a structural schematic diagram of a large model optimization device based on knowledge editing provided in an embodiment of the present application;
[0052] Figure 5 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application, they are only examples of devices and methods consistent with some aspects of the embodiments of the present application.
[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0055] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:
[0056] Large Language Models (LLMs) are a type of generative AI that are trained on large amounts of natural language data using deep learning algorithms. These models learn the patterns and structures of human language and are able to generate human-like responses to a variety of written inputs or prompts.
[0057] The Generative Pre-Trained Transformer (GPT) model is a deep learning model that uses self-attention extrema to capture long-range dependencies in input data. From automatic text generation to sentiment analysis to complex dialogue systems, GPT has a wide range of applications and plays a key role in improving the naturalness and fluency of communication between machines and humans.
[0058] In the related technologies, although the large model fine-tuning method is a common technique, it is very easy to cause catastrophic forgetting due to overfitting new data. This hidden danger will seriously damage the general ability of the large model, and then cause its overall performance to degrade significantly. More importantly, due to the high computational cost, frequent fine-tuning is impractical.
[0059] The Large Model Retrieval Enhancement (RAG) method does show a small impact in the general ability to handle large models, however, it also faces some challenges, such as the consumption of additional resources and the possible hallucination problem. These problems, to a certain extent, limit its extensiveness and reliability in practical applications.
[0060] Large model knowledge editing technology aims to modify the output of LLMs efficiently and accurately to update specific knowledge without affecting other knowledge. Existing research has mainly focused on knowledge editing of large white-box models that require local deployment and transparent parameters. However, a large number of high-quality LLMs (such as OpenAI's GPT4, etc.) are only provided to downstream services through APIs, and their internal working principles are inaccessible and only text output is provided. For black-box models like this, the opacity of their internal structure makes the existing evaluation method based on the change of Logits before and after editing no longer applicable, and thus cannot improve the accuracy of the output results of such large models.
[0061] In view of this, a large model optimization method and device based on knowledge editing, an electronic device and a medium are provided in the embodiments of the present application. The present application optimizes the output of the preset large model through a cyclic optimization step, combines the expert modification opinions in the optimization process, and after knowledge fusion is performed through the knowledge editing judgment model, a prompt learning model is used to generate a second input text information corresponding to the first input text information, so as to optimize the output text information of the preset large model until the optimized target output text information is obtained after meeting the preset requirements, thereby obtaining a large model output result with higher accuracy without adjusting the internal structure of the preset large model.
[0062] The large model optimization method based on knowledge editing provided in the embodiment of the present application relates to the field of model processing technology. The large model optimization method based on knowledge editing provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server, and can also be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or it can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms and other basic cloud computing services. The cloud server, the server can also be a node server in the blockchain network; the software can be an application that implements the large model optimization method based on knowledge editing, etc., but is not limited to the above forms.
[0063] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0064] Figure 1 is an optional flow chart of a large model optimization method based on knowledge editing provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S110 to S120:
[0065] Step S110, obtaining first input text information of the target object;
[0066] Step S120: input the first input text information into the preset large model, and process the output of the preset large model through a loop optimization step until it meets the preset requirements, thereby obtaining the optimized target output text information.
[0067] In the embodiments of the present application, Figure 2 As shown, the loop optimization steps include but are not limited to steps S210 to S250:
[0068] Step S210: obtaining the to-be-processed output text information of the preset large model, and storing the first input text information and the to-be-processed output text information into a first data pair in a first preset database;
[0069] Step S220, obtaining an expert-corrected knowledge pair, wherein the expert-corrected knowledge pair includes a first data pair and a second data pair, and the second data pair includes first input text information and expert modification opinion information;
[0070] Step S230: performing knowledge fusion through a knowledge editing judgment model according to the second data pair and the knowledge of the second preset database;
[0071] Step S240, inputting the knowledge fusion result into the prompt learning model to generate second input text information;
[0072] Step S250: input the second input text information into the preset macro model as the first input text information.
[0073] In an embodiment of the present application, when it is necessary to obtain an expert revised knowledge pair, an audit request message can be asynchronously sent to an expert terminal based on business demand information, and the expert revised knowledge pair returned by the expert terminal according to the audit request message can be received. It can be understood that by including the first input text information in the expert revised knowledge pair, the subsequent processing process can more accurately determine the expert modification opinion information corresponding to each input text information. Specifically, the expert modification opinions of this embodiment can be modification opinions input by the expert at the corresponding terminal, or they can be corresponding modification opinions generated by the intelligent tool applied in the server according to preset judgment knowledge.
[0074] In the embodiment of the present application, the step of performing knowledge fusion through the knowledge editing determination model according to the second data pair and the knowledge of the second preset database may include but is not limited to the following steps:
[0075] Acquire first text information of a second data pair; and acquire second text information of knowledge of a second preset database;
[0076] Converting the first text information into a first vector, and converting the second text information into a second vector;
[0077] Knowledge fusion is performed based on the comparison between the first vector and the second vector.
[0078] This embodiment converts structured or unstructured text information into vectors of the same dimension for comparison, thereby improving the accuracy of the comparison process.
[0079] It can be understood that, in this embodiment, when knowledge fusion is performed based on the comparison between the first vector and the second vector, if it is determined based on the comparison result between the first vector and the second vector that the first input text information in the second data pair is not stored in the second preset database, the second data pair is stored in the second preset database; if it is determined based on the comparison result between the first vector and the second vector that the first input text information in the second data pair is stored in the second preset database, a conflict judgment is performed between the expert modification opinion information and the knowledge in the second preset database; and the knowledge in the second preset database is updated based on the conflict judgment result. Specifically, when the knowledge in the second preset database is updated based on the conflict judgment result, if there is a logical problem between the expert modification opinion information and the knowledge in the second preset database, the historical second data pair in the second preset database is updated to the current second data pair. On the contrary, if it is determined based on the logical judgment result that there is no logical problem between the expert modification opinion information and the knowledge in the second preset database, the optimized target output text information is generated. That is, when the output of the preset large model meets the preset requirements, the current output is used as the optimized target output text information.
[0080] In an embodiment of the present application, an output template is pre-set in the prompt learning model, and the output template is used to guide the filling position of the model's original input information, original output information, expert modification opinions and other information, and generate text information with a new word order based on the filled-in information. Specifically, during the processing of this embodiment, after obtaining the output template of the prompt learning model, the second input text information is generated according to the knowledge fusion result and the output template, so that the preset large model can better understand the specific meaning of the input text of the target object. In this embodiment, the preset large model may include but is not limited to black box large models such as chatGPT / GPT4.
[0081] In some embodiments, the large model optimization method based on knowledge editing provided by the present application is applied to Figure 3 The application process as shown includes, but is not limited to, the following steps:
[0082] S1. The target object inputs a piece of text T_i (first input text information) through the terminal device and sends a dialogue request to a black box large model (preset large model) such as chatGPT / GPT4.
[0083] S2. The black box model will return a piece of text as the original output result T_o (output text information to be processed).
[0084] S3, all the data pairs of the first input text information and the output text information to be processed QA_r=<T_i,T_o> Stored in database D_r (first preset database).
[0085] S4. Based on the business need information, the review request information will be sent asynchronously to the expert terminal, where the expert can be a person or other intelligent tools such as large models.
[0086] S5. The expert terminal asynchronously returns the expert modification opinion information and generates the expert modified knowledge pair<QA_r,QA_f> , where QA_f =<T_i,T’_o> ,T'_o is the output result that needs to be modified after expert review (expert modification opinion information).
[0087] S6. The audit result QA_f =<T_i,T’_o> (The second data pair) is fused with the existing revised database (D_f) (the second preset database) through the knowledge editing judgment model. Specifically, it is determined whether the first input text information (T_i) belongs to the new knowledge in the existing revised database, and it is determined whether it conflicts with the existing knowledge in D_f through the expert modification opinion information (T'_o), so that it needs to be updated and revised. The knowledge editing judgment model can be implemented by semantic correlation or semantic implication through a general NLP model, such as Bert.
[0088] S7. Determine whether knowledge editing is required based on the result of the knowledge editing judgment model. Specifically, if the first input text information (T_i) belongs to new knowledge, directly add new knowledge QA_f= in the revised database (D_f).<T_i,T’_o> ; If the first input text information (T_i) belongs to the old knowledge already contained in the revised data D_f, it is further modified based on whether the expert opinion information (T'_o) conflicts with the existing knowledge in D_f. If so, the existing historical QA'_f (historical second data pair) is updated to QA_f (current second data pair) in the revised database (D_f). Otherwise, no updating is required, and the final request result T_o' (target output text information) is directly given.
[0089] S8. If you are editing knowledge, you need to change QA_f=<T_i,T’_o> The new input T'_i (second input text information) is passed into the prompt learning model based on knowledge editing. The prompt learning model based on knowledge editing can adopt a manual template method or can adopt relevant technical solutions such as APE for automatic prompt generation and optimization.
[0090] S9. Based on the new input T'_i (second input text information), a request is made to the large model again, and the above steps S2-S7 are repeated.
[0091] S10. Return the final request result T_o' (target output text information) to the terminal device of the target object.
[0092] From the above content, it can be seen that this application optimizes the output of the preset large model, so there is no need to adjust the internal structure of the preset large model, and thus the general capabilities of the large model will not be damaged, effectively improving the accuracy of the preset large model output and the controllability of the preset large model, so that fine-grained updates of specific knowledge can be performed. In addition, this application belongs to a lightweight, pluggable architecture with low cost and easy to implement. And it has good versatility, not only for the output optimization of white box large models, but also for the output optimization of black box large models.
[0093] Reference Figure 4 The embodiment of the present application also provides a large model optimization device based on knowledge editing, the device comprising:
[0094] The first module 410 is used to obtain first input text information of a target object;
[0095] The second module 420 is used to input the first input text information into the preset large model, and process the output of the preset large model through a loop optimization step until the preset requirements are met, thereby obtaining the optimized target output text information;
[0096] The loop optimization step includes the following steps:
[0097] Obtaining the to-be-processed output text information of the preset large model, and forming a first data pair of the first input text information and the to-be-processed output text information into a first preset database;
[0098] Acquire an expert-corrected knowledge pair, the expert-corrected knowledge pair comprising a first data pair and a second data pair, the second data pair comprising first input text information and expert modification opinion information;
[0099] Based on the knowledge of the second data pair and the second preset database, knowledge fusion is performed through the knowledge editing determination model;
[0100] Inputting the knowledge fusion result into the prompt learning model to generate second input text information;
[0101] The second input text information is input into the preset macro model as the first input text information.
[0102] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0103] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned large model optimization method based on knowledge editing when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0104] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0105] See also Figure 5 , Figure 5 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0106] The processor 510 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0107] The memory 520 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 520 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 520, and the processor 510 calls and executes the large model optimization method based on knowledge editing in the embodiment of this application;
[0108] Input / output interface 530, used to implement information input and output;
[0109] Communication interface 540, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WI FI, Bluetooth, etc.);
[0110] bus 550 , which transmits information between the various components of the device (e.g., processor 510 , memory 520 , input / output interface 530 , and communication interface 540 );
[0111] The processor 510 , the memory 520 , the input / output interface 530 and the communication interface 540 are connected to each other in communication within the device via the bus 550 .
[0112] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned large model optimization method based on knowledge editing.
[0113] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0114] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0115] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0116] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0117] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0118] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0119] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0120] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0121] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0122] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0123] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0124] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0125] The preferred embodiments of the present application are described above with reference to the accompanying drawings, but the scope of the rights of the present application is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application should be within the scope of the rights of the present application.
Claims
1. A large model optimization method based on knowledge editing, characterized in that: The method comprises the following steps: Obtaining first input text information of the target object; Inputting the first input text information into a preset large model, and processing the output of the preset large model through a loop optimization step until the output meets the preset requirements, thereby obtaining optimized target output text information; Wherein, the cycle optimization step comprises the following steps: Acquire the to-be-processed output text information of the preset large model, and form a first data pair of the first input text information and the to-be-processed output text information into a first preset database; Acquire an expert revised knowledge pair, wherein the expert revised knowledge pair includes a first data pair and a second data pair, wherein the second data pair includes the first input text information and expert revision opinion information; According to the second data pair and the knowledge of the second preset database, knowledge fusion is performed through a knowledge editing determination model; Inputting the knowledge fusion result into the prompt learning model to generate second input text information; The second input text information is input into the preset macro model as the first input text information.
2. The method according to claim 1, characterized in that The obtaining of expert-corrected knowledge pairs comprises: Obtain business demand information; Sending review request information to the expert terminal according to the business demand information; Receive the expert-corrected knowledge pair returned by the expert terminal according to the review request information.
3. The method according to claim 1, characterized in that The performing knowledge fusion through the knowledge editing determination model according to the second data pair and the knowledge of the second preset database includes: Acquire first text information of the second data pair; and acquire second text information of knowledge of the second preset database; Converting the first text information into a first vector, and converting the second text information into a second vector; Knowledge fusion is performed based on the comparison between the first vector and the second vector.
4. The method according to claim 3, characterized in that The performing knowledge fusion according to the comparison between the first vector and the second vector includes: If it is determined according to the comparison result of the first vector and the second vector that the first input text information in the second data pair is not stored in the second preset database, storing the second data pair in the second preset database; If it is determined according to the comparison result of the first vector and the second vector that the first input text information in the second data pair is stored in the second preset database, a conflict judgment is performed between the expert modification opinion information and the knowledge in the second preset database; The knowledge in the second preset database is updated according to the conflict determination result.
5. The method according to claim 4, characterized in that The updating of the knowledge of the second preset database according to the conflict judgment result includes: If there is a logical problem between the expert modification opinion information and the knowledge in the second preset database, the historical second data pair in the second preset database is updated to the current second data pair.
6. The method according to claim 4, characterized in that After the output of the preset large model is processed through the loop optimization step until the preset requirements are met, the optimized target output text information is obtained, including: If it is determined according to the logic judgment result that there is no logic problem between the expert modification opinion information and the knowledge in the second preset database, the optimized target output text information is generated.
7. The method according to claim 1, characterized in that The step of inputting the knowledge fusion result into the prompt learning model to generate the second input text information comprises: Obtaining an output template of the prompt learning model; Generate second input text information according to the knowledge fusion result and the output template.
8. A large model optimization device based on knowledge editing, characterized in that: The device comprises: The first module is used to obtain first input text information of the target object; The second module is used to input the first input text information into a preset large model, and process the output of the preset large model through a loop optimization step until it meets the preset requirements, thereby obtaining the optimized target output text information; Wherein, the cycle optimization step comprises the following steps: Acquire the to-be-processed output text information of the preset large model, and form a first data pair of the first input text information and the to-be-processed output text information into a first preset database; Acquire an expert revised knowledge pair, wherein the expert revised knowledge pair includes a first data pair and a second data pair, wherein the second data pair includes the first input text information and expert revision opinion information; According to the second data pair and the knowledge of the second preset database, knowledge fusion is performed through a knowledge editing determination model; Inputting the knowledge fusion result into the prompt learning model to generate second input text information; The second input text information is input into the preset macro model as the first input text information.
9. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Pre-training model adjustment method and device, storage medium and computing equipment
CN116881641A
Question and answer model editing method and device, electronic equipment and storage medium
CN116882450A
Man-machine interaction method and device based on large language model and electronic equipment
CN117787409A
Intelligent adaptive retrieval enhancement system and method and storage medium
CN118210983A
Ensemble of machine learning models for real-time predictions in expert electronic chats
US11646014B1
Cited By
Stable knowledge editing method and system based on attention drift constraint
CN119443059A
A stable knowledge editing method and system based on attention drift constraint
CN119443059B
