Large model training method and device based on knowledge graph and electronic equipment
By building a knowledge graph and integrating structured and unstructured data, the problem of traditional large model training methods ignoring structured data information is solved, the model's understanding ability and training efficiency are improved, and overfitting is prevented.
Patent Information
- Application Number
- CN202410673102.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional large model training methods mainly rely on unstructured data and ignore the rich relationship and entity information in structured data. As a result, the model cannot effectively utilize the information in structured data during training, which limits its ability to understand complex entities and relationships. ability.
By acquiring structured and unstructured data from multiple data sources, build a knowledge graph, use preset mapping rules to convert structured data into standard triples, and extract entities, attributes, and relationships from unstructured data. Fusion builds the target knowledge graph, inputs the pre-trained model as training data, and stops training when reaching the preset accuracy or number of rounds threshold to prevent overfitting.
It improves the model's ability to understand different types of data, enhances the comprehensiveness and accuracy of the knowledge graph, avoids overfitting, and improves the model's generalization ability and training efficiency.
Smart Images

Figure CN118626656A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and specifically to a large model training method, device and electronic device based on knowledge graph. Background Art
[0002] With the development of technology and the advent of the big data era, large models have played an irreplaceable role in processing complex data analysis and prediction tasks. These models can demonstrate excellent performance in multiple fields such as natural language processing and image recognition by learning massive data sets. However, as application needs continue to deepen, training strategies that rely solely on large-scale unstructured data have exposed their limitations, especially in understanding complex entities and relationships.
[0003] Currently, traditional large model training methods focus on extracting information from unstructured data and ignore the potential of structured data. This leads to the following problem: the model cannot effectively utilize the rich relationship and entity information present in structured data during training.
[0004] Therefore, there is an urgent need for a large model training method, device and electronic equipment based on knowledge graph. Summary of the invention
[0005] The present application provides a large model training method, device and electronic device based on knowledge graph, which constructs and applies knowledge graph through structured data and unstructured data, so that the model can better understand and utilize the relationship between data during the training process.
[0006] In a first aspect of the present application, a large model training method based on a knowledge graph is provided, the method comprising: obtaining basic data from a variety of data sources, the basic data comprising structured data and unstructured data; processing the structured data to obtain a first standard triple, and processing the unstructured data to obtain a second standard triple; constructing a target knowledge graph according to the first standard triple and the second standard triple; obtaining a target entity in the target knowledge graph and its corresponding text information; using the target knowledge graph and the text information as training set data, inputting them into a pre-trained model for training and recording the number of training rounds; judging whether the number of training rounds is greater than a preset round threshold; if it is determined that the number of training rounds is greater than the preset round threshold, stopping the training to obtain a target model.
[0007] By adopting the above technical solution, the method can obtain basic data from a variety of data sources, including structured data and unstructured data, so that the model can integrate different types of information for learning, thereby improving the comprehensiveness and accuracy of the model. Based on the acquired structured data and unstructured data, the method can construct a target knowledge graph. The target knowledge graph is a way to store and represent knowledge in a graphical structure, which can effectively organize and express the relationship between entities and provide rich semantic information for the model. At the same time, the method provides a mechanism for determining whether the number of training rounds has reached a preset round threshold. When the number of training rounds exceeds the preset threshold, the training is automatically stopped to avoid overfitting or improve training efficiency. By using the target knowledge graph and its corresponding text information as training data, the model's ability to understand various types of data (structured data and unstructured data) can be improved.
[0008] Optionally, the structured data is processed to obtain a first standard triple, and the unstructured data is processed to obtain a second standard triple, specifically including: based on a preset mapping rule, mapping the table, column and row in the structured data to the first standard triple; extracting the unstructured data to obtain corresponding entities, attributes of entities and relationships between entities, and then obtaining the second standard triple.
[0009] By adopting the above technical solution, the tables, columns and rows in the structured data are mapped to the first standard triples through preset mapping rules. This processing method can convert the information in the data table into triples, making the data easier to understand and process by the model. Unstructured data is extracted to obtain entities, attributes of entities and relationships between entities, and then generate second standard triples. This processing method can extract useful information from unstructured data such as text and convert it into a structured representation, providing the model with richer semantic information. The generated first standard triples and second standard triples have standardized representations, which are conducive to subsequent knowledge graph construction and model training.
[0010] Optionally, a target knowledge graph is constructed based on the first standard triple and the second standard triple, specifically including: extracting multiple first entities included in the first standard triple and multiple second entities included in the second standard triple; performing similarity judgment on the first target entity and the second target entity, the first target entity being any first entity among the multiple first entities, and the second target entity being any second entity among the multiple second entities; if it is determined that the similarity between the first target entity and the second target entity is greater than or equal to a preset similarity threshold, constructing the first standard triple or the second standard triple as the target knowledge graph.
[0011] By adopting the above technical solutions, the integration between different data sets is promoted by comparing and fusing different entities and relationships (such as first standard triples and second standard triples). This is particularly important for building a more comprehensive and comprehensive knowledge graph.
[0012] Optionally, after performing a similarity judgment on the first target entity and the second target entity, the method further includes: if it is determined that the similarity between the first target entity and the second target entity is less than the preset similarity threshold, constructing the first standard triple and the second standard triple as the target knowledge graph.
[0013] By adopting the above technical solution, even if the similarity between the first target entity and the second target entity is lower than the preset similarity threshold, both of them will be constructed into the target knowledge graph, which can ensure that the graph contains more data points and relationships, thereby enhancing the integrity and information richness of the knowledge graph.
[0014] Optionally, obtaining the target entity in the target knowledge graph and its corresponding text information specifically includes: using the target entity contained in the target knowledge graph as a search keyword, and searching in a preset text data set according to the search keyword to obtain the text information corresponding to the search keyword.
[0015] By adopting the above technical solution, by using the target entities in the target knowledge graph as search keywords and searching in the preset text dataset, text information related to these entities can be obtained. This helps to enrich the semantic information of the entities in the knowledge graph and provide a more comprehensive entity description.
[0016] Optionally, after the target knowledge graph and the text information are used as training set data, input into a pre-trained model for training and the number of training rounds is recorded, the method further includes: using test set data to perform performance evaluation on the target model to obtain the accuracy of the target model; if it is determined that the accuracy is less than or equal to a preset accuracy threshold, determining whether the number of training rounds is greater than a preset round threshold; if it is determined that the accuracy is greater than the preset accuracy threshold, stopping training to obtain the target model.
[0017] By adopting the above technical solution, the target model's performance can be evaluated using the test set data, and the accuracy of the target model on unseen data can be objectively evaluated. When the accuracy of the target model is lower than or equal to the preset accuracy threshold, the preset round number threshold is used to determine whether to continue training. When the accuracy of the model reaches the preset accuracy threshold, the training is stopped to obtain the target model. This optimization and stopping strategy can ensure that the model is no longer over-trained after reaching a certain accuracy, prevent overfitting, and also ensure the accuracy and generalization ability of the model.
[0018] Optionally, recording the number of training rounds specifically includes: at the end of each training round, recording the current training round number through a log; and counting the number of the training round numbers to obtain the number of training rounds.
[0019] By adopting the above technical solution, the number of training rounds can be obtained by counting the training round numbers. This helps to understand the total number of rounds experienced by the target model training and provides data support for subsequent analysis and reporting.
[0020] In a second aspect of the present application, a large model training device based on a knowledge graph is provided, the device comprising: an acquisition module and a processing module; the acquisition module is used to acquire basic data from multiple data sources, the basic data comprising structured data and unstructured data; the processing module is used to process the structured data to obtain a first standard triple, and to process the unstructured data to obtain a second standard triple; the processing module is used to construct a target knowledge graph according to the first standard triple and the second standard triple; the acquisition module is also used to acquire a target entity in the target knowledge graph and its corresponding text information; the processing module is also used to input the target knowledge graph and the text information as training set data into a pre-trained model for training and record the number of training rounds; the processing module is also used to determine whether the number of training rounds is greater than a preset round threshold; the processing module is also used to stop training and obtain a target model if it is determined that the number of training rounds is greater than the preset round threshold.
[0021] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.
[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the methods described above is executed.
[0023] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. This method can obtain basic data from a variety of data sources, including structured data and unstructured data, so that the model can integrate different types of information for learning, improving the comprehensiveness and accuracy of the model. Based on the obtained structured data and unstructured data, the method can construct a target knowledge graph. Knowledge graph is a way to store and represent knowledge in a graphical structure, which can effectively organize and express the relationship between entities and provide rich semantic information for the model. By obtaining the entities in the target knowledge graph and their corresponding text information, the knowledge graph and text information are input as training set data into the pre-trained model for training. The method provides a mechanism to determine whether the number of training rounds has reached a preset round threshold. When the number of training rounds exceeds the preset threshold, the training is automatically stopped to avoid overfitting or improve training efficiency.
[0024] 2. Map the tables, columns, and rows in the structured data to the first standard triples through preset mapping rules. This processing method can convert the information in the data table into triples, making the data easier for the model to understand and process. Extract the unstructured data to obtain entities, their attributes, and the relationships between them, and then generate the second standard triples. This processing method can extract useful information from unstructured data such as text and convert it into a structured representation, providing the model with richer semantic information. The generated first standard triples and second standard triples have standardized representations, which are conducive to the subsequent knowledge graph construction and model training.
[0025] 3. By accurately selecting entities with high similarity to construct the knowledge graph, we can ensure that the constructed knowledge graph is more accurate and relevant in content, thereby improving the quality and practicality of the knowledge graph. By comparing and fusing entities and relationships from different sources (such as first and second standard triples), the integration between different data sets is promoted. This is particularly important for building a more comprehensive and comprehensive knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a flowchart of a large model training method based on knowledge graph disclosed in an embodiment of the present application; Figure 2 It is a module schematic diagram of a large model training device based on knowledge graph disclosed in an embodiment of the present application; Figure 3 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.
[0027] Explanation of the reference numerals: 201, acquisition module; 202, processing module; 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION
[0028] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0029] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.
[0030] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0031] This application provides a large model training method based on knowledge graph, referring to Figure 1 , Figure 1 1 is a flow chart of a large model training method based on knowledge graph provided in an embodiment of the present application. The method is applied to a server, including steps S101 to S107, which are as follows: Step S101: basic data is obtained from various data sources, where the basic data includes structured data and unstructured data.
[0032] In step S101, the server obtains basic data by establishing connections with various data sources. The basic data includes structured data and unstructured data. For structured data, such as relational databases, graph databases, etc., the server uses the corresponding query language (such as SQL) to send data query requests and receives the returned structured data results. For unstructured data, such as web pages, documents, social media, etc., the server captures and receives unstructured text, images, videos and other unstructured data through crawlers and API interfaces. The server performs preliminary pre-processing operations such as format conversion, encoding unification, and noise filtering on the acquired unstructured data to prepare for subsequent data processing.
[0033] Step S102: Process the structured data to obtain a first standard triplet, and process the unstructured data to obtain a second standard triplet.
[0034] In step S102, based on preset mapping rules, the tables, columns and rows in the structured data are mapped to the first standard triples; the unstructured data is extracted to obtain the corresponding entities, the attributes of the entities and the relationships between the entities, and then the second standard triples are obtained.
[0035] Specifically, the server needs to process structured data and unstructured data separately, and convert structured data and unstructured data into a unified triple representation. For structured data, the server maps the table, column, row and other elements in the relational database to knowledge graph elements such as entities, attributes and relationships through preset mapping rules. For example, the following mapping rules are preset inside the server: map each data table to an entity type, with the table name as the name of the entity type; map each data column to an attribute type, with the column name as the name of the attribute type; map each row of data to an entity, with the value of the primary key column as the unique identifier of the entity; and map the foreign key relationship to the relationship between two entities, with the relationship type constrained by the foreign key. The server finally obtains the first standard triple corresponding to the structured data. For unstructured data, such as text, the server needs to use natural language processing technology to extract entities, their attributes and the relationships between them, and then construct the second standard triple.
[0036] Step S103: Construct a target knowledge graph based on the first standard triples and the second standard triples.
[0037] In step S103, multiple first entities included in the first standard triple and multiple second entities included in the second standard triple are extracted; the similarity of the first target entity and the second target entity is judged, the first target entity is any first entity among the multiple first entities, and the second target entity is any second entity among the multiple second entities; if it is determined that the similarity between the first target entity and the second target entity is greater than or equal to a preset similarity threshold, the first standard triple or the second standard triple is constructed as a target knowledge graph.
[0038] Specifically, the server extracts all non-repeating entities from the first standard triple set and the second standard triple set respectively to form a first entity set and a second entity set, wherein the first entity set includes multiple first entities and the second entity set includes multiple second entities. These two sets contain all entities that appear in structured data and unstructured data. Next, the server selects a first entity from the first entity set as the first target entity, selects a second entity from the second entity set as the second target entity, and calculates the similarity between them. A variety of methods can be used to calculate the similarity. In an embodiment of the present application, the server uses the Jaccard similarity algorithm to compare the string edit distance of the two entity names to obtain the similarity of the two entities. After the server calculates the similarity between the first target entity and the second target entity, it compares it with a preset similarity threshold. If the similarity is greater than or equal to the preset similarity threshold, the two entities are considered to be similar and can be regarded as the same entity.
[0039] In a possible implementation, after determining the similarity between the first target entity and the second target entity, the method further includes: if it is determined that the similarity between the first target entity and the second target entity is less than a preset similarity threshold, constructing the first standard triple and the second standard triple as a target knowledge graph.
[0040] Specifically, when the server calculates that the similarity between the first target entity and the second target entity is less than the preset similarity threshold, it indicates that the two entities are semantically different and are unlikely to refer to the same real-world object. Therefore, merging them directly may introduce erroneous information and reduce the quality of the knowledge graph. In this case, the server will treat the first target entity and the second target entity as two independent entities, retain their attributes and relationships in the original triple set, and build them into the target knowledge graph respectively. Specifically, the server will perform the following steps: create a new node in the target knowledge graph for the first target entity, and associate all attributes and relationships of the entity in the first standard triple to this node. Create another new node in the target knowledge graph for the second target entity, and associate all attributes and relationships of the entity in the second standard triple to this node. The difference between the first target entity and the second target entity is retained in the target knowledge graph without any merging or association operations.
[0041] Step S104: Obtain the target entity in the target knowledge graph and its corresponding text information.
[0042] In step S104, the target entity contained in the target knowledge graph is used as a search keyword, and a search is performed in a preset text data set based on the search keyword to obtain text information corresponding to the search keyword.
[0043] Specifically, the server needs to use the constructed target knowledge graph to further obtain the text information corresponding to each entity, establish an association between the entity in the target knowledge graph and the text information in the preset text data set, and realize the mapping from structured entity representation to unstructured text description. Specifically, the server will perform the following steps: traverse all entity nodes in the target knowledge graph and use the target entity as a search keyword. The server loads the preset text data set, which can be a structured database, a semi-structured XML / JSON file, or an unstructured plain text document. The content of the preset text data set is related to the domain of the knowledge graph and contains a detailed description and attribute values of the entity. For each search keyword, the server performs a full-text search in the preset text data set to find all text fragments containing the search keyword. Here, the inverted index can be used to quickly locate the relevant text fragments. In the retrieved text fragments, the server further extracts the text information directly related to the search keyword through natural language processing technology, such as named entity recognition, and filters out irrelevant or redundant content. Further, the server associates the extracted text information with the corresponding target entity in the knowledge graph and uses it as the text information corresponding to the target entity.
[0044] Step S105: Use the target knowledge graph and text information as training set data, input them into the pre-training model for training and record the number of training rounds.
[0045] In step S105, the server serializes the target knowledge graph and converts it into a linear representation that is convenient for pre-training model learning. The server embeds the target knowledge graph into a low-dimensional vector space, converts the target knowledge graph into a series of triple sequences, etc. The server converts unstructured text into a structured feature vector to facilitate pre-training model learning. The structured representation of the target knowledge graph and the feature representation of text information are integrated into a unified training sample. The server implements it through a variety of splicing and nesting methods to form a comprehensive feature vector containing multi-dimensional information of entities, relationships, and attributes. According to the type of pre-training model and the requirements of the task, the training set data is divided into an input part and a verification part. The constructed training data set is input into the pre-training model to start the training process.
[0046] After step S105, the target knowledge graph and text information are used as training set data, input into the pre-training model for training and the number of training rounds is recorded. The method also includes: using the test set data to perform performance evaluation on the target model to obtain the accuracy of the target model; if it is determined that the accuracy is less than or equal to the preset accuracy threshold, determining whether the number of training rounds is greater than the preset round threshold; if it is determined that the accuracy is greater than the preset accuracy threshold, stopping the training to obtain the target model.
[0047] Specifically, the server will prepare an independent test set data in advance. The data format and distribution of this data set are similar to those of the training set, but it does not contain samples that have appeared in the training set, so as to evaluate the generalization and prediction ability of the model for unseen data. For example, for the training task of the knowledge graph of Chinese historical celebrities, the server can extract a part of entities, relationships, and text paragraphs from the knowledge graph and text data set as test set samples. The test set data is input into the trained target model, and the model is asked to predict and output each sample. The prediction task can be entity classification, relationship extraction, text generation, etc., depending on the design and application scenario of the model. For example, the server can randomly select an entity node "Du Fu" from the test set, and let the model generate an introduction or poem based on the attributes and relationships of the entity and the associated text information. The prediction results of the model are compared with the true labels in the test set to calculate the accuracy of the model. For example, if the word overlap of the introduction of "Du Fu" generated by the model reaches more than 80% compared with the standard answer provided in the test set, the sample prediction can be considered correct. The server will count the prediction accuracy of all test samples to obtain the overall accuracy of the model on the test set. Compare the accuracy of the model on the test set with the preset accuracy threshold. The preset accuracy threshold is set by the server based on task requirements and experience, and represents the basic requirements for model performance. If the accuracy of the model is lower than or equal to the threshold, it means that the performance of the model is not ideal and needs further optimization and training. For example, the accuracy threshold set by the server is 85%, and the accuracy of the current model on the test set is only 82%, which means that there is room for improvement in the model. If the accuracy of the model does not reach the preset threshold, the server needs to further determine whether the number of training rounds of the model has exceeded the preset round threshold. The preset round threshold is set based on task requirements and experience, and represents the server's restrictions on training time and resources. If the current number of training rounds does not exceed the threshold, the server can continue to train the model until the round limit is reached or the model performance meets the requirements. For example, the training round threshold set by the server is 20 rounds, and the current model has only been trained for 10 rounds and the accuracy is not up to standard, then the server can continue to train the model for up to 10 more rounds. If the accuracy of the model has exceeded the preset threshold, or the number of training rounds has reached the upper limit, the server can stop the training process and use the current model as the final target model. This model has achieved good performance under the joint training of knowledge graph and text information, and can be used for subsequent applications and reasoning tasks. For example, after multiple rounds of training and tuning, the server obtained a target model with an accuracy of 88% on the test set. This model can better understand and generate knowledge and text related to Chinese historical celebrities, and can support a variety of application scenarios such as intelligent question and answer, knowledge recommendation, and poetry creation.
[0048] Step S106: Determine whether the number of training rounds is greater than a preset round number threshold.
[0049] In step S106, a preset round number threshold is defined internally by the server. The preset round number threshold is set based on experience, previous tests or specific training requirements, with the purpose of controlling the duration of model training and avoiding overfitting. During the training process of the pre-trained model, the server needs to monitor and record the completion of each round of training in real time. The server records the completion of each round of training by maintaining an iteration count in the training loop, and the counter increases each time a round of training is completed. After each round of training, the server will check whether the current number of completed training rounds is greater than the preset round number threshold; if the number of training rounds is greater than the preset round number threshold, the server will stop training, thereby avoiding unnecessary resource consumption and potential overfitting.
[0050] Step S107: If it is determined that the number of training rounds is greater than the preset round number threshold, the training is stopped to obtain the target model.
[0051] In step S107, after each training round, the server will record the current number of training rounds and compare it with the preset round number threshold. If the current number of training rounds exceeds the preset threshold, the server will trigger the operation of stopping training.
[0052] The target model provided in this application can be applied to at least two application scenarios: In the field of financial risk control, assessing the credit risk of users is a key task. Related technologies usually use unstructured data, such as historical transaction records of users, social media information, etc., to train risk control models. However, relying solely on unstructured data has the following limitations: unstructured data cannot directly express the association between user information, and it is difficult to capture complex risk patterns. In the embodiment of this application, key information is extracted from the structured data of the bank system (such as user information table, loan record table, etc.), such as triples such as "user-age-35 years old", "user-loan-mortgage". Key information is extracted from unstructured data, such as triples such as "user-occupation-teacher", "user-negative news-tax arrears". The financial risk control knowledge graph is constructed by integrating structured data and unstructured data. User entities and their associated information are obtained from the knowledge graph as training data to train the financial risk control model. The model can make full use of the user's information in various dimensions, including age, occupation, loan record, negative news, etc., to comprehensively assess the user's credit risk. The knowledge graph provided by this solution can reveal the complex associations between user information, such as "old age + high loan amount + negative news" may mean a higher risk of default, which helps to discover more risk patterns.
[0053] In the field of medical diagnosis, related technologies use unstructured data, such as doctors' diagnosis reports and patients' medical records, to train diagnostic models. However, relying solely on unstructured data has the following limitations: unstructured data usually only contains part of the medical knowledge and lacks a comprehensive representation of the disease-symptom-treatment relationship. Unstructured data cannot directly express complex medical knowledge such as causal relationships and complications between diseases, which limits the depth of diagnostic reasoning. Using this solution, standardized medical knowledge triplets are extracted from medical structured data (such as disease terminology libraries, drug instructions, etc.), such as "disease-symptom-headache", "disease-complication-heart disease", etc. Patient-specific symptom descriptions, treatment plans and other information triplets are extracted from unstructured data (such as diagnosis reports, research papers, etc.), such as "patient-symptom-dizziness", "patient-medication-aspirin", etc. Structured data and unstructured data are integrated to build a medical knowledge graph. Through entity linking and synonym normalization, medical terms in unstructured data are mapped to structured entities such as diseases, symptoms, and treatments to form a standardized medical knowledge base. The patient-centric diagnosis-related entities and their relationships are obtained from the knowledge graph as training data to train the medical diagnosis model. The model can make full use of multi-dimensional information such as the patient's symptoms, medical history, and medication, and perform deep diagnostic reasoning with the help of the medical knowledge graph.
[0054] Reference Figure 2 The present application also provides a large model training device based on a knowledge graph, which is a server, and the server includes an acquisition module 201 and a processing module 202; the acquisition module 201 is used to acquire basic data from multiple data sources, and the basic data includes structured data and unstructured data; the processing module 202 is used to process the structured data to obtain a first standard triple, and to process the unstructured data to obtain a second standard triple; the processing module 202 is used to construct a target knowledge graph according to the first standard triple and the second standard triple; the acquisition module 201 is also used to acquire the target entity in the target knowledge graph and its corresponding text information; the processing module 202 is also used to input the target knowledge graph and the text information as training set data into the pre-training model for training and record the number of training rounds; the processing module 202 is also used to determine whether the number of training rounds is greater than a preset round threshold; the processing module 202 is also used to stop training if it is determined that the number of training rounds is greater than the preset round threshold, and obtain the target model.
[0055] In a possible implementation, the processing module 202 processes the structured data to obtain a first standard triple, and processes the unstructured data to obtain a second standard triple, specifically including: the processing module 202 maps the table, column, and row in the structured data to the first standard triple based on a preset mapping rule; the processing module 202 extracts the unstructured data to obtain corresponding entities, attributes of entities, and relationships between entities, and then obtains the second standard triple.
[0056] In a possible implementation, the processing module 202 constructs a target knowledge graph based on the first standard triple and the second standard triple, specifically including: the processing module 202 extracts multiple first entities included in the first standard triple and multiple second entities included in the second standard triple; the processing module 202 performs similarity judgment on the first target entity and the second target entity, the first target entity is any first entity among the multiple first entities, and the second target entity is any second entity among the multiple second entities; if it is determined that the similarity between the first target entity and the second target entity is greater than or equal to a preset similarity threshold, the processing module 202 constructs the first standard triple or the second standard triple as the target knowledge graph.
[0057] In a possible implementation, after the processing module 202 performs similarity judgment on the first target entity and the second target entity, the method further includes: if it is determined that the similarity between the first target entity and the second target entity is less than the preset similarity threshold, the processing module 202 constructs the first standard triple and the second standard triple into the target knowledge graph.
[0058] In a possible implementation, the acquisition module 201 acquires the target entity in the target knowledge graph and its corresponding text information, specifically including: the acquisition module 201 uses the target entity contained in the target knowledge graph as a search keyword, and searches in a preset text data set according to the search keyword to obtain the text information corresponding to the search keyword.
[0059] In a possible implementation, after the processing module 202 uses the target knowledge graph and the text information as training set data, inputs them into a pre-trained model for training and records the number of training rounds, the method further includes: the processing module 202 uses the test set data to perform performance evaluation on the target model to obtain the accuracy of the target model; if it is determined that the accuracy is less than or equal to a preset accuracy threshold, the processing module 202 determines whether the number of training rounds is greater than a preset round threshold; if it is determined that the accuracy is greater than the preset accuracy threshold, the processing module 202 stops training to obtain the target model.
[0060] In a possible implementation, the processing module 202 records the number of training rounds, specifically including: the processing module 202 records the current training round number through a log at the end of each training round; the processing module 202 counts the number of the training round numbers to obtain the number of training rounds.
[0061] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0062] The present application also provides an electronic device. Figure 3 , Figure 3 The electronic device 300 may include: at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .
[0063] The communication bus 302 is used to realize the connection and communication between these components.
[0064] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0065] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0066] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.
[0067] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally also be at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 , as a computer storage medium, the memory 305 may include an operating system, a network communication module, a user interface module, and an application program for a large model training method based on a knowledge graph.
[0068] exist Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call the memory 305 to store an application program for a large model training method based on a knowledge graph, and when executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for this application.
[0069] The present application also provides a computer-readable storage medium, which stores instructions. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments.
[0070] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0071] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0072] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0073] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0074] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0075] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.
[0076] This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A large model training method based on knowledge graph, characterized in that: The method comprises: Acquire basic data from multiple data sources, wherein the basic data includes structured data and unstructured data; Processing the structured data to obtain a first standard triple, and processing the unstructured data to obtain a second standard triple; Constructing a target knowledge graph according to the first standard triples and the second standard triples; Obtaining the target entity and its corresponding text information in the target knowledge graph; The target knowledge graph and the text information are used as training set data, input into the pre-training model for training and the number of training rounds is recorded; Determine whether the number of training rounds is greater than a preset round number threshold; If it is determined that the number of training rounds is greater than the preset round number threshold, the training is stopped to obtain the target model.
2. The method according to claim 1, characterized in that The processing of the structured data to obtain a first standard triplet and the processing of the unstructured data to obtain a second standard triplet specifically include: Based on a preset mapping rule, mapping the table, column, and row in the structured data to the first standard triple; The unstructured data is extracted to obtain corresponding entities, attributes of entities, and relationships between entities, and then the second standard triples are obtained.
3. The method according to claim 1, characterized in that The constructing a target knowledge graph according to the first standard triple and the second standard triple specifically includes: extracting a plurality of first entities included in the first standard triples and a plurality of second entities included in the second standard triples; Performing similarity judgment on a first target entity and a second target entity, wherein the first target entity is any first entity among the plurality of the first entities, and the second target entity is any second entity among the plurality of the second entities; If it is determined that the similarity between the first target entity and the second target entity is greater than or equal to a preset similarity threshold, the first standard triplet or the second standard triplet is constructed as the target knowledge graph.
4. The method according to claim 3, characterized in that After determining the similarity between the first target entity and the second target entity, the method further includes: If it is determined that the similarity between the first target entity and the second target entity is less than the preset similarity threshold, the first standard triple and the second standard triple are constructed as the target knowledge graph.
5. The method according to claim 1, characterized in that The obtaining of the target entity and its corresponding text information in the target knowledge graph specifically includes: The target entity contained in the target knowledge graph is used as a search keyword, and a search is performed in a preset text data set according to the search keyword to obtain text information corresponding to the search keyword.
6. The method according to claim 1, characterized in that After inputting the target knowledge graph and the text information as training set data into the pre-training model for training and recording the number of training rounds, the method further includes: Using the test set data to perform performance evaluation on the target model to obtain the accuracy of the target model; If it is determined that the accuracy is less than or equal to a preset accuracy threshold, determining whether the number of training rounds is greater than a preset round number threshold; If it is determined that the accuracy is greater than a preset accuracy threshold, the training is stopped to obtain the target model.
7. The method according to claim 1, characterized in that The recording of the number of training rounds specifically includes: At the end of each training round, the current training round number is recorded in the log; The training round numbers are counted to obtain the training round number.
8. A large model training device based on knowledge graph, characterized in that: The device comprises an acquisition module (201) and a processing module (202), wherein: The acquisition module (201) is used to acquire basic data from multiple data sources, wherein the basic data includes structured data and unstructured data; The processing module (202) is used to process the structured data to obtain a first standard triple, and to process the unstructured data to obtain a second standard triple; The processing module (202) is used to construct a target knowledge graph according to the first standard triples and the second standard triples; The acquisition module (201) is further used to acquire the target entity in the target knowledge graph and its corresponding text information; The processing module (202) is further used to input the target knowledge graph and the text information as training set data into a pre-training model for training and record the number of training rounds; The processing module (202) is further used to determine whether the number of training rounds is greater than a preset round number threshold; The processing module (202) is further configured to stop training and obtain a target model if it is determined that the number of training rounds is greater than the preset round number threshold.
9. An electronic device, characterized in that: The electronic device (300) comprises a processor (301), a memory (305), a user interface (303) and a network interface (304), wherein the memory (305) is used to store instructions, the user interface (303) and the network interface (304) are used to communicate with other devices, and the processor (301) is used to execute the instructions stored in the memory (305) so that the electronic device (300) executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Steel potential knowledge reasoning method and system based on steel knowledge graph
CN114860889A
Model training method, legal litigation information alignment and fusion method and terminal equipment thereof
CN115455198A
Service execution method and device, storage medium and electronic equipment
CN116502633A
Knowledge graph construction method and system for ship test training and medium
CN118036733A
Cited By
Method and device for extracting chapter-level relation, equipment, medium and product
CN119003791A
Method and device for querying path based on associated knowledge graph, medium and equipment
CN120873171A
