Figure graph model training method with anti-editing concept erasing function

By adding LORA layers to the literary and biographical graphics model and performing specific training methods, the problem that traditional concept erasure methods cannot prevent image editing from generating images containing target concepts is solved, and the target concept is filtered in image editing and images that meet user requirements are generated.

CN119888011AActive Publication Date: 2025-04-25HARBIN INST OF TECH

Patent Information

Application Number
CN202411952896.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

Traditional concept erasing methods cannot prevent users from producing images that contain target concepts and meet user requirements through image editing.

Method used

A literary graph model training method with anti-editing concept erasing function is adopted, which includes data preparation, model construction and model training stages. The specific steps include: preparing the target concept text and prior concept text, building a fine-tuned post-text biographical model and adding a LORA layer, aligning through noise prediction under frozen and non-freezing parameters, constructing a conditional predicted noise alignment loss function and prior concept noise constraint loss, and conducting multiple trainings until the termination condition is met.

Benefits of technology

The concept of filtering targets during image editing is realized, preventing unsafe content from being generated during editing and generation, and the generated images are more accurate and meet user requirements and are not restricted by input text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888011A_ABST
    Figure CN119888011A_ABST
Patent Text Reader

Abstract

The invention discloses a text graph model training method with a reverse editing concept erasing function, and belongs to the field of concept erasing of text graph models. The problem that a traditional concept erasing method cannot prevent a user from generating an image which contains a target concept and meets the requirements of the user through editing is solved. According to the method, after unconditional noise predicted through the constructed fine-tuned text generation graph model and prior guidance calculation, erasure guidance is introduced into the image inference process, and the method is not limited by input texts. In the training stage, a loss function # imgabs0 #, a loss function # imgabs1 # and a loss # imgabs2 # are constructed to obtain total loss, and conditional noise and unconditional noise are finely adjusted, so that concept erasure can be achieved under the condition that a text input by a user does not contain target concept information. And thus, the effect of preventing the target concept image from being generated in generation and editing is achieved. The method and the device are mainly used in the field of text graphs, and concept erasing can be realized under the condition that target concept information is not included.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of concept erasure of cultural graph models. Background Art

[0002] Concept erasure of the text-based graph model aims to accurately remove the target concept while faithfully retaining the generation of non-target concepts. Specifically, for any input text, the images generated by the model do not contain the target concept, while the images generated for non-target concepts remain unchanged. Copyrighted and unsafe data are used in the training process of the text-based graph model, which can cause the model to generate infringing content in the generated images. In order to prevent this phenomenon, research on concept erasure of text-based graph models has become a hot topic.

[0003] In past studies, concept erasure methods based on fine-tuning models have gradually developed. Such methods achieve concept erasure by fine-tuning the model's noise prediction on the target concept text. The technology of editing using the text-generated graph model has gradually matured. The development of this technology has enabled users to use images containing target concepts and edited text to achieve the purpose of generating new images. Although past erasure methods can effectively prevent the generation of images corresponding to unsafe content under given text, image editing can bypass their erasure methods to generate images containing target concepts and meeting user requirements. This is because past erasure methods require the input text to contain the target concept to produce an effect, while the edited text does not necessarily contain the target concept, and the input original image also provides information about the target concept. Therefore, there is a need for an anti-editing concept erasure method that can filter the target concept during the editing process to prevent unsafe content from being generated during editing and generation. Summary of the invention

[0004] The purpose of the present invention is to solve the problem that the traditional concept erasing method cannot prevent the user from generating an image containing the target concept and meeting the user's requirements through editing, and to provide a method for training a text graph model with an anti-editing concept erasing function.

[0005] A method for training a text graph model with an anti-editing concept erasure function, the method comprising:

[0006] (I) Data preparation stage:

[0007] The text content to be erased is taken as the target concept text c;

[0008] The large language model outputs multiple natural language texts based on user questions and answer samples. Each natural language text is used as a prior concept text, and all natural language texts constitute a prior concept set.

[0009] The user question includes user requirements, target concept text c and output quantity;

[0010] (II) Model building stage:

[0011] A LORA layer is added after each attention layer in the noise prediction network of the original pre-trained text-generated graph model, and the attention layer is adjacent to the added LORA layer, to generate a fine-tuned text-generated graph model; wherein the category of each attention layer is the same as the category of the LORA layer corresponding to the attention layer;

[0012] (III) Model training phase:

[0013] The specific process of training the fine-tuned text image model is as follows:

[0014] First, the fine-tuned text image model under frozen parameters is based on the input original noise z T , empty text φ and target concept text c and random time step t, predict the image latent space representation z after denoising t steps t ;

[0015] Secondly, the fine-tuned text image model under non-frozen parameters is based on the image latent space representation z t , N prior concept texts, empty text φ and target concept text c, predict the target concept noise, prior concept noise and unconditional noise under non-frozen parameters;

[0016] The original pre-trained Wensheng graph model under frozen parameters represents z according to the image latent space t , N prior concept texts, empty text φ and target concept text c, predict the target concept noise, prior concept noise and unconditional noise under frozen parameters;

[0017] According to the target concept noise, prior concept noise and unconditional noise under frozen and non-frozen parameters, the conditional prediction noise alignment loss function is constructed. Unconditional prediction noise alignment loss function and the prior concept noise constraint loss

[0018] Finally, according to and Total structural loss Utilize total loss Gradient back propagation updates the LORA layer parameters of the fine-tuned text-generated graph model under non-frozen parameters;

[0019] The fine-tuned text-generated image model is trained multiple times until the termination condition is met, thereby completing the training of the fine-tuned text-generated image model.

[0020] Preferably, a conditional prediction noise alignment loss function is constructed The implementation methods include:

[0021] First, according to and Compute conditional prediction noise erasure guidance

[0022] in, is the unconditional noise predicted under frozen parameters, is the target concept noise predicted under frozen parameters;

[0023] Secondly, according to and ∈ θ (z t ,c,t), construct a conditional prediction noise alignment loss function and

[0024]

[0025] Among them, ∈ θ (z t ,c,t) is the target concept noise predicted under non-frozen parameters, is the Monte Carlo simulation expectation under the target concept, and ||·||2 is the calculation of the L2 norm.

[0026] Preferably, Among them, η c Erasing strength for conditional noise concepts.

[0027] Preferably, an unconditional prediction noise alignment loss function is constructed The implementation methods include:

[0028] First, according to and Unconditional prediction of noise-erased guidance under computational prior guidance

[0029] in, is the unconditional noise predicted under frozen parameters, is the target concept noise predicted under the frozen parameters, is the i-th prior concept noise predicted under the frozen parameters, N ≥ 1;

[0030] Secondly, according to and ∈ θ (z t ,t), construct unconditional prediction noise alignment loss function and

[0031]

[0032] Among them, ∈ θ (z t,t) is the unconditional noise predicted under non-frozen parameters, is the Monte Carlo simulation expectation under the target concept, and ||·||2 is the calculation of the L2 norm.

[0033] Preferably,

[0034] Among them, η u represents the unconditional noise erasure strength, η p represents the prior guidance strength, Represents the i-th prior concept text The degree of relevance to the target concept text c.

[0035] Preferably, It means to combine x with After encoding into vectors, the cosine similarity between the two vectors is calculated; CLIP(x,c) means that after encoding x and c into vectors, the cosine similarity between the two vectors is calculated; x is the target concept image, is the i-th prior concept text.

[0036] Preferably, the prior concept noise-constrained loss The implementation methods include:

[0037]

[0038] in, is the Monte Carlo simulation expectation under the a priori concept, represents the set of prior concepts obtained by the large language model, is the i-th prior concept noise predicted under non-frozen parameters, is the i-th prior concept noise predicted under the frozen parameters, N ≥ 1.

[0039] Preferably,

[0040] Among them, λ PUnc ,λ Cons ,λ ESD They are the first to third preset loss function weights respectively.

[0041] Preferably, the AdamW optimization algorithm is used to optimize and update the LORA layer parameters of the fine-tuned text image model under non-frozen parameters.

[0042] Preferably, the large language model outputs a natural language according to the user's questions and answer samples. The implementation of this article includes:

[0043] Initialization phase: User questions and answer samples are input into the large language model according to the question and answer templates. The large language model proposes user requirements according to the question template and obtains preliminary answers.

[0044] Self-feedback stage: The large language model evaluates the current preliminary answer based on the answer examples and user requirements;

[0045] Revision stage: modify the current preliminary answer based on the self-assessment results and the answer sample;

[0046] After a predetermined number of cycles of the self-feedback stage and the modification stage, the modification stage outputs a final answer, which serves as a natural language text and also as a priori concept text.

[0047] Advantages of the present invention:

[0048] The text graph model training method with anti-editing concept erasing function of the present invention first constructs a fine-tuned text graph model, performs three-way alignment based on the target concept noise, prior concept noise and unconditional noise under frozen and non-frozen parameters predicted by the model, and constructs a conditional prediction noise alignment loss function Unconditional prediction noise alignment loss function and the prior concept noise constraint loss

[0049] After calculating the unconditional noise and prior guidance predicted by the constructed fine-tuned post-context image model, the erasure guidance will be introduced into the image inference process without being restricted by the input text.

[0050] At the same time, the unconditional prediction noise alignment loss function The noise training is performed on the latent vector containing the target concept text, so it will be more targeted at erasing the target concept text c (i.e., the text content to be erased). Prior concept noise constraint loss It will ensure that the erasing effect is not affected by overfitting, and the prior guidance will reduce the impact of erasure training on the generation and editing of other concepts, improve the prediction accuracy of the fine-tuned text image model, and generate images that are more accurate and meet user requirements.

[0051] The present invention fine-tunes both conditional noise (i.e., target concept noise) and unconditional noise to achieve concept erasure even when the user input text does not contain target concept information, thereby achieving the effect of preventing the generation of target concept images during generation and editing.

[0052] When using the trained text-generated graph model for text-generated graph prediction, it is only necessary to insert the trained LORA layer into the original model (i.e., the original pre-trained text-generated graph model) to obtain a fine-tuned model, and then input the text used to describe the image content to generate the corresponding image, so as to achieve concept erasure even when the user input text does not contain the target concept information, thereby achieving the effect of preventing the target concept image from being generated during generation and editing. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 This is a schematic diagram showing the principle of the method for training a text graph model with an anti-editing concept erasing function according to the present invention.

[0054] Figure 2 This is a schematic diagram of obtaining prior concepts using a large language model according to the present invention. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0056] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0057] The method of the present invention is based on the calculation without classifier guidance. The mathematical form of the classifier-free guidance (CFG) is:

[0058]

[0059] Among them, ∈ θ (·) represents the noise predicted by the noise prediction network in the Wensheng graph model, θ represents the network parameters, z t represents the latent space representation of the image after t steps of denoising, c represents the embedded representation of the input text, and ω represents the guidance strength without the classifier.

[0060] Specific implementation method 1. Figure 1 The present embodiment is described. The method for training a viz graph model with an anti-editing concept erasing function described in the present embodiment comprises:

[0061] (I) Data preparation stage:

[0062] The text content to be erased is taken as the target concept text c;

[0063] The large language model outputs multiple natural language texts based on user questions and answer samples. Each natural language text is used as a prior concept text, and all natural language texts constitute a prior concept set.

[0064] The user question includes user requirements, target concept text c and output quantity;

[0065] (II) Model building stage:

[0066] A LORA layer is added after each attention layer in the noise prediction network of the original pre-trained text-generated graph model, and the attention layer is adjacent to the added LORA layer, to generate a fine-tuned text-generated graph model; wherein the category of the attention layer is the same as the category of the LORA layer corresponding to the attention layer;

[0067] (III) Model training phase:

[0068] The specific process of training the fine-tuned text image model is as follows:

[0069] First, the fine-tuned text image model under frozen parameters is based on the input original noise z T , empty text φ and target concept text c and random time step t, predict the image latent space representation z after denoising t steps t ;

[0070] Secondly, the fine-tuned text image model under non-frozen parameters is based on the image latent space representation z t , N prior concept texts, empty text φ and target concept text c, predict the target concept noise, prior concept noise and unconditional noise under non-frozen parameters;

[0071] The original pre-trained Wensheng graph model under frozen parameters represents z according to the image latent space t , N prior concept texts, empty text φ and target concept text c, predict the target concept noise, prior concept noise and unconditional noise under frozen parameters;

[0072] According to the target concept noise, prior concept noise and unconditional noise under frozen and non-frozen parameters, the conditional prediction noise alignment loss function is constructed. Unconditional prediction noise alignment loss function and the prior concept noise constraint loss

[0073] Finally, according to and Total structural loss Utilize total loss Gradient back propagation updates the LORA layer parameters of the fine-tuned text-generated graph model under non-frozen parameters;

[0074] The fine-tuned text-generated image model is trained multiple times until the termination condition is met, thereby completing the training of the fine-tuned text-generated image model.

[0075] In this implementation, the target concept noise, prior concept noise, and unconditional noise are aligned according to the frozen and non-frozen parameters predicted by the model to construct a conditional prediction noise alignment loss function. Unconditional prediction noise alignment loss function and the prior concept noise constraint loss

[0076] After the unconditional noise predicted by the constructed fine-tuned text-generated image model and the prior guidance are calculated, the erasure guidance is introduced into the image inference process and is not restricted by the input text. At the same time, the unconditional prediction noise alignment loss function The noise training is performed on the latent vector containing the target concept text, so it will be more targeted at erasing the target concept text c (i.e., the text content to be erased). Prior concept noise constraint loss It will ensure that the erasing effect is not affected by overfitting, and the prior guidance will reduce the impact of erasure training on the generation and editing of other concepts, improve the prediction accuracy of the fine-tuned text image model, and generate images that are more accurate and meet user requirements.

[0077] When using the trained text-generated graph model for text-generated graph prediction, it is only necessary to insert the trained LORA layer into the original model (i.e., the original pre-trained text-generated graph model) to obtain a fine-tuned model, and then input the text used to describe the image content to generate the corresponding image, so as to achieve concept erasure even when the user input text does not contain the target concept information, thereby achieving the effect of preventing the target concept image from being generated during generation and editing.

[0078] When specifically applied, the Wensheng graph model is Stable Diffusion, and the noise prediction network used in the Wensheng graph model is the UNet network in Stable Diffusion v1.4, through which the target concept noise, prior concept noise and unconditional noise are predicted. The training object is the LORA layer added after each attention layer of UNet added by the present invention. Specifically, the UNet network includes two types of attention layers, and the categories of the two types of attention layers are divided into linear layers and convolutional layers, so the categories of the two types of LORA layers added are linear layers and convolutional layers, respectively. The LORA in the linear layer is a two-layer structure, and the linear layer 1 reduces the input dimension to the rank of the LORA, and the linear layer 2 promotes the input dimension to the original dimension. The convolution layer LORA also includes a two-layer structure. Convolution layer 1 reduces the number of input channels to the rank of the LORA, and the convolution setting is the same as the pre-convolution layer except for the number of input and output channels. Convolution layer 2 promotes the number of input channels to the original number of channels, and the convolution kernel size is 1*1, and the step size is 1.

[0079] See also Figure 1 , construct a conditional prediction noise alignment loss function The implementation methods include:

[0080] First, according to and Compute conditional prediction noise erasure guidance

[0081] in, is the unconditional noise predicted under frozen parameters, is the target concept noise predicted under frozen parameters;

[0082] Secondly, according to and ∈ θ (z t ,c,t), construct a conditional prediction noise alignment loss function and

[0083]

[0084] Among them, ∈ θ (z t ,c,t) is the target concept noise predicted under non-frozen parameters, is the Monte Carlo simulation expectation under the target concept, and ||·||2 is the calculation of the L2 norm.

[0085] In this preferred embodiment, the conditional prediction noise erasure guidance (CEG) reversely uses the classifier-free guidance to construct the alignment noise, and the constructed conditional prediction noise alignment loss function is The erasure guidance is introduced into the target concept prediction noise, and the erasure effect is stronger when the target concept is included in the text.

[0086] Specifically, Among them, η c The conditional noise concept erasure strength. In the expression of t The noise prediction network in training is trained to generate Gaussian noise z under the condition of target concept text. T The inference is Tt steps. During this process, the model calculation does not participate in the gradient back propagation. Its advantage is that there is no need to prepare training data in advance.

[0087] For further information, see Figure 1 Constructing unconditional prediction noise alignment loss function The implementation methods include:

[0088] First, according to and Unconditional prediction of noise-erased guidance under computational prior guidance

[0089] in, is the unconditional noise predicted under frozen parameters, is the target concept noise predicted under the frozen parameters, is the i-th prior concept noise predicted under the frozen parameters, N ≥ 1 represents the number of prior concept samples;

[0090] Secondly, according to and ∈ θ (z t ,t), construct unconditional prediction noise alignment loss function and

[0091]

[0092] Among them, ∈ θ (z t ,t) is the unconditional noise predicted under non-frozen parameters, is the Monte Carlo simulation expectation under the target concept, and ||·||2 is the calculation of the L2 norm.

[0093] In this preferred embodiment, the predicted unconditional noise is guided by the unconditional predicted noise erasure guided by the alignment prior The erasure guidance is introduced into the noise prediction containing the latent space representation of the target concept image. At the same time, the prior guidance in the alignment noise reduces the impact of erasure on the prior concept noise prediction, ensuring the prediction accuracy of the fine-tuned text image model. Specifically,

[0094]

[0095] Among them, η u represents the unconditional noise erasure strength, η p represents the prior guidance strength, Represents the i-th prior concept text The degree of relevance to the target concept text c.

[0096] This preferred embodiment provides an unconditional prediction noise erasure guidance under a priori guidance. The expression of erasing the guide The introduction of can accurately erase the target concept while reducing the impact on non-target concepts.

[0097] further,

[0098] It means to combine x with After encoding into vectors, calculate the cosine similarity between the two vectors;

[0099] CLIP(x,c) means encoding x and c into vectors and calculating the cosine similarity between the two vectors;

[0100] x is the target concept image, is the i-th prior concept text.

[0101] In this embodiment, the given , CLIP(·) is a multimodal model, which encodes the image and text into vector representations through the image encoder and the text encoder, and uses the cosine similarity between the image vector representation and the text vector representation to represent the correlation between the image and the text. x is the image of the target concept, and here the correlation between the prior concept and the target concept is represented by calculating the proportion of the correlation between the target concept image and the prior concept text in the target concept image and the target concept text. This representation method can adaptively control the introduction strength of the prior guidance.

[0102] See also Figure 1 , prior concept noise constraint loss The implementation methods include:

[0103]

[0104] in, Monte Carlo simulation expectation for the a priori concept, represents the set of prior concepts obtained by the large language model, is the i-th prior concept noise predicted under non-frozen parameters, is the ith prior concept noise predicted under the frozen parameters, and N ≥ 1 represents the number of prior concept samples.

[0105] The preferred embodiment provides , which can constrain the noise prediction of the model under non-target concept conditions to be consistent with the original model (i.e., the original pre-trained text graph model), thereby maintaining the erasing effect.

[0106] When applying specifically,

[0107] Among them, λ PUnc ,λ Cons ,λ ESD They are the first to third preset loss function weights respectively.

[0108] Specifically, the AdamW optimization algorithm is used to optimize and update the LORA layer parameters of the fine-tuned text image model under non-frozen parameters.

[0109] The present invention uses a large language model to generate prior concept text in the data preparation stage, which is a prior art. When used specifically, refer to Figure 2 , the large language model outputs a natural language based on user questions and answer samples. The implementation of this article includes:

[0110] Initialization phase: User questions and answer samples are input into the large language model according to the question and answer templates. The large language model proposes user requirements according to the question template and obtains preliminary answers.

[0111] Self-feedback stage: The large language model evaluates the current preliminary answer based on the answer examples and user requirements;

[0112] Revision stage: modify the current preliminary answer based on the self-assessment results and the answer sample;

[0113] After a predetermined number of cycles of the self-feedback stage and the modification stage, the modification stage outputs a final answer, which serves as a natural language text and also as a priori concept text.

[0114] Principle analysis:

[0115] First, use a large language model to obtain a set of prior concepts Prepare the pre-trained model that needs to be concept-erased, initialize the LORA layer and insert it into the target position of the pre-trained model, and set the number of iterations required for training. In each iteration, use the model in training to infer the image latent space representation z t , the target concept noise is predicted by the model under frozen and unfrozen parameters ∈ θ (z t,c,t), prior concept noise ∈ θ (z t ,c pi ,t), unconditional noise ∈ θ (z t ,t);

[0116] Secondly, calculate the unconditional prediction noise erasure guidance under the prior guidance Noise erasure bootstrapping with conditional prediction

[0117] Then, the unconditional noise and the unconditional prediction noise erasure guidance under the prior guidance are used. Alignment, to construct the unconditional prediction noise alignment loss function

[0118] Using the prior concept noise predicted under non-frozen and frozen parameters and Alignment, to construct a priori concept noise constraint loss

[0119] Using the target concept noise ∈ predicted under non-frozen parameters θ (z t ,c,t) and conditional prediction noise erasure guidance Alignment, to construct a conditional prediction noise alignment loss function

[0120] Finally, using and Total structural loss And back propagate and update the LORA layer parameters according to the gradient of the total loss. After the specified number of iterations, the final LORA model parameters are obtained.

[0121] The present invention combines the unconditional noise with the unconditional prediction noise erasure guidance under the prior guidance. Alignment, the erasure guidance is introduced into the inference process and is not limited by the input text, and the present invention combines conditional noise (i.e., target concept noise) with conditional prediction noise erasure guidance Alignment is used to improve the erasing strength, while alignment is constrained by a priori concept noise to maintain the erasing effect.

[0122] Although the present invention is described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the present invention. It should therefore be understood that many modifications may be made to the exemplary embodiments and that other arrangements may be devised without departing from the spirit and scope of the present invention as defined by the appended claims. It should be understood that the various dependent claims and features described herein may be combined in a manner different from that described in the original claims. It should also be understood that features described in conjunction with individual embodiments may be used in other described embodiments.

Claims

1. A method for training a viz-graph model with an anti-editing concept erasing function, characterized in that: The method includes: (I) Data preparation stage: The text content to be erased is taken as the target concept text c; The large language model outputs multiple natural language texts based on user questions and answer samples. Each natural language text is used as a prior concept text, and all natural language texts constitute a prior concept set. The user question includes user requirements, target concept text c and output quantity; (II) Model building stage: A LORA layer is added after each attention layer in the noise prediction network of the original pre-trained text-generated graph model, and the attention layer is adjacent to the added LORA layer, to generate a fine-tuned text-generated graph model; wherein the category of each attention layer is the same as the category of the LORA layer corresponding to the attention layer; (III) Model training phase: The specific process of training the fine-tuned text image model is as follows: First, the fine-tuned text image model under frozen parameters is based on the input original noise z T , empty text φ and target concept text c and random time step t, predict the image latent space representation z after denoising t steps t ; Secondly, the fine-tuned text image model under non-frozen parameters is based on the image latent space representation z t , N prior concept texts, empty text φ and target concept text c, predict the target concept noise, prior concept noise and unconditional noise under non-frozen parameters; The original pre-trained Wensheng graph model under frozen parameters represents z according to the image latent space t , N prior concept texts, empty text φ and target concept text c, predict the target concept noise, prior concept noise and unconditional noise under frozen parameters; According to the target concept noise, prior concept noise and unconditional noise under frozen and non-frozen parameters, the conditional prediction noise alignment loss function is constructed. Unconditional prediction noise alignment loss function and the prior concept noise constraint loss Finally, according to and Total structural loss Utilize total loss Gradient back propagation updates the LORA layer parameters of the fine-tuned text-generated graph model under non-frozen parameters; The fine-tuned text-generated image model is trained multiple times until the termination condition is met, thereby completing the training of the fine-tuned text-generated image model.

2. The method for training a viz graph model with an anti-editing concept erasing function according to claim 1, characterized in that: Constructing conditional prediction noise alignment loss function The implementation methods include: First, according to and Compute conditional prediction noise erasure guidance in, is the unconditional noise predicted under frozen parameters, is the target concept noise predicted under frozen parameters; Secondly, according to and ∈ θ (z t ,c,t), construct a conditional prediction noise alignment loss function and Among them, ∈ θ (z t ,c,t) is the target concept noise predicted under non-frozen parameters, is the Monte Carlo simulation expectation under the target concept, and ||·||2 is the calculation of the L2 norm.

3. The method for training a text graph model with an anti-editing concept erasing function according to claim 2, characterized in that: Among them, η c Erasing strength for conditional noise concepts.

4. The method for training a text graph model with an anti-editing concept erasing function according to claim 1, characterized in that: Constructing unconditional prediction noise alignment loss function The implementation methods include: First, according to and Unconditional prediction of noise-erased guidance under computational prior guidance in, is the unconditional noise predicted under frozen parameters, is the target concept noise predicted under the frozen parameters, is the i-th prior concept noise predicted under the frozen parameters, N ≥ 1; Secondly, according to and ∈ θ (z t ,t), construct unconditional prediction noise alignment loss function and Among them, ∈ θ (z t ,t) is the unconditional noise predicted under non-frozen parameters, is the Monte Carlo simulation expectation under the target concept, and ||·||2 is the calculation of the L2 norm.

5. The method for training a text graph model with an anti-editing concept erasing function according to claim 4, characterized in that: Among them, η u represents the unconditional noise erasure strength, η p represents the prior guidance strength, Represents the i-th prior concept text The degree of relevance to the target concept text c.

6. The method for training a text graph model with an anti-editing concept erasing function according to claim 5, characterized in that: It means to combine x with After encoding into vectors, the cosine similarity between the two vectors is calculated; CLIP(x,c) means that after encoding x and c into vectors, the cosine similarity between the two vectors is calculated; x is the target concept image, is the i-th prior concept text.

7. The method for training a text graph model with an anti-editing concept erasing function according to claim 1, characterized in that: Prior concept noise constraint loss The implementation methods include: in, is the Monte Carlo simulation expectation under the a priori concept, represents the set of prior concepts obtained by the large language model, is the i-th prior concept noise predicted under non-frozen parameters, is the i-th prior concept noise predicted under the frozen parameters, N ≥ 1.

8. The method for training a text graph model with an anti-editing concept erasing function according to claim 1, characterized in that: Among them, λ PUnc ,λ Cons ,λ ESD They are the first to third preset loss function weights respectively.

9. The method for training a text graph model with an anti-editing concept erasing function according to claim 1, characterized in that: The AdamW optimization algorithm is used to optimize and update the LORA layer parameters of the fine-tuned text image model under non-frozen parameters.

10. The method for training a text graph model with an anti-editing concept erasing function according to claim 1, characterized in that: The large language model outputs a natural language based on user questions and answer samples. The implementation of this article includes: Initialization phase: User questions and answer samples are input into the large language model according to the question and answer templates. The large language model proposes user requirements according to the question template and obtains preliminary answers. Self-feedback stage: The large language model evaluates the current preliminary answer based on the answer examples and user requirements; Revision stage: modify the current preliminary answer based on the self-assessment results and the answer sample; After a predetermined number of cycles of the self-feedback stage and the modification stage, the modification stage outputs a final answer, which serves as a natural language text and also as a priori concept text.

Citation Information

Patent Citations

  • Pentograph model training method and device, equipment and storage medium

    CN117173504A

  • Multi-modal image super-resolution reconstruction method based on structured knowledge distillation

    CN117911246A

  • Concept segmentation-based lifelong learning text graph generation method

    CN118196231A

  • Figure generation method based on consistency model

    CN118887308A

  • Apparatus for predicting mental disease and diagnosis classification by natural language expression and method thereof

    KR102996023B1

Cited By

  • Structure apparent anomaly cross-modal identification method and system based on diffusion model

    CN121236610A