Model training or knowledge graph construction method and device, electronic device and medium

The model training method for knowledge graphs uses dual data sets to improve the accuracy and reliability of private data knowledge graphs by balancing symbolic and natural language processing, ensuring effective triple data extraction and logical path clarity.

CN118863045BActive Publication Date: 2024-12-17CHENGDU MINGTU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411328812.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-17
Estimated Expiration
2044-09-24

AI Technical Summary

Technical Problem

Traditional knowledge graph construction methods struggle with accuracy and reliability when dealing with private data due to limited data volume, data distribution deviations, and uneven data quality, making it difficult to ensure the integrity of the constructed knowledge graphs.

Method used

A model training method involving two training data sets is employed to enhance the accuracy and reliability of knowledge graphs for private data. The first data set includes natural language text and corresponding symbolic data, while the second data set includes natural language question-answer pairs, balancing the processing capabilities of symbolic and natural language data to improve the extraction of triple data.

Benefits of technology

The method enhances the accuracy and reliability of the knowledge graph by ensuring the target triple extraction model can process complex logical relationships and maintain natural language processing capabilities, providing a clear logical path for triple data extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118863045B_ABST
    Figure CN118863045B_ABST
Patent Text Reader

Abstract

The present application provides a model training or knowledge graph construction method and device, electronic device and medium, and relates to the technical field of neural networks. The model training method includes: obtaining a first training data set, the first training data set includes multiple first sample pairs, each first sample pair includes a natural language text and symbolic data corresponding to the natural language text; using the first training data set to train the initial triple extraction large model to obtain the first triple extraction large model; obtaining a second training data set, the second training data set includes multiple first sample pairs and multiple second sample pairs, each second sample pair includes a natural language question-answer pair related to the symbolic data; using the second training data set to train the first triple extraction large model to obtain a target triple extraction large model; so as to extract triple data of private data through the target triple extraction large model, and construct a knowledge graph based on the extracted triple data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of neural networks, and more specifically, to a model training or knowledge graph construction method and device, electronic equipment, and medium. Background Art

[0002] With the continuous development of meta-computing and big data technology, social and economic development is increasingly inseparable from data interaction. The data of different enterprises often involve private data such as confidential or private information. This type of private data usually has the following characteristics: limited data volume, possible deviations in data distribution, and uneven data quality. These factors make it difficult to ensure the accuracy and reliability of knowledge graphs for private data using traditional knowledge graph construction methods. Summary of the invention

[0003] The present application provides a model training or knowledge graph construction method and device, electronic device and medium to improve the accuracy and reliability of the knowledge graph constructed for private data.

[0004] In a first aspect, the present application provides a model training method, comprising: obtaining a first training data set, the first training data set comprising multiple first sample pairs, each of the first sample pairs comprising a natural language text and symbolic data corresponding to the natural language text; using the first training data set to train an initial triple extraction large model to obtain a first triple extraction large model; obtaining a second training data set, the second training data set comprising multiple first sample pairs and multiple second sample pairs, each of the second sample pairs comprising a natural language question-answer pair related to the symbolic data; using the second training data set to train the first triple extraction large model to obtain a target triple extraction large model; so as to extract triple data of private data through the target triple extraction large model, and construct a knowledge graph based on the extracted triple data.

[0005] In the embodiment of the present application, the initial triple extraction model is trained by the first training data set, so that the initial triple extraction model can learn the knowledge of symbolic data. The first triple extraction model is trained by the second training data set. Since the training data of this training combines symbolic data and natural language data, the first triple extraction model can retain the ability to process natural language on the basis of learning the knowledge of symbolic data, so that the final trained model can not only extract the symbolic data of the text, but also restore the triple data based on the symbolic data. Since the target triple extraction model has learned the knowledge of symbolic data, the processing ability of complex logical relationships is improved. And the extracted symbolic data provides a clear logical path for triple data extraction, thereby enhancing the accuracy and reliability of the extracted triple data, and also increasing the interpretability of the final triple data. As a result, the accuracy and reliability of the knowledge graph constructed by the triple data extracted by the target triple extraction model trained by this scheme are higher.

[0006] In combination with the technical solution provided in the first aspect above, in some possible implementations, the difference between the number of first sample pairs and the number of second sample pairs included in the second training data set is less than a preset threshold.

[0007] In an embodiment of the present application, by setting the difference between the number of first sample pairs and the number of second sample pairs included in the second training data set to be less than a preset threshold, it is ensured that the number of first sample pairs and second sample pairs in the second training data set is relatively balanced, so that the target triple extraction model trained using the second training data set can balance the processing capabilities of symbolic data and natural language, so as to improve the reliability and accuracy of the triple data finally extracted.

[0008] In combination with the technical solution provided in the first aspect above, in some possible implementations, the sum of the number of first sample pairs and the number of second sample pairs included in the second training data set is less than the number of first sample pairs included in the first training data set.

[0009] In the embodiment of the present application, the symbolic data extracted by the target triple extraction large model can provide a clear logical path for triple data extraction to enhance the accuracy and reliability of the extracted triple data. The higher the accuracy of the symbolic data extracted by the target triple extraction large model, the higher the accuracy of the provided logical path. Therefore, the sum of the number of first sample pairs and the number of second sample pairs included in the second training data set is set to be less than the number of first sample pairs included in the first training data set, so that the triple extraction large model can learn more knowledge about the symbolic data to improve the accuracy of the extracted symbolic data. And because the second training data set also includes natural language question and answer pairs related to the symbolic data, the target triple extraction large model finally obtained will not lose its ability to process natural language.

[0010] In combination with the technical solution provided in the first aspect above, in some possible implementations, the loss function in the process of training the initial triple extraction large model using the first training data set is maximum likelihood estimation.

[0011] In combination with the technical solution provided in the first aspect above, in some possible implementations, the first triple extraction large model is trained using the second training data set, including: based on the second training data set, the first triple extraction large model is trained in combination with an efficient fine-tuning method for large model parameters.

[0012] In a second aspect, the present application provides a method for constructing a knowledge graph of private data, including: obtaining private data; for each piece of data in the private data, extracting symbolic data of the data using a target triple extraction model trained by the method described in the first aspect above and / or in combination with any possible implementation method of the first aspect above; for each piece of data in the private data, based on the symbolic data of the data, using the target triple extraction model to convert the symbolic data into triple data; and constructing a knowledge graph based on the triple data corresponding to all the data in the private data.

[0013] In a third aspect, the present application provides a model training device, comprising: a first acquisition module and a training module, the first acquisition module is used to acquire a first training data set, the first training data set includes multiple first sample pairs, each of the first sample pairs includes a natural language text and symbolic data corresponding to the natural language text; the training module is used to use the first training data set to train an initial triple extraction large model to obtain a first triple extraction large model; the first acquisition module is also used to acquire a second training data set, the second training data set includes multiple first sample pairs and multiple second sample pairs, each of the second sample pairs includes a natural language question and answer pair related to the symbolic data; the training module is also used to use the second training data set to train the first triple extraction large model to obtain a target triple extraction large model.

[0014] In a fourth aspect, the present application provides a device for constructing a knowledge graph of private data, comprising: a second acquisition module and a processing module, the second acquisition module is used to acquire private data; the processing module is used to extract symbolic data of each piece of data in the private data using a target triple extraction model trained by the method described in the first aspect and / or in combination with any possible implementation method of the first aspect; the processing module is also used to convert the symbolic data into triple data for each piece of data in the private data based on the symbolic data of the data using the target triple extraction model; the processing module is also used to construct a knowledge graph based on the triple data corresponding to all the data in the private data.

[0015] In a fifth aspect, the present application provides an electronic device, comprising: a memory and a processor, the memory and the processor being connected; the memory being used to store programs; the processor being used to call the programs stored in the memory to execute the method described in the first aspect above and / or in combination with any possible implementation of the first aspect above, or to execute the method described in the second aspect above.

[0016] In a sixth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer, it executes the method described in the first aspect above and / or in combination with any possible implementation of the first aspect above, or executes the method described in the second aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 A flowchart of a model training method shown in an embodiment of the present application;

[0019] Figure 2 A schematic diagram of a process for constructing a knowledge graph of private data shown in an embodiment of the present application;

[0020] Figure 3 A structural block diagram of a model training device shown in an embodiment of the present application;

[0021] Figure 4 A structural block diagram of a device for constructing a knowledge graph of private data shown in an embodiment of the present application;

[0022] Figure 5 A structural block diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0023] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0024] It should be noted that similar numbers and letters represent similar items in the following figures, so once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. At the same time, in the description of this application, relational terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0025] The technical solution of the present application will be described in detail below with reference to the accompanying drawings.

[0026] See also Figure 1 , Figure 1 This is a flow chart of a model training method shown in an embodiment of the present application. Figure 1 Describe the steps it involves.

[0027] S100: Acquire a first training data set.

[0028] The first training data set includes a plurality of first sample pairs, each of which includes a natural language text and symbolic data corresponding to the natural language text.

[0029] Symbolic data is data that uses symbols to express the logic of natural language. For ease of understanding, the following example will be used.

[0030] For example, if the natural language data is “all cats are mammals”, then the corresponding symbolic data may be “∀x(cat(x)→mammal(x))”.

[0031] Alternatively, if the natural language data is "x squared plus 5 equals 20", the corresponding symbolic data may be "x^2 + 5 = 20".

[0032] The examples given here are only for ease of understanding. The specific method of converting natural language text into corresponding symbolic data can be set according to actual needs, as long as the converted symbolic data can reflect the internal logical relationship of the natural language text.

[0033] The first training data set may be acquired in advance and stored in a local storage medium, and can be directly called when needed, or may be acquired from a third party in real time when needed.

[0034] In one implementation, the natural language text in the first training data set may be obtained from the network, and then the obtained natural language text is converted into corresponding symbolic data to obtain a plurality of first sample pairs.

[0035] Alternatively, the first sample pairs in the first training data set may also be obtained through a symbolic data extraction model having symbolic data extraction capability. In this case, the natural language text acquired in advance may be used as input data of the symbolic data extraction model to obtain the symbolic data result output by the symbolic data extraction model. Thus, multiple first sample pairs may be obtained.

[0036] In one implementation, the first training data set may include multiple sub-training data sets, wherein each sub-training data set has a different data source.

[0037] Correspondingly, in S200, each sub-training data set may be used in turn to train the initial triple extraction large model to obtain the first triple extraction large model.

[0038] For example, the first training data set may include two sub-training data sets. The data source of the first sub-training data set is manually generated by staff, and the data source of the second sub-training data set is generated by a symbolic data extraction model. Then, the initial triple extraction large model can be first trained using the first sub-training data set; then the trained initial triple extraction large model (the initial triple extraction large model trained using the first sub-training data set) can be trained using the second sub-training data set to obtain the first triple extraction large model. The examples here are only for ease of understanding and should not be used as limitations on this application.

[0039] S200: Using the first training data set to train the initial triple extraction large model to obtain a first triple extraction large model.

[0040] The method of training the initial triple extraction large model using the first training data set can be to use the natural language text in the first sample pair as the input text of the initial triple extraction large model, and give a prompt word that represents the symbol data of the extracted input text. Then the initial triple extraction large model will output the training symbol data of the input text. Then, the loss value is calculated using the training symbol data and the corresponding symbol data in the first sample pair and the preset loss function, and the parameters of the initial triple extraction large model are adjusted based on the calculated loss value. Repeat the above training steps until the number of training times reaches the preset number of times, or the calculated loss value meets the preset threshold, and the training ends.

[0041] In addition to the training methods exemplified above, other training methods may also be used to train the initial triplet extraction large model.

[0042] Optionally, the loss function in the process of training the initial triple extraction large model using the first training data set is maximum likelihood estimation.

[0043] S300: Acquire a second training data set.

[0044] The second training data set includes a plurality of first sample pairs and a plurality of second sample pairs, each of the second sample pairs including a natural language question-answer pair associated with the symbolic data.

[0045] Among them, the implementation method and acquisition method of the first sample pair in the second training data set are the same as the implementation method and acquisition method of the first sample pair in the first training data set, and are not repeated here for the sake of brief description.

[0046] The second sample pair includes natural language question-answer pairs related to symbolic data (a question-answer pair is a question plus the answer to the question), that is, question-answer pairs whose subject is symbolic data.

[0047] For example, a natural language question-answer pair related to symbolic data may include a question: "What is symbolic data?" and an answer: "Symbolic data refers to a data type that uses specific symbols to represent or indicate a certain thing, concept, or operation." The question and answer here are a natural language question-answer pair. The examples here are only for ease of understanding and should not be used as a limitation of this application.

[0048] Optionally, the natural language question-answer pair may be pre-set by a staff member, or may be obtained from the Internet. The method for obtaining the natural language question-answer pair is not limited here.

[0049] The second training data set may be acquired in advance and stored in a local storage medium, and can be directly called when needed, or may be acquired from a third party in real time when needed.

[0050] Optionally, the second training data set and the first training data set may also be acquired simultaneously.

[0051] In one implementation, the difference between the number of first sample pairs and the number of second sample pairs included in the second training data set is less than a preset threshold. By setting the difference between the number of first sample pairs and the number of second sample pairs included in the second training data set to be less than the preset threshold, the number of first sample pairs and the number of second sample pairs in the second training data set are relatively balanced, so that the target triple extraction large model trained using the second training data set can balance the processing capabilities of symbolic data and natural language, so as to improve the reliability and accuracy of the triple data finally extracted.

[0052] The preset threshold value may be set according to actual needs, for example, it may be 1, 2, 3, 4, 5, 10, 20, etc. Alternatively, the specific value of the preset threshold value may be related to the number of sample pairs included in the second training data set, for example, the value of the preset threshold value is 1% of the total number of sample pairs included in the second training data set, etc. The specific setting method of the preset threshold value includes but is not limited to the implementation method exemplified above.

[0053] In one implementation, the sum of the number of first sample pairs and the number of second sample pairs included in the second training data set is less than the number of first sample pairs included in the first training data set.

[0054] Since the symbolic data extracted by the target triple extraction large model can provide a clear logical path for triple data extraction, the accuracy and reliability of the extracted triple data can be enhanced. The higher the accuracy of the symbolic data extracted by the target triple extraction large model, the higher the accuracy of the provided logical path. Therefore, the sum of the number of first sample pairs and the number of second sample pairs included in the second training data set is set to be smaller than the number of first sample pairs included in the first training data set, so that the triple extraction large model can learn more knowledge about symbolic data to improve the accuracy of the extracted symbolic data. And since the second training data set also includes natural language question and answer pairs related to the symbolic data, the target triple extraction large model finally obtained will not lose its ability to process natural language.

[0055] S400: Using the second training data set to train the first triple extraction large model to obtain a target triple extraction large model.

[0056] In order to extract triple data of private data through the target triple extraction model, and build a knowledge graph based on the extracted triple data.

[0057] Among them, triple data consists of three parts, namely, subject (entity or concept), predicate (relation or attribute) and object (another entity or value).

[0058] The method of training the first triple extraction large model using the second training data set can be: for the first sample pair in the second training data set, the natural language text in the first sample pair is used as the input text of the first triple extraction large model, and a prompt word representing the symbol data of the extracted input text is given. Then the first triple extraction large model will output the training symbol data of the input text. Then the loss value is calculated using the training symbol data and the symbol data in the corresponding first sample pair and a preset loss function, and the parameters of the first triple extraction large model are adjusted based on the calculated loss value.

[0059] For the second sample pair in the second training data set, the question in the second sample pair is used as the input text of the first triple extraction large model. Then the first triple extraction large model outputs the training answer. Then the loss value is calculated using the training answer and the answer in the corresponding question-answer pair and the preset loss function, and the parameters of the first triple extraction large model are adjusted based on the calculated loss value.

[0060] Repeat the above training steps until the number of training times reaches the preset number, or the calculated loss value meets the preset threshold, and then the training ends.

[0061] Optionally, the specific method of using the second training data set to train the first triple extraction large model may also be to train the first triple extraction large model based on the second training data set in combination with an efficient fine-tuning method for large model parameters.

[0062] Among them, since the efficient fine-tuning method of large model parameters allows to adapt to new tasks or environments by adjusting or adding a small number of parameters while keeping most of the model parameters unchanged, using this training method to train the first triple extraction large model will not cause excessive interference to the results of the previous training (using the first training data set to train the initial triple extraction large model), and reduce the impact of the second training on the effect of the first training.

[0063] In addition to the training methods exemplified above, other training methods may also be used to train the first triple extraction large model.

[0064] In order to facilitate understanding of the above-mentioned model training method, the following will be explained by taking the first training data set including the first sub-data set and the second sub-data set as an example.

[0065] First, a training data set is obtained, which includes a first sub-training data set, a second sub-training data set, and a second training data set. The first sub-training data set and the second sub-training data set both include a plurality of first sample pairs. And the first sub-training data set: the second sub-training data set: the second training data set = 1:5:4, where the ratio is the ratio of the number of sample pairs included. The implementation of the first sub-data set and the second sub-data set has been clearly described in the previous text.

[0066] Then, the first sub-training data set is used to train the initial triple extraction large model; then, the second sub-training data set is used to train the initial triple extraction large model after training the first sub-training data set to obtain the first triple extraction large model.

[0067] Finally, the second training data set is used to train the first triple extraction large model to obtain the target triple extraction large model.

[0068] The specific implementation methods of the above steps have been clearly described in the previous text and will not be repeated here for the sake of brevity.

[0069] Based on the same technical concept, this application also provides a method for constructing a knowledge graph of private data, such as Figure 2 As shown below. Figure 2 Describe the steps it involves.

[0070] S600: Acquire private data.

[0071] Private data can be acquired in advance and stored in a storage medium or database, and can be directly called when needed. Alternatively, it can be acquired from a third party in real time when needed.

[0072] Among them, private data can be the company's internal confidential data, privacy data, etc.

[0073] S700: For each piece of private data, use the target triple extraction large model to extract symbolic data of the piece of data.

[0074] Among them, the target triplet extraction large model is the triplet extraction large model trained by the above-mentioned model training method.

[0075] For each piece of private data, the specific method of using the target triple extraction model to extract the symbolic data of the piece of data can be: for each piece of private data, the piece of data is input into the target triple extraction model, and then the prompt word representing the extracted text symbolic data is input. The target triple extraction model can then output the symbolic data corresponding to the piece of data.

[0076] Among them, the prompt words representing the extraction of text symbol data can be, for example, "extract the symbol data of the input text", "what is the symbol data of the input text", etc., and the specific implementation method of the prompt words is not limited here.

[0077] S800: For each piece of private data, based on the symbolic data of the piece of data, a target triplet extraction large model is used to convert the symbolic data into triplet data.

[0078] In one implementation mode, for each piece of private data, based on the symbolic data of the data, the target triple extraction large model is used to convert the symbolic data into triple data. The specific method can be: for each piece of private data, after the target triple extraction large model outputs the symbolic data corresponding to the data, a prompt word representing the conversion of the symbolic data into triple data is input, and the target triple extraction large model can output the triple data corresponding to the data.

[0079] Among them, the prompt words representing the extracted text symbol data can be, for example, "convert the symbol data into triple data", "obtain triple data of the input text based on the obtained symbol data", etc. The specific implementation method of the prompt words is not limited here.

[0080] In one implementation, the above S700 and S800 may also be: input the data into the target triple extraction model, then input the symbol data representing the extracted text and convert the symbol data to obtain the prompt word of the triple data. The target triple extraction model can then output the triple data corresponding to the data.

[0081] In this case, the prompt word that represents the extraction of text symbol data and the conversion of triple data based on the symbol data can be "first extract the symbol data of the input text, and then obtain the triple data of the input text based on the extracted symbol data", etc. The specific implementation method of the prompt word is not limited here.

[0082] This method only requires inputting a prompt word once, so that the target triple extraction model can complete the process of extracting the symbol data of the input text and converting the extracted symbol data into triple data.

[0083] S900: Construct a knowledge graph based on the triple data corresponding to all the data in the private data.

[0084] Since triple data consists of three parts, namely subject (entity or concept), predicate (relationship or attribute) and object (another entity or value), the specific way to construct a knowledge graph based on the triple data corresponding to all data in the private data can be: use the subject and object in the triple data as nodes in the knowledge graph, and use the predicate as the connection between the nodes.

[0085] Alternatively, the method of constructing a knowledge graph based on the triple data corresponding to all the data in the private data can also be, after obtaining the triple data corresponding to all the data in the private data, importing all the obtained triple data into the knowledge graph generation software, so that the knowledge graph generation software generates a knowledge graph based on the imported triple data.

[0086] The knowledge graph generating software may be any type of software that can generate a knowledge graph, such as neo4j (graph database software).

[0087] Based on the same technical concept, the present application also provides a model training device, such as Figure 3 As shown, the model training device 100 includes a first acquisition module 110 and a training module 120 .

[0088] The first acquisition module 110 is used to acquire a first training data set, where the first training data set includes a plurality of first sample pairs, each of which includes a natural language text and symbol data corresponding to the natural language text.

[0089] The training module 120 is used to train the initial triple extraction large model using the first training data set to obtain a first triple extraction large model.

[0090] The first acquisition module 110 is further used to acquire a second training data set, where the second training data set includes a plurality of the first sample pairs and a plurality of second sample pairs, and each of the second sample pairs includes a natural language question-answer pair related to the symbolic data.

[0091] The training module 120 is also used to train the first triple extraction large model using the second training data set to obtain a target triple extraction large model.

[0092] In one implementation manner, a difference between the number of first sample pairs and the number of second sample pairs included in the second training data set is less than a preset threshold.

[0093] In one implementation manner, the sum of the number of first sample pairs and the number of second sample pairs included in the second training data set is less than the number of first sample pairs included in the first training data set.

[0094] In one implementation, the loss function in the process of training the initial triple extraction large model using the first training data set is maximum likelihood estimation.

[0095] The training module 120 is specifically used to train the first triple extraction large model based on the second training data set in combination with an efficient fine-tuning method for large model parameters.

[0096] The model training device 100 provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned model training method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned model training method embodiment.

[0097] Based on the same technical concept, the present application also provides a knowledge graph construction device for private data, such as Figure 4 As shown, the knowledge graph construction device 200 for private data includes a second acquisition module 210 and a processing module 220.

[0098] The second acquisition module 210 is used to acquire private data.

[0099] The processing module 220 is used to extract the symbol data of each piece of private data using the target triple extraction large model trained by the above-mentioned model training method.

[0100] The processing module 220 is further used to convert the symbolic data of each piece of private data into triplet data by using the target triplet extraction large model based on the symbolic data of the piece of private data.

[0101] The processing module 220 is also used to construct a knowledge graph based on the triple data corresponding to all the data in the private data.

[0102] The knowledge graph construction device 200 for private data provided in the embodiment of the present application has the same implementation principle and technical effects as those in the aforementioned knowledge graph construction method embodiment for private data. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned knowledge graph construction method embodiment for private data.

[0103] See also Figure 5 , which is an electronic device 300 provided in an embodiment of the present application. The electronic device 300 includes: a processor 310 and a memory 320.

[0104] The memory 320 and the processor 310 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines. The memory 320 is used to store computer programs, such as Figure 3 The software function modules shown in the figure are the model training device 100 and / or the knowledge graph construction device 200 for private data. The model training device 100 and / or the knowledge graph construction device 200 for private data include at least one software function module that can be stored in the memory 320 in the form of software or firmware or solidified in the operating system (OS) of the electronic device 300. The processor 310 is used to execute the executable modules stored in the memory 320, such as the software function modules or computer programs included in the model training device 100. At this time, the processor 310 is used to obtain a first training data set, wherein the first training data set includes multiple first sample pairs, each of which includes a natural language text and symbolic data corresponding to the natural language text; use the first training data set to train the initial triple extraction large model to obtain a first triple extraction large model; obtain a second training data set, wherein the second training data set includes multiple first sample pairs and multiple second sample pairs, each of which includes a natural language question-answer pair related to the symbolic data; use the second training data set to train the first triple extraction large model to obtain a target triple extraction large model; so as to extract triple data of private data through the target triple extraction large model, and build a knowledge graph based on the extracted triple data.

[0105] The processor 310 is used to execute the executable modules stored in the memory 320, such as the software function modules or computer programs included in the knowledge graph construction device 200 for private data. At this time, the processor 310 is used to obtain private data; for each piece of data in the private data, use the target triple extraction model to extract the symbolic data of the data; for each piece of data in the private data, based on the symbolic data of the data, use the target triple extraction model to convert the symbolic data into triple data; and construct a knowledge graph based on the triple data corresponding to all the data in the private data.

[0106] Among them, the memory 320 can be, but is not limited to, RAM (Random Access Memory), ROM (Read Only Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.

[0107] The processor 310 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a CPU (Central Processing Unit), an NP (Network Processor), etc.; it may also be a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. A general-purpose processor may be a microprocessor or the processor 310 may also be any conventional processor, etc.

[0108] The electronic device 300 mentioned above includes but is not limited to a personal computer, a server, etc.

[0109] The embodiment of the present application also provides a computer-readable storage medium (hereinafter referred to as storage medium), on which a computer program is stored. When the computer program is run by a computer such as the above-mentioned electronic device 300, the model training method and / or the knowledge graph construction method of private data shown above are executed. The computer-readable storage medium includes: a U disk, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk, and other media that can store program codes.

[0110] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A model training method, characterized in that: include: Acquire a first training data set, the first training data set comprising a plurality of first sample pairs, each of the first sample pairs comprising a natural language text and symbolic data corresponding to the natural language text; wherein the symbolic data is data that uses symbols to express the logic of natural language; Using the prompt words representing the extracted text symbol data and the first training data set to train the initial triple extraction large model to obtain the first triple extraction large model; Acquire a second training data set, wherein the second training data set includes a plurality of the first sample pairs and a plurality of second sample pairs, each of the second sample pairs including a natural language question-answer pair associated with the symbolic data; The first triple extraction large model is trained using the second training data set, prompt words representing the conversion of symbolic data into triple data, and prompt words representing the extraction of text symbolic data to obtain a target triple extraction large model; so as to extract triple data of private data through the target triple extraction large model, and construct a knowledge graph based on the extracted triple data; wherein, when training with the first sample pair in the second training data set, the prompt word is a prompt word representing the extraction of text symbolic data; when training with the second sample pair in the second training data set, the prompt word is a prompt word representing the conversion of symbolic data into triple data.

2. The method according to claim 1, characterized in that The difference between the number of first sample pairs and the number of second sample pairs included in the second training data set is smaller than a preset threshold.

3. The method according to claim 1, characterized in that The sum of the number of first sample pairs and the number of second sample pairs included in the second training data set is smaller than the number of first sample pairs included in the first training data set.

4. The method according to any one of claims 1 to 3, characterized in that: The loss function in the process of training the initial triple extraction large model using the first training data set is maximum likelihood estimation.

5. The method according to any one of claims 1 to 3, characterized in that: Using the second training data set to train the first triple extraction large model includes: Based on the second training data set, the first triple extraction large model is trained in combination with an efficient large model parameter fine-tuning method.

6. A method for constructing a knowledge graph of private data, characterized in that: include: Get private data; For each piece of private data, extract the symbolic data of the piece of data using the prompt words representing the extracted text symbolic data and the target triple extraction large model trained by the method according to any one of claims 1 to 5; For each piece of private data, based on the symbolic data of the piece of data, the symbolic data is converted into triple data using a prompt word representing the conversion of the symbolic data into triple data and the target triple extraction large model; A knowledge graph is constructed based on the triple data corresponding to all the data in the private data.

7. A model training device, characterized in that: include: A first acquisition module is used to acquire a first training data set, wherein the first training data set includes a plurality of first sample pairs, each of which includes a natural language text and symbolic data corresponding to the natural language text; wherein the symbolic data is data that uses symbols to express the logic of natural language; A training module, used for training the initial triple extraction large model using the prompt words representing the extracted text symbol data and the first training data set to obtain a first triple extraction large model; The first acquisition module is further used to acquire a second training data set, where the second training data set includes a plurality of the first sample pairs and a plurality of second sample pairs, each of the second sample pairs includes a natural language question-answer pair related to the symbolic data; The training module is also used to train the first triple extraction large model using the second training data set, a prompt word representing the conversion of symbol data into triple data, and a prompt word representing the extraction of text symbol data, so as to obtain a target triple extraction large model; wherein, when training using the first sample pair in the second training data set, the prompt word is a prompt word representing the extraction of text symbol data; when training using the second sample pair in the second training data set, the prompt word is a prompt word representing the conversion of symbol data into triple data.

8. A device for constructing a knowledge graph of private data, characterized in that: include: The second acquisition module is used to acquire private data; A processing module, for extracting symbolic data of each piece of private data using a prompt word representing the extracted text symbolic data and a target triplet extraction large model trained by the method according to any one of claims 1 to 5; The processing module is further configured to convert the symbolic data into triple data based on the symbolic data of the data by using a prompt word representing the conversion of the symbolic data into triple data and the target triple extraction large model for each piece of private data; The processing module is also used to construct a knowledge graph based on the triple data corresponding to all the data in the private data.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are connected; The memory is used to store programs; The processor is used to call the program stored in the memory to execute the method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a computer, the method according to any one of claims 1 to 6 is executed.