Data filtering method and apparatus for generative artificial intelligence model, device, and medium
By constructing and querying knowledge graphs at different stages of the generative artificial intelligence model, the problem of filtering illegal content in the output data of the generative artificial intelligence model is solved, and data security and legality are guaranteed throughout the entire life cycle.
Patent Information
- Application Number
- PCT/CN2024/083882
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-03-26
- Publication Date
- 2025-10-02
AI Technical Summary
The output data of generative AI models may contain illegal content, such as content that poses a risk of intellectual property infringement, and existing technologies find it difficult to effectively filter and avoid these risks.
By determining the filtering time point, knowledge graphs are constructed in the pre-training, model fine-tuning and reasoning stages of the generative artificial intelligence model respectively, and the knowledge graphs constructed by legal and illegal data are queried in the second knowledge graph, and data filtering is performed based on the query results and filtering rules.
It achieves accurate filtering of illegal data throughout the entire life cycle of the generative artificial intelligence model, reduces the risk of output data, and improves data security.
Smart Images

Figure CN2024083882_02102025_PF_FP_ABST
Abstract
Description
Data filtering method, device, equipment and medium for generative artificial intelligence model Technical Field
[0001] The present invention relates to the field of artificial intelligence (AI) technology, and in particular to methods, devices, equipment, and media for filtering data in generative AI models. Background Art
[0002] Generative Artificial Intelligence (GAI) is an AI technology that uses complex algorithms, models, and rules to learn from large-scale data sets to create new and original content. This technology can create a variety of content types, including text, images, audio, video, and code.
[0003] Generative AI also brings new challenges to the engineering community. For example, the output data of generative AI models may contain illegal content (for example, content that poses a risk of intellectual property infringement).
[0004] Summary of the Invention
[0005] The embodiments of the present invention provide a data filtering method, device, equipment and medium for a generative artificial intelligence model.
[0006] In a first aspect, a data filtering method for a generative artificial intelligence model is provided. The method comprises:
[0007] Determining the point at which filtering is performed on the data of the generative AI model;
[0008] When the time point is reached, constructing a first knowledge graph based on the data;
[0009] Querying the first knowledge graph in a second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data;
[0010] The data is filtered based on the query results and filtering rules, wherein the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
[0011] In a second aspect, a data filtering device for a generative artificial intelligence model is provided. The device comprises:
[0012] a determination module for determining a time point for performing filtering on data of a generative artificial intelligence model;
[0013] A construction module, configured to construct a first knowledge graph based on the data when the time point is reached;
[0014] A query module, configured to query the first knowledge graph in a second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data;
[0015] A filtering module is used to filter the data based on the query results and filtering rules, wherein the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
[0016] In a third aspect, a data filtering system for a generative artificial intelligence model is provided. The system includes:
[0017] A pre-training device, configured to receive pre-training data during a pre-training phase of a generative artificial intelligence model, and pre-train the generative artificial intelligence model based on the pre-training data;
[0018] A model fine-tuning device, configured to perform model fine-tuning on the generative artificial intelligence model based on the fine-tuning data during the model fine-tuning phase of the generative artificial intelligence model;
[0019] a data generating device for generating generation data of the generative artificial intelligence model during the inference phase of the generative artificial intelligence model;
[0020] A filter for constructing a first knowledge graph based on the pre-trained data, the fine-tuning data or the generated data; querying the first knowledge graph in a second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data; filtering the pre-trained data, the fine-tuning data or the generated data based on the query results and filtering rules, wherein the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
[0021] In a fourth aspect, an electronic device is provided. The electronic device includes:
[0022] processor;
[0023] a memory for storing executable instructions of the processor;
[0024] The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the data filtering method of the generative artificial intelligence model as described in any one of the above.
[0025] In a fifth aspect, a computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the data filtering method of the generative artificial intelligence model as described above is implemented.
[0026] In a sixth aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the data filtering method of the generative artificial intelligence model as described above.
[0027] It can be seen from the above technical solution that in the embodiment of the present invention, the time point for filtering the data of the generative artificial intelligence model is determined; when the time point is reached, a first knowledge graph is constructed based on the data; the first knowledge graph is queried in the second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data; based on the query results and filtering rules, the data is filtered. Therefore, based on the specific design of the filtering time point and the knowledge graph query processing, the data of the generative artificial intelligence model can be accurately filtered, thereby avoiding risks. In addition, performing data filtering in the pre-training and model fine-tuning stages can reduce the risk of data illegality before inference. Moreover, performing data filtering in the inference stage improves the security of the output data. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, so that those skilled in the art will understand the above and other features and advantages of the present invention more clearly. In the accompanying drawings:
[0029] FIG1 is an exemplary flow chart of a data filtering method of a generative artificial intelligence model according to an embodiment of the present invention.
[0030] FIG. 2 is an exemplary schematic diagram of a data filtering process according to an embodiment of the present invention.
[0031] FIG3 is a schematic diagram of generating a knowledge graph based on data according to an embodiment of the present invention.
[0032] FIG4 is a schematic diagram of generating a knowledge graph based on illegal data according to an embodiment of the present invention.
[0033] FIG5 is a schematic diagram of generating a knowledge graph based on legal data according to an embodiment of the present invention.
[0034] FIG6 is a schematic diagram of generating a knowledge graph based on pre-training data according to an embodiment of the present invention.
[0035] FIG7 is a schematic diagram of generating a knowledge graph based on generated data according to an embodiment of the present invention.
[0036] FIG8 is an exemplary structural diagram of a data filtering system according to an embodiment of the present invention.
[0037] FIG. 9 is an exemplary structural diagram of a data filtering device according to an embodiment of the present invention.
[0038] FIG. 10 is an exemplary structural diagram of an electronic device according to an embodiment of the present invention.
[0039] The accompanying drawings are numerals as follows: DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail with reference to the following examples.
[0041] For the sake of brevity and intuitiveness in description, the solution of the present invention is explained below by describing several representative implementations. A large number of details in the implementations are only used to help understand the solution of the present invention. However, it is obvious that the technical solution of the present invention may not be limited to these details when implemented. In order to avoid unnecessarily obscuring the solution of the present invention, some implementations are not described in detail, but only a framework is given. Hereinafter, "including" means "including but not limited to", and "according to..." means "at least according to..., but not limited to only according to...". Due to the language habits of Chinese, when the number of a component is not specifically specified below, it means that the component can be one or more, or can be understood as at least one.
[0042] The applicant discovered that the output data of the generative artificial intelligence model may contain illegal content, such as content that may infringe intellectual property rights. In an embodiment of the present invention, the query operation of the knowledge graph is used to filter multiple types of data related to the artificial intelligence model (such as pre-trained data, fine-tuning data, and generated data, etc.), thereby effectively avoiding risks. Moreover, multiple filtering time points are carefully designed to achieve data filtering throughout the entire process. For example, data filtering is performed during the pre-training and model fine-tuning stages, and the trained artificial intelligence model tries not to generate illegal data to reduce illegal risks. In addition, performing data filtering during the inference stage can improve the security of the output data.
[0043] The above disclosure details the technical defects in the prior art, the causes of these defects, and the analytical process for overcoming them. In reality, the understanding of these technical defects is not common knowledge in the field, but rather a novel discovery made by the applicant during their research. Furthermore, the tracing of the causes of these defects and the analytical process for overcoming them are the result of gradual analysis conducted by the applicant during their actual research and are not common knowledge in the field.
[0044] First, let's provide an illustrative explanation of concepts related to knowledge graphs. Knowledge graphs describe objective things in the form of graphs, which specifically consist of nodes and edges. Nodes in a knowledge graph can represent concepts and entities, with concepts being abstract and entities being concrete. Edges represent the relationships and attributes between things or concepts. Attributes represent internal characteristics of things or concepts, while relationships represent external connections. Often, to simplify the description of knowledge graphs, entities and concepts are collectively referred to as entities, and relationships and attributes are collectively referred to as relationships. In this way, knowledge graphs describe entities and the relationships between them. Entities can be people, places, organizations, and concepts, among others. Relationships can be relationships between people, between people and organizations, between concepts and objects, and so on. A knowledge graph is essentially a knowledge base based on a semantic network—that is, a knowledge base with a directed graph structure. Knowledge graphs can be used to contextualize data (structured and unstructured) into meaningful information networks.
[0045] Labeled Property Graph (LPG) and Resource Description Framework (RDF) are two common approaches to building knowledge graphs. LPG focuses on efficient deep data traversal, path analysis, and storage of arbitrary graph data. RDF emphasizes atomic decomposition of data suitable for ontology creation and data exchange.
[0046] FIG1 is an exemplary flow chart of a data filtering method for a generative artificial intelligence model according to an embodiment of the present invention. As shown in FIG1 , the method includes:
[0047] Step 101: Determine the time point at which filtering is performed on the data of the generative artificial intelligence model.
[0048] In one embodiment, the data for the generative artificial intelligence model may include:
[0049] (1) During the training process (including the pre-training process and the model fine-tuning process), input data (e.g., pre-training data and fine-tuning data) is provided to the generative artificial intelligence model.
[0050] (2) Data generated by generative AI models during inference.
[0051] By determining the point in time at which filtering is performed on the data, it is possible to determine when filtering is performed on the data for the generative AI model.
[0052] In one embodiment, the time points for performing filtering on data may include:
[0053] (1) During the pre-training process, the first time point at which filtering is performed on the pre-training data input to the artificial intelligence model.
[0054] (2) During model fine-tuning after the pre-training process, a second time point is used to perform filtering on the fine-tuning data input to the artificial intelligence model.
[0055] (3) During the inference process of the artificial intelligence model after training, a third time point is used to filter the data generated by the artificial intelligence model.
[0056] It can be seen that by setting a first time point for filtering the pre-training data, filtering can be performed during the pre-training process in the artificial intelligence model to prevent illegal data from entering the generative artificial intelligence model during the pre-training process, thereby constraining the artificial intelligence model as early as possible before the inference stage, and the trained artificial intelligence model can reduce the possibility of generating illegal data. Moreover, by setting a second time point for filtering the fine-tuning data, filtering can be performed during the model fine-tuning process in the artificial intelligence model (usually after the pre-training process) to prevent illegal data from entering the generative artificial intelligence model during the model fine-tuning process, and the artificial intelligence model can be constrained before the inference stage, further reducing the possibility of the artificial intelligence model generating illegal data. In addition, by setting a third time point for filtering the generated data, filtering can be performed during the inference stage in the artificial intelligence model (usually after the model fine-tuning process) to prevent the artificial intelligence model from outputting illegal data.
[0057] Step 102: When the time point is reached, a first knowledge graph is constructed based on the data.
[0058] Here, when the time point is reached, a first knowledge graph can be constructed based on the data of the generative artificial intelligence model through LPG or RDF. Specifically, the data of the generative artificial intelligence model can be implemented as a variety of data types, such as text, audio, images, video, and design data. For example, it can be implemented as design drawings or design models (such as CAD models for mechanical design, control models for electrical design, etc.).
[0059] In one embodiment, when the first time point at which filtering is performed on the pre-training data of the generative artificial intelligence model during the pre-training phase of the generative artificial intelligence model is determined in step 101, step 102 includes: when the first time point is reached, constructing a first knowledge graph based on the pre-training data.
[0060] In one embodiment, when a second time point is determined in step 101 for performing filtering on the fine-tuning data of the generative artificial intelligence model during the model fine-tuning stage of the generative artificial intelligence model, step 102 includes: when the second time point is reached, constructing a first knowledge graph based on the fine-tuning data.
[0061] In one embodiment, when a third time point is determined in step 101 for performing filtering on the generated data of the generative artificial intelligence model during the reasoning phase of the generative artificial intelligence model, step 102 includes: when the third time point is reached, constructing a first knowledge graph based on the generated data.
[0062] For example, the process of constructing the first knowledge graph based on data of a generative artificial intelligence model usually includes: named entity recognition and relationship extraction.
[0063] Named entity recognition can be performed in the following ways: (1) Sequence labeling model: A sequence labeling model is used to extract entity relationships. Typical models include the Bidirectional Long Short-Term Memory Network-Conditional Random Field (BiLSTM-CRF) model. In this model, text data is usually segmented and each word is converted into a vector. The BiLSTM model is then used to extract features from the text, and CRF is used for sequence labeling. (2) Sequence classification model: A sequence classification model is used to extract entity relationships. Typical models include the Convolutional Neural Network (CNN) model and the Transformer model. (3) Structured prediction model: A structured prediction model is used to extract entity relationships. Typical models include the Graph Convolutional Network (GCN) model and the Variational Graph Auto-Encoder (VGAE) model.
[0064] Relation extraction methods can include: (1) relationship classification, such as relationship classification using the BERT model; (2) weakly supervised learning, such as using CNN combined with remote supervision for relationship identification; (3) rule-based methods.
[0065] Then, the first knowledge graph can be constructed based on the named entity recognition results and the relationship extraction results.
[0066] The above exemplary description is a typical example of constructing a first knowledge graph based on data of a generative artificial intelligence model. Those skilled in the art will appreciate that this description is merely exemplary and is not intended to limit the scope of protection of the embodiments of the present invention.
[0067] Step 103: Query the first knowledge graph in the second knowledge graph, where the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data.
[0068] Here, the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data. For example, legal data can be data that does not pose a risk of intellectual property infringement; illegal data is data that poses a risk of intellectual property infringement. For example, intellectual property rights are the exclusive rights that the right holder enjoys in accordance with the law over the subject matter, which can specifically include: (1) works; (2) inventions, utility models, and designs; (3) trademarks; (4) geographical indications; (5) trade secrets; (6) integrated circuit layout designs; (7) new plant varieties; (8) other subjects prescribed by law, etc.
[0069] Similarly, a third knowledge graph can be constructed based on legal data and a fourth knowledge graph can be constructed based on illegal data using LPG or RDF. The second knowledge graph includes the third and fourth knowledge graphs. Preferably, a fifth knowledge graph can be constructed based on data whose legality has not been determined using LPG or RDF, and the fifth knowledge graph can be further included in the second knowledge graph.
[0070] Step 104: Filter the data based on the query results and filtering rules, where the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
[0071] The data is filtered based on the query result of querying the first knowledge graph in the second knowledge graph and the predetermined filtering rules. In the filtering rules, the rules for filtering the data are specified based on the association with the third knowledge graph and / or the fourth knowledge graph.
[0072] In one embodiment, the filtering rule includes: using only valid data contained in the third knowledge graph; step 104 includes:
[0073] (1) When the first knowledge graph is found in the third knowledge graph, the data is allowed to pass;
[0074] (2) When the first knowledge graph is not found in the third knowledge graph, the data is not allowed to pass.
[0075] Therefore, if the query results determine that the first knowledge graph is found in the third knowledge graph, that is, the data constructed by the first knowledge graph is legal data for constructing the third knowledge graph, the data is allowed to pass. If the query results determine that the first knowledge graph is not found in the third knowledge graph, that is, the data constructed by the first knowledge graph is not legal data for constructing the third knowledge graph, the data is not allowed to pass.
[0076] In one embodiment, the filtering rule includes: not using illegal data contained in the fourth knowledge graph; step 104 includes:
[0077] (1) When the first knowledge graph is found in the fourth knowledge graph, data is not allowed to pass;
[0078] (2) When the first knowledge graph is not found in the fourth knowledge graph, the data is allowed to pass.
[0079] Therefore, if the query results determine that the first knowledge graph is found in the fourth knowledge graph, that is, the data constructed by the first knowledge graph is illegal data for constructing the fourth knowledge graph, the data is not allowed to pass. If the query results determine that the first knowledge graph is not found in the fourth knowledge graph, that is, the data constructed by the first knowledge graph is not illegal data for constructing the fourth knowledge graph, the data is allowed to pass.
[0080] In one embodiment, the second knowledge graph includes a fifth knowledge graph constructed based on data whose legitimacy has not been determined; the filtering rules include: not using illegal data contained in the fourth knowledge graph and not using data contained in the fifth knowledge graph whose legitimacy has not been determined; step 104 includes:
[0081] (1) When the first knowledge graph is found in the fourth knowledge graph or the fifth knowledge graph, data is not allowed to pass;
[0082] (2) When the first knowledge graph is not found in either the fourth knowledge graph or the fifth knowledge graph, the data is allowed to pass.
[0083] Therefore, when it is determined based on the query results that the first knowledge graph is found in the fourth knowledge graph or the fifth knowledge graph, that is, the data constructed by the first knowledge graph is illegal data for constructing the fourth knowledge graph, or is data whose legitimacy has not been determined for constructing the fifth knowledge graph, the data is not allowed to pass. When it is determined based on the query results that the first knowledge graph is not found in either the fourth knowledge graph or the fifth knowledge graph, that is, the data constructed by the first knowledge graph is neither illegal data for constructing the fourth knowledge graph nor data whose legitimacy has not been determined for constructing the fifth knowledge graph, the data is allowed to pass.
[0084] Furthermore, the generative AI model in Figure 1 can be applied in a variety of scenarios. For example, in language-related applications, it can be used for content promotion, note-taking, gene sequencing, code development, and essay writing. In visual applications, it can be used for video generation, 3D modeling, interface design, and image generation. In acoustic applications, it can be used for music generation and speech generation. For example, generative AI models can be implemented as GPT-4 and CodeGeeX models, among others.
[0085] The above exemplary descriptions are typical examples of application scenarios of filtering rules and generative artificial intelligence models. Those skilled in the art will appreciate that such descriptions are merely exemplary and are not intended to limit the scope of protection of the embodiments of the present invention.
[0086] FIG2 is an exemplary schematic diagram of a data filtering process according to an embodiment of the present invention. As shown in FIG2 , the data filtering process includes:
[0087] Obtain the data 20 to be filtered (for example, pre-trained data, fine-tuned data, or generated data). Perform a filtering process 10 on the data 20. In the filtering process 10, first perform a knowledge graph construction process 11. In the knowledge graph construction process 11: extract knowledge graph elements such as entities, relationships, and attributes from the data 20, and construct a first knowledge graph 12 of the data 20 based on the knowledge graph elements. Then, perform a knowledge graph query 13. In the knowledge graph query 13, query the first knowledge graph 12 in the second knowledge graph 20 that includes a third knowledge graph 31 constructed based on legal data and a fourth knowledge graph 32 constructed based on illegal data. Then, apply the rule 21 to the query result 14 to execute the rule application process 15. Next, filter the data 20 based on the result output by the rule application process 15 to determine whether the data 20 passes.
[0088] Figure 3 is a schematic diagram of generating a knowledge graph based on data according to an embodiment of the present invention. The image on the left side of Figure 3 is an image 40 of a bench with a backrest. Based on image 40 of a bench with a backrest, a knowledge graph as shown on the right side of Figure 4 can be constructed. In the knowledge graph, the relationship between backrest 41 and quadrilateral 42 is: "has a shape"; the relationship between seat 43 and backrest 41 is: "has a backrest"; the relationship between seat 43 and quadrilateral 44 is: "has a shape"; and the relationship between seat 43 and four legs 45-48 is: "has legs".
[0089] Figure 4 is a schematic diagram of generating a knowledge graph based on illegal data according to an embodiment of the present invention. The image on the left side of Figure 4 is a stool image 50, and the stool image 50 is a proprietary right enjoyed by other objects, and is therefore illegal data in the embodiment of the present invention. Based on the stool image 50, a knowledge graph as shown on the right side of Figure 4 can be constructed. In the knowledge graph, the relationship between the seat 51 and the circle 52 is: having a shape; the relationship between the seat 51 and the three chair legs 53 to 55 is: having legs.
[0090] Figure 5 is a schematic diagram of generating a knowledge graph based on legal data according to an embodiment of the present invention. The picture on the left side of Figure 5 is a picture of an armchair 60. The picture of the armchair 60 does not pose a risk of infringing on the intellectual property rights of others and is therefore legal data in an embodiment of the present invention. Based on the picture of the armchair 60, a knowledge graph as shown on the right side of Figure 5 can be constructed. In the knowledge graph, the relationship between the backrest 61 and the quadrilateral 62 is: having a shape; the relationship between the seat 63 and the backrest 61 is: having a backrest; the relationship between the seat 63 and the quadrilateral 64 is: having a shape; the relationship between the seat 63 and the four chair legs 65 to 68 is: having legs.
[0091] Figure 6 is a schematic diagram of generating a knowledge graph based on pre-training data according to an embodiment of the present invention. The image on the left side of Figure 6 is an image of a chair 70 used as pre-training data. Based on the image of the chair 70, a knowledge graph as shown on the right side of Figure 6 can be constructed. In the knowledge graph, the relationship between the backrest 71 and the quadrilateral 72 is: has a shape; the relationship between the seat 73 and the backrest 71 is: has a backrest; the relationship between the seat 73 and the circle 74 is: has a shape; and the relationship between the seat 73 and the four legs 75 to 78 is: has legs.
[0092] (1) When the filtering rule is to not use illegal data: As can be seen, since the knowledge graph shown on the right side of FIG. 6 cannot be found in the knowledge graph shown on the right side of FIG. 4 , the filtering result is: pass. The image of the armchair 70 can be input as pre-training data into the generative artificial intelligence model in the pre-training process to perform pre-training on the generative artificial intelligence model using the image of the armchair 70.
[0093] (2) When the filtering rule is to use only valid data: As can be seen, since the knowledge graph shown on the right side of Figure 6 (seat shapes are different) cannot be found in the knowledge graph shown on the right side of Figure 5, the filtering result is: Fail. In this case, the image of the chair 70 cannot be input as pre-training data into the generative artificial intelligence model during the pre-training process.
[0094] Figure 7 is a schematic diagram of generating a knowledge graph based on generated data according to an embodiment of the present invention. The picture on the left side of Figure 7 is a chair picture 80 as generated data in the reasoning process. Based on the chair picture 80, a knowledge graph as shown on the right side of Figure 7 can be constructed. In the knowledge graph, the relationship between the seat 81 and the quadrilateral 82 is: having a shape; the relationship between the seat 81 and the four chair legs 83 to 86 is: having legs. Assume that when the filtering rule is not to use illegal data: It can be seen that since the knowledge graph shown on the right side of Figure 7 cannot be queried in the knowledge graph shown on the right side of Figure 4 (the shape of the seat 81 is different from the shape of the seat 51; the number of legs of the seat 81 is different from the number of legs of the seat 51). Therefore, the filtering result is: passed. The chair picture 80 can be used as the output data of the generative artificial intelligence model.
[0095] As can be seen, in the embodiments of the present invention, knowledge graph technology is used to filter harmful training data and output data throughout the entire life cycle of the generative artificial intelligence model (pre-training, fine-tuning, and inference). Moreover, based on the third knowledge graph similar to a "whitelist" and the fourth knowledge graph similar to a "blacklist", as well as the rules based on these two knowledge graphs, the data filtering method of the generative artificial intelligence model can be easily configured.
[0096] FIG8 is an exemplary structural diagram of a data filtering system according to an embodiment of the present invention. The data filtering system for a generative artificial intelligence model includes: a pre-training device 201 for receiving pre-training data during the pre-training phase of the generative artificial intelligence model and pre-training the generative artificial intelligence model based on the pre-training data; a model fine-tuning device 202 for fine-tuning the generative artificial intelligence model based on the fine-tuning data during the fine-tuning phase of the generative artificial intelligence model; a data generation device 203 for generating generated data for the generative artificial intelligence model during the inference phase of the generative artificial intelligence model; a filter 204 for constructing a first knowledge graph based on the pre-training data, the fine-tuning data, or the generated data; querying the first knowledge graph in a second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data; and filtering the pre-training data, the fine-tuning data, or the generated data based on the query results and filtering rules, wherein the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
[0097] Dataset 90 includes a pretraining dataset 93 and a fine-tuning dataset 94. During training phase 91, pretraining data is first extracted from pretraining dataset 93, and filter 204 performs filtering 95 on the pretraining data. Pretraining device 201 pretrains the model based on the pretraining data that has passed filtering 95, resulting in pretrained model 401. Then, fine-tuning data is extracted from fine-tuning dataset 94, and filter 204 performs filtering 96 on the fine-tuning data. Furthermore, model fine-tuning device 202 fine-tunes pretrained model 401 based on the fine-tuning data that has passed filtering 96, resulting in fine-tuned model 402. During inference 92, data generation device 203 uses fine-tuned model 402 to generate generated data 403 to be output. Filter 204 performs filtering 97 on generated data 403. Generated data 403, after passing filtering 97, becomes model output data 98. In filtering process 95, the knowledge graph constructed based on the pre-trained data is queried in the second knowledge graph 30, and the filtering result of the pre-trained data is determined using rule 301 and the query result. In filtering process 96, the knowledge graph constructed based on the fine-tuned data is queried in the second knowledge graph 30, and the filtering result of the fine-tuned data is determined using rule 302 and the query result. In filtering process 97, the knowledge graph constructed based on the generated data is queried in the second knowledge graph 30, and the filtering result of the generated data is determined using rule 303 and the query result.
[0098] Figure 9 is an exemplary structural diagram of a data filtering device according to an embodiment of the present invention. In Figure 9, the data filtering device 600 includes: a determination module 601 for determining the time point at which filtering is performed on the data of the generative artificial intelligence model; a construction module 602 for constructing a first knowledge graph based on the data when the time point is reached; a query module 603 for querying the first knowledge graph in the second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data; and a filtering module 604 for filtering the data based on the query results and filtering rules, wherein the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
[0099] In one embodiment, the determination module 601 is used to determine the first time point for filtering the pre-training data of the generative artificial intelligence model during the pre-training stage of the generative artificial intelligence model; the construction module 602 is used to construct a first knowledge graph based on the pre-training data when the first time point is reached.
[0100] In one embodiment, the determination module 601 is used to determine a second time point for filtering the fine-tuning data of the generative artificial intelligence model during the model fine-tuning stage of the generative artificial intelligence model; the construction module 602 is used to construct a first knowledge graph based on the fine-tuning data when the second time point is reached.
[0101] In one embodiment, the determination module 601 is used to determine a third time point for filtering the generated data of the generative artificial intelligence model during the reasoning phase of the generative artificial intelligence model; the construction module 602 is used to construct a first knowledge graph based on the generated data when the third time point is reached.
[0102] In one embodiment, the filtering rules include: only using legal data contained in the third knowledge graph; the filtering module 604 is used to allow data to pass when the first knowledge graph is queried in the third knowledge graph; and not allow data to pass when the first knowledge graph is not queried in the third knowledge graph.
[0103] In one embodiment, the filtering rules include: not using illegal data contained in the fourth knowledge graph; a filtering module 604, which is used to not allow data to pass when the first knowledge graph is queried in the fourth knowledge graph; and to allow data to pass when the first knowledge graph is not queried in the fourth knowledge graph.
[0104] In one embodiment, the second knowledge graph includes a fifth knowledge graph constructed based on data whose legitimacy has not been determined; the filtering rules include: not using illegal data contained in the fourth knowledge graph and not using data contained in the fifth knowledge graph whose legitimacy has not been determined; the filtering module 604 is used to not allow data to pass when the first knowledge graph is queried in the fourth knowledge graph or the fifth knowledge graph; and to allow data to pass when the first knowledge graph is not queried in either the fourth knowledge graph or the fifth knowledge graph.
[0105] The embodiment of the present invention also proposes an electronic device with a processor-memory architecture. Figure 10 is an exemplary structural diagram of an electronic device with a processor-memory architecture according to an embodiment of the present invention. As shown in Figure 10, the electronic device 700 includes a processor 701, a memory 702, and a computer program stored on the memory 702 and runnable on the processor 701. When the computer program is executed by the processor 701, it implements the data filtering method of any of the above generative artificial intelligence models. Among them, the memory 702 can be specifically implemented as a variety of storage media such as an electrically erasable programmable read-only memory (EEPROM), a flash memory (Flash memory), and a programmable program read-only memory (PROM). The processor 901 can be implemented to include one or more central processing units or one or more field programmable gate arrays, wherein the field programmable gate array integrates one or more central processing unit cores. Specifically, the central processing unit or the central processing unit core can be implemented as a CPU or an MCU or a DSP, and so on.
[0106] It should be noted that not all steps and modules in the above processes and structure diagrams are required, and certain steps or modules can be omitted based on actual needs. The execution order of the steps is not fixed and can be adjusted as needed. The division of the modules is merely for the convenience of describing the functional division adopted. In actual implementation, a module can be implemented by multiple modules, and the functions of multiple modules can be implemented by the same module. These modules can be located in the same device or in different devices.
[0107] The hardware modules in each embodiment can be implemented mechanically or electronically. For example, a hardware module may include a specially designed permanent circuit or logic device (such as a dedicated processor, such as an FPGA or ASIC) for performing a specific operation. The hardware module may also include a programmable logic device or circuit (such as a general-purpose processor or other programmable processor) temporarily configured by software to perform a specific operation. As for whether to implement the hardware module mechanically, or using a dedicated permanent circuit, or using a temporarily configured circuit (such as configured by software), it can be decided based on cost and time considerations.
[0108] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A data filtering method for a generative artificial intelligence model, characterized in that: include: determining (101) a point in time at which filtering is performed on data from a generative artificial intelligence model; When the time point is reached, constructing (102) a first knowledge graph based on the data; querying (103) the first knowledge graph in a second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data; The data is filtered (104) based on the query results and filtering rules, wherein the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
2. The method according to claim 1, characterized in that The determining (101) of the time point for performing filtering on the data of the generative artificial intelligence model includes: Determining a first time point at which to perform filtering on pre-training data of the generative artificial intelligence model during a pre-training phase of the generative artificial intelligence model; The constructing of a first knowledge graph based on the data when the time point is reached includes: constructing a first knowledge graph based on the pre-trained data when the first time point is reached.
3. The method according to claim 1, characterized in that The determining (101) of the time point for performing filtering on the data of the generative artificial intelligence model includes: Determining a second time point at which filtering is performed on fine-tuning data of the generative artificial intelligence model during a model fine-tuning phase of the generative artificial intelligence model; The constructing of a first knowledge graph based on the data when the time point is reached includes: constructing a first knowledge graph based on the fine-tuning data when the second time point is reached.
4. The method according to claim 1, wherein The determining (101) of the time point for performing filtering on the data of the generative artificial intelligence model includes: determining a third time point at which filtering is performed on data generated by the generative artificial intelligence model during an inference phase of the generative artificial intelligence model; The constructing of a first knowledge graph based on the data when the time point is reached includes: constructing a first knowledge graph based on the generated data when the third time point is reached.
5. The method according to any one of claims 1 to 4, characterized in that The filtering rules include: using only legal data contained in the third knowledge graph; The filtering (104) of the data based on the query result and the filtering rule includes: When the first knowledge graph is found in the third knowledge graph, the data is allowed to pass; When the first knowledge graph is not found in the third knowledge graph, the data is not allowed to pass.
6. The method according to any one of claims 1 to 4, characterized in that The filtering rules include: not using illegal data contained in the fourth knowledge graph; The filtering (104) of the data based on the query result and the filtering rule includes: When the first knowledge graph is found in the fourth knowledge graph, the data is not allowed to pass; When the first knowledge graph is not found in the fourth knowledge graph, the data is allowed to pass.
7. The method according to any one of claims 1 to 4, characterized in that The second knowledge graph includes a fifth knowledge graph constructed based on data whose legitimacy has not been determined; the filtering rules include: not using illegal data contained in the fourth knowledge graph and not using data whose legitimacy has not been determined contained in the fifth knowledge graph; The filtering (104) of the data based on the query result and the filtering rule includes: When the first knowledge graph is found in the fourth knowledge graph or the fifth knowledge graph, the data is not allowed to pass; When the first knowledge graph is not found in either the fourth knowledge graph or the fifth knowledge graph, the data is allowed to pass.
8. A data filtering device for a generative artificial intelligence model, characterized in that: include: A determination module (601) for determining a time point for performing filtering on data of a generative artificial intelligence model; A construction module (602) is configured to construct a first knowledge graph based on the data when the time point is reached; A query module (603) is configured to query the first knowledge graph in a second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data; A filtering module (604) is configured to filter the data based on query results and filtering rules, wherein the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
9. A data filtering system for a generative artificial intelligence model, characterized in that: include: A pre-training device (201) is used to receive pre-training data during a pre-training phase of a generative artificial intelligence model, and pre-train the generative artificial intelligence model based on the pre-training data; A model fine-tuning device (202) is used to perform model fine-tuning on the generative artificial intelligence model based on fine-tuning data during the model fine-tuning phase of the generative artificial intelligence model; Data generating means (203), for generating the generated artificial intelligence model in the inference phase Generate data for AI models; A filter (204) for constructing a first knowledge graph based on the pre-trained data, the fine-tuned data, or the generated data; Querying the first knowledge graph in a second knowledge graph, wherein the second knowledge graph includes a third knowledge graph constructed based on legal data and a fourth knowledge graph constructed based on illegal data; Based on the query results and filtering rules, the pre-trained data, the fine-tuning data or the generated data is filtered, wherein the filtering rules are related to the third knowledge graph and / or the fourth knowledge graph.
10. The system according to claim 9, characterized in that The filter (204) is configured to perform at least one of the following: When the first knowledge graph is found in the third knowledge graph, the pre-trained data, the fine-tuned data, or the generated data is allowed to pass; When the first knowledge graph is not found in the third knowledge graph, the data is not allowed to pass; wherein the filtering rule includes: only using legal data contained in the third knowledge graph; When the first knowledge graph is queried in the fourth knowledge graph, the pre-trained data, the fine-tuned data or the generated data is not allowed to pass; when the first knowledge graph is not queried in the fourth knowledge graph, the pre-trained data, the fine-tuned data or the generated data is allowed to pass, wherein the filtering rule includes: not using illegal data contained in the fourth knowledge graph; When the first knowledge graph is queried in the fourth knowledge graph or the fifth knowledge graph constructed based on data whose legitimacy has not been determined, the pre-trained data, the fine-tuning data or the generated data are not allowed to pass; when the first knowledge graph is not queried in either the fourth knowledge graph or the fifth knowledge graph, the pre-trained data, the fine-tuning data or the generated data are allowed to pass, wherein the second knowledge graph includes the fifth knowledge graph; the filtering rules include: not using illegal data contained in the fourth knowledge graph and not using data contained in the fifth knowledge graph whose legitimacy has not been determined.
11. An electronic device, characterized in that: include: Processor (701); a memory (702) for storing executable instructions of the processor (701); The processor (701) is configured to read the executable instructions from the memory (702) and execute the executable instructions to implement the data filtering method of the generative artificial intelligence model according to any one of claims 1 to 7.
12. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by a processor, the data filtering method of the generative artificial intelligence model according to any one of claims 1 to 7 is implemented.
13. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the data filtering method of the generative artificial intelligence model according to any one of claims 1 to 7.
Citation Information
Patent Citations
Phishing website identification method and device, equipment and medium
CN113609493A
Multi-step attack detection method based on MDATA subgraph matching
CN115842684A
Private data use compliance check method based on knowledge graph
CN115906852A
Method for establishing compliance auditing model based on knowledge graph
CN117575006A
Case recommendation method and device, apparatus, and computer readable storage medium
WO2021051865A1
Cited By
Transformer fault diagnosis method and system based on generative acoustic large model enhancement
CN121708954A