4.1. Modeling Framework
The attack path prediction model presented in our approach is based on the link prediction framework of the graph attention mechanism, which aims to map out the attack paths by predicting the potential relationships between entities in the knowledge graph. Faced with entities from different data sources and their complex inter-relationships, this model innovatively introduces the utilization of the corresponding textual information of the entities to enhance the accuracy and depth of the prediction of relationships between different nodes. Specifically, the model first adopts structural embedding techniques and textual description generation methods to construct vectorized representations of nodes and their associated texts. Subsequently, we incorporate an attention mechanism layer that allows the model to selectively attend to salient features and produce relational embeddings capturing inter-entity links, thereby effectively achieving relationship prediction. This process not only optimizes the process of identifying entity relationships but also strengthens the model’s ability to understand potential threats in complex cybersecurity environments by combining structural and textual data. Through this approach, we can accurately reveal and predict the strategies and attack sequences that may be employed by attackers, providing a new and more efficient means of network security protection. The attack path prediction model includes data preprocessing, vectorized representation generation, the application of the attention mechanism, and the final relationship prediction process.
We train the structural representation of the knowledge graph using the TransE algorithm, which efficiently captures the connectivity patterns of entities and relations such as CVE, CWE, CAPEC, and ATT&CK IDs extracted from cyber threat intelligence. The textual descriptions of these entities are vectorized through the Word2Vec model and transformed into numerical information to capture the entities’ semantic features.
Subsequently, these vectors of textual feature are combined with the structural feature vectors generated by TransE to form a rich entity representation that integrates structural and textual information.
Based on this, the model introduces an attention mechanism layer that is capable of assigning weights to potential connections between entities, thereby focusing on the most critical information during the prediction process. In this way, the text-enhanced GAT model can make effective predictions of possible entity relationships in the knowledge graph, providing strong technical support to reveal links that are not directly observed [
5]. The architecture of the text-enhanced graph attention mechanism is shown in
Figure 5.
4.3. Results
The text enhancement map pays attention to the network model. Specifically, for the GAT module, the weight decay coefficient is chosen as 5 × 10−6, while that for the convolutional layers is fixed at 1 × 10−5. Parameter optimization is performed using an iterative update approach with a learning rate of 1 × 10−3. To mitigate the overfitting problem, a dropout rate of 0.3 is uniformly applied to each convolutional layer. Throughout training, a batch size of 8923 is employed for all samples. The Adam algorithm is chosen as the optimization function, along with its recommended hyperparameters.
Baseline Comparison: The TransH model is an extension of TransE model, which provides a hyperplane () for each relationship (r). The TransH model compensates for the poor performance of the TransE model in one-to-many, many-to-one, and many-to-many relationships. Therefore, the TransH model, combined with text model, is selected for comparison with the Text-enhanced GAT model proposed in this paper.
For the link prediction task, we adopt a unified negative sampling strategy that randomly destroys the head or tail entities to generate K negative examples for each positive instance while maintaining validity constraints. In addition, we divide the dataset into training, validation, and testing sets, with proportions of 70%, 15%, and 15%, respectively. Stratified sampling is applied to maintain the distribution of entity types and relationship types in the splitting process, minimizing potential biases.
Evaluation Metrics: For each triple, it is necessary to predict the missing elements according to the other two elements and provide a candidate list containing the missing elements. Knowledge graph link prediction performance can only be as common as mean rank (MR), Hits@N, and mean reciprocal rank (MRR). MR is used to measure the model’s performance in predicting missing relationships between entities with the following formula:
where S represents the set of all triples,
denotes the total number of triples in this set, and
is the predicted ranking of links for the i-th triple.
MRR considers all the test triples and calculates the inverse of the correct relationship ranking for each triple in its correlation ranking list. Next, we compute the average of these inversion statistics to obtain the final assessment metric with the following formula:
Hits@N indicates the proportion of correct entities among the top
N candidates predicted by this model. A higher value of this metric signifies superior retrieval performance of the model. Its formula is expressed as follows:
Hits@N measures the hit rate of correct entities in the model’s top-
N prediction list. MR evaluates the average position of correct predictions for the test dataset. MRR evaluates model performance by averaging the reciprocal ranks of the correct entities across individual prediction tasks. The corresponding experimental outcomes are summarized in
Table 5.
From
Table 5, it can be seen that the text-enhanced GAT model proposed in this paper finds the correct entity to be predicted earlier than the baseline model, and MMR is improved by 0.131, while Hits@5 is improved by 0.179. This indicates that the text-enhanced GAT model can better represent the textual description of entities, thereby improving prediction accuracy. In predicting the missing head entity, the MRR is increased by 0.134, while Hits@5 is increased 0.195. This improvement indicates that text-enhanced GAT can more effectively alleviate the problem of uncertainty in head entity prediction by utilizing descriptive semantics. In predicting the tail task, the MRR is increased by 0.136, while Hits@5 is increased by 0.161. The result indicates that when entities correspond to specific vulnerabilities, attack patterns, or strategies described in natural language reports, textual information helps improve the ranking of tail entities. Therefore, the model proposed in this paper improves the results of both head and tail prediction tasks.
Ablation Experiments: Typically, systematically removing or “ablating” certain components of the model has a certain impact on model performance. In this way, the part that contributes the most to the improvement of model performance can be identified. This research method can provide an intuitive understanding of the balance between model complexity and performance. In this section, we perform ablation studies by developing three modified models (i.e., CNN layer and TransE M-1, M-2, and M-3) and omitting the effects of initialization and attention components. The link prediction performance is tested using metrics such as MR, MRR, and Hits@N. The results are shown in
Table 6.
Table 6 shows a comparison of results between the proposed source model and three improved models. When the negative effects of M-1, M-2, and M-3 are minimized, the MR of the CNN thesis increases from 91 to 149, MRR decreases to 0.626, and Hits@5 declines to 0.665. In the ablation variants, M-2 exhibits the second greatest performance degradation, which is obtained by removing the TransE module. Compared with the baseline model, the MR of M-2 increases by 235, but its MRR decreases to 0.522, and its Hits@5 decreases by 0.638. Further inspection reveals that the attention layer constitutes a pivotal component of the text-enhanced GAT architecture. When excluding this layer (model M-3), the MRR falls to 0.476, and Hits@5 declines to 0.531. The results underscore the decisive role of the attention mechanism in shaping the prediction capability of the text-enhanced GAT model.
Inference Time Analysis: In this study, we evaluate the inference performance of a knowledge graph-based model, with a focus on analyzing the inference time of the execution graph neural network for link prediction tasks. The inference process involves loading the entire graph structure (1.25 million nodes and 1.47 million edges) from a graph database, retrieving text-enhanced features, and executing forward propagation through the graph attention mechanism to generate node/edge representations and calculate prediction results. We conduct 1000 inference runs for each of the three target categories (CVE, CWE, and CAPE) and calculate the average execution time. The results are presented in
Table 7.
As shown in
Table 7, under the full-graph condition, the average inference times for CVE, CWE, and CAPEC are 42.6 ms, 38.4 ms, and 46.8 ms, respectively. These times are all within the millisecond response range, thereby meeting the requirements for real-time analysis in cybersecurity applications.
Scalability Analysis: To evaluate the scalability of the proposed text-enhanced graph attention mechanism, we extend the inference-time analysis by evaluating model performance on subgraphs of varying sizes extracted from the full knowledge graph (1,257,355 nodes and 1,478,742 edges). Subgraph scales are selected to represent incremental growth in nodes and edges while preserving the original structural characteristics of the cybersecurity domain. For each scale, we measure the average inference time for link prediction on CVE, CWE, and CAPEC-related subgraphs, as well as the corresponding F1 score and GPU memory usage. A comparison of inference time and performance at different subgraph scales is shown in
Table 8.
The results presented in
Table 8 demonstrate that inference time increases gradually with graph size, remaining in the millisecond range, even at full scale. This indicates that the model has good scalability, as the average inference times for CVE, CWE, and CAPEC tasks only moderately increase when expanding from a small subgraph (10,000 nodes) to the full knowledge graph (1.26 million nodes) (e.g., CVE from 28 ms to 42.6 ms). The F1 score decreases slightly (≤5.0%) as scale increases, reflecting minor performance degradation due to increased graph complexity. GPU memory usage scales accordingly but remains manageable on a single high-end GPU. These findings confirm that the proposed method sustains real-time inference capability across a wide range of graph sizes, a key advantage for practical deployment in cybersecurity scenarios.
4.4. Experimental Case Study
In this section, we present a real-world cybersecurity case study to illustrate how the GAT method can be applied to predict potential cyber attack paths. To visualize the process, we consider a specific cybersecurity scenario and use the cypher query command expressed as “MATCH (n:Software) WHERE n.name = ‘Apache’ AND n.version = ‘2.4.29’ RETURN n” to retrieve information about a particular software node from the knowledge graph. Starting from the server software node, i.e., Apache 2.4.29, the relevant information obtained by this node is further expanded, including CVE, CWE, CAPEC, as well as ATT&CK IDs extracted from threat intelligence reports. For example, this server may be associated with CVE7-9798 (a vulnerability affecting Apache HTTP servers), which allows remote attackers to execute arbitrary code through crafted requests. This vulnerability corresponds to CWE-20 (improper input validation), which can be exploited by attackers to launch CAPEC-31 (command injection) attacks, executing unexpected commands or accessing unauthorized data. By correlating relevant threat intelligence, this vulnerability can also be associated with ATT&CK technology T1190, which describes the exploitation of vulnerabilities in publicly accessible applications.
Based on these associations, we construct a branching path starting from Apache 2.4.29, passing through CVE7-9798, CWE-20, and CAPEC-31 and finally linking to ATT&CK T1190. This path not only identifies potential attack entry points but also points out specific techniques that adversaries may use. This analysis process helps security analysts better understand the nature of threats in order to propose appropriate countermeasures. Therefore, this method enables previously unconnected relationships in the knowledge graph to be discovered and predicted, providing solid support for network security defense.