Knowledge editing evaluation sample construction method and system in a multi-modal scenario

By introducing a dual similarity filtering mechanism and a generative model, the problem of constructing local and generalized samples in multimodal knowledge editing evaluation is solved, achieving efficient and automated multidimensional evaluation and generating a high-quality multimodal knowledge editing evaluation sample set.

CN121542745BActive Publication Date: 2026-05-29ZHEJIANG UNIV +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2026-01-19
Publication Date
2026-05-29

Smart Images

  • Figure CN121542745B_ABST
    Figure CN121542745B_ABST
Patent Text Reader

Abstract

The application discloses a kind of multi-modal scene under knowledge editing evaluation sample construction method and system, belong to artificial intelligence technical field.The method is aimed at each knowledge point, first, filter triplets visual question and answer sample as reliability sample;Further, by modifying the fine-grained attribute of target entity in the sample, generate generalization sample for testing deep reasoning;Introduce the dual similarity filtering mechanism of text semantics and visual attribute, accurately filter irrelevant candidate samples from large-scale multi-modal problem library as locality sample;Finally, three kinds of samples are packaged as standardized test tuples, forming the evaluation sample set covering reliability, generalization and locality.The present application realizes the whole process automation construction, solves the limitation of single evaluation dimension and dependence on artificial annotation, and provides an efficient benchmark for accurately evaluating the knowledge editing effect of multi-modal large model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence technology, and involves the cross-application of computer vision and natural language processing, especially a method and system for constructing knowledge editing and evaluation samples in a multimodal scenario. Background Technology

[0002] With the rapid development of deep learning technology, Multimodal Large Language Models (MLLMs) such as GPT-4V, Gemini, and LLaVA have made breakthroughs in image understanding, visual question answering (VQA), and cross-modal reasoning tasks. However, these models are usually trained on static datasets, and once their internal parameters are fixed, they are difficult to adapt to the constantly updated knowledge in the real world (such as current affairs news, newly emerging entity attributes, etc.). When the model encounters outdated information or incorrect knowledge, traditional solutions are usually full fine-tuning or retrieval-enhanced generation (RAG). However, full fine-tuning is extremely computationally expensive and easily leads to the model's "catastrophic forgetting" of old knowledge, while RAG technology relies on the accuracy of external retrieval and does not truly change the parameterized knowledge inside the model.

[0003] To address these challenges, "knowledge editing" technology has emerged. This technology aims to update, correct, or inject specific factual knowledge by precisely modifying a small number of specific parameters in a model, with low resource consumption, without affecting the model's performance on other irrelevant inputs. Currently, knowledge editing technology is expanding from the plain text domain to the multimodal domain, and researchers are beginning to explore how to precisely modify the visually and linguistically aligned knowledge representations in MLLMs.

[0004] Despite the proliferation of multimodal knowledge editing algorithms, the development of benchmarks for this technology has lagged behind. Existing evaluation schemes mainly suffer from the following problems and shortcomings:

[0005] 1) Coarse-constructed local samples make it difficult to detect visual confusion: In existing evaluation datasets, local samples used to test "non-forgetting ability" are often generated through simple random sampling or text-label-based filtering. In multimodal scenarios, relying solely on text labels (such as category names) for filtering is insufficient. For example, when editing knowledge about "wolves," excluding "wolves" based solely on text while retaining "huskies," which have extremely similar visual features, as test samples may lead to distorted evaluation results. Existing data construction processes lack a dual similarity filtering mechanism based on vector semantics (Embedding) and visual content (such as CLIP features), failing to generate high-quality, challenging local test samples.

[0006] 2) Some sample construction relies on manual processes and lacks automation: Building high-quality edit datasets that include image and text alignment usually relies on a large amount of manual annotation, which is costly and difficult to scale. Existing automated construction methods often only involve simple image-text pair concatenation and lack feature conflict construction for specific entity attributes (such as adversarially modifying image attributes to test generalization). This results in overly simple generated samples that cannot effectively test the robustness of the model in complex scenarios.

[0007] Semantic alignment of multimodal data is inherently complex, and multimodal knowledge editing is still in its early stages. The academic community has yet to establish a standardized, automated data generation protocol that covers multiple dimensions. How to construct a high-quality benchmark dataset that can be automatically generated, simultaneously consider semantic and visual feature filtering, and comprehensively cover reliability, generalization, and locality assessments is a pressing technical problem in this field. Summary of the Invention

[0008] The purpose of this invention is to address the following two technical problems in the construction of benchmark data for multimodal knowledge editing in existing technologies: 1) In the selection of locality samples, existing technologies lack a precise measurement mechanism for the relevance of knowledge semantics to visual scenes. When constructing locality samples for testing the model's "non-forgetting ability," existing technologies typically only perform simple random sampling or filtering based on coarse category labels, without adequately measuring whether the selected samples are truly unrelated to the specific knowledge points and visual scenes involved in the current editing sample. This deficiency easily leads to the inclusion of samples in the test set that are semantically or visually similar to the editing target, thus failing to accurately assess the model's ability to isolate and retain irrelevant knowledge after editing specific knowledge. 2) In the construction of generality samples, existing technologies lack deep construction methods based on fine-grained entity features. Existing benchmark datasets often focus on simply rewriting or modifying the expression of existing problems (such as sentence transformation), without constructing new samples at a finer semantic level. In particular, they lack a method to automatically extract core entities and construct feature conflicts or logical reasoning questions based on the entities' own attributes (such as appearance, material, and background). This results in generated samples that are difficult to effectively test a model's deep understanding of edited knowledge and its ability to generalize. Therefore, this invention proposes a method and system for constructing evaluation samples for knowledge editing in multimodal scenarios.

[0009] To achieve the above-mentioned objectives, the present invention specifically adopts the following technical solution:

[0010] In a first aspect, the present invention provides a method for constructing knowledge editing evaluation samples in a multimodal scenario, comprising the following steps:

[0011] S1. For each knowledge point to be edited, select a triplet visual question answer sample consisting of an image, a natural language question, and a standard answer from the multimodal question answering dataset as a reliability sample;

[0012] S2. After identifying the target entity from the reliability sample, the text description corresponding to the target entity is used as factual information, and the multidimensional attribute information of the target entity is obtained from the factual information. A generative model is used to modify the multidimensional attribute information of the reliability sample at the image level and / or text level, and the modified reliability sample is used as a generalization sample.

[0013] S3. Extract candidate samples from a large-scale multimodal question library independent of the current knowledge points. Calculate the similarity between the candidate samples and the reliability samples from both semantic and visual perspectives. Select candidate samples that simultaneously meet the first and second filtering conditions as local samples. The first filtering condition is that the semantic similarity between the candidate entity and the target entity in the candidate sample is less than a preset entity similarity threshold. The second filtering condition is that the visual similarity between the image features of the candidate sample and the image features of the reliability sample is less than a preset scene similarity threshold.

[0014] S4. The reliability samples, generalization samples, and locality samples generated for the same knowledge point are structured and encapsulated to form a standardized test tuple as an evaluation sample. S1~S3 are repeated until all knowledge points to be edited are covered. Thus, all the obtained evaluation samples constitute a multimodal knowledge editing evaluation sample set covering the three dimensions of reliability, generalization, and locality.

[0015] Based on the above scheme, each step can be implemented in the following preferred manner.

[0016] As a preferred embodiment of the first aspect mentioned above, the specific process of step S2 is as follows:

[0017] S21. Input the pre-constructed first prompt word into the multimodal large model, and use the visual understanding capability of the multimodal large model to analyze the reliability samples in S1, extract the core objects focused on in the image and natural language problem, and use them as target entities;

[0018] S22. Using the target entity as the query keyword, the text description of the target entity is retrieved from the pre-accessed external structured knowledge base using the retrieval enhancement generation method, or the text description of the target entity is directly generated by the language model based on its internal knowledge. The text description is used as factual information and multidimensional attribute information of the target entity is obtained from it.

[0019] S23. Input the pre-constructed second prompt word into the language model, which generates counterfactual information that conflicts with the factual information. At the image level, the counterfactual information is used as a guiding condition, and an image generative model is used to modify the multidimensional attribute information or background environment of the target entity while keeping the target entity category unchanged to generate a new image. At the text level, the natural language questions and counterfactual information in the reliability samples are filled into a pre-set template, and the text generative model generates a new natural language question based on the filled template. Finally, the triplet visual question-answering sample consisting of the new image, the new natural language question, and the standard answer is used as a generalization sample.

[0020] As a preferred embodiment of the first aspect above, the specific process for filtering candidate samples in step S3 is as follows:

[0021] S31. Randomly select a certain number of samples from a large-scale multimodal problem database as candidate samples to form a candidate sample set;

[0022] S32. Input the pre-constructed third prompt words into the multimodal large model, and use the visual understanding capability of the multimodal large model to analyze the candidate samples and extract the core objects focused on in the image and natural language problem as candidate entities; use the candidate entities as query keywords, and use the retrieval enhancement generation method to retrieve the text description of the candidate entities from the pre-accessed external structured knowledge base, or have the language model directly generate the text description of the candidate entities based on its internal knowledge;

[0023] S33. Traverse the candidate sample set. For each candidate sample in the candidate sample set, concatenate the text descriptions of all target entities to form a global target entity description. Concatenate the text descriptions of all candidate entities contained in a candidate sample to form a global candidate entity description. Use a pre-trained text embedding model to convert the global target entity description and the global candidate entity description into high-dimensional vector representations, respectively, to obtain the target text features and candidate text features. Calculate the semantic similarity between the target text features and the candidate text features. When the calculated semantic similarity is greater than or equal to the entity similarity threshold, filter the candidate sample. When the calculated semantic similarity is less than the entity similarity threshold, use a pre-trained visual feature extraction model to extract the image features from the candidate sample and the image features from the reliability sample, respectively. Calculate the visual similarity between the two image features. When the calculated visual similarity is greater than or equal to the scene similarity threshold, filter the candidate sample. When the calculated visual similarity is less than the scene similarity threshold, retain the candidate sample.

[0024] As a preferred embodiment of the first aspect above, in step S3, each candidate sample is a triplet visual question-answering sample containing an image, a natural language question, and a standard answer.

[0025] As a preferred embodiment of the first aspect mentioned above, in step S3, cosine similarity is used as the measurement method when calculating semantic similarity and visual similarity.

[0026] As a preferred embodiment of the first aspect mentioned above, in step S3, the BERT model is used as the text embedding model, and the visual encoder of the CLIP model is used as the visual feature extraction model.

[0027] Secondly, the present invention provides a knowledge editing system for multimodal scenarios, comprising:

[0028] The evaluation sample acquisition module is used to generate an evaluation sample set containing reliability samples, generalization samples, and locality samples according to the knowledge editing evaluation sample construction method in the multimodal scenario described in any of the above-mentioned first aspects;

[0029] The knowledge editing module is used to edit the knowledge of the multimodal large language model on a subset of reliability samples in the evaluation sample set. After the knowledge editing is completed, reliability, generalization and locality indices are calculated on another subset of reliability samples, generalization samples and locality samples to evaluate the knowledge editing effect of the multimodal large language model. When the knowledge editing effect meets the user's expectations, the user's question is input into the knowledge-edited multimodal large language model to obtain the answer.

[0030] Thirdly, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, can implement the method for constructing knowledge editing and evaluation samples in a multimodal scenario as described in any of the solutions in the first aspect above.

[0031] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method for constructing knowledge editing and evaluation samples in a multimodal scenario as described in any of the solutions in the first aspect above.

[0032] Fifthly, the present invention provides a computer electronic device, which includes a memory and a processor;

[0033] The memory is used to store computer programs;

[0034] The processor is configured to, when executing the computer program, implement the method for constructing knowledge editing and evaluation samples in a multimodal scenario as described in any of the solutions of the first aspect above.

[0035] Compared with the prior art, the present invention has the following advantages:

[0036] This invention establishes a comprehensive evaluation system that includes three dimensions: reliability, generalization, and locality. It effectively solves the technical problem that existing technologies only focus on the single dimension of memory accuracy and cannot distinguish whether the model truly understands knowledge or is mechanically overfitting.

[0037] This invention introduces a dual similarity filtering mechanism based on Embedding text semantics and CLIP visual content, which can accurately remove interference samples that are highly similar in visual features but irrelevant in semantics, thereby significantly improving the purity of local test data and the confidence of evaluation results.

[0038] This invention breaks through the limitation of existing generalization tests that rely solely on text rewriting. By constructing adversarial visual attribute conflicts and multi-hop logic problems for fine-grained entity attributes (such as color, material, and background), it achieves effective verification of the deep reasoning ability and robustness of multimodal large models.

[0039] This invention constructs an end-to-end fully automated data processing solution that can generate standardized, high-quality benchmark datasets in batches without requiring extensive manual annotation. While ensuring the consistency of sample generation logic, it significantly reduces the human resource investment and time cost of constructing multimodal knowledge editing benchmarks. Attached Figure Description

[0040] Figure 1 This is an overall flowchart of the method of the present invention;

[0041] Figure 2 This is a schematic diagram of the semantic and visual dual similarity filtering mechanism in the method of the present invention;

[0042] Figure 3 This is a schematic diagram of the reliability sample structure in the evaluation samples of this embodiment;

[0043] Figure 4 This is a schematic diagram of the generalization sample structure in the evaluation samples of this embodiment;

[0044] Figure 5 This is a schematic diagram of the local sample structure in the evaluation samples of this embodiment;

[0045] Figure 6 This is a system block diagram of the present invention;

[0046] Figure 7 This is a schematic diagram of a computer electronic device provided by the present invention. Detailed Implementation

[0047] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. Technical features in the various embodiments of the present invention can be combined accordingly without mutual conflict.

[0048] In the description of this invention, it should be understood that the terms "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include at least one of those features.

[0049] This invention proposes a method for constructing evaluation samples for knowledge editing in multimodal scenarios. This method generates an evaluation sample set comprising three dimensions—reliability, generality, and locality—for each knowledge point to be edited through a standardized data processing workflow.

[0050] like Figure 1 As shown, in a preferred embodiment of the present invention, the method for constructing knowledge editing evaluation samples in the above-mentioned multimodal scenario includes the following steps S1 to S4. The specific implementation process of each step will be described in detail below.

[0051] S1. For each knowledge point to be edited, select a triplet visual question answer sample consisting of an image, a natural language question, and a standard answer from the multimodal question answering dataset as a reliability sample.

[0052] It should be noted that in step S1 of this invention, for each knowledge point to be edited, clear images, as well as natural language questions and standard answers with clear questions and answers, are selected from publicly available multimodal question-answering datasets (such as VQA v2, GQA, or Visual Genome) to form triplet visual question answering (VQA) samples. At the same time, these samples are directly labeled as "reliability samples" to verify whether the model can accurately reproduce the original learning objective after knowledge editing, that is, to evaluate the effectiveness of the editing.

[0053] S2. After identifying the target entity from the reliability samples, the text description corresponding to the target entity is used as factual information, and the multidimensional attribute information of the target entity is obtained from the factual information. A generative model is used to modify the multidimensional attribute information of the reliability samples at the image level and / or text level. The modified reliability samples are used as generalization samples, and the generalization samples are different from the reliability samples at the image level or inference link.

[0054] It should be noted that step S2 of this invention aims to generate samples for evaluating the model's ability to "generalize from one instance to another," which is defined in this invention as "generalization samples" based on entity feature conflicts. The specific process of step S2 is as follows:

[0055] S21. Input the pre-constructed first prompt word into the multimodal large model (such as GPT-4o, Gemini), and use the visual understanding capability of the multimodal large model to analyze the reliability samples in S1, extract the core objects focused on in the image and natural language problem, and use them as the target entity.

[0056] In this embodiment S21, the first prompt word needs to explicitly indicate that the multimodal large model can extract the target entity in the image and / or natural language problem.

[0057] S22. Using the target entity as the query keyword, the text description of the target entity is retrieved from the pre-accessed external structured knowledge base using the retrieval enhancement generation method, or the text description of the target entity is directly generated by the language model based on its internal knowledge. The text description is used as factual information and multidimensional attribute information of the target entity is obtained from it.

[0058] In this embodiment S22, the Retrieval-Augmented Generation (RAG) method is existing technology and will not be described in detail here. The multi-dimensional attribute information of the target entity obtained is including but not limited to the target entity's color, material, shape, and purpose.

[0059] S23. Input the pre-constructed second prompt word into the language model, which generates counterfactual information that conflicts with the factual information. At the image level, the counterfactual information is used as a guiding condition, and an image generative model is used to modify the multidimensional attribute information or background environment of the target entity while keeping the target entity category unchanged to generate a new image. At the text level, the natural language questions and counterfactual information in the reliability samples are filled into a pre-set template, and the text generative model generates a new natural language question based on the filled template. Finally, the triplet visual question-answering sample consisting of the new image, the new natural language question, and the standard answer is used as a generalization sample.

[0060] In this embodiment S23, the generated counterfactual information must satisfy the requirement that when added to the natural language question of the reliability sample, it will not change the standard answer to that question. For example, given an image of a red apple and its corresponding natural language question "What color is the fruit in the picture?" as a reliability sample, the standard answer should be "red". If counterfactual information such as "If apples are usually blue" is generated and added to the original natural language question, forming a new natural language question "If apples are usually blue, what color is the fruit in the picture?", it can be seen that although a textual assumption contrary to common sense is introduced, this does not affect the visual fact that the apple in the picture is red, that is, it ensures that the standard answer corresponding to the reliability sample is still correct.

[0061] In this embodiment S23, after obtaining counterfactual information, the present invention further performs feature conflict-based rewriting of the visual attributes or semantic features of the target entity at the following two levels, thereby automatically generating new triplet visual question-answering samples that differ from the reliability samples at the image level or inference link, as generalization samples:

[0062] (1) At the image level, image generative models can be used to modify the visual attributes of the target entity, such as color and shape (e.g., change "red apple" to "blue apple"), as well as the non-visual attributes of the target entity, such as material and purpose. The background environment of the target entity can also be modified, but the category of the target entity must remain unchanged.

[0063] (2) At the text level, natural language questions and counterfactual information from the reliability samples can be filled into the specified positions in the template, and then a text generation model can be used to generate new natural language questions based on the filled template.

[0064] It should be noted that there are multiple image generative models to choose from when constructing generalized samples with conflicting features. This embodiment uses an image inpainting technique based on a diffusion model (such as Stable Diffusion)—Stable Diffusion Inpainting. However, this image generative model is not unique and can be replaced by Generative Adversarial Networks (GANs) or Variational Autoencoders (VAEs). Furthermore, for simple visual attribute conflicts (such as color, brightness, and rotation), image processing operations based on traditional computer vision algorithms (such as affine transformations and color space conversions in OpenCV) can also be used, as long as the purpose is to modify non-core features of the target entity to test the model's robustness; all of these fall within the scope of this invention.

[0065] S3. Extract candidate samples from a large-scale multimodal question library independent of the current knowledge points. Calculate the similarity between the candidate samples and the reliability samples from both semantic and visual perspectives. Select candidate samples that simultaneously meet the first and second filtering conditions as local samples. The first filtering condition is that the semantic similarity between the candidate entity and the target entity in the candidate sample is less than a preset entity similarity threshold. The second filtering condition is that the visual similarity between the image features of the candidate sample and the image features of the reliability sample is less than a preset scene similarity threshold.

[0066] It should be noted that step S3 of this invention is crucial in preventing "catastrophic forgetting" in the model. It aims to filter samples irrelevant to the current editing task—i.e., "local samples"—from a large-scale external multimodal question database through rigorous semantic and visual filtering. Specifically, in step S3, this embodiment designs a dual similarity filtering mechanism. It sequentially calculates the similarity between candidate samples and reliability samples in semantic entities and visual scenes, eliminating interfering candidate samples highly relevant to the current knowledge point. Only candidate samples with no significant correlation in either semantic or visual space are retained, and these are constructed as local samples for evaluating the non-forgetting ability. The specific process of filtering candidate samples in step S3 is as follows:

[0067] S31. Randomly select a certain number of samples from a large-scale multimodal problem database as candidate samples to form a candidate sample set.

[0068] In this embodiment S31, the large-scale multimodal question library uses a different dataset than the aforementioned multimodal question-answering dataset. Of course, it can also be redesigned by those skilled in the art according to actual needs, as long as the generated candidate samples are unrelated to the target entity and the background environment. Each candidate sample is also a triplet visual question-answering sample containing an image, a natural language question, and a standard answer.

[0069] S32. Input the pre-constructed third prompt words into the multimodal large model, and use the visual understanding capability of the multimodal large model to analyze the candidate samples and extract the core objects focused on in the image and natural language problem as candidate entities; use the candidate entities as query keywords, and use the retrieval enhancement generation method to retrieve the text description of the candidate entities from the pre-accessed external structured knowledge base, or have the language model directly generate the text description of the candidate entities based on its internal knowledge.

[0070] In this embodiment, S32, the same entity recognition operation as in S21 is performed on each candidate sample to extract its core entity. The third prompt word also needs to explicitly indicate that the multimodal large model can extract candidate entities from images and / or natural language problems. Then, the same text retrieval operation as in S22 is performed on each candidate sample to obtain a text description of the candidate entity.

[0071] S33. Traverse the candidate sample set. For each candidate sample in the candidate sample set, concatenate the text descriptions of all target entities to form a global target entity description. Concatenate the text descriptions of all candidate entities contained in a candidate sample to form a global candidate entity description. Use a pre-trained text embedding model to convert the global target entity description and the global candidate entity description into high-dimensional vector representations, respectively, to obtain the target text features and candidate text features. Calculate the semantic similarity between the target text features and the candidate text features. When the calculated semantic similarity is greater than or equal to the entity similarity threshold, filter the candidate sample. When the calculated semantic similarity is less than the entity similarity threshold, use a pre-trained visual feature extraction model to extract the image features from the candidate sample and the image features from the reliability sample, respectively. Calculate the visual similarity between the two image features. When the calculated visual similarity is greater than or equal to the scene similarity threshold, filter the candidate sample. When the calculated visual similarity is less than the scene similarity threshold, retain the candidate sample.

[0072] In this embodiment S33, the aim is to exclude similar entities and similar scenes based on vector semantic filtering and visual filtering. For example... Figure 2 As shown, specifically, taking a single candidate sample from the candidate sample set as a unit, the text descriptions of all candidate entities corresponding to that candidate sample are concatenated, and correspondingly, the text descriptions of all target entities are concatenated. Then, using a pre-trained text embedding model, the concatenated target entity text descriptions and the concatenated candidate entity text descriptions are transformed into high-dimensional vector representations, respectively, to obtain the target text features. and candidate text features Then calculate the target text features. and candidate text features semantic similarity between At the same time, set an entity similarity threshold. (For example, 0.6). If If the candidate sample is too semantically similar to the editing target, it is discarded; otherwise, it is retained for the next screening, and the image features of the reliable samples are extracted using a pre-trained visual feature extraction model. Image features of candidate samples Calculate the visual similarity between two image features. Simultaneously set a scene similarity threshold. (For example, 0.5). If If a candidate sample is deemed potentially confusing with reliable samples in terms of visual scene, composition, or object co-occurrence, it is removed. Finally, the candidate samples remaining after both rounds of filtering are labeled as "local samples." These samples ensure that they have no significant correlation with the editing target in terms of semantic entities and visual scene, effectively testing the model's knowledge isolation capabilities.

[0073] It should be noted that in this invention, during the dual filtering process, the BERT model is used as the text embedding model, and the CLIP (Contrastive Language-Image Pre-training) model's visual encoder is used as the visual feature extraction model to extract feature vectors. Both core models have several alternatives.

[0074] For text embedding models, in addition to BERT, static word vector models such as Word2Vec and GloVe, or other pre-trained language models such as RoBERTa and GPT series can be used for text feature extraction.

[0075] For visual feature extraction models, in addition to CLIP, high-level semantic features of images can also be extracted using convolutional neural networks (CNNs such as ResNet, VGG, and EfficientNet) or visual Transformers (ViT) pre-trained on ImageNet.

[0076] It should be noted that this invention uses cosine similarity as the metric for calculating semantic and visual similarity. Of course, Euclidean distance, Manhattan distance, or other vector distance metrics can also be used instead.

[0077] It should also be noted that in the parallel processing of the filtering process in step S3, the screening of local samples in this embodiment of the invention is performed in a sequential order of "semantic filtering first, then visual filtering". However, this order is not fixed and can also be "visual first, then semantic", or a parallel computing method can be used: that is, semantic similarity and visual similarity are calculated simultaneously, and a comprehensive similarity is obtained by weighted summation of the two similarities, and then the calculated comprehensive similarity is compared with a comprehensive threshold. This adjustment in the process does not change the core idea of ​​"dual feature-based filtering" of this invention.

[0078] S4. The reliability samples, generalization samples, and locality samples generated for the same knowledge point are structured and encapsulated to form a standardized test tuple as an evaluation sample. S1~S3 are repeated until all knowledge points to be edited are covered. Thus, all the obtained evaluation samples constitute a multimodal knowledge editing evaluation sample set covering the three dimensions of reliability, generalization, and locality.

[0079] In this embodiment, the final evaluation sample obtained is as follows: Figure 3 , Figure 4 , Figure 5 As shown, the evaluation sample includes three evaluation dimensions in the multimodal knowledge editing task. The reliability sample addresses the model's erroneous perception in specific visual scenarios (such as misjudging a red apple as yellow) and corrects the model's erroneous perception by applying specific knowledge editing methods. For the knowledge-edited model, this embodiment uses these three samples to evaluate the effectiveness of knowledge editing. Figure 3 The reliability samples in the test are designed to verify whether the knowledge-edited model can successfully correct errors and output the correct target knowledge (red). Figure 4 The generalization samples in the model are tested by introducing counterfactual information (such as "if apples are usually blue") into natural language problems to examine whether the model can still accurately anchor visual facts and apply edited knowledge when faced with complex instruction variations. Figure 5 The local samples in the model introduce scenes that are semantically and visually unrelated to the target knowledge (such as the sky color in a natural landscape) to detect whether editing operations have a negative impact on other general capabilities of the model or cause catastrophic forgetting.

[0080] To better demonstrate the specific implementation and technical effects of the present invention, the method for constructing knowledge editing evaluation samples in a multimodal scenario as shown in steps S1 to S4 of the above preferred implementation is applied to a specific example.

[0081] Example

[0082] The specific implementation process of the knowledge editing evaluation sample construction method in the multimodal scenario used in this embodiment is as described above and will not be repeated here.

[0083] To construct generalization samples, this embodiment selects the publicly available multimodal question-answering dataset OK-VQA as the core data source and introduces the GQA dataset as an external interference data source. 1000 samples with valid images, natural language questions, and standard answers are randomly selected from OK-VQA as reliability samples. Furthermore, Llama-3.1-8B-Instruct is used to identify target entities in natural language questions, retrieve the entity's attribute information (including visual attributes such as color, material, and shape), and generate rewritten natural language questions containing factual conflicts based on the attribute information, serving as generalization samples.

[0084] To construct localized samples, this embodiment builds a large-scale multimodal question library containing 1000 candidate samples from the GQA dataset. It utilizes Sentence-BERT (all-MiniLM-L6-v2) to calculate text features and CLIP (ViT-Base-Patch32) to calculate image features, performing dual similarity filtering. Specifically, this embodiment sets an entity similarity threshold of 0.6 and a scene similarity threshold of 0.5, retaining only candidate samples whose semantic and visual similarities are both below the corresponding thresholds. When the filtered candidate samples are insufficient, this embodiment gradually relaxes the above thresholds in steps of 0.1 to ensure that corresponding localized samples are selected for each edited knowledge point.

[0085] Following the above process, this embodiment divides the generated evaluation sample set into a test set containing 500 samples and a training set containing 500 samples. For the IKE (In-Context Knowledge Editing) method, since it requires the use of an external training set to build a semantic retrieval index, this embodiment uses the training set to generate the embedding file required by IKE, while the test set is used to evaluate the editing effect of all methods.

[0086] For the specific test models, this embodiment uses the MiniGPT-4 with 7B parameters and the BLIP-2-OPT with 2.7B parameters as the multimodal large model base to be edited. To evaluate the effectiveness of the evaluation sample set, this embodiment applies existing knowledge editing methods (including IKE and LoRA fine-tuning) to these two models. For LoRA, this embodiment performs fine-tuning on the last Transformer layer of the language model (LoRA-LLM) and the last Transformer layer of the visual encoder (LoRA-Vision), respectively. The experimental results are compared in Table 1. This embodiment measures the difference in accuracy performance of different editing methods when facing multimodal knowledge conflicts by calculating the changes in token-level accuracy scores of the models in three dimensions: reliability, generalization, and locality, thereby verifying the effectiveness of the evaluation sample set in distinguishing the model editing capabilities.

[0087] Table 1. Experimental results of different methods

[0088]

[0089] It should also be noted that the method for constructing knowledge editing evaluation samples in multimodal scenarios in the above embodiments can essentially be executed by a computer program or module. Therefore, similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a knowledge editing system in a multimodal scenario corresponding to the method for constructing knowledge editing evaluation samples in multimodal scenarios provided in the above embodiments, such as... Figure 6 As shown, it includes:

[0090] The evaluation sample acquisition module is used to generate an evaluation sample set containing reliability samples, generalization samples, and locality samples according to the knowledge editing evaluation sample construction method in the multimodal scenario described in the above embodiments.

[0091] The knowledge editing module is used to edit the knowledge of the multimodal large language model on a subset of reliability samples in the evaluation sample set. After the knowledge editing is completed, reliability, generalization and locality indices are calculated on another subset of reliability samples, generalization samples and locality samples to evaluate the knowledge editing effect of the multimodal large language model. When the knowledge editing effect meets the user's expectations, the user's question is input into the knowledge-edited multimodal large language model to obtain the answer.

[0092] It should be noted that in the field of knowledge editing, reliability, generalization, and locality are common evaluation metrics. These three metrics together demonstrate the effectiveness of this knowledge editing method. Here, existing knowledge editing methods can be used to edit knowledge in multimodal large language models. The specific application scenarios of knowledge editing methods can be used to fix a specific problem output of a multimodal large language model, such as correcting the model's misremembering of historical events or people's information, and customizing a model's response preference, as well as some knowledge that needs to be constantly updated.

[0093] It is understood that the method for constructing knowledge editing evaluation samples in multimodal scenarios described in S1-S4 above can essentially be implemented by a computer program. Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer program product corresponding to the method for constructing knowledge editing evaluation samples in multimodal scenarios provided in the above embodiments. This product includes a computer program / instruction, which, when executed by a processor, can implement the method for constructing knowledge editing evaluation samples in multimodal scenarios as described in the above embodiments.

[0094] Similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer electronic device corresponding to the method for constructing knowledge editing and evaluation samples in multimodal scenarios provided in the above embodiments, such as... Figure 7 As shown, it includes a memory and a processor;

[0095] The memory is used to store computer programs;

[0096] The processor is configured to implement the method for constructing knowledge editing and evaluation samples in multimodal scenarios as described in the above embodiments when executing the computer program.

[0097] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0098] Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer-readable storage medium corresponding to the knowledge editing evaluation sample construction method in the multimodal scenario provided in the above embodiments. The storage medium stores a computer program, which, when executed by a processor, can realize the knowledge editing evaluation sample construction method in the multimodal scenario in the above embodiments.

[0099] Specifically, in the computer-readable storage medium of the above three embodiments, the stored computer program is executed by a processor, which can perform the aforementioned steps S1 to S4.

[0100] It is understood that the aforementioned storage media may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Furthermore, the storage media may also be various media capable of storing program code, such as USB flash drives, external hard drives, magnetic disks, or optical discs.

[0101] It is understood that the processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0102] It should also be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. In the embodiments provided in this application, the division of steps or modules in the system and method is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple modules or steps may be combined or integrated together, and a module or step may also be split.

[0103] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.

Claims

1. A method for constructing evaluation samples for knowledge editing in a multimodal scenario, characterized in that, Includes the following steps: S1. For each knowledge point to be edited, select a triplet visual question answer sample consisting of an image, a natural language question, and a standard answer from the multimodal question answering dataset as a reliability sample; S2. After identifying the target entity from the reliability sample, the text description corresponding to the target entity is used as factual information, and the multidimensional attribute information of the target entity is obtained from the factual information. A generative model is used to modify the multidimensional attribute information of the reliability sample at the image level and / or text level, and the modified reliability sample is used as a generalization sample. S3. Extract candidate samples from a large-scale multimodal question library independent of the current knowledge points. Calculate the similarity between the candidate samples and the reliability samples from both semantic and visual perspectives. Select candidate samples that simultaneously meet the first and second filtering conditions as local samples. The first filtering condition is that the semantic similarity between the candidate entity and the target entity in the candidate sample is less than a preset entity similarity threshold. The second filtering condition is that the visual similarity between the image features of the candidate sample and the image features of the reliability sample is less than a preset scene similarity threshold. S4. The reliability samples, generalization samples, and locality samples generated for the same knowledge point are encapsulated in a structured manner to form a standardized test tuple as an evaluation sample. S1~S3 are repeated until all knowledge points to be edited are covered. Thus, all the obtained evaluation samples constitute a multimodal knowledge editing evaluation sample set covering the three dimensions of reliability, generalization, and locality. The specific process of step S2 is as follows: S21. Input the pre-constructed first prompt word into the multimodal large model, and use the visual understanding capability of the multimodal large model to analyze the reliability samples in S1, extract the core objects focused on in the image and natural language problem, and use them as target entities; S22. Using the target entity as the query keyword, the text description of the target entity is retrieved from the pre-accessed external structured knowledge base using the retrieval enhancement generation method, or the text description of the target entity is directly generated by the language model based on its internal knowledge. The text description is used as factual information and multidimensional attribute information of the target entity is obtained from it. S23. Input the pre-constructed second prompt word into the language model, and the language model generates counterfactual information that conflicts with the factual information based on the factual information; at the image level, use the counterfactual information as a guiding condition, and use the image generative model to modify the multidimensional attribute information or background environment of the target entity, while keeping the target entity category unchanged, to generate a new image; At the text level, natural language questions and counterfactual information from the reliability samples are filled into a pre-defined template, and the text generation model generates new natural language questions based on the filled template. Finally, the triplet visual question-answering sample consisting of the new image, the new natural language question, and the standard answer is used as a generalization sample.

2. The method for constructing knowledge editing evaluation samples in a multimodal scenario as described in claim 1, characterized in that, In step S3, the specific process of filtering candidate samples is as follows: S31. Randomly select a certain number of samples from a large-scale multimodal problem database as candidate samples to form a candidate sample set; S32. Input the pre-constructed third prompt words into the multimodal large model, and use the visual understanding capability of the multimodal large model to analyze the candidate samples and extract the core objects focused on in the image and natural language problem as candidate entities; use the candidate entities as query keywords, and use the retrieval enhancement generation method to retrieve the text description of the candidate entities from the pre-accessed external structured knowledge base, or have the language model directly generate the text description of the candidate entities based on its internal knowledge; S33. Traverse the candidate sample set. For each candidate sample in the candidate sample set, concatenate the text descriptions of all target entities to form a global target entity description. Concatenate the text descriptions of all candidate entities contained in a candidate sample to form a global candidate entity description. Use a pre-trained text embedding model to convert the global target entity description and the global candidate entity description into high-dimensional vector representations, respectively, to obtain the target text features and candidate text features. Calculate the semantic similarity between the target text features and the candidate text features. When the calculated semantic similarity is greater than or equal to the entity similarity threshold, filter the candidate sample. When the calculated semantic similarity is less than the entity similarity threshold, use a pre-trained visual feature extraction model to extract the image features from the candidate sample and the image features from the reliability sample, respectively. Calculate the visual similarity between the two image features. When the calculated visual similarity is greater than or equal to the scene similarity threshold, filter the candidate sample. When the calculated visual similarity is less than the scene similarity threshold, retain the candidate sample.

3. The method for constructing knowledge editing evaluation samples in a multimodal scenario as described in claim 1 or 2, characterized in that, In step S3, each candidate sample is a triplet visual question-answering sample containing an image, a natural language question, and a standard answer.

4. The method for constructing knowledge editing evaluation samples in a multimodal scenario as described in claim 1 or 2, characterized in that, In step S3, cosine similarity is used as the metric for both semantic and visual similarity.

5. The method for constructing knowledge editing evaluation samples in a multimodal scenario as described in claim 2, characterized in that, In step S3, the BERT model is used as the text embedding model, and the CLIP model's visual encoder is used as the visual feature extraction model.

6. A knowledge editing system for multimodal scenarios, characterized in that, include: The evaluation sample acquisition module is used to generate an evaluation sample set containing reliability samples, generalization samples, and locality samples according to the knowledge editing evaluation sample construction method in the multimodal scenario as described in any one of claims 1 to 5. The knowledge editing module is used to edit the knowledge of the multimodal large language model on a subset of reliability samples in the evaluation sample set. After the knowledge editing is completed, reliability, generalization and locality indices are calculated on another subset of reliability samples, generalization samples and locality samples to evaluate the knowledge editing effect of the multimodal large language model. When the knowledge editing effect meets the user's expectations, the user's question is input into the knowledge-edited multimodal large language model to obtain the answer.

7. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it can implement the method for constructing knowledge editing and evaluation samples in a multimodal scenario as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method for constructing knowledge editing and evaluation samples in a multimodal scenario as described in any one of claims 1 to 5.

9. A computer electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to implement the method for constructing knowledge editing and evaluation samples in a multimodal scenario as described in any one of claims 1 to 5 when executing the computer program.