Model training method and device, computer equipment and storage medium
By acquiring and fusing the knowledge graph vectors and natural language vectors of PSR objects, the PSR model is trained, which solves the problem of insufficient utilization of deep information caused by the complex relationship between PSR objects, and improves the processing performance and reasoning ability of the model.
Patent Information
- Application Number
- CN202411138752.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-12-27
AI Technical Summary
The intricate interrelationships between PSR objects make it difficult to make full use of deep information when training on PSR models.
By obtaining the knowledge graph vector and natural language vector of the data to be processed, vector fusion is performed and the initial network model is trained to obtain the target network model, and natural language vectors are used to improve the performance of natural language processing tasks, and knowledge graph vectors are used to improve inference and recognition and query capabilities.
Make full use of the deep information of the to-process data to improve the processing performance and reasoning capabilities of the target network model, and avoid complex relationships affecting the training effect.
Smart Images

Figure CN119202127A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data, and in particular to a model training method, apparatus, computer equipment and storage medium. Background Art
[0002] The design concept of the PSR (Pressure State Response) model is to decouple resources, services, and products in layers, assemble and design them based on the underlying cloud network capabilities, form services, and provide communication services / products to the outside world.
[0003] In order to adapt to the rapidly changing market needs, the Product Service Center needs to maintain the foresight and innovation of the design. Therefore, it is necessary to update the PSR model through PSR objects. However, there are many complex relationships between PSR objects, which makes it difficult to fully utilize the deep information of PSR objects when updating the PSR model. Summary of the invention
[0004] Based on this, it is necessary to provide a model training method, device, computer equipment and storage medium that can fully utilize the deep information of PSR objects in response to the above technical problems.
[0005] In a first aspect, the present application provides a model training method. The method comprises:
[0006] Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed;
[0007] According to the knowledge graph vector and the natural language vector, the initial network model is trained to obtain a trained target network model.
[0008] In one embodiment, the performing model training on the initial network model according to the knowledge graph vector and the natural language vector to obtain a trained target network model includes:
[0009] Performing vector fusion on the knowledge graph vector and the natural language vector to determine the target fusion vector;
[0010] According to the target fusion vector, the initial network model is trained to obtain a trained target network model.
[0011] In one embodiment, the step of fusing the knowledge graph vector and the natural language vector to determine the target fusion vector includes:
[0012] Perform vector addition processing on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
[0013] In one embodiment, the step of fusing the knowledge graph vector and the natural language vector to determine the target fusion vector includes:
[0014] The knowledge graph vector and the natural language vector are subjected to vector concatenation processing to obtain the target fusion vector.
[0015] In one embodiment, the step of fusing the knowledge graph vector and the natural language vector to determine the target fusion vector includes:
[0016] Obtaining a preset first influence weight corresponding to the knowledge graph vector and a second influence weight corresponding to the natural language vector;
[0017] According to the first influence weight and the second influence weight, a weighted operation is performed on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
[0018] In one embodiment, obtaining the knowledge graph vector and the natural language vector corresponding to the data to be processed includes:
[0019] Determine a data triple corresponding to the data to be processed; wherein the data triple includes a head entity, a tail entity and a relationship definition corresponding to the data to be processed;
[0020] Performing vector transformation on the data triples according to the knowledge graph model to obtain a knowledge graph vector;
[0021] The data triples are transformed into vectors according to the large language model to obtain natural language vectors.
[0022] In one of the embodiments, the data to be processed includes at least one of business service object data, network service object data and resource object data.
[0023] In a second aspect, the present application also provides a model training device. The device comprises:
[0024] An acquisition module is used to obtain the knowledge graph vector and natural language vector corresponding to the data to be processed;
[0025] The training module is used to perform model training on the initial network model according to the knowledge graph vector and the natural language vector to obtain a trained target network model.
[0026] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0027] Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed;
[0028] According to the knowledge graph vector and the natural language vector, the initial network model is trained to obtain a trained target network model.
[0029] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0030] Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed;
[0031] According to the knowledge graph vector and the natural language vector, the initial network model is trained to obtain a trained target network model.
[0032] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0033] Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed;
[0034] According to the knowledge graph vector and the natural language vector, the initial network model is trained to obtain a trained target network model.
[0035] The above-mentioned model training method, device, computer equipment and storage medium obtain the knowledge graph vector and natural language vector corresponding to the data to be processed; then, based on the knowledge graph vector and natural language vector, the initial network model is trained to obtain the trained target network model. According to the above content, it can be seen that when the initial network model is trained, the present application does not directly train the initial network model through the data to be processed, but trains the initial network model according to the knowledge graph vector and natural language vector corresponding to the data to be processed; because the natural language vector can effectively reflect the semantic relationship between each data to be processed, therefore, when the initial network model is trained according to the natural language vector, the processing performance of the target network model for natural language processing tasks can be effectively improved; and, the knowledge graph vector can effectively reflect the structural relationship and semantic information between each data to be processed, therefore, when the initial network model is trained according to the knowledge graph vector, the reasoning, recognition and query capabilities of the target network model can be effectively improved; therefore, when the target network model is obtained by training according to the knowledge graph vector and the natural language vector, the present application fully utilizes the deep information between the data to be processed to prevent the training effect of the target network model from being affected due to the numerous complex relationships between the data to be processed. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] FIG1 is an application environment diagram of a model training method provided in an embodiment of the present application;
[0037] FIG2 is a schematic diagram of a flow chart of a first model training method provided in an embodiment of the present application;
[0038] FIG3 is a schematic diagram of a flow chart of a second model training method provided in an embodiment of the present application;
[0039] FIG4 is a schematic diagram of a flow chart of a third model training method provided in an embodiment of the present application;
[0040] FIG5 is a schematic diagram of a flow chart of a fourth model training method provided in an embodiment of the present application;
[0041] FIG6 is a structural block diagram of a first model training device provided in an embodiment of the present application;
[0042] FIG. 7 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. In the description of the present application, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms is not necessarily for the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples without contradicting each other.
[0045] The model training method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed; then, according to the knowledge graph vector and the natural language vector, perform model training on the initial network model to obtain the trained target network model. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0046] In one embodiment, as shown in FIG. 2 , a model training method is provided, which is described by taking the method applied to the terminal 102 in FIG. 1 as an example, and includes the following steps:
[0047] S201, obtain the knowledge graph vector and natural language vector corresponding to the data to be processed.
[0048] It should be noted that when it is necessary to obtain the knowledge graph vector corresponding to the data to be processed, the format of the data to be processed can be converted in advance to obtain the processed data to be processed, and then the processed data to be processed can be vectorized to obtain the knowledge graph vector and natural language vector corresponding to the data to be processed.
[0049] It is further explained that in order for the subsequently determined knowledge graph vector and natural language vector to accurately reflect the actual situation of the data to be processed, the data to be processed can be converted into a triple format, and then the data to be processed in the triple format is vectorized to obtain the knowledge graph vector and natural language vector corresponding to the data to be processed.
[0050] In one embodiment of the present application, a knowledge graph model and a large language model may be pre-trained, and then the data to be processed in triple format may be transformed into vectors according to the knowledge graph model to obtain a knowledge graph vector corresponding to the data to be processed; and the data to be processed in triple format may be transformed into vectors through the large language model to obtain a natural language vector corresponding to the data to be processed.
[0051] S202, performing model training on the initial network model according to the knowledge graph vector and the natural language vector to obtain a trained target network model.
[0052] It should be noted that when it is necessary to perform model training on the initial network model based on the knowledge graph vector and the natural language vector, the initial network model can be trained successively based on the knowledge graph vector and the natural language vector to achieve the purpose of training the target network model.
[0053] In one embodiment of the present application, when a trained target network model is required, the initial network model can be trained according to the knowledge graph vector to obtain a trained candidate model; then, the candidate model can be trained according to the natural language vector to obtain a trained target network model.
[0054] It is further explained that when it is necessary to perform model training on the initial network model based on the knowledge graph vector and the natural language vector, the knowledge graph vector and the natural language vector can also be vector fused, and then, the initial network model is trained based on the fused target fusion vector to obtain the trained target network model.
[0055] In one embodiment of the present application, when it is necessary to perform vector fusion of the knowledge graph vector and the natural language vector, the elements with high importance in the knowledge graph vector and the natural language vector (i.e., key features) can be extracted according to the importance of each element in the knowledge graph vector and the natural language vector, and the elements with high importance in the knowledge graph vector and the natural language vector can be fused to obtain the fused target fusion vector.
[0056] Among them, element importance is used to characterize each element in the knowledge graph vector and natural language vector, corresponding to the importance of the data to be processed.
[0057] In another embodiment of the present application, when it is necessary to perform vector fusion on the knowledge graph vector and the natural language vector, each element in the knowledge graph vector and the natural language vector may be added point by point to obtain a fused target fusion vector.
[0058] In another embodiment of the present application, when it is necessary to perform vector fusion on the knowledge graph vector and the natural language vector, the influence weights corresponding to the knowledge graph vector and the natural language vector can be determined respectively, and then, according to the influence weights corresponding to the knowledge graph vector and the natural language vector, weighted operation is performed on the knowledge graph vector and the natural language vector to obtain the fused target fusion vector.
[0059] The above-mentioned model training method obtains the knowledge graph vector and natural language vector corresponding to the data to be processed; then, the initial network model is trained according to the knowledge graph vector and the natural language vector to obtain the trained target network model. According to the above content, it can be seen that when the initial network model is trained, the present application does not directly train the initial network model through the data to be processed, but trains the initial network model according to the knowledge graph vector and natural language vector corresponding to the data to be processed; because the natural language vector can effectively reflect the semantic relationship between each data to be processed, therefore, when the initial network model is trained according to the natural language vector, the processing performance of the target network model for natural language processing tasks can be effectively improved; and, the knowledge graph vector can effectively reflect the structural relationship and semantic information between each data to be processed, therefore, when the initial network model is trained according to the knowledge graph vector, the reasoning, recognition and query capabilities of the target network model can be effectively improved; therefore, when the target network model is obtained by training according to the knowledge graph vector and the natural language vector, the present application fully utilizes the deep information between the data to be processed to prevent the training effect of the target network model from being affected due to the numerous complex relationships between the data to be processed.
[0060] In one embodiment, as shown in FIG3 , when it is necessary to perform model training on the initial network model according to the knowledge graph vector and the natural language vector to obtain the trained target network model, the following contents may be specifically included:
[0061] S301, perform vector fusion on the knowledge graph vector and the natural language vector to determine the target fusion vector.
[0062] It should be noted that there are many methods for vector fusion of knowledge graph vectors and natural language vectors, which may include: vector fusion through vector addition, vector fusion through vector concatenation, or vector fusion through weighted operation; in summary, there are many methods for vector fusion of knowledge graph vectors and natural language vectors, and the vector fusion methods are not limited here. The following will describe in detail the above three vector fusion methods.
[0063] In one embodiment of the present application, when it is necessary to determine a target fusion vector, the following contents may be included: performing vector addition processing on the knowledge graph vector and the natural language vector to obtain a target fusion vector.
[0064] Specifically, when it is necessary to perform vector addition processing on the knowledge graph vector and the natural language vector, the position correspondence between the elements in the knowledge graph vector and the natural language vector can be determined, that is, the first element of the knowledge graph vector corresponds to the first element in the natural language vector, the second element of the knowledge graph vector corresponds to the second element in the natural language vector, and so on, thereby determining the position correspondence between the elements in the knowledge graph vector and the natural language vector; then, the elements in the knowledge graph vector and the natural language vector that have a corresponding relationship are added together, and the new vector obtained is the target fusion vector.
[0065] In another embodiment of the present application, when it is necessary to determine a target fusion vector, the following contents may also be included: performing vector concatenation processing on the knowledge graph vector and the natural language vector to obtain a target fusion vector.
[0066] Specifically, when it is necessary to perform vector splicing processing on the knowledge graph vector and the natural language vector, the vector splicing position can be determined in advance from the knowledge graph vector or the natural language vector, and then, after the splicing position is determined, the vector that does not contain the splicing position is inserted into the splicing position of the vector with the splicing position. The splicing position can be located in any one of the vectors of the knowledge graph vector and the natural language vector, and the splicing position can also be located at any position in any vector, for example, the splicing position can be located between the first element and the second element in the knowledge graph vector, or the splicing position can also be located between the last element and the second to last element in the natural language vector.
[0067] The splicing position may be determined and adjusted according to actual conditions and / or historical experience of operation and maintenance personnel, and the selection of the splicing position is not limited here.
[0068] In another embodiment of the present application, when it is necessary to determine the target fusion vector, the following contents may also be included: obtaining a first influence weight corresponding to a pre-set knowledge graph vector and a second influence weight corresponding to a natural language vector; performing a weighted operation on the knowledge graph vector and the natural language vector according to the first influence weight and the second influence weight to obtain a target fusion vector.
[0069] Among them, the first influence weight and the second influence weight are respectively used to characterize the influence of the knowledge graph vector and the natural language vector on the training of the target network model. Furthermore, they can also be used to characterize the proportion of elements of the knowledge graph vector and the natural language vector in the target fusion vector. Therefore, in order to ensure that the target fusion vector determined subsequently can make full use of the deep information between the data to be processed to effectively train the target network model, therefore, in the process of determining the first influence weight and the second influence weight, the historical training situation of the initial network model and the historical experience of the operation and maintenance personnel can be combined to determine and adjust the first influence weight and the second influence weight to ensure that the target fusion vector determined according to the first influence weight and the second influence weight can effectively train the target network model.
[0070] Furthermore, in order to ensure that the target fusion vector determined according to the first influence weight and the second influence weight can be effectively trained to obtain the target network model, the historical training process of the initial network model can be combined in the process of determining the first influence weight and the second influence weight, and then the first historical weight and the second historical weight corresponding to the initial network model in the historical training process are obtained, and the model operation effect of the target network model trained by the initial network model in the historical training process is evaluated, and the first historical weight and the second historical weight are adjusted according to the level of the model operation effect to obtain the first candidate weight and the second candidate weight; predict whether the predicted operation effect of the target network model trained according to the first candidate weight and the second candidate weight is greater than the model operation effect of the target network model trained by the initial network model in the historical training process. If so, the first candidate weight and the second candidate weight are used as the first influence weight and the second influence weight; if not, the step of adjusting the first historical weight and the second historical weight according to the level of the model operation effect is re-executed until the first influence weight and the second influence weight are determined.
[0071] Specifically, when it is necessary to perform weighted operations on the knowledge graph vector and the natural language vector according to the first influence weight and the second influence weight to obtain a target fusion vector, the following contents may be included: performing weighted operations on the knowledge graph vector according to the first influence weight to obtain a first target vector; performing weighted operations on the natural language vector according to the second influence weight to obtain a second target vector, and then performing mean operations on the first target vector and the second target vector to obtain a target fusion vector.
[0072] S302, performing model training on the initial network model according to the target fusion vector to obtain a trained target network model.
[0073] In one embodiment of the present application, when it is necessary to perform model training on the initial network model, the following contents may be included: preprocessing the target fusion vector to clean the target fusion vector and remove noise and irrelevant information, inputting the processed target fusion vector into the initial network model, and adjusting the model parameters through optimization methods such as back propagation algorithm and gradient descent. During the training process, the error between the predicted value and the true value is calculated, and the model parameters are updated according to the error. In addition, the model performance of the model after parameter adjustment is evaluated. If the model performance of the model after parameter adjustment meets the preset performance standard, the model after parameter adjustment is used as the trained target network model.
[0074] The above-mentioned model training method determines the target fusion vector by fusing the knowledge graph vector and the natural language vector; then, according to the target fusion vector, the initial network model is trained to obtain the trained target network model; the present application determines the target fusion vector to fully utilize the deep information between the knowledge graph vector and the natural language vector when training the target network model, thereby preventing the training effect of the target network model from being affected by the numerous complex relationships between the data to be processed.
[0075] In one embodiment, as shown in FIG4 , when it is necessary to obtain the knowledge graph vector and the natural language vector corresponding to the data to be processed, the following contents may be specifically included:
[0076] S401, determining the data triplet corresponding to the data to be processed.
[0077] The data triplet contains the head entity, tail entity and relationship definition corresponding to the data to be processed.
[0078] In one embodiment of the present application, when it is necessary to determine the data triplet corresponding to the data to be processed, the data network structure corresponding to the data to be processed can be determined in advance, and then, based on the relationship between the head entity, the tail entity and the relationship definition, the data network structure corresponding to the data to be processed is structurally transformed to obtain the data triplet corresponding to the data to be processed.
[0079] It should be noted that the data to be processed includes: at least one of business service object data, network service object data and resource object data.
[0080] S402, transform the data triples into vectors according to the knowledge graph model to obtain the knowledge graph vector.
[0081] In one embodiment of the present application, when a knowledge graph vector is required, a knowledge graph model and a tokenizer can be loaded, and GPT2Tokenizer.from_pretrained("gpt2") is used to load a pre-trained tokenizer to convert the data triple text into an input format that the model can understand. Use GPT2Model.from_pretrained("gpt2") to load a pre-trained knowledge graph model that can generate a knowledge graph vector. Specifically, a triple_to_embedding function can be defined that accepts a data triple as input. First, the data triples are combined into a string in the format of "{subject} {relation} {object}". Then, the string is encoded using a tokenizer, special tags are added (such as [CLS] and [SEP]), and the input in PyTorch tensor format is returned. Next, the encoded input is forward propagated through the knowledge graph model to obtain the output of the model. In the output of the knowledge graph model, last_hidden_state contains the hidden state of the last layer, which is usually used as an embedded representation of text. Finally, the average value of last_hidden_state at all sequence positions is calculated (i.e., average pooling) to obtain an embedding vector of fixed length, which is converted into a NumPy array to obtain a knowledge graph vector.
[0082] S403, transforming the data triples into vectors according to the large language model to obtain natural language vectors.
[0083] In one embodiment of the present application, when it is necessary to determine a natural language vector, the data triples can be converted into a three-element list, and then the data triples in the triple list form are input into a large language model, and the output result of the large language model is obtained, which is the natural language vector.
[0084] The above model training method determines the data triples corresponding to the data to be processed, and then transforms the data triples into vectors according to the knowledge graph model and the large language model to obtain the knowledge graph vector and the natural language vector. This ensures that the initial network model can be trained according to the knowledge graph vector and the natural language vector corresponding to the data to be processed, and ensures that the application fully utilizes the deep information between the data to be processed, and prevents the training effect of the target network model from being affected due to the numerous complex relationships between the data to be processed.
[0085] In one embodiment, as shown in FIG5 , when it is necessary to obtain a trained target network model, the following contents may be specifically included:
[0086] S501, determining a data triplet corresponding to the data to be processed; wherein the data triplet includes a head entity, a tail entity and a relationship definition corresponding to the data to be processed.
[0087] S502, transform the data triples into vectors according to the knowledge graph model to obtain the knowledge graph vector.
[0088] S503, transforming the data triples into vectors according to the large language model to obtain natural language vectors.
[0089] S504, obtaining a first influence weight corresponding to a preset knowledge graph vector and a second influence weight corresponding to a natural language vector.
[0090] S505: Perform a weighted operation on the knowledge graph vector and the natural language vector according to the first influence weight and the second influence weight to obtain a target fusion vector.
[0091] S506, performing model training on the initial network model according to the target fusion vector to obtain a trained target network model.
[0092] The above-mentioned model training method obtains the knowledge graph vector and natural language vector corresponding to the data to be processed; then, the initial network model is trained according to the knowledge graph vector and the natural language vector to obtain the trained target network model. According to the above content, it can be seen that when the initial network model is trained, the present application does not directly train the initial network model through the data to be processed, but trains the initial network model according to the knowledge graph vector and natural language vector corresponding to the data to be processed; because the natural language vector can effectively reflect the semantic relationship between each data to be processed, therefore, when the initial network model is trained according to the natural language vector, the processing performance of the target network model for natural language processing tasks can be effectively improved; and, the knowledge graph vector can effectively reflect the structural relationship and semantic information between each data to be processed, therefore, when the initial network model is trained according to the knowledge graph vector, the reasoning, recognition and query capabilities of the target network model can be effectively improved; therefore, when the target network model is obtained by training according to the knowledge graph vector and the natural language vector, the present application fully utilizes the deep information between the data to be processed to prevent the training effect of the target network model from being affected due to the numerous complex relationships between the data to be processed.
[0093] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0094] Based on the same inventive concept, the embodiment of the present application also provides a model training device for implementing the model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more model training device embodiments provided below can refer to the limitations on the model training method above, and will not be repeated here.
[0095] In one embodiment, as shown in FIG6 , a model training device is provided, including: an acquisition module 10 and a training module 20, wherein:
[0096] The acquisition module 10 is used to obtain the knowledge graph vector and natural language vector corresponding to the data to be processed.
[0097] The training module 20 is used to perform model training on the initial network model according to the knowledge graph vector and the natural language vector to obtain a trained target network model.
[0098] In one embodiment, vector fusion is performed on the knowledge graph vector and the natural language vector to determine a target fusion vector;
[0099] According to the target fusion vector, the initial network model is trained to obtain the trained target network model.
[0100] In one embodiment, vector addition processing is performed on the knowledge graph vector and the natural language vector to obtain a target fusion vector.
[0101] In one embodiment, vector concatenation processing is performed on the knowledge graph vector and the natural language vector to obtain a target fusion vector.
[0102] In one embodiment, a first influence weight corresponding to a preset knowledge graph vector and a second influence weight corresponding to a natural language vector are obtained;
[0103] According to the first influence weight and the second influence weight, a weighted operation is performed on the knowledge graph vector and the natural language vector to obtain a target fusion vector.
[0104] In one embodiment, a data triple corresponding to the data to be processed is determined; wherein the data triple includes a head entity, a tail entity and a relationship definition corresponding to the data to be processed;
[0105] According to the knowledge graph model, the data triples are transformed into vectors to obtain knowledge graph vectors;
[0106] The data triples are transformed into vectors according to the large language model to obtain natural language vectors.
[0107] In one embodiment, the data to be processed includes: at least one of business service object data, network service object data and resource object data.
[0108] The above-mentioned model training device obtains the knowledge graph vector and natural language vector corresponding to the data to be processed; then, based on the knowledge graph vector and natural language vector, the initial network model is trained to obtain the trained target network model. According to the above content, it can be seen that when the initial network model is trained, the present application does not directly train the initial network model through the data to be processed, but trains the initial network model according to the knowledge graph vector and natural language vector corresponding to the data to be processed; because the natural language vector can effectively reflect the semantic relationship between each data to be processed, therefore, when the initial network model is trained according to the natural language vector, the processing performance of the target network model for natural language processing tasks can be effectively improved; and, the knowledge graph vector can effectively reflect the structural relationship and semantic information between each data to be processed, therefore, when the initial network model is trained according to the knowledge graph vector, the reasoning, recognition and query capabilities of the target network model can be effectively improved; therefore, when the target network model is obtained by training according to the knowledge graph vector and the natural language vector, the present application fully utilizes the deep information between the data to be processed to prevent the training effect of the target network model from being affected due to the numerous complex relationships between the data to be processed.
[0109] Each module in the above-mentioned model training device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0110] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG7. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a model training method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0111] Those skilled in the art will understand that the structure shown in FIG. 7 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0112] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0113] Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed;
[0114] According to the knowledge graph vector and the natural language vector, the initial network model is trained to obtain the trained target network model.
[0115] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0116] Perform vector fusion on the knowledge graph vector and the natural language vector to determine the target fusion vector;
[0117] According to the target fusion vector, the initial network model is trained to obtain the trained target network model.
[0118] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0119] Perform vector addition processing on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
[0120] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0121] Perform vector concatenation processing on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
[0122] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0123] Obtain a first influence weight corresponding to a preset knowledge graph vector and a second influence weight corresponding to a natural language vector;
[0124] According to the first influence weight and the second influence weight, a weighted operation is performed on the knowledge graph vector and the natural language vector to obtain a target fusion vector.
[0125] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0126] Determine a data triple corresponding to the data to be processed; wherein the data triple includes a head entity, a tail entity and a relationship definition corresponding to the data to be processed;
[0127] According to the knowledge graph model, the data triples are transformed into vectors to obtain knowledge graph vectors;
[0128] The data triples are transformed into vectors according to the large language model to obtain natural language vectors.
[0129] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0130] The data to be processed includes: at least one of business service object data, network service object data and resource object data.
[0131] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0132] Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed;
[0133] According to the knowledge graph vector and the natural language vector, the initial network model is trained to obtain the trained target network model.
[0134] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0135] Perform vector fusion on the knowledge graph vector and the natural language vector to determine the target fusion vector;
[0136] According to the target fusion vector, the initial network model is trained to obtain the trained target network model.
[0137] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0138] Perform vector addition processing on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
[0139] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0140] Perform vector concatenation processing on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
[0141] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0142] Obtain a first influence weight corresponding to a preset knowledge graph vector and a second influence weight corresponding to a natural language vector;
[0143] According to the first influence weight and the second influence weight, a weighted operation is performed on the knowledge graph vector and the natural language vector to obtain a target fusion vector.
[0144] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0145] Determine a data triple corresponding to the data to be processed; wherein the data triple includes a head entity, a tail entity and a relationship definition corresponding to the data to be processed;
[0146] According to the knowledge graph model, the data triples are transformed into vectors to obtain knowledge graph vectors;
[0147] The data triples are transformed into vectors according to the large language model to obtain natural language vectors.
[0148] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0149] The data to be processed includes: at least one of business service object data, network service object data and resource object data.
[0150] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0151] Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed;
[0152] According to the knowledge graph vector and the natural language vector, the initial network model is trained to obtain the trained target network model.
[0153] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0154] Perform vector fusion on the knowledge graph vector and the natural language vector to determine the target fusion vector;
[0155] According to the target fusion vector, the initial network model is trained to obtain the trained target network model.
[0156] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0157] Perform vector addition processing on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
[0158] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0159] Perform vector concatenation processing on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0161] Obtain a first influence weight corresponding to a preset knowledge graph vector and a second influence weight corresponding to a natural language vector;
[0162] According to the first influence weight and the second influence weight, a weighted operation is performed on the knowledge graph vector and the natural language vector to obtain a target fusion vector.
[0163] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0164] Determine a data triple corresponding to the data to be processed; wherein the data triple includes a head entity, a tail entity and a relationship definition corresponding to the data to be processed;
[0165] According to the knowledge graph model, the data triples are transformed into vectors to obtain knowledge graph vectors;
[0166] The data triples are transformed into vectors according to the large language model to obtain natural language vectors.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0168] The data to be processed includes: at least one of business service object data, network service object data and resource object data.
[0169] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0170] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0171] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0172] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A model training method, characterized in that: The method comprises: Obtain the knowledge graph vector and natural language vector corresponding to the data to be processed; According to the knowledge graph vector and the natural language vector, the initial network model is trained to obtain a trained target network model.
2. The method according to claim 1, characterized in that The step of training the initial network model according to the knowledge graph vector and the natural language vector to obtain a trained target network model includes: Performing vector fusion on the knowledge graph vector and the natural language vector to determine the target fusion vector; According to the target fusion vector, the initial network model is trained to obtain a trained target network model.
3. The method according to claim 2, characterized in that The step of fusing the knowledge graph vector and the natural language vector to determine the target fusion vector includes: Perform vector addition processing on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
4. The method according to claim 2, characterized in that: The step of fusing the knowledge graph vector and the natural language vector to determine the target fusion vector includes: The knowledge graph vector and the natural language vector are subjected to vector concatenation processing to obtain the target fusion vector.
5. The method according to claim 2, characterized in that: The step of fusing the knowledge graph vector and the natural language vector to determine the target fusion vector includes: Obtaining a preset first influence weight corresponding to the knowledge graph vector and a second influence weight corresponding to the natural language vector; According to the first influence weight and the second influence weight, a weighted operation is performed on the knowledge graph vector and the natural language vector to obtain the target fusion vector.
6. The method according to any one of claims 1 to 5, characterized in that The step of obtaining the knowledge graph vector and the natural language vector corresponding to the data to be processed includes: Determine a data triple corresponding to the data to be processed; wherein the data triple includes a head entity, a tail entity and a relationship definition corresponding to the data to be processed; Performing vector transformation on the data triples according to the knowledge graph model to obtain a knowledge graph vector; The data triples are transformed into vectors according to the large language model to obtain natural language vectors.
7. The method according to any one of claims 1 to 5, characterized in that The data to be processed includes: at least one of business service object data, network service object data and resource object data.
8. A model training device, characterized in that: The device comprises: An acquisition module is used to obtain the knowledge graph vector and natural language vector corresponding to the data to be processed; The training module is used to perform model training on the initial network model according to the knowledge graph vector and the natural language vector to obtain a trained target network model.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
