Progressive knowledge graph completion method based on semantic information and structural information

The progressive knowledge graph completion method, which employs phased training and an embedded cache queue mechanism, addresses the problem of insufficient fusion between semantic and structural information, thereby improving the efficiency and stability of knowledge graph completion.

CN121031745APending Publication Date: 2025-11-28SUZHOU UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511097515.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-11-28

AI Technical Summary

Technical Problem

Existing knowledge graph completion methods suffer from inefficiency, asymmetric information utilization, and unstable training processes when integrating semantic and structural information, making it difficult to handle complex semantic relationships and large-scale knowledge graphs.

Method used

We adopt a progressive knowledge graph completion method based on semantic and structural information. Through a phased training strategy and an embedding cache queue mechanism, combined with the BERT model and graph attention network, we gradually integrate semantic and structural information and use contrastive learning to optimize model parameters.

Benefits of technology

It significantly improves the accuracy and stability of knowledge graph completion, enhances computational efficiency, simplifies the operation process, and strengthens the robustness and adaptability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121031745A_ABST
    Figure CN121031745A_ABST
Patent Text Reader

Abstract

The invention discloses a progressive knowledge graph completion method based on semantic information and structural information. The progressive knowledge graph completion method comprises the following steps: preprocessing and initializing data, defining an input data format, creating and initializing an embedded cache queue, and performing corresponding name and description text information on each entity; entities and relationships are encoded through a text encoder, and names and description information of a head entity and a tail entity are subjected to text representation learning by using a BERT model to obtain semantic-based vector representation; performing structure enhancement on the entity through a structure encoder; a progressive training strategy is adopted, and the method is divided into a semantic learning stage and a structure fusion stage; performing model optimization by using comparative learning, and performing parameter updating by using an InfoNCE loss function by calculating similarity and constructing a negative sample; executing a reasoning prediction process, performing candidate entity generation and sorting on the query, and outputting a knowledge graph completion result; according to the method, the knowledge graph completion performance is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of knowledge graph, and particularly relates to a progressive knowledge graph completion method based on semantic information and structural information. BACKGROUND

[0002] Knowledge graph completion (KGC) technology, as a key method to solve the incompleteness of knowledge graphs, aims to automatically predict and supplement missing entity relationships through machine learning and deep learning techniques, thereby improving the completeness and practicality of knowledge graphs. However, existing knowledge graph completion methods have significant limitations in handling complex semantic information and structural information fusion. On the one hand, traditional translation-based models (such as TransE, TransH, TransR, etc.) mainly focus on the geometric transformation of entities and relationships, although they can capture certain structural patterns, they do not fully utilize the semantic information of entities, making it difficult to handle complex semantic relationships and long-tail entities. On the other hand, language model-based methods (such as KG-BERT, KEPLER, etc.) can better utilize the textual description information of entities and relationships, but often ignore the rich structural information in knowledge graphs, such as the neighborhood relationships of entities, the topology of the graph, etc., resulting in a lack of structural consistency in the prediction results. More importantly, existing methods often use simple concatenation or linear combination strategies to fuse semantic information and structural information, which can easily cause information conflicts and noise interference, making it difficult to effectively coordinate the two types of information. In addition, most methods mainly focus on the neighborhood information of the head entity, while ignoring the important structural context provided by the tail entity neighborhood. This asymmetric information utilization limits the model's expressive power. At the same time, the instability problem in the training process also affects the convergence effect and final performance of the model, especially when dealing with large-scale knowledge graphs, how to ensure the quality consistency of the embedding representation becomes a technical problem that needs to be solved urgently. SUMMARY

[0003] The present application aims to provide a progressive knowledge graph completion method based on semantic information and structural information to solve the problem of low information utilization efficiency caused by insufficient fusion of semantic information and structural information; to solve the problem of incomplete structural context caused by asymmetric utilization of head and tail entity neighborhood information; to solve the problem of inconsistent embedding representation quality caused by unstable training process.

[0004] The technical scheme of the present application is as follows: (1) Data preprocessing and initialization, define the input data format, create and initialize the embedding cache queue, where the knowledge graph G=(E, R) contains entity set E and relation set R, train the triple set T={(h, r, t)|h, t∈E, r∈R}, and perform corresponding name and description text information for each entity; (2) Encode entities and relations through a text encoder, use the BERT model to perform text representation learning on the name and description information of the head entity and the tail entity, and obtain semantic-based vector representation; (3) Perform structural enhancement on the entity through a structure encoder, use a graph attention network to obtain the neighborhood information of the entity, and fuse the semantic information and the structural information to obtain the vector representation of the structural enhancement; (4) Adopt a progressive training strategy, divided into a semantic learning stage and a structure fusion stage, to improve the stability and convergence of the model through staged training; (5) Use contrastive learning to optimize the model, calculate the similarity and construct negative samples, and use the InfoNCE loss function to update the parameters; perform inference and prediction, generate and sort candidate entities for queries, and output the knowledge graph completion result.

[0005] Further, step (1) includes the following steps: (11) Define the input data format, including the knowledge graph G=(E, R), the training triple set T, the entity description information name_e and desc_e, and the relation description information rel_r; (12) Create an embedding cache queue Q_τ: E→R^d, where d is the embedding dimension 768, initialize all entity embeddings to zero vectors, and set the queue update mechanism to support real-time updating according to the training steps; (13) Configure model parameters, including maximum sequence length, dropout probability, learning rate, and other hyperparameter settings Further, step (2) includes the following steps: (21) Configure the BERT model, use the bert-base-uncased pre-trained model, the hidden layer dimension is 768, and the maximum sequence length is 512 tokens; (22) Encode the head entity, construct the input sequence input_h = [CLS] + name_h + desc_h +[SEP]+ rel_r + [SEP], and obtain the text representation e_hr^text through BERT forward propagation; (23) Encode the tail entity, construct the input sequence input_t = [CLS] + name_t + desc_t + [SEP], and obtain the text representation e_t^text by forward propagation of BERT; (24) Perform L2 standardization on all text embeddings to obtain the standardized semantic vector representation.

[0006] Further, step (3) includes the following steps: (31) Configuring the graph attention network includes: setting the number of attention heads to 4, the output dimension of each attention head to 192, and the activation function to LeakyReLU; (32) Obtain the neighborhood information of the entity, obtain the 1-hop neighbor set N(h) and N(t) for the head entity h and the tail entity t respectively, and randomly sample if the neighborhood size exceeds the threshold K; (33) Calculate the GAT attention coefficient, obtain the attention weight a_{ij} through linear transformation and attention mechanism, and perform normalization processing; (34) Perform multi-head attention calculation on the head entity and the tail entity respectively, and fuse the semantic information and the structural information to obtain the structure-enhanced vector representation e_hr^struct and e_t^struct; (35) Update the entity embedding representation in real time during the training process to ensure the consistency and timeliness of the embedding information.

[0007] Further, step (4) includes the following steps: (51) Perform first-stage training, i.e., the semantic learning stage, only activate the text encoder, freeze the structure encoder parameters, set the learning rate to 5e-5, and use the AdamW optimizer; (52) Perform second-stage training, i.e., the structure fusion stage, activate the text encoder and the structure encoder at the same time, reduce the text encoder learning rate to 1e-5, and set the structure encoder learning rate to 5e-5; (53) Monitor the MRR index of the validation set, and automatically switch the training stage when there is no improvement for 3 consecutive epochs or the maximum number of epochs is reached.

[0008] Further, step (5) includes the following steps: (61) Calculate the similarity between entities using the cosine similarity formula sim(e_hr, e_t) = (e_hr · e_t) / (||e_hr|| × ||e_t||), and the temperature parameter τ = 0.05; (62) Construct a negative sample set, and for each positive sample (h, r, t), construct negative samples by head replacement, tail replacement, and batch negative samples; (63) calculating an InfoNCE loss function, calculating a contrastive learning loss according to a positive sample score and a negative sample score set; (64) updating model parameters through back propagation and gradient descent, only updating text encoder parameters in the first stage, and jointly updating all parameters in the second stage.

[0009] The progressive knowledge graph completion system based on semantic information and structural information comprises: A data preprocessing and initialization module is configured to define an input data format, create an embedding cache queue and initialize the same, wherein a knowledge graph G=(E, R) comprises an entity set E and a relation set R, a training triple set T={(h, r, t)|h, t∈E, r∈R} is obtained, and corresponding name and description text information of each entity is obtained. An encoding module is configured to encode entities and relations through a text encoder, perform text representation learning on name and description information of head entities and tail entities by using a BERT model, and obtain semantic-based vector representation. A structural enhancement module is configured to enhance entities through a structural encoder, obtain neighborhood information of the entities by using a graph attention network, and fuse semantic information and structural information to obtain structural enhancement vector representation. A progressive training module is configured to improve stability and convergence of the model by training in stages in a semantic learning stage and a structural fusion stage. A model optimization module is configured to optimize the model by using contrastive learning, update parameters by calculating similarity and constructing negative samples, and use an InfoNCE loss function, perform an inference prediction process, generate and sort candidate entities for a query, and output knowledge graph completion results.

[0010] The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps of any of the methods when executing the program.

[0011] The computer readable storage medium stores a computer program, and the program is executed by the processor to implement the steps of any of the methods.

[0012] Advantages: Compared with the prior art, the present application has the following advantages: the present application proposes a knowledge graph completion method based on a progressive structural enhancement semantic framework, which effectively fuses semantic information and structural information through a staged training strategy, uses an embedding cache queue mechanism to ensure stability of the training process, and optimizes model parameters by using contrastive learning, so that accuracy and stability of knowledge graph completion are significantly improved, and computational efficiency is effectively improved. BRIEF DESCRIPTION OF DRAWINGS

[0013] Figure 1 is a relationship prediction schematic diagram of the present application; Figure 2 is a model structure schematic diagram of the present application; Figure 3 is a learning process flowchart of the knowledge graph completion model of the present application. DETAILED DESCRIPTION

[0014] The technical solutions of the present application will be further described below in combination with the drawings.

[0015] As shown in Figure 3 , the present application embodiment provides a progressive knowledge graph completion method based on semantic information and structural information, including the following steps: S1, as shown in Figure 3 , data preprocessing and initialization are performed, the input data format is defined and the embedding cache queue is created, the knowledge graph data is standardized by using the preprocessing module, and structured training data is obtained, and the specific process is: S11, construct a data set, set the knowledge graph G=(E,R) to contain entity set E and relation set R according to user input, train the triple set T={(h,r,t)|h,t∈E, r∈R}, and initialize the text description of entities and relations; As shown in Figure 1 , the knowledge graph completion example, the knowledge graph data set includes entity relationship triplets, and the entity relationship triplets can represent the semantic relationship between entities. Figure 1 The tail entity prediction task for the query triplet (New_York_City, located_in,?) is shown, where New York City is the head entity, located_in is the relationship, and the correct tail entity needs to be predicted. The gray dashed line in the figure represents the neighbor entity (such as Empire State Building, Statue of Liberty, Brooklyn Bridge, Metropolitan Museum of Art, etc.) providing structural context information for the head entity New York City through neighbor fusion mechanism, the black solid line represents the target relationship to be predicted, and the candidate tail entity includes New York State, Manhattan, North America, etc. Each entity consists of a name (name) and a text description (desc), and each relationship is represented as a phrase (rel). The entity relationship triplet includes the vector representation h of the head entity, the vector representation t of the tail entity, and the vector representation r of the relationship.

[0016] The Xavier method is used to randomly initialize entity vectors and relation vectors respectively. Specifically, the input dimension of the layer containing the parameters is defined as n, and the output dimension as m. The parameters are then initialized uniformly within the range [-√(6 / (n+m)), √(6 / (n+m))]. Model parameters are set according to user input, including hyperparameter settings such as embedding dimension d = 768, maximum sequence length, dropout probability = 0.1, and learning rate. S12. Create an embedding cache queue Qτ: E→R^d, where d is the embedding dimension 768. Initialize all entity embeddings as zero vectors. The queue maintains the mapping relationship from entity to vector Qτ(j) = e(τ)j, ∀j∈E, where e(τ)j represents the latest embedding representation of entity j in training step τ. Set up a queue update mechanism to support real-time updates according to training steps: At the beginning of each training step τ+1, the queue is initialized with all entity embeddings from the previous step Qτ+1(j)←Qτ(j). During forward propagation, whenever a new embedding e(τ+1)j is calculated, the corresponding old embedding Qτ+1(j)←e(τ+1)j in the queue is immediately replaced.

[0017] S13. Construct a text encoder based on the BERT model to process textual information about entities and relations. For head entities, concatenate their name, description, and relational text as BERT input, using the special marker [SEP] to separate them: `etexthr = BERT(nameh ∥ desch ∥ [SEP] ∥ relr)`, enabling the model to jointly consider head entities and relations. For tail entities, only their name and description are input into BERT: `etextt = BERT(namet ∥ desct)`, preserving the independent semantic information of tail entities.

[0018] S2, such as Figure 2 As shown, a structural encoder is constructed, and a graph attention network (GAT) is used to fuse one-hop neighbor information. A bidirectional neighbor aggregation strategy is employed to simultaneously consider the neighbor context of both the head and tail entities. The specific implementation process is as follows: S21. For a given triple (h, r, t), obtain the 1-hop neighbors N(h) and N(t) of the head entity h and tail entity t, respectively. For example... Figure 1 and Figure 2 As shown in the middle Phase 2 section, Figure 1The neighboring entities connected by the gray dashed lines (such as Empire State Building, Statue of Liberty, Metropolitan Museum of Art, etc.) provide rich structural context for the head entity New York City. Unlike traditional methods that only focus on the neighbors of the head entity, this invention aggregates the neighbor information of both the head node and the tail node to form a bidirectional context encoding.

[0019] S22. Utilize GAT computational structure-enhanced entity embedding to combine the real-time text embedding of the target entity with the cached embedding of its neighbors: Header entity structure augmented embedding: estructhr = GAT(etexthr ∪ {Qτ(j) | j∈N(h)}) Tail entity structure enhancement embedding: estructt = GAT(etextt ∪ {Qτ(j) | j∈N(t)}) Here, etexthr and etextt represent the text embeddings of the head and tail entities currently generated by the text encoder, and Qτ(j) represents the cached embedding of the neighbor entity j retrieved from the shared embedding cache queue. GAT uses four attention heads to apply a multi-head attention mechanism to entities and their neighbors, learning the importance weights of neighbor information.

[0020] S23. Design the attention calculation mechanism of GAT. For the neighbor aggregation of the head entity h, calculate the attention weight αij = softmax(LeakyReLU(aT[Whi||Whj])), where hi represents the head entity embedding, hj represents the neighbor entity embedding, W is the learnable weight matrix, a is the attention vector, and || represents the connection operation. The aggregated neighbor information is obtained by weighted summation: h'i = σ(Σj∈N(i) αijWhj), where σ is the activation function.

[0021] S3, such as Figure 2 and Figure 3 As shown, a progressive two-stage training strategy is adopted, which improves the model's stability and convergence by integrating semantic and structural information in stages. The specific process is as follows: S31, First Stage: Pure Semantic Learning Stage. For example... Figure 2As shown in Phase 1, this stage uses only a textual encoder to learn high-quality semantic representations without introducing any structural information. The model learns entity embeddings by maximizing positive sample similarity and minimizing negative sample similarity. Cosine similarity is used to calculate the similarity between the head node embedding `etexthr` and the tail node embedding `etextt`, resulting in the Losstext loss. Five epochs are run on the FB15k-237 dataset and 30 epochs on the WN18RR dataset to establish a stable semantic foundation.

[0022] S32, Second Stage: Structural Integration Stage. For example... Figure 2 As shown in Phase 2, the structural encoder is activated, and both the text encoder and the structural encoder are trained simultaneously. The GAT network processes the neighbor information of the head and tail nodes, generating structure-enhanced head node neighborhood embeddings `estructhr` and tail node neighborhood embeddings `estructt`. Gradients are propagated to both encoders simultaneously, achieving joint optimization of semantic and structural representations, resulting in a Losstext+struct loss. At this stage, structural information is fused on a stable semantic foundation, avoiding training instability that might result from introducing structural information too early.

[0023] S33, such as Figure 3 The training process shown determines the optimal timing for introducing the structural encoder. Experiments verify that introducing the structural encoder around the midpoint of the total training cycle yields the best performance. The process then determines whether the structural fusion epoch has been reached: if not, continue pure semantic learning using InfoNCE loss and optimized BERT parameters; if so, enable the structural encoder, use GAT to aggregate neighbor information, and simultaneously use InfoNCE loss to optimize BERT and GAT parameters. Introducing it too early leads to unstable semantic representations, while introducing it too late fails to fully utilize structural information.

[0024] S4. Contrastive learning is used for model optimization, similarity is calculated and negative samples are constructed, and the InfoNCE loss function is used for parameter updates. The specific process is as follows: S41. A contrastive learning objective function is used uniformly in both training phases. Cosine similarity is used to calculate the similarity between the head entity and tail entity embeddings: score(h,r,t) = cos(ehr, et) = (ehr·et) / (||ehr||×||et||), where ehr and et represent the entity representation in the current phase (text representation in the first phase and structural enhancement representation in the second phase).

[0025] S42. Use the InfoNCE loss function to maximize the similarity between positive sample triples and negative samples: L = -log(exp(score(h,r,t) / τ) / (exp(score(h,r,t) / τ) + Σ(h',r',t')∈Nexp(score(h',r',t') / τ))) Where τ=0.05 is the temperature parameter, and N represents the negative sample set. Through contrastive learning, the model learns to distinguish between correct and incorrect entity relation triples.

[0026] S43. Negative Sample Construction Strategy. For each positive sample triple (h,r,t), negative samples are constructed as follows: (1) replace the head entity: (h',r,t); (2) replace the tail entity: (h,r,t'); (3) replace the relation: (h,r',t). The construction of negative samples ensures that the model can learn the subtle differences between entities and relations.

[0027] S44. In the first stage, only the text encoder parameters are updated. In the second stage, both the text encoder and the structure encoder parameters are updated simultaneously to ensure the coordinated optimization of semantic and structural information.

[0028] S5. Use the learned entity vector representations to perform a knowledge graph completion task, and evaluate the model performance through link prediction. The specific process is as follows: S51. For a given incomplete triple (h, r, ?), use the trained model to calculate the scores for all candidate tail entities. For example... Figure 1 The knowledge graph completion example shown illustrates that for the query (New York City, located_in, ?), the model needs to predict the correct answer from among the candidate tail entities. In this process, the neighboring entities of the head entity New York City (represented by gray dashed lines in the diagram, such as Empire State Building, Statue of Liberty, Brooklyn Bridge, Metropolitan Museum of Art, etc.) are aggregated through a GAT network to provide structural enhancement information for the head entity. The computation process is as follows: first, the enhanced representation ehr of the head entity is obtained through a text encoder and a structural encoder; then, its cosine similarity with all candidate tail entities et (such as New York State, Manhattan, North America, etc.) is calculated; the candidate entities are ranked according to the similarity; and finally, the correct tail entity is predicted.

[0029] S52. Standard link prediction evaluation metrics are used. The average reciprocal rank (MRR) is used to quantify the model's average performance across all test queries: MRR = (1 / N)ΣNi=1(1 / ranki), where ranki represents the correct answer rank for the i-th query. Hits@K (K=1,3,10) is used to measure the proportion of test cases where the correct entity ranks in the top K positions.

[0030] S53. Analysis of the effect of bidirectional neighbor aggregation. Ablation experiments verified that aggregation using only head entity neighbors performs well on the Hits@1 metric, but its overall ranking quality is inferior to bidirectional aggregation. Although bidirectional aggregation may introduce noise in some cases (such as confusion caused by common neighbors), it provides richer structural context and performs better on metrics such as Hits@3 and Hits@10, making it more suitable for practical applications.

[0031] S6. Model performance optimization and parameter tuning to ensure robustness across different datasets: S61. Hyperparameter Settings. bert-base-uncased is used as the text encoder, and the GAT layer as the structure encoder, with a hidden layer size of 768 for both. The GAT uses four attention heads with a dropout rate of 0.1. The learning rate is selected from {5e-4, 5e-5, 1e-5} via grid search, the temperature parameter τ = 0.05, and the margin γ = 0.02.

[0032] S62. Parameter updates are performed using the AdamW optimizer, coupled with a linear learning rate decay strategy. Training is conducted on a single A100 GPU with a batch size of 768. Different training epochs are used for different datasets: 11 epochs for FB15k-237 and 70 epochs for WN18RR.

[0033] S63. Model Robustness Validation. Experiments were conducted on two benchmark datasets, FB15k-237 and WN18RR, to validate the effectiveness of the method on knowledge graphs of different sizes and densities. FB15k-237 contains 14,541 entities and 237 relations, exhibiting a rich variety of relation types; WN18RR contains 40,943 entities and 11 relations, with a relatively sparse structure but rich semantic hierarchy.

[0034] This invention improves prediction accuracy and precision: By enhancing the semantic framework through a progressive structure, this invention improves the MRR index by 2.4% on the standard dataset FB15k-237 compared to the existing best method, and improves the Hits@10 index by 3.6% on the WN18RR dataset, significantly improving the prediction accuracy of knowledge graph completion, especially when dealing with complex relational reasoning tasks, where it performs more stably and reliably.

[0035] This invention significantly improves training efficiency: by adopting an embedded cache queue mechanism and a phased training strategy, it avoids repeated computation of entity embedding representations. Compared with traditional end-to-end training methods, the training time is shortened by about 20%, while significantly reducing GPU memory usage, making it possible to process large-scale knowledge graphs. Under the same hardware conditions, the scale of entities that can be processed is increased by more than 2 times.

[0036] This invention saves computational resources and memory overhead: by introducing a dynamic caching neighbor embedding mechanism, the representations of entity neighbors are cached in memory for reuse, avoiding repeated calculations and frequent loading of neighbor information in each training round, replacing the traditional processing method that relies on the complete adjacency matrix. This mechanism not only significantly reduces GPU memory usage and computational burden, but also reduces the memory overhead of intermediate results, effectively improving the training efficiency and system scalability of large-scale knowledge graph completion tasks.

[0037] This invention enhances model stability and convergence: the proposed progressive training strategy effectively alleviates the gradient conflict problem in the process of fusion of semantic and structural information, enabling the model to exhibit better convergence characteristics during training, avoiding oscillations and performance degradation, and significantly improving the robustness and stability of the model.

[0038] This invention simplifies the operation and control process: it adopts a unified framework design, eliminating the need for complex hyperparameter tuning and manual feature engineering. Users only need to provide knowledge graph data and entity description information to automatically complete training and prediction, greatly simplifying the usage process and improving the practicality and ease of use of the method.

[0039] This invention improves generalization ability and adaptability: by introducing a contrastive learning mechanism and a cache queue update strategy, this method exhibits good generalization ability in cross-domain knowledge graph completion tasks, maintains stable performance on knowledge graphs of different sizes and types, and has strong versatility and adaptability.

[0040] The knowledge graph completion method proposed in this invention, based on a progressively structured semantic enhancement framework, systematically solves the problems of insufficient fusion of semantic and structural information and incomplete neighbor context representation in existing methods. By constructing a robust semantic foundation through a phased training strategy before introducing structural information, and combining a bidirectional neighbor aggregation mechanism with an embedded cache queue technique, the overall performance of knowledge graph completion is effectively improved.

Claims

1. A progressive knowledge graph completion method based on semantic and structural information, characterized in that, Includes the following steps: (1) Data preprocessing and initialization: Define the input data format, create an embedding cache queue and initialize it. The knowledge graph G=(E,R) contains the entity set E and the relation set R. The training triple set T={(h,r,t)|h,t∈E, r∈R} is used to assign a corresponding name and descriptive text information to each entity. (2) Entities and relations are encoded by a text encoder, and the BERT model is used to learn the text representation of the names and descriptions of the head and tail entities to obtain semantic-based vector representations; (3) The entity is structurally enhanced by a structural encoder, and the neighborhood information of the entity is obtained by using a graph attention network. The semantic information and structural information are fused to obtain the structurally enhanced vector representation. (4) A progressive training strategy is adopted, which is divided into a semantic learning stage and a structural fusion stage. The stability and convergence of the model are improved through staged training. (5) Use contrastive learning to optimize the model. Calculate similarity and construct negative samples, and use the InfoNCE loss function to update parameters. Perform the inference prediction process, generate and sort candidate entities for the query, and output the knowledge graph completion results.

2. The progressive knowledge graph completion method based on semantic and structural information according to claim 1, characterized in that, Step (1) includes the following steps: (11) Define the input data format, including the knowledge graph G=(E,R), the training triple set T, the entity description information name_e and desc_e, and the relation description information rel_r; (12) Create an embedding cache queue Q_τ: E→R^d, where d is the embedding dimension 768, initialize all entity embeddings as zero vectors, and set the queue update mechanism to support real-time updates according to training steps; (13) Configure model parameters, including setting hyperparameters such as maximum sequence length, dropout probability, and learning rate.

3. The progressive knowledge graph completion method based on semantic and structural information according to claim 1, characterized in that, Step (2) includes the following steps: (21) Configure the BERT model using the bert-base-uncased pre-trained model with a hidden layer dimension of 768 and a maximum sequence length of 512 tokens; (22) Encode the head entity and construct the input sequence input_h = [CLS] + name_h + desc_h + [SEP] + rel_r + [SEP], and obtain the text representation e_hr^text through BERT forward propagation; (23) Encode the tail entity, construct the input sequence input_t = [CLS] + name_t + desc_t + [SEP], and obtain the text representation e_t^text through BERT forward propagation; (24) Perform L2 normalization on all text embeddings to obtain normalized semantic vector representations.

4. The progressive knowledge graph completion method based on semantic and structural information according to claim 1, characterized in that, Step (3) includes the following steps: (31) The configuration of the graph attention network includes: setting the number of attention heads to 4, the output dimension of each attention head to 192, and the activation function to LeakyReLU; (32) Obtain the neighborhood information of the entities. Obtain the 1-hop neighbor sets N(h) and N(t) for the head entity h and the tail entity t respectively. If the neighborhood size exceeds the threshold K, random sampling is performed. (33) Calculate the GAT attention coefficients, obtain the attention weights α_{ij} through linear transformation and attention mechanism, and perform normalization; (34) Perform multi-head attention calculation on the head entity and the tail entity respectively, and fuse semantic information with structural information to obtain structure-enhanced vector representations e_hr^struct and e_t^struct; (35) Update the entity embedding representation in real time during training to ensure the consistency and timeliness of the embedding information.

5. The progressive knowledge graph completion method based on semantic and structural information according to claim 1, characterized in that, Step (4) includes the following steps: (51) Perform the first stage of training, namely the semantic learning stage, activate only the text encoder, freeze the structural encoder parameters, set the learning rate to 5e-5, and use the AdamW optimizer. (52) Perform the second stage of training, namely the structure fusion stage, while activating the text encoder and the structure encoder. The learning rate of the text encoder is reduced to 1e-5, and the learning rate of the structure encoder is set to 5e-5. (53) Monitor the validation set MRR index and automatically switch the training phase when there is no improvement for 3 consecutive epochs or the preset maximum number of epochs is reached.

6. The progressive knowledge graph completion method based on semantic and structural information according to claim 1, characterized in that, Step (5) includes the following steps: (61) Calculate the similarity between entities using the cosine similarity formula sim(e_hr, e_t) = (e_hr · e_t) / (||e_hr|| × ||e_t||), with temperature parameter τ=0.05; (62) Construct a negative sample set, and construct negative samples for each positive sample (h,r,t) by head replacement, tail replacement and intra-batch negative sample method; (63) Calculate the InfoNCE loss function and calculate the contrastive learning loss based on the set of positive and negative sample scores; (64) The model parameters are updated through backpropagation and gradient descent. In the first stage, only the text encoder parameters are updated, and in the second stage, all parameters are updated together.

7. A progressive knowledge graph completion system based on semantic and structural information, characterized in that, include: The data preprocessing and initialization module is used to define the input data format, create an embedding cache queue and initialize it. The knowledge graph G=(E,R) contains the entity set E and the relation set R. The training triple set T={(h,r,t)|h,t∈E,r∈R} is used to assign a corresponding name and descriptive text information to each entity. Encoding module: Used to encode entities and relations through a text encoder, and to learn text representations of the names and descriptions of head and tail entities using the BERT model to obtain semantic-based vector representations; The structural enhancement module is used to enhance the structure of entities through a structural encoder. It uses a graph attention network to obtain neighborhood information of entities and fuses semantic and structural information to obtain a structurally enhanced vector representation. The progressive training module is used to improve the stability and convergence of the model through phased training in the semantic learning and structural fusion stages. Model optimization module: Used to optimize the model using contrastive learning, it updates parameters by calculating similarity and constructing negative samples, and adopts the InfoNCE loss function; it executes the inference prediction process, generates and sorts candidate entities for the query, and outputs knowledge graph completion results.

8. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the program to implement the steps of the method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The device contains a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-6.

Citation Information

Cited By

  • Geology big data knowledge completion method, system and device and medium

    CN122198086A

  • Knowledge graph embedding hyperbolic mutual distillation method fusing topological and semantic information

    CN122489745A