Machine forgetting learning method based on information retrieval and large language model driving

By introducing information retrieval and verification devices into large language models, the model is prohibited from accessing the forget set, which solves the problem of high computational cost and difficulty in applying the traditional forget learning method in the legal field, and achieves efficient and accurate forget learning effects.

CN119848214AActive Publication Date: 2025-04-18SOUTHEAST UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510071938.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-04-18
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

The traditional forgetting learning method requires adjustment of model parameters, which leads to high computational cost and is more challenging to learn large language models for forgetting learning and difficult to apply in the legal field.

Method used

The machine forgetting learning method driven by information retrieval and large language model is adopted. The model refuses to answer information about the forgetting set without changing the model parameters and the forgetting effect is achieved.

Benefits of technology

Reduces the cost of forgetful learning of large language models, avoids model hallucinations, is applicable to the legal field, and can efficiently handle dynamically increased forgetful learning requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848214A_ABST
    Figure CN119848214A_ABST
Patent Text Reader

Abstract

The invention discloses a machine forgetting learning method based on information retrieval and big language model driving. The machine forgetting learning method is used for carrying out forgetting learning on a big language model with rich knowledge in the field of law. A forgetting learning task is redefined for a given user query, a mode of not changing model parameters is adopted, and a permission for forbidding access to a forgetting set is added to a model, so that the model refuses to answer information related to the forgetting set, and a forgetting learning target is achieved. Firstly, information retrieval is carried out on user query in forgotten set corpora through a mixed retrieval mechanism. And then reordering the retrieved paragraphs according to correlation based on a reordering device designed by the invention. Inputting the most relevant first n paragraphs into a checker based on a large language model for checking, and further determining whether the user query relates to the information of the forgotten set or not. The method has high overall performance in forgetting learning tasks, and efficiency and cost can be taken into account while accurate and reliable forgetting learning is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a machine forgetting learning method based on information retrieval and large language model driving. Background Art

[0002] In the past few decades, with the continuous growth of data and the advancement of machine learning algorithms, artificial intelligence has achieved great success in various fields. The quality and quantity of data are crucial to the performance of machine learning models. However, as artificial intelligence becomes more and more data-dependent, it also brings challenges to privacy protection. Models will inevitably learn data collected from individuals, which usually involves sensitive private privacy and may include information such as medical records or personal emails. Data governance frameworks such as the EU's General Data Protection Regulation (GDPR) and the United States' California Consumer Privacy Act (CCPA) list the right to be forgotten as a key principle, that is, to allow the request to delete data about oneself under certain conditions, aiming to solve the problem that the long-term existence of network information may cause lasting harm to individuals. Machine forgetting learning is an emerging field of machine learning that focuses on eliminating the influence of a specific subset of training instances (called the "forgotten set") in the training model. Its goal is to develop algorithms that can effectively eliminate the influence of these instances while retaining other ideal properties of the model, such as accuracy on the remaining training data and generalization to new unseen examples.

[0003] Utilizing large language models (LLMs) has become a mainstream paradigm for various natural language processing applications, because LLMs memorize a large amount of knowledge when pre-trained or fine-tuned on large amounts of text data. However, this data may contain sensitive information, such as names, phone numbers, email addresses, etc. Extensive research has shown that LLMs can generate private information. Therefore, the ability to easily remove data related to individual users from LLMs without reducing their prediction quality after deletion becomes increasingly important. However, previous forgetting learning work has mainly focused on computer vision scenarios and largely ignored the nature of forgetting in the field of natural language processing, because text data contains more explicit and sensitive personal information than images. There is even less work on forgetting learning for LLMs. In the current work on forgetting learning for LLMs, the mainstream view is to encourage LLMs to replace harmful outputs (i.e., text that leaks private information) with harmless outputs, such as replacing specific expressions in the target data with general counterparts through reinforcement models to achieve forgetting, and another example is to use gradient ascent (GA) strategies and reinforcement learning methods to directly update model parameters in the opposite direction of the gradient of harmful tokens to reduce the probability of the model generating harmful outputs. However, these methods essentially instruct the model to produce irrelevant outputs to cover up the information in the forgotten set data. However, this approach is unacceptable in some fields with high credibility requirements, such as law and medicine. The model outputs irrelevant text for specific instances, which will lead to model hallucinations. Text output that deviates from the facts, is logically confusing, or is fabricated will seriously mislead users.

[0004] Traditional forgetting learning methods are divided into exact forgetting (Exact Machine Unlearning) and approximate forgetting (Machine Unlearning). Exact forgetting refers to retraining model parameters from scratch on the remaining dataset. Although retraining from scratch is optimal for forgetting learning, it incurs a lot of computational overhead. This problem can be alleviated by approximate forgetting learning, which is an easy-to-compute alternative to retraining that improves computational efficiency at the expense of certain forgetting learning performance, and aims to enable LLMs to forget specific parts of their training data without full retraining. The technical routes of approximate forgetting learning mainly include fine-tuning, gradient ascent, Fisher forgetting, and influence unlearning. Since these methods all require adjustment of model parameters, the forgetting effect is strongly related to the size of the forgetting set. The forgetting effect can only be guaranteed when the size of the forgetting set accounts for a small proportion of the original model training set (generally ≤10%). If the forgetting set ratio is large, not only a large number of forgetting requests may lead to frequent retraining or parameter adjustments, significantly increasing computing resources and time costs, but also as the proportion of forgotten samples increases, the model may need to frequently adapt to data changes, which may not only destroy the stability of the model, but also lead to a decrease in the generalization ability of the model and affect the accuracy.

[0005] In addition, traditional forgetting learning mainly focuses on classification models. It is obviously more challenging to perform forgetting learning on LLM for the following reasons. (1) Compared with classification tasks, the output space of LLM is extremely wide, much larger than the label categories in classification. In classification, the definition of forgetting learning is more clear: as long as the sample is classified (or not classified) into a specific category. However, in the context of natural language output, the definition of behavior is much more vague. (2) Given the scale of LLM, any computationally expensive forgetting method is not feasible. The forgetting process must be efficient to adapt to the size of the model and the actual application requirements. Efficiency is a prominent consideration. (3) The behavior of LLM is diverse and highly unstructured. Unlike simple classification, the model needs to forget these specific bad behavior patterns while maintaining useful functions.

[0006] In order to solve the above challenges, the present invention conducts an in-depth study on how LLM in the legal field can achieve forgetting learning of specific instances. A forgetting learning method based on information retrieval and large language model driving is proposed in this paper. The present invention believes that, for the protection of privacy data, the essence of forgetting learning is to erase the traces of specific instance data in the original model, so that the model behaves as if it has never seen data. In order to achieve this goal, the present invention does not follow the technical path of forgetting learning in the past to change the original parameters of the model, but attempts to achieve the forgetting effect by letting the model refuse to answer the relevant information in the forgetting set. Therefore, in the forgetting learning method based on information retrieval and LLM driving proposed in this invention, there is no need to train and adjust the original model, but by performing information retrieval on the user query in the forgetting set, and introducing a verifier based on the language model to dynamically guide the retrieval process. If the verification result finds that the user query information involves the content of the forgetting set, the LLM directly refuses to answer the user query and has no right to talk about the related instances of the forgetting set; if the verification result finds that the user query is irrelevant to the forgetting set, the LLM can reply to the user's question normally. In addition, in previous methods, the forgetting sets during forgetting learning are collected in advance. If new forgotten data is added subsequently, the model needs to be re-learned for forgetting. In vertical fields, requests for data forgetting may increase dynamically at any time. The method of the present invention only needs to add new forgetting requests to the forgetting set, and no additional optimization of the model is required. Therefore, this shortcoming of previous static forgetting learning is solved, and the forgetting learning effect for the dynamic forgetting set is efficiently achieved. Summary of the invention

[0007] Technical problem: The technical problem to be solved by the present invention is that the traditional forgetting learning method needs to adjust the model parameters, and the forgetting effect is strongly related to the size of the forgetting set. As the proportion of forgotten samples increases, the generalization ability of the model decreases and the accuracy is affected; traditional forgetting learning mainly focuses on classification models, and forgetting learning for large language models is more challenging and computationally expensive; the current method of using large language models for forgetting learning essentially guides the model to produce irrelevant outputs to cover up the information of the forgotten set data, resulting in model hallucination phenomenon, which cannot be applied to the legal field; the forgetting sets of the current forgetting learning methods are all collected in advance. If new forgotten data is added later, the model needs to be re-forgotten, and a machine forgetting learning method based on information retrieval and large language model driving is provided. This method is mainly used to forget learning for knowledge-rich large language models in the legal field, filter sensitive information, and protect personal privacy. For a given user query, the present invention redefines the forgetting learning task, adopts a method without changing the model parameters, and adds permissions to the model that prohibit access to the forgetting set, so that the model refuses to answer information about the forgetting set, thereby achieving the goal of forgetting learning. First, the user query is retrieved in the forgetting set corpus through a hybrid retrieval mechanism. Then, based on the re-ranker designed by the present invention, the retrieved paragraphs are re-ranked according to relevance. Then, the top n most relevant paragraphs are input into the verifier based on the large language model for verification, so as to further clarify whether the user query involves the information in the forgotten set. In the verification process, the present invention introduces an outline guidance mechanism, which guides the verification scope through the outline, and combines the user's conversational dynamic update of supplementary information to gradually determine the user's intention, thereby improving the verification accuracy, and instructing the large model to make a corresponding reply. If the forgotten set information is not involved, the large model will reply normally, otherwise it will refuse to answer. Finally, the present invention constructs a forgetting learning dataset of theft cases in the private legal domain and proves the effectiveness of the method through a large number of experiments. A series of experiments show that the method of the present invention has a high overall performance in the forgetting learning task, and can take into account efficiency and cost while achieving accurate and reliable forgetting learning.

[0008] Technical solution: The technical solution adopted by the present invention to solve its technical problem is: a machine forgetting learning method driven by information retrieval and large language model. For a given user query, the method redefines the forgetting learning task, adopts a method without changing the model parameters, and adds the permission of prohibiting access to the forgetting set to the model, so that the model refuses to answer information about the forgetting set, thereby achieving the forgetting learning goal. First, the user query is retrieved in the forgetting set corpus through a hybrid retrieval mechanism. Then, based on the reranker designed by the present invention, the retrieved paragraphs are reranked according to relevance. Then, the top n most relevant paragraphs are input into the verifier based on the large language model for verification, and further clarify whether the user query involves the information of the forgetting set. In the verification process, the present invention introduces an outline guidance mechanism, guides the verification scope through the outline, and combines the user's conversational dynamic update of supplementary information to gradually determine the user's intention, thereby improving the verification accuracy, and instructs the large model to make a corresponding reply. If the forgotten set information is not involved, the large model will reply normally, otherwise it will refuse to answer. Finally, the present invention constructs a forgetting learning data set of theft cases in the private legal domain and proves the effectiveness of the method through a large number of experiments.

[0009] The machine forgetting learning method based on information retrieval and large language model driving of the present invention comprises the following steps:

[0010] 1) For a given user query, redefine the forgetting learning task;

[0011] 2) Design a retriever that uses a hybrid retrieval mechanism to perform information retrieval on the forgotten set corpus to further improve search performance;

[0012] 3) For the first K paragraphs output by the retriever in step 2), use the reranker to adjust the order of these paragraphs to ensure that the most relevant paragraphs are ranked better;

[0013] 4) Input the n most relevant paragraphs in the forgotten set obtained in step 3) to the verifier based on the large language model for verification, further clarify whether the user query involves information in the forgotten set, and instruct the large model to make a corresponding response;

[0014] 5) Construct a forgetting learning benchmark dataset of theft cases in the legal field to verify the effectiveness of the method proposed in this invention.

[0015] As a further improvement of the present invention, in step 1), considering that the existing methods need to adjust the model parameters, the forgetting effect is closely affected by the size of the forgetting set, and it is difficult to maintain the normal performance of the model on the non-forgetting set data, the present invention decides to adopt a method without changing the model parameters, by adding the permission of prohibiting access to the forgetting set to the model, so that the model refuses to answer the information about the forgetting set, and achieves the forgetting learning goal of erasing the data traces of the forgetting set in the model and the model acting as if it does not know it. The forgetting learning task is formally defined as: for the forgetting set D f ={}y1,y2,...,y f ,...}, where y f is harmful text that will leak private information, and the pre-trained language model θ o Processing Tips x f will generate a f The harmful output of . Denote the forgetting learning mechanism as U, such that

[0016]

[0017] Among them, when the model θ o Process normal prompts x that do not involve the contents of the forget set n , it should be treated as a normal question and generate a normal response y n ; When the model θ o Encountered hints about the contents of the forgotten set x f When it is, it should be identified and a rejection response y should be generated reject ,in

[0018] As a further improvement of the present invention, in step 2), in order to achieve zero-sample retrieval of user queries, from the perspective of efficiency and retrieval performance, the present invention believes that the dictionary-based retrieval method BM25 is an ideal choice for implementing the retriever. BM25 only relies on dictionary overlap and considers the dictionary's term and document frequency, which is simple to implement and has good retrieval performance. BM25 considers factors such as term frequency (TF) and inverse document frequency (IDF) in the document, and first parses the user query to obtain each morpheme q i , then for each search document D, calculate each morpheme q i The correlation score with D is finally i The weighted sum of the relevance scores relative to D is used to obtain the relevance score of the user query and the search document D. BM25 .

[0019] As a further improvement of the present invention, in step 2), in order to further improve the search performance, the present invention designs a hybrid retrieval mechanism, which combines the dictionary-based BM25 with the vector similarity retrieval, and integrates the retrieval results of the two to achieve hybrid retrieval.

[0020] The present invention selects BGE-M3 as the vector retrieval model of the retriever. The user query Q is first converted into a hidden state H based on the text encoder. Q And normalized: e Q =norm(H Q ). Similarly, the embedding vector of the candidate document paragraph is expressed as: e D =norm(H D ). Therefore, the relevance score between the user query Q and the paragraph D is measured by the inner product between the two embeddings:

[0021] Score dense (D,Q)= <e D ,e Q >

[0022] Then, the final retrieval results are re-ranked according to the comprehensive BM25 score and vector similarity retrieval score:

[0023] Score(D,Q)=Score BM25 +k*Score dense

[0024] Among them, k is a hyperparameter used to adjust the importance weights of the two retrieval scores. Finally, the top K paragraphs with the highest comprehensive scores are screened out and enter the reranker.

[0025] As a further improvement of the present invention, in step 3), the present invention represents the first K paragraphs as: The reorderer proposed in the present invention calculates P(p i |Q) to measure the relevance score of each paragraph relative to the user query to achieve re-ranking. Specifically, the present invention uses the Bayesian formula to calculate P(p i |Q) for analysis:

[0026]

[0027] Among them, P(p i ) is the prior probability of the retrieved paragraph, and log P(Q) is related to p i is irrelevant, so for any p i , which has the same value and is a common constant. Further, inspired by the existing work, the present invention assumes that the prior probability P(p i ) is uniformly distributed (i.e. for all paragraphs pi are the same), so they can be ignored when reordering. Therefore, the above formula can be simplified to:

[0028] log P(p i |Q)∝log P(Q|p i )

[0029] Therefore, the reordering is based on P(Q|p i ) size.

[0030] As a further improvement of the present invention, in the step 3), the present invention selects mT5 as the basic model of the re-ranker, and fine-tunes it using a question-answering dataset in the legal field. mT5 adopts a sequence-to-sequence (Seq2Seq) architecture, in which the encoder encodes the input sequence into a hidden layer representation, and the decoder generates an output sequence based on the hidden layer representation. In the fine-tuning process, the present invention uses the answer sequence as input and the question sequence as the target output, and learns to rearrange the candidate paragraphs by learning the mapping relationship between these sequences. During the training process, the cross entropy loss is used to measure the gap between the answer generated by the model and the real answer, thereby optimizing the parameters. After fine-tuning, the present invention obtains a re-ranker based on a pre-trained language model, which has low implementation cost and high rearrangement efficiency, providing strong support for the subsequent verification process.

[0031] As a further improvement of the present invention, in step 4), in order to clarify whether the query intention of the user's query involves the forgotten set, the present invention designs a verifier based on a large language model. The large language model has a strong context understanding ability and can better understand the user's query intention in the context of multiple rounds of dialogue between the user and the system. Secondly, the large language model shows a strong instruction following ability and can complete the instructions well to realize the judgment of the relevance between the query and the forgotten set. Therefore, the present invention is designed to achieve this goal, which is formally expressed as follows:

[0032]

[0033] Among them, goal(Q) represents the query intention of the user's query. If the query intention of the user's query is irrelevant to the forgotten set, the judgment result of the verifier based on the large language model is 0; if the query intention of the user's query is related to the forgotten set, the judgment result of the verifier based on the large language model is 1.

[0034] As a further improvement of the present invention, in step 4), inspired by the conversational search mode, the present invention combines the characteristics of cases in the legal field and designs an outline of theft cases to assist the verifier based on the large language model in determining and clarifying the user's query intention, thereby preventing misjudgment of intention recognition. The outline is an ontology-level modeling of the forgotten set corpus information, which describes the common information of the forgotten set data. In this work, the forgotten set of the present invention is the theft case data in the legal field. Therefore, the present invention models the outline into four attributes that describe the key information of the case, namely "time", "place", "defendant", and "stolen items". The verifier based on the large language model uses them to determine whether the related case C has related cases, which can effectively improve the efficiency and accuracy of verification.

[0035] As a further improvement of the present invention, in step 4), the present invention constructs a dynamic interaction mode between the user and the system. If the verifier based on the large language model finds that there are multiple cases related to the user's query under the condition of the current outline, the user will be required to further provide the remaining unknown key information about the case for updating the outline. Through a series of back-and-forth exchanges to respond to user queries and clarify the user's information needs, the outline is updated in real time, thereby guiding the verifier based on the large language model to gradually narrow the scope of review of related cases, to retrieve related cases that are consistent with the latest outline, and thus improve the accuracy of the final judgment.

[0036] As a further improvement of the present invention, in step 5), in order to verify the effectiveness of the method described in the present invention, a forgetting learning benchmark dataset of theft cases in the legal field is constructed. In the dataset constructed by the present invention, each piece of data consists of a user query related to the content of the case, a text describing the facts of the case and the outline of the case, wherein the outline contains four attributes of "time", "place", "defendant" and "stolen items", which are stored in the form of key-value pairs, and the initial user query only contains information related to the "defendant". The present invention divides the dataset into a forgetting set and a non-forgetting set, with a total of 2039 samples.

[0037] Beneficial effects:

[0038] Compared with the prior art, the present invention has the following advantages: 1) The existing forgetting learning method requires adjustment of the model parameters, and the forgetting effect is strongly related to the size of the forgetting set. As the proportion of forgotten samples increases, the generalization ability of the model decreases and the accuracy is affected. The present invention proposes to achieve the forgetting effect by letting the model refuse to answer the relevant information in the forgetting set without changing the original parameters of the model. 2) The existing methods mainly focus on classification models, and forgetting learning for LLM is more challenging and computationally expensive. The method of the present invention greatly reduces the cost of forgetting learning for LLM by amortizing the cost of forgetting learning to each questioning link. 3) The current method of forgetting learning using a large language model essentially guides the model to produce irrelevant outputs to cover up the information of the forgetting set data, resulting in model hallucination phenomenon, and cannot be applied to the legal field. The present invention adopts the method of letting the model refuse to answer the relevant information in the forgetting set, which fundamentally eliminates the generation of texts that deviate from the facts and are made out of nothing, and can be applied to the legal field. 4) The forgetting sets of the existing methods are all collected in advance. If the forgotten data is added later, the model needs to be re-learned for forgetting. The present invention designs a forgetting learning framework, which clarifies the user's information needs through a dynamic interaction mode and can effectively handle dynamically increasing forgetting learning requests without the need to re-perform forgetting learning on the model.

[0039] Experimental analysis has proved that the machine forgetting learning method based on information retrieval and large language model driven proposed in this method has improved the forgetting learning model and greatly improved the model performance. It can achieve accurate and reliable forgetting learning while taking into account efficiency and cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a basic process schematic diagram of the present invention;

[0041] Figure 2 It is a model framework diagram of the present invention. DETAILED DESCRIPTION

[0042] The present invention will be further described below in conjunction with the embodiments and the accompanying drawings.

[0043] Example:

[0044] See also Figure 1 , Figure 2 The machine forgetting learning method based on information retrieval and large language model driving of the present invention comprises the following steps:

[0045] 1) For a given user query, redefine the forgetting learning task. Assume that the large-scale language model θ oThe training has been done on the dataset D. The present invention hopes that the model can forget the information of some data in D. This part of data belongs to a subset of D, which is called the forgotten set D in the present invention. f The goal of forgetting learning is to approximately simulate the r =D\D f The effect of retraining the model is obtained by u , let θ u Right D f The data is like the unseen data, but while retaining θ o Processing D f In addition, forgetting the learned θ u Still should maintain D r The utility on the non-forgetting set is θ u The ability should be related to θ o The closer the better. One easy way to do this is to r Retraining the LLM on the fly is too slow and expensive to be an acceptable approach.

[0046] The present invention aims to adjust the model parameters to obtain the θ after forgetting learning in consideration of the existing methods. u The approach will make the forgetting effect closely affected by the size of the forgetting set, and it is difficult to maintain the normal performance of the model on the non-forgetting set data. The present invention decides to adopt the method of not changing the model parameters, by adding the permission of prohibiting access to the forgetting set to the model, so that the model refuses to answer the information about the forgetting set, and achieves the forgetting learning goal of erasing the data traces of the forgetting set in the model and the model behaves as if it does not know about it. The formal definition is: for the forgetting set D f ={y1,y2,...,y f ,...}, where y f is harmful text that will leak private information, and the pre-trained language model θ o Processing Tips x f will generate a f The harmful output of . Denote the forgetting learning mechanism as U, such that

[0047]

[0048] Among them, when the model θ o Process normal prompts x that do not involve the contents of the forget set n , it should be treated as a normal question and generate a normal response y n ; When the model θ o Encountered hints about the contents of the forgotten set x f When it is, it should be identified and a rejection response y should be generated refect ,in

[0049] 2) Design a retriever that uses a hybrid retrieval mechanism to perform information retrieval on user queries in the forgotten set corpus to further improve search performance. In order to achieve zero-sample retrieval of user queries, from the perspective of efficiency and retrieval performance, the present invention believes that the dictionary-based retrieval method BM25 is an ideal choice for implementing a retriever. BM25 only relies on dictionary overlap and considers the dictionary's term and document frequency. It is simple to implement and has good retrieval performance. BM25 takes into account factors such as term frequency (TF) and inverse document frequency (IDF) in the document. First, the user query is parsed to obtain each morpheme q i , then for each search document D, calculate each morpheme q i The correlation score with D is finally i The relevance score of the user query and the search document D is obtained by weighted summation relative to the relevance score of D:

[0050]

[0051] Where avgdl is the average length of all documents, k1 and b are adjustable parameters, N is the total number of documents in the document collection, and n(q i ) is a string containing the word q i The number of documents.

[0052] In addition to probabilistic retrieval models such as BM25, commonly used information retrieval models also include vector space models. The vector similarity-based retriever represents documents as vectors in the document space through feature selection and weight calculation, and then measures the similarity between documents by calculating the similarity between vectors. Therefore, in order to further improve the search performance, the present invention combines the dictionary-based BM25 with the vector similarity retrieval, integrates the retrieval results of the two, and realizes hybrid retrieval.

[0053] This paper selects BGE-M3 as the vector retrieval model of the retriever. It is a semantic vector model newly proposed by BAAI. It has the characteristics of multi-language, multi-function and multi-granularity, and has achieved leading performance in a wide range of information retrieval tasks. The user query Q is first converted into a hidden state H based on the text encoder. Q And normalized: e Q =norm(H Q ). Similarly, the embedding vector of the candidate document paragraph is expressed as: e D =norm(H D ). Therefore, the relevance score between the user query Q and the paragraph D is measured by the inner product between the two embeddings:

[0054] Score dense (D,Q)= <eD ,e Q >

[0055] Then, the final retrieval results are re-ranked according to the comprehensive BM25 score and vector similarity retrieval score:

[0056] Score(D,Q)=Score BM25 +k*Score dense

[0057] Among them, k is a hyperparameter used to adjust the importance weights of the two retrieval scores. Finally, the top K paragraphs with the highest comprehensive scores are screened out and enter the reranker.

[0058] 3) For the first K paragraphs output by the retriever in step 2), the order of these paragraphs is adjusted by a reranker to ensure that the most relevant paragraphs are ranked better. The present invention represents these first K paragraphs as: By calculating P(p i |Q) to measure the relevance score of each paragraph relative to the user query and achieve re-ranking.

[0059] Specifically, the present invention uses the Bayesian formula to calculate P(p i |Q) for analysis:

[0060]

[0061] Among them, P(p i ) is the prior probability of the retrieved paragraph, and log P(Q) is related to p i is irrelevant, so for any p i , which has the same value and is a common constant. Further, inspired by the existing work, the present invention assumes that the prior probability P(p i ) is uniformly distributed (i.e. for all paragraphs p i are the same), so they can be ignored when reordering. Therefore, the above formula can be simplified to:

[0062] log P(p i |Q)∝log P(Q|p i )

[0063] Therefore, the reordering is based on P(Q|p i ). The present invention uses a pre-trained language model (PLM) to calculate it:

[0064]

[0065] where Θ represents the parameters of the pre-trained language model. The conditional probability of the entire output sequence Q is calculated by multiplying the conditional probabilities of all time steps, where P(Qt |Q <t ,p i ; Θ) is the conditional probability of the model generating the current tag at each time step, which can be expressed as:

[0066] P(Q t |Q <t ,p i ; θ) = Softmax(f(Q <t ,p i ;Θ))

[0067] Among them, f(Q <t ,p i ; Θ) is the output of the model, indicating the generation of the current tag Q t The score is converted into a probability distribution through the Softmax function. In this work, the present invention selects mT5 as the basic model of the re-ranker, and fine-tunes it using a question-answering dataset in the legal field. mT5 adopts a sequence-to-sequence (Seq2Seq) architecture, in which the encoder encodes the input sequence into a hidden layer representation, and the decoder generates an output sequence based on the hidden layer representation. In the fine-tuning process, the present invention uses the answer sequence as input and the question sequence as the target output, and learns to rearrange the candidate paragraphs by learning the mapping relationship between these sequences. During the training process, the cross entropy loss is used to measure the gap between the answer generated by the model and the real answer, so as to optimize the parameters. After fine-tuning, the present invention obtains a re-ranker based on a pre-trained language model, which has low implementation cost and high rearrangement efficiency, providing strong support for the subsequent verification process.

[0068] 4) Input the n most relevant paragraphs in the forgotten set obtained in step 3) to the verifier based on the large language model for verification, further clarify whether the user query involves information in the forgotten set, and instruct the large model to make a corresponding response. The present invention regards the top n paragraphs after re-ranking as relevant cases potentially associated with the user query, represented by C = {c1, c2, ..., c n Next, the present invention needs to determine whether the user query has an exact related case in the related case C, that is, to clarify whether the query intention of the user query involves the forgotten set. LLM has a strong context understanding ability and can better understand the user's query intention in the context of multiple rounds of dialogue between the user and the system. Secondly, LLM shows a strong instruction following ability and can complete the instruction well to realize the judgment of the relevance between the query and the forgotten set. Therefore, the present invention designs a verifier based on a large language model to achieve this goal, which is formally expressed as follows

[0069]

[0070] Among them, goal(Q) represents the query intention of the user's query. If the query intention of the user's query is irrelevant to the forgotten set, the judgment result of the verifier based on the large language model is 0; if the query intention of the user's query is related to the forgotten set, the judgment result of the verifier based on the large language model is 1. Inspired by the conversational search mode, the present invention combines the characteristics of cases in the legal field and designs an outline of theft cases to assist the verifier based on the large language model to determine and clarify the user's query intention, so as to prevent misjudgment of intent recognition. At the same time, the present invention constructs a dynamic interaction mode between users and the system. Through a series of back-and-forth exchanges, it responds to user queries and clarifies the user's information needs, and updates the outline in real time to guide the verifier based on the large language model to gradually narrow the scope of review of related cases C, to retrieve related cases that are consistent with the latest outline, and thus improve the accuracy of the final judgment.

[0071] like Figure 2 As shown, the prompts input to the verifier based on the large language model include three parts: related cases C, instructions, and outlines. First, the related case C is provided to the verifier based on the large language model as the judgment object of the user query, and then the instructions are used to instruct the verifier based on the large language model to judge whether there are related cases in the above-mentioned related cases C according to the information provided by the outline. The outline is an ontology-level modeling of the forgotten set corpus information, which describes the common information of the forgotten set data. In this work, the forgotten set of the present invention is the theft case data in the legal field. Therefore, the present invention models the outline into four attributes describing the key information of the case, namely "time", "place", "defendant", and "stolen items". The verifier based on the large language model judges whether there are related cases in the related case C according to them, which can effectively improve the efficiency and accuracy of the verification.

[0072] When the LLM-based verifier believes that there is no case related to the user query in the related case C, that is, the user query does not involve the forgotten set information, so LLM can normally reply to the user's query related questions. If the LLM-based verifier believes that there are related cases according to the existing outline, the IDs of the corresponding related cases are returned in the form of a list, such as Figure 2As shown. If the number of related cases is 1 at this time, the verifier based on the large language model determines that the query target of the user query touches the information in the forgotten set. In order to prevent LLM from leaking relevant information, LLM is instructed to refuse to answer at this time. If the verifier based on the large language model finds that there are multiple cases related to the user query under the condition of the current outline, the user will be required to further provide the remaining unknown key information about the case to update the outline. The updated outline and the related cases C and instructions form a new prompt and are re-input into the verifier based on the large language model to perform a new round of verification. If there are still empty attributes in the outline, the above process is repeated until the verifier based on the large language model determines that the number of related cases is 0 or 1; if all the attribute information in the outline is clear, the verifier based on the large language model still believes that there are multiple related cases, then it is determined that the user query involves forgotten set information, and LLM is instructed to refuse to answer.

[0073] 5) Construct a forgetting learning benchmark dataset of theft cases in the legal field to verify the effectiveness of the method proposed in the present invention. In the dataset constructed by the present invention, each piece of data consists of a user query related to the content of the case, a text describing the facts of the case and an outline of the case, wherein the outline contains four attributes, namely "time", "place", "defendant" and "stolen items", which are stored in the form of key-value pairs, and the initial user query only contains information related to the "defendant". The present invention divides the dataset into a forgotten set and a non-forgotten set, with a total of 2039 samples. In the experiment, the present invention quantifies the forgetting learning effect by evaluating the accuracy of accurately identifying whether the case facts involved in the user query exist in the forgotten set.

[0074] The above embodiments are only preferred implementation modes of the present invention. It should be pointed out that ordinary technicians in this technical field can make several improvements and equivalent substitutions without departing from the principles of the present invention. These technical solutions after improvements and equivalent substitutions to the claims of the present invention all fall within the protection scope of the present invention.

Claims

1. A machine forgetting learning method based on information retrieval and large language model driven, characterized by: The method comprises the following steps: 1) For a given user query, redefine the forgetting learning task; 2) Design a retriever that uses a hybrid retrieval mechanism to perform information retrieval on the forgotten set corpus to further improve search performance; 3) For the first K paragraphs output by the retriever in step 2), use the reranker to adjust the order of these paragraphs. To ensure that the most relevant paragraphs are ranked better; 4) Input the n most relevant paragraphs in the forgotten set obtained in step 3) to the verifier based on the large language model for verification, further clarify whether the user query involves information in the forgotten set, and instruct the large model to make a corresponding response; 5) Construct a forgetting learning benchmark dataset of theft cases in the legal field to verify the effectiveness of the learning method.

2. The machine forgetting learning method based on information retrieval and large language model driving according to claim 1 is characterized in that: In step 1), the model parameters are not changed. By adding the permission of prohibiting access to the forgotten set to the model, the model refuses to answer information about the forgotten set, so as to erase the data traces of the forgotten set in the model and make the model behave as if it does not know about it. The forgetting learning task is formally defined as: for the forgotten set D f ={}y1,y2,...,y f , ...}, where y f is harmful text that will leak private information, and the pre-trained language model θ o Processing Tips x f will generate a f The harmful output of the forgetting learning mechanism is represented as U, so that Among them, when the model θ o Process normal prompts x that do not involve the contents of the forget set n , it should be treated as a normal question and generate a normal response y n ; When the model θ o Encountered hints about the contents of the forgotten set x f When it is, it should be identified and a rejection response y should be generated reject ,in 3. The machine forgetting learning method based on information retrieval and large language model driving according to claim 1 is characterized in that: In step 2), the dictionary-based retrieval method BM25 is an ideal choice for implementing the retriever. BM25 only relies on dictionary overlap and considers the term and document frequency of the dictionary. It is simple to implement and has good retrieval performance. BM25 considers the term frequency (TF) and inverse document frequency (IDF) factors in the document. First, the user query is parsed to obtain each morpheme q i , then for each search document D, calculate each morpheme q i The correlation score with D is finally i The weighted sum of the relevance scores relative to D is used to obtain the relevance score of the user query and the search document D. BM25 .

4. The machine forgetting learning method based on information retrieval and driven by a large language model according to claim 1, characterized in that: In step 2), a hybrid search mechanism is designed to combine the dictionary-based BM25 with the vector similarity search, and the search results of the two are combined to achieve hybrid search. Select BGE-M3 as the vector retrieval model of the retriever. The user query Q will first be converted into a hidden state H based on the text encoder. Q And normalized: e Q =norm(H Q ), similarly, the embedding vector of the candidate document paragraph is expressed as: D =norm(H D ), therefore, the relevance score between the user query Q and the paragraph D is measured by the inner product between the two embeddings: Score dense (D,Q)=<e D ,e Q > Then, the final retrieval results are re-ranked according to the comprehensive BM25 score and vector similarity retrieval score: Score(D,Q)=Score BM25 +k*Score dense Among them, k is a hyperparameter used to adjust the importance weights of the two retrieval scores. Finally, the top K paragraphs with the highest comprehensive scores are screened out and enter the reranker.

5. The machine forgetting learning method based on information retrieval and large language model driving according to claim 1 is characterized in that: In step 3), the first K paragraphs are represented as: The proposed resequencer calculates P(p i |Q) to measure the relevance score of each paragraph relative to the user query to achieve rearrangement, as follows: i |Q) for analysis: Among them, P(p i ) is the prior probability of the retrieved paragraph, and logP(Q) is related to p i is irrelevant, so for any p i , whose value is the same, is a common constant. Assuming that the prior probability P(p i ) is uniformly distributed, the above formula can be simplified to: log P(p i |Q)∝log P(Q|p i ) Therefore, the reordering is based on P(Q|p i ) size.

6. The machine forgetting learning method based on information retrieval and large language model driving according to claim 1, characterized in that: In the step 3), mT5 is selected as the basic model of the re-ranker, and is fine-tuned using a question-answering dataset in the legal field. mT5 adopts a sequence-to-sequence (Seq2Seq) architecture, in which the encoder encodes the input sequence into a hidden layer representation, and the decoder generates an output sequence based on the hidden layer representation. In the fine-tuning process, the answer sequence is used as input and the question sequence is used as the target output. The mapping relationship between these sequences is learned to learn how to re-rank the candidate paragraphs. During the training process, the cross entropy loss is used to measure the gap between the answers generated by the model and the real answers, so as to optimize the parameters. After fine-tuning, a re-ranker based on a pre-trained language model is obtained, which has low implementation cost and high re-ranking efficiency, providing strong support for the subsequent verification process.

7. The machine forgetting learning method based on information retrieval and driven by a large language model according to claim 1, characterized in that: In step 4), in order to clarify whether the query intention of the user's query involves the forgotten set, a verifier based on a large language model is designed. The large language model has a strong context understanding ability and can better understand the user's query intention in the context of multiple rounds of dialogue between the user and the system. Secondly, the large language model shows a strong instruction following ability and can complete the instruction well to realize the judgment of the relevance between the query and the forgotten set. Therefore, a verifier is designed to achieve this goal, which is formally expressed as follows: Among them, goal(Q) represents the query intention of the user's query. If the query intention of the user's query is irrelevant to the forgotten set, the judgment result of the verifier based on the large language model is 0; if the query intention of the user's query is related to the forgotten set, the judgment result of the verifier based on the large language model is 1.

8. The machine forgetting learning method based on information retrieval and large language model driving according to claim 1, characterized in that: In the step 4), an outline of the theft case is designed to assist the verifier based on the large language model in determining and clarifying the user's query intention. The forgotten set is the theft case data in the legal field. The outline is modeled into four attributes describing the key information of the case, namely "time", "place", "defendant", and "stolen items". The verifier based on the large language model uses them to determine whether the related case C has related cases, which can effectively improve the efficiency and accuracy of verification.

9. The machine forgetting learning method based on information retrieval and large language model driving according to claim 1, characterized in that: In step 4), a dynamic interaction mode between the user and the system is constructed. If the verifier based on the large language model finds that there are multiple cases related to the user query under the given current outline, the user will be required to further provide the remaining unknown key information about the case for updating the outline. Through a series of back-and-forth exchanges, the user query is responded to and the user's information needs are clarified. The outline is updated in real time, thereby guiding the verifier based on the large language model to gradually narrow the scope of review of related cases, to retrieve related cases that are consistent with the latest outline, and thus improve the accuracy of the final judgment.

10. The machine forgetting learning method based on information retrieval and large language model driving according to claim 1, characterized in that: In the step 5), each piece of data in the constructed data set consists of a user query related to the case content, a text describing the case facts and the outline of the case, wherein the outline contains four attributes, namely "time", "place", "defendant" and "stolen items", and is stored in the form of key-value pairs. The initial user query only contains information related to the "defendant", and the data set is divided into a forgotten set and a non-forgotten set, with a total of 2039 samples.

Citation Information

Patent Citations

  • Removal of undesired inferences from machine learning models

    CN116157810A

  • Large language model security alignment training method and device, electronic equipment and medium

    CN118966299A

  • Guided anomaly detection framework

    WO2024112501A1