Skip to Content
Applied SciencesApplied Sciences
  • Article
  • Open Access

22 April 2026

18 Pages

RSTGP: A Relation-Aware and Span-Graph-Enhanced Method for Joint Entity and Relation Extraction from Medical Texts

,
,
,
,
,
and
School of Artificial Intelligence, China University of Mining and Technology (Beijing), Beijing 100083, China
*
Author to whom correspondence should be addressed.

Abstract

Electronic health records (EHRs) contain abundant medical entities and relations, and their accurate extraction is essential for medical knowledge graph construction and clinical decision-support. However, medical texts are typically characterized by dense terminology, syntactically complex expressions, and frequent overlapping triplets, which significantly increase the difficulty of joint extraction. Although table-filling methods such as GPLinker have achieved strong performance, they remain limited in modeling cross-relation interactions, capturing latent structural dependencies among candidate spans, and reducing noise from redundant entity-pair combinations. To address these limitations, we propose RSTGP, a unified joint extraction framework built upon the GPLinker paradigm. The proposed framework integrates three key mechanisms: (1) a relation-aware scoring strategy that enhances cross-relation interaction and calibrates relation scores; (2) a span-level graph enhancement mechanism that captures latent structural dependencies among candidate spans; and (3) a type-constrained calibration mechanism that suppresses implausible subject–object combinations. Extensive experiments on the CMeIE and DuIE2.0 datasets demonstrate that RSTGP consistently outperforms seven representative baseline models and achieves F1 scores of 62.75% and 76.79%, respectively. In particular, the proposed model shows clear advantages in handling overlapping and multiple triplets, yielding a more robust performance in complex extraction scenarios.

1. Introduction

With the continued growth of electronic health records (EHRs), extracting structured information from large volumes of medical text has become an important task in medical natural language processing (NLP) [1]. Medical entity and relation extraction aims to identify entities and the semantic relations between them from unstructured medical corpora, providing a foundation for medical knowledge graph construction and completion [2], medical question answering [3], and medical text summarization [4].
Medical texts differ substantially from general-domain texts. They often contain dense domain-specific terminology, complex sentence structures, and multiple co-occurring entities and relations within a single sentence. These characteristics frequently give rise to overlapping triplets. Existing studies typically categorize such patterns into three types: normal, single-entity overlap (SEO), and entity-pair overlap (EPO) [5]. Examples of these overlap patterns in medical texts are shown in Figure 1. Such complex structures substantially increase the difficulty of relation extraction.
Figure 1. Examples of normal, SEO, and EPO triplets in medical texts. Note: The text before “@” denotes the disease mention, and the text after “@” denotes the corresponding text description.
Recent studies have shown that table-filling joint extraction methods, such as TPLinker and GPLinker, are effective for extracting overlapping triplets. By formulating entity recognition and relation extraction as link prediction over position pairs, these methods alleviate the error propagation commonly observed in pipeline approaches. Even so, several challenges remain in medical settings. Relation types are typically modeled with independent parameters, which limits semantic sharing across relations and makes semantically similar relations harder to distinguish. At the same time, scoring a large number of candidate entity pairs against all predefined relation types introduces many redundant candidates with incompatible types, which can interfere with relation prediction [6]. In addition, latent structural dependencies among candidate spans are often underexplored, making it difficult to fully capture sentence-level interactions in complex overlap scenarios.
To address these challenges, we build upon the GPLinker framework and propose RSTGP, a unified model for joint entity and relation extraction. The proposed approach extends the original position-pair scoring mechanism by incorporating relation-aware modeling, span-graph enhancement strategy, and type constraints in a consistent manner. Specifically, RSTGP introduces a relation-aware scoring mechanism to improve cross-relation interaction and better calibrate relation scores. It further incorporates a span-graph enhancement strategy to capture latent structural dependencies among candidate spans, and employs a type-constrained calibration mechanism to suppress implausible subject–object combinations. By integrating these components within the same scoring framework, the model improves both the discriminability and robustness of relation prediction in complex medical texts.
The main contributions of this work are summarized as follows:
  • We present a unified joint extraction framework based on GPLinker, which systematically enhances relation prediction by incorporating relation-aware modeling, structural dependency modeling, and type-constrained calibration within a shared scoring space.
  • We design a relation-aware scoring mechanism together with a span-graph enhancement strategy, enabling the model to capture both cross-relation interactions and latent structural dependencies among candidate spans.
  • We introduce a type-constrained calibration mechanism to reduce noise from incompatible entity pairs, improving prediction consistency in complex scenarios. Extensive experiments on CMeIE and DuIE2.0 demonstrate the effectiveness and robustness of the proposed approach.

3. Methodology

This section introduces the proposed RSTGP framework. We first present the task formulation, followed by the overall architecture. As shown in Figure 2, RSTGP follows a unified position-pair modeling paradigm built upon the GPLinker framework, and consists of an encoder, a relation-aware joint modeling module, a span-graph enhancement module, a type-constraint module, and a decoding module. The input sentence is first encoded by Chinese-RoBERTa-wwm-ext to obtain contextualized representations. On this basis, the relation-aware joint modeling module performs entity boundary detection and relation-specific position-pair scoring within a shared semantic space. To further enhance structural reasoning, the span-graph enhancement module constructs a lightweight span graph over high-confidence candidate spans and propagates information to capture latent dependencies among overlapping or adjacent spans. In addition, the type-constraint module incorporates entity type priors to refine relation scores, improving discrimination ability and stability in overlapping triplet scenarios.
Figure 2. The overall framework of RSTGP. The model consists of five components: an encoder, a relation-aware joint modeling module, a span-graph enhancement module, a type-constraint module, and a decoding module. In the relation-aware joint modeling module, we introduce a low-rank decomposition mechanism, where a shared basis matrix V captures common semantic patterns across relations. Each relation is associated with a learnable coefficient vector U r , which is projected onto the shared basis to obtain a compact relation-specific representation. This representation is further transformed into a gating vector g r , which is used to modulate relation-specific representations and improve cross-relation semantic sharing while preserving relation-specific characteristics.

3.1. Task Definition

Given an input sentence denoted by S = x 1 , x 2 , … , x n and a predefined relation set R = r 1 , r 2 , … , r m , where n is the sentence length and m is the number of relation types, the goal is to extract all relational triples from the sentence. Each triplet is represented as T = s , r , o s , o ∈ E , r ∈ R , where E denotes the entity set, and s and o represent the subject and object entities, respectively.

3.2. Encoder Module

The encoder produces contextualized representations of the input sentence. Given an input sequence S = x 1 , x 2 , … , x n , we use Chinese-RoBERTa-wwm-ext as the encoder to obtain the corresponding feature matrix:
H = C h i n e s e - R o B E R T a - w w m - e x t ( S )
where H ∈ ℝ n × d denotes the encoder output, n is the number of input tokens, and d = 768 is the hidden size of Chinese-RoBERTa-wwm-ext. Accordingly, H can be written as H = h 1 ⋮ h n ∈ ℝ n × d , where h i ∈ ℝ d denotes the contextualized representation of the i -th token.

3.3. Relation-Aware Joint Modeling Module

In the original GPLinker, different relation types are modeled with independent parameters at the relation modeling stage. In this work, we retain the entity position-pair modeling scheme while redesigning the relation modeling stage with a relation-aware enhancement mechanism. Specifically, the proposed module strengthens cross-relation semantic sharing through a shared low-rank semantic basis, relation-aware gating, and relation temperature calibration, while also reducing inconsistencies in score scales across relation types.
(1) Entity score: Given the contextualized representations H = h 1 , h 2 , … , h n produced by the encoder, let ε ∈ 0 , 1 denote the entity role label, where 0 and 1 represent the subject and object, respectively. The corresponding query and key vectors are obtained through linear projection combined with rotary position encoding (RoPE) [31]:
q ε , i = R i W ε q h i + b ε q
k ε , j = R j W ε k h j + b ε k
where R i and R j denote the rotary position encoding matrices at positions i and j , respectively, and W ε q , W ε k , b ε q , and b ε k are learnable parameters. The score of position pair i , j for entity role ε is then defined as
s ε i , j = q ε , i T ⋅ k ε , j
(2) Relation score: For relation type r ∈ 1 , … , C r and the entity-pair boundary combination m ∈ H H , T T , the contextual representation is projected into the corresponding query and key vectors:
q r , i m = R i ⋅ W r q , m h i + b r q , m
k r , j m = R j ⋅ W r k , m h j + b r k , m
where W r q , m , W r k , m , b r q , m , and b r k , m are the learnable weights and biases associated with relation type r .
On top of this, a learnable relation coefficient matrix U and a shared low-rank basis matrix V are introduced to generate a relation-aware gating vector:
U ∈ ℝ C r × l , V ∈ ℝ l × d p
where C r is the number of relation types, l is the low-rank dimension, and d p is the relation pointer representation dimension.
For relation type r , the corresponding coefficient vector U r is multiplied by the shared low-rank semantic basis V , and the resulting low-rank semantic representation is further normalized and nonlinearly transformed to obtain the relation-aware gating vector
g r = 1 + α ⋅ tanh L a y e r N o r m U r ⋅ V
where U r is the coefficient vector corresponding to relation type r , g r ∈ ℝ d p denotes the relation-aware gating vector for relation type r , and α is the gating scaling coefficient. Intuitively, the shared low-rank basis captures common semantic patterns across relations, while the relation-specific coefficients select and combine these patterns to form the gating vector, which then adaptively modulates the relation representation.
The resulting gating vector is applied element-wise to modulate the relation pointer representations:
q ˜ m = r , i q r , i m ⊙ g r ,   k ˜ m = r , j k r , j m ⊙ g r
To alleviate score-scale inconsistencies across relation types, relation-specific temperature coefficients are further introduced for the HH and TT position-pair scores:
s ˜ r H H i s , i o = τ r ⋅ q ˜ r , i s H H T ⋅ k ˜ r , i o H H , s ˜ r T T j s , j o = τ r ⋅ q ˜ r , j s T T T ⋅ k ˜ r , j o T T
where i s , i o and j s , j o denote the start-position pair and end-position pair of the subject and object, respectively, and τ r is the learnable temperature coefficient for the relation r . By arranging the calibrated scores over all valid position pairs, we obtain the HH and TT relation score matrices for relation r , denoted as S ˜ r H H and S ˜ r T T , respectively.
Compared with the original GPLinker, the proposed relation-aware mechanism enhances cross-relation semantic sharing while preserving relation-specific representations, and further mitigates score-scale variation across relation types.

3.4. Span-Graph Enhancement Module

To better capture structural dependencies among candidate spans, we incorporate a span-graph enhancement module. The module builds a lightweight graph over high-confidence spans and injects the resulting structural information into the relation score matrices through a residual mechanism.
Specifically, the top- K spans with the highest scores are first selected from the entity score matrix to form a node set V = n 1 , n 2 , … , n k . The K -th node is denoted as n k = i k , j k , ε k , s k , where i k and j k are the start and end positions of the span, ε k ∈ 0 , 1 denotes the span role, and s k is the corresponding prediction confidence. For each span i k , j k , the encoder outputs within its boundary are average-pooled to obtain the span representation z k . The initial node representation is then constructed by combining the role-type embedding e ε k with the prediction confidence:
x k = σ s k ⋅ z k + e ε k
where σ ⋅ denotes the sigmoid function.
Based on these node representations, a span graph G = ( V , A ) is constructed according to local associations defined by span overlap, boundary adjacency, and role consistency. GATv2 is then applied for neighborhood aggregation. For node n k and one of its neighboring nodes n m , the attention weight is computed as
α k m = exp a T L e a k y R e L U W s x k + W n x m ∑ n j ∈ N k exp a T L e a k y R e L U W s x k + W n x j
where N k denotes the neighbor set of node n k , and W s , W n , and a are learnable parameters. After aggregation, the graph-enhanced span representation is obtained as
x ′ k = G E L U L a y e r N o r m x k + ∑ n m ∈ N k α k m ⋅ W o x m
where W o is the output projection matrix.
Using the graph-enhanced span representations, matching scores between subject spans and object spans are computed in the head-boundary and tail-boundary spaces, yielding span-pair scores:
δ k m H H = W h h x ′ k T ⋅ W h h x ′ m , δ k m T T = W t t x ′ k T ⋅ W t t x ′ m
These span-pair scores are then mapped to their corresponding head-boundary and tail-boundary position pairs and aggregated into the graph-enhanced relation score matrices S g H H and S g T T .
Because different relation types may rely on structural information to different extents, we further introduce relation-specific graph residual gates to modulate the graph-enhanced relation scores and obtain the residual relation matrices
Δ S g H H = λ h ⋅ ρ r h ⋅ S g H H , Δ S g T T = λ t ⋅ ρ r t ⋅ S g T T
where ρ r h and ρ r t denote the graph residual gating coefficients for relation r at the HH and TT boundaries, respectively, and λ h and λ t are learnable residual scaling factors.
Finally, the graph-enhanced residual matrices are added to the relation score matrices produced by the relation-aware joint modeling module, yielding the graph-refined relation score matrices:
S ^ r H H = S ˜ r H H + Δ S g H H ,   S ^ r T T = S ˜ r T T + Δ S g T T

3.5. Type-Constraint Module

To suppress the influence of candidate entity pairs that violate type constraints during relation prediction, we incorporate a type-constraint module into the relation modeling stage. The module uses schema-defined entity-pair type constraints and applies a gated bias term to the HH and TT relation score matrices based on entity-type predictions and a relation-type compatibility table.
For the top- K candidate spans selected from the entity score matrix, span representations are first constructed, and entity type probabilities are predicted through a linear classification head:
p i = S o f t m a x ( W e z i + b e ) , p i ∈ ℝ C e
where z i denotes the representation of the i -th candidate span, C e is the number of entity types, and W e ∈ ℝ C e × d and b e ∈ ℝ C e are learnable parameters.
A learnable relation-type compatibility table T ∈ ℝ C r × C e × C e is then introduced to encode the prior compatibility between relation types and subject–object type combinations. For an arbitrary subject–object candidate pair, its type compatibility score under relation r is defined as
u r = ∑ t s = 1 C e ∑ t o = 1 C e p s ( t s ) p o ( t o ) T r , t s , t o
where p s ( t s ) and p o ( t o ) denote the probabilities that the subject and object belong to types t s and t o , respectively, and T r , t s , t o represents the compatibility between subject type t s and object type t o under relation r . This score represents the expected compatibility of relation r under the predicted type distributions of the subject and object.
The compatibility score is then incorporated as a gated bias term to refine the HH and TT relation scores:
s ^ ′ r H H i s , i o = s ^ r H H i s , i o + log σ λ t c ⋅ u r
s ^ ′ r T T j s , j o = s ^ r T T j s , j o + log σ λ t c ⋅ u r
where λ t c is the scaling coefficient of the type-constraint gate and σ ⋅ denotes the sigmoid function. Applying this correction to all valid position pairs yields the final type-refined HH and TT relation score matrices, denoted as S ^ ′ r H H and S ^ ′ r T T , respectively.

3.6. Decoding Module

During decoding, entity spans i , j with scores greater than 0 are selected from the subject and object entity score matrices to form the candidate subject set Ω s and candidate object set Ω o , respectively, where i and j denote the start and end positions of a span. For any candidate entity pair ω s , ω o ∈ Ω s × Ω o , the subject span is denoted as ω s = i s , j s , and the object span as ω o = i o , j o . The HH and TT relation score matrices are then jointly checked for boundary consistency. Specifically, for a relation type r , a candidate entity pair is predicted to hold the relation r only when both the head-boundary score and the tail-boundary score exceed the predefined relation threshold. In this way, relation prediction does not rely on a single boundary signal, which helps reduce false positives caused by incomplete boundary evidence. Finally, the corresponding relational triplet ω s , r , ω o is extracted.

3.7. Loss Function

Because positive entity and relation instances account for only a small fraction of all candidate position pairs, the dataset exhibits severe label sparsity and class imbalance. To improve training efficiency, we adopt the sparse multilabel cross-entropy loss used in GPLinker [32]. Instead of explicitly constructing a complete label matrix, this loss uses only the indices of positive samples, thereby reformulating multilabel classification as relative comparisons between target and non-target scores and reducing computational overhead. For the entity score matrix, the loss is defined as
L E = ∑ ε = 1 2 log 1 + ∑ ( i , j ) ∈ Ε ε e s ε ( i , j ) + log 1 − ∑ ( i , j ) ∈ Ρ ε e s ε ( i , j ) 1 + ∑ ( i , j ) ∈ Ε ε e s ε ( i , j )
where Ε ε denotes the set of all candidate spans for the entity role ε , Ρ ε denotes the set of positive spans for the entity role ε , and s ε i , j represents the predicted score of span i , j for the entity role ε , as defined in Equation (4).
Similarly, the loss functions for the head-relation score matrix S ^ ′ r H H i s , i o and the tail-relation score matrix S ^ ′ r T T j s , j o are defined as
L H H = ∑ r = 1 C r log 1 + ∑ ( i s , i o ) ∈ H r e s ^ ′ r H H ( i s , i o ) + log 1 − ∑ ( i s , i o ) ∈ Ρ r H H e s ^ ′ r H H ( i s , i o ) 1 + ∑ ( i s , i o ) ∈ H r e s ^ ′ r H H ( i s , i o )
L T T = ∑ r = 1 C r log 1 + ∑ ( j s , j o ) ∈ Τ r e s ^ ′ r T T ( j s , j o ) + log 1 − ∑ ( j s , j o ) ∈ Ρ r T T e s ^ ′ r T T ( j s , j o ) 1 + ∑ ( j s , j o ) ∈ Τ r e s ^ ′ r T T ( j s , j o )
where C r denotes the number of relation types; H r and Τ r denote the sets of all candidate position pairs in the head-relation and tail-relation score matrices for relation type r , respectively; Ρ r H H and Ρ r T T denote the corresponding sets of positive position pairs; and s ^ ′ r H H i s , i o and s ^ ′ r T T j s , j o represent the predicted scores of the relation type r on the HH and TT position pairs, respectively.
According to Equations (21)–(23), the final loss consists of the entity loss, the head-relation loss, and the tail-relation loss, and is defined as
L R S = L E + L H H + L T T 3

4. Experimental Results and Analysis

In this section, we conduct a series of experiments to examine the effectiveness of the proposed RSTGP model. We first describe the datasets, evaluation metrics, and parameter settings. We then compare RSTGP with several representative baseline methods on the medical entity-relation extraction task. To further analyze its performance in complex scenarios, we also report results under overlapping triplet settings and perform ablation studies to evaluate the contribution of each component.

4.1. Datasets and Metrics for Evaluation

4.1.1. Datasets

Experiments were conducted on CMeIE (https://tianchi.aliyun.com/dataset/145741, accessed on 10 March 2025) and DuIE2.0 (https://huggingface.co/datasets/hccngu/Viscacha-Chinese-IE/tree/main/DuIE2.0, accessed on 10 March 2025) datasets, and their statistics are summarized in Table 1.
Table 1. Statistical data of the CMeIE and DuIE2.0 dataset.
CMeIE is a Chinese medical entity-relation extraction dataset from the CBLUE benchmark [33]. Its annotated corpus is mainly derived from medical textbooks, such as Pediatrics, Clinical Pediatrics, and Clinical Practice, and covers a broad range of pediatric and general medical conditions. The dataset contains approximately 75,000 triplets, 28,000 instances, and 53 relation types.
DuIE2.0 is a large scale Chinese relation extraction dataset in the general domain. Its data are mainly collected from Baidu Baike and Baidu News. The dataset contains approximately 430,000 triplets, 210,000 sentences, 28 entity types, and 48 predefined relation types. Since the labels of the official test sets of CMeIE and DuIE2.0 are not publicly available, we follow prior work and conduct an evaluation on the validation sets for both datasets. To ensure fair comparison, all baseline results are reported under the same evaluation setting.

4.1.2. Evaluation Metrics

We evaluate entity-relation extraction performance on the CMeIE and DuIE2.0 datasets using three standard metrics: Precision ( P ), Recall ( R ), and F1 score ( F 1 ). Their definitions are given in Equations (25)–(27):
P r e c i s i o n = T P T P + F P
R e c a l l = T P T P + F N
F 1 = 2 × P r e c i s i o n × R e c a l l P r e c i s i o n + R e c a l l
where T P denotes the number of correctly predicted triplets, F P denotes the number of triplets predicted by the model but not present in the gold annotations, and F N denotes the number of gold triplets that are not identified by the model. P measures the proportion of correctly predicted triplets among all predicted triplets, R measures the proportion of correctly predicted triplets among all gold triplets, and F 1 is the harmonic mean of Precision and Recall.

4.2. Parameter Setting

We use the Chinese-RoBERTa-wwm-ext as the encoder, with a hidden size of 768 (https://huggingface.co/hfl/chinese-roberta-wwm-ext, accessed on 12 March 2025). The model is trained using Adam, with a learning rate of 2 × 10 − 5 , a weight decay of 0.01, a maximum input length of 512, and a dropout rate of 0.1. The batch size is set to 8. The model is trained for 80 epochs on CMeIE and 20 epochs on DuIE2.0. During decoding, the relation threshold is set to 0 for CMeIE and −0.6 for DuIE2.0. Early stopping is applied based on validation loss, and the final model is selected according to the best validation performance.
Hyperparameters are determined based on commonly used settings in prior work, combined with a limited grid search on the validation set. Once selected, the configuration is kept fixed across experiments. Except for the number of training epochs and the relation threshold, all other settings are shared across datasets and ablation studies. All experiments are conducted with a fixed random seed. The main hyperparameter settings are listed in Table 2.
Table 2. Hyperparameter settings.

4.3. Main Results

We compare our model with seven representative baseline methods:
(1) CasRel [21]: A cascaded binary tagging framework that decomposes triplet extraction into two stages, namely subject extraction and object extraction. It uses relation-specific taggers to identify all possible object entities for a given subject and is effective in handling overlapping triplets.
(2) OneRel [34]: A single-module and one-stage joint extraction method that formulates entity-relation extraction as a fine-grained triplet classification problem. It further employs a relation-specific corner tagging strategy for triplet decoding.
(3) GPLinker [35]: A joint extraction model based on position-pair modeling. It uses the global pointer mechanism to jointly model entity boundaries and relation links, and serves as the main baseline in this work.
(4) DREAM [36]: A deep purified feature mining model that improves subtask classification performance by combining shared representation learning with a task-aware information bottleneck mechanism to capture task-specific features.
(5) SpIB [37]: A span-aware pre-trained model based on information bottleneck theory. It enhances boundary modeling and alleviates interference from redundant information through span-level representation learning and a min–max information optimization strategy.
(6) SCEGP [38]: A joint extraction model for Chinese medical texts. It introduces a global semantic module for feature recalibration and further adopts a character-level spatial attention mechanism to enhance entity boundary modeling and relation representation.
(7) BAMRE [39]: A joint extraction model developed for the traditional Chinese medicine domain. It combines Biaffine transformation with a candidate-relation attention mechanism to reduce irrelevant relation predictions and improve the recognition of overlapping triplets.
Table 3 reports the main results on CMeIE and DuIE2.0, RSTGP achieves the best Precision and F1 scores on both datasets. On CMeIE, it consistently outperforms CasRel, OneRel, and DREAM across all evaluation metrics. Compared with GPLinker, RSTGP improves Precision by 1.53%, Recall by 2.61%, and F1 by 2.12%, indicating gains in both prediction accuracy and triplet coverage. RSTGP also achieves higher F1 scores than SpIB and SCEGP, and slightly surpasses BAMRE, showing competitive performance in the medical domain. On DuIE2.0, RSTGP achieves the highest F1 score of 76.79%, exceeding GPLinker by 2.42% and SCEGP by 1.29%. Although its Recall (78.89%) is slightly lower than that of SpIB, its Precision (74.80%) is substantially higher than SpIB’s 68.34%, resulting in a better overall F1 score. These results suggest that the proposed model achieves a more balanced trade-off between Precision and Recall while maintaining strong Recall performance.
Table 3. The main experimental results on the CMeIE dataset and the DuIE2.0 dataset (Best, Second Best).

4.4. Analysis of Overlapping Triplets

To further examine the behavior of RSTGP under different overlap patterns, we divide the CMeIE dataset into three subsets: normal, SEO (single-entity overlap), and EPO (entity-pair overlap). We then compare RSTGP with four representative baselines using F1 score as the evaluation metric. The results are reported in Table 4.
Table 4. F1 scores pertaining to various overlapping patterns (Best, Second Best).
Table 4 reports the F1 scores of different models under three overlap patterns on CMeIE. RSTGP achieves the best performance on the SEO subset, where its F1 score reaches 65.65%, surpassing CasRel by 6.42%, GPLinker by 2.26%, SpIB by 2.47%, and BAMRE by 1.05%. This suggests that the proposed model is particularly effective in handling shared-entity cases involving multiple relations. This is mainly because the span-graph module enables information sharing among spans associated with the same entity, facilitating the modeling of shared structural dependencies in overlapping triples. On the EPO subset, RSTGP performs slightly below GPLinker, but still maintains clear advantages over CasRel and SpIB, with gains of 19.11% and 9.70%, respectively, and also exceeds BAMRE by 1.61%. This result can be attributed to the inherent characteristics of EPO cases, where multiple relations are associated with the same entity pair, leading to increased ambiguity in relation classification. Although the span-graph module strengthens global structural modeling of entity spans, it may introduce interference during message propagation when multiple relation-specific signals coexist, thereby weakening relation separability in highly ambiguous scenarios. In contrast, GPLinker directly models token-level pairwise interactions without introducing explicit global structural propagation, which can be more effective in scenarios requiring fine-grained discrimination between competing relations. In addition, the relatively small proportion of EPO samples in the dataset limits the impact of structural modeling improvements, making performance gains less evident in this subset. On the normal subset, the differences among models are relatively small, and RSTGP remains competitive, outperforming CasRel, GPLinker, and SpIB, while trailing BAMRE by only a small margin. Overall, RSTGP shows strong robustness across different overlap patterns, especially in the more challenging SEO setting.
To further analyze model performance in sentences containing dense triplets, we divide the CMeIE dataset into five subsets according to the number of annotated triplets in each sentence, namely N = 1 , N = 2 , N = 3 , N = 4 and N ≥ 5 , where N denotes the number of gold triples in a sentence. As N increases, entity sharing and relation overlap become more frequent. This is especially evident in the N ≥ 5 subset, where sentences often contain both SEO and EPO patterns, making extraction more challenging.
The results in Table 5 show that the performance of all models generally increases as the number of triplets grows. This may be because sentences with more triplets often provide richer relational cues, which can facilitate relation identification. Among all compared methods, RSTGP achieves the best performance on every subset. In particular, on the most challenging subset ( N ≥ 5 ), its F1 score reaches 70.43%, which is 2.62% higher than that of SpIB, the second-best model. These results indicate that RSTGP remains effective in the presence of multiple entities, multiple relations, and overlapping structures, and demonstrates strong robustness in complex extraction scenarios.
Table 5. F1 of multiple triplets in a sample (Best, Second Best).

4.5. Ablation Study

To assess the contribution of each component, ablation experiments are performed on CMeIE and DuIE2.0 under the same hardware environment and hyperparameter settings. GPLinker is used as the baseline model. We first replace its original relation modeling stage with the proposed relation-aware joint modeling mechanism and denote the resulting model as RelAwareGP. On this basis, the Span-Graph Enhancement module and the Type-Constraint module are further introduced in sequence, denoted as SpanGraph and TC, respectively, to evaluate the contribution of each component to the overall model performance.
(1) As shown in Table 6, replacing the original relation modeling stage with the proposed relation-aware mechanism improves Precision on both CMeIE and DuIE2.0, with gains of 1.68% and 1.66%, respectively, while Recall decreases slightly. This pattern suggests that relation-aware modeling improves relation discrimination and leads to more precise predictions.
Table 6. Results of the ablation study on CMeIE and DuIE2.0 (Best, Second Best).
(2) After introducing the SpanGraph module, Recall increases by 1.60% on CMeIE and 2.10% on DuIE2.0, while the corresponding F1 scores rise from 61.28% to 61.89% and from 75.13% to 75.79%, respectively. This improvement indicates that span-graph enhancement can capture latent associations among high-confidence entity spans and provide additional structural information within a sentence, which is particularly helpful for reducing missed relation predictions in complex cases.
(3) When the TC module is further incorporated, the final RSTGP model achieves additional improvements, with F1 increasing from 61.89% to 62.75% on CMeIE and from 75.79% to 76.79% on DuIE2.0. Recall also reaches its highest value in both datasets. This result suggests that type-aware constraints further refine relation prediction and improve overall extraction performance.
The final results indicate that RelAwareGP mainly improves the discriminability of relation representations, SpanGraph strengthens structural modeling among entity spans, and TC further reduces invalid relation predictions through type-aware constraints. These three components complement each other and together lead to consistent performance gains on both datasets.

4.6. Efficiency Analysis

To evaluate the computational efficiency of the proposed method, we measure inference latency and model size on an NVIDIA RTX 4090 GPU. All models are tested under identical settings with batch size set to 1 and the inference time is averaged over multiple runs under the same trained model to ensure stability.
As shown in Table 7, RSTGP introduces only a marginal increase in model size (112.90 M vs. 113.11 M) and inference latency (5.96 ms vs. 8.88 ms per sample) compared with GPLinker, while maintaining comparable runtime efficiency.
Table 7. Comparison of model efficiency on the validation set.
This limited overhead is attributed to the design of the proposed components. The relation-aware scoring module introduces only lightweight relation-specific gating without altering decoding complexity. The span-level graph refinement is applied on a small set of high-confidence candidate spans (top-K mentions with a maximum of 16 nodes per instance), ensuring that graph construction remains bounded. The type-constraint mechanism operates on compact span-level representations and adds only matrix-level compatibility computation without additional sequence encoding.
Importantly, all enhancements are performed after candidate span selection, which prevents the model from introducing quadratic complexity with respect to sequence length. As a result, RSTGP maintains a throughput of 112.60 sentences per second on an RTX 4090, demonstrating that the model remains efficient for practical and near real-time extraction scenarios.
Overall, the results indicate that the proposed improvements introduce only minimal computational overhead while preserving the efficiency advantages of the GPLinker framework.

5. Conclusions

This study proposes RSTGP, a unified joint extraction model for medical entity-relation extraction. Built upon a position-pair modeling paradigm, the model integrates relation-aware modeling, span-graph enhancement, and type-constrained calibration to improve extraction performance in complex overlapping scenarios. By jointly modeling semantic interactions, structural dependencies among candidate spans, and type-level constraints, RSTGP effectively reduces noise from redundant entity pairs and enhances relation prediction consistency. Experimental results on CMeIE and DuIE2.0 demonstrate that RSTGP achieves strong overall performance and remains effective in complex triplet settings. In addition, the ablation study confirms that each component contributes positively to the final performance.
Despite these encouraging results, several directions remain for future work. First, the current framework is developed under a predefined relation schema, which may limit its adaptability to open-domain or evolving clinical scenarios. In real-world applications, new relation types or limited annotated data are often encountered. Extending the model to few-shot or low-resource settings is therefore an important direction for future work. This could be explored through techniques such as meta-learning, prompt-based tuning, or data augmentation. In addition, reducing the reliance on large-scale manual annotation, for example through weakly supervised or semi-supervised approaches, is also worth exploring. Second, the introduction of multiple enhancement modules increases the complexity of the framework. Exploring lighter architectures and parameter-efficient strategies may help improve computational efficiency without sacrificing extraction performance. Finally, evaluating the model on more multilingual and international biomedical datasets is also an important future direction to further validate cross-domain and cross-lingual generalization.

Author Contributions

Conceptualization, F.Z. and S.Y.; methodology, F.Z. and S.Y.; validation, S.Y., Y.W. and Z.Y.; formal analysis, J.Y. and Y.W.; investigation, S.Y. and Z.Y.; resources, Y.W.; data curation, S.Y. and Y.W.; writing—original draft preparation, S.Y.; writing—review and editing, K.L. and M.C.; visualization, S.Y. and K.L.; supervision, F.Z. and Z.Y.; project administration, S.Y. and J.Y.; funding acquisition, F.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This work was partially supported by the National Key Research and Development Program of China (No. 2024YFC3016800).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author. The data are not publicly available due to data privacy protection and restrictions on usage rights.

Acknowledgments

We would like to express our special gratitude to the teachers from China Uni-versity of Mining and Technology (Beijing), for making this study possible. During the preparation of this work, the authors used Kimi Chat (version K2.5, 2025) and DeepSeek-R1 (2025 release) to check the grammar and improve the language. After using these tool, the authors reviewed and edited the content as needed and take full responsibility for the final content of the article. All authors have read and agreed to the published version of the manuscript.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Hu, Y.; Chen, Y.; Huang, R.; Qin, Y.; Zheng, Q. A hierarchical convolutional model for biomedical relation extraction. Inf. Process. Manag. 2024, 61, 103560. [Google Scholar] [CrossRef] [Scilit]
  2. Murali, L.; Gopakumar, G.; Viswanathan, D.M.; Nedungadi, P. Towards electronic health record-based medical knowledge graph construction, completion, and applications: A literature study. J. Biomed. Inform. 2023, 143, 104403. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  3. Mo, D.; Liu, P. Construction of medical information knowledge graph question and answer system based on deep learning. In Proceedings of the Third International Conference on Biomedical and Intelligent Systems (IC-BIS 2024); SPIE: Bellingham, WA, USA, 2024; Volume 13208, pp. 350–359. [Google Scholar] [CrossRef] [Scilit]
  4. Berg, N.; Dalianis, H. Using BART to Automatically Generate Discharge Summaries from Swedish Clinical Text. In Proceedings of the First Workshop on Patient-Oriented Language Processing (CL4Health) @ LREC-COLING 2024; Demner-Fushman, D., Ananiadou, S., Thompson, P., Ondov, B., Eds.; ELRA and ICCL: Torino, Italy, 2024; pp. 246–252. Available online: https://aclanthology.org/2024.cl4health-1.30/ (accessed on 18 March 2026).
  5. Liao, J.; Wu, C.; Jiang, L.; Su, X.; Liang, W.; Li, L.H.; Castiglione, A.; Li, K. ARETO: A joint entity and relation extraction model for the triple overlapping problem. Knowl.-Based Syst. 2026, 335, 115178. [Google Scholar] [CrossRef] [Scilit]
  6. Lyu, S.; Chen, H. Relation classification with entity type restriction. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021; Association for Computational Linguistics: Stroudsburg, PA, USA, 2021; pp. 390–395. [Google Scholar] [CrossRef] [Scilit]
  7. Feng, J.; Zhang, T.; Hang, T. Survey of overlapping entities and relations extraction. Comput. Eng. Appl. 2022, 58, 1–11. [Google Scholar] [CrossRef]
  8. Zhong, Z.; Chen, D. A frustratingly easy approach for entity and relation extraction. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies; Toutanova, K., Rumshisky, A., Zettlemoyer, L., Hakkani-Tur, D., Beltagy, I., Bethard, S., Cotterell, R., Chakraborty, T., Zhou, Y., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2021; pp. 50–61. [Google Scholar] [CrossRef] [Scilit]
  9. Ye, D.; Lin, Y.; Li, P.; Sun, M. Packed levitated marker for entity and relation extraction. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers); Muresan, S., Nakov, P., Villavicencio, A., Eds.; Association for Computational Linguistics: Dublin, Ireland, 2022; pp. 4904–4917. [Google Scholar] [CrossRef] [Scilit]
  10. Zhao, Q.; Xu, D.; Li, J.; Zhao, L.; Rajput, F.A. Knowledge guided distance supervision for biomedical relation extraction in Chinese electronic medical records. Expert Syst. Appl. 2022, 204, 117606. [Google Scholar] [CrossRef] [Scilit]
  11. Liu, Z.; Li, H.; Wang, H.; Liao, Y.; Liu, X.; Wu, G. A novel pipelined end-to-end relation extraction framework with entity mentions and contextual semantic representation. Expert Syst. Appl. 2023, 228, 120435. [Google Scholar] [CrossRef] [Scilit]
  12. Cao, J.; van Veen, E.M.; Peek, N.; Renehan, A.G.; Ananiadou, S. A novel automated approach to mutation-cancer relation extraction by incorporating heterogeneous knowledge. IEEE J. Biomed. Health Inform. 2023, 27, 1096–1105. [Google Scholar] [CrossRef] [Scilit]
  13. Li, Q.; Yao, N.; Zhou, N.; Zhao, J.; Zhang, Y. A joint entity and relation extraction model based on efficient sampling and explicit interaction. ACM Trans. Intell. Syst. Technol. 2023, 14, 77. [Google Scholar] [CrossRef] [Scilit]
  14. Zhao, X.; Deng, Y.; Yang, M.; Wang, L.; Zhang, R.; Cheng, H.; Lam, W.; Shen, Y.; Xu, R. A comprehensive survey on relation extraction: Recent advances and new frontiers. ACM Comput. Surv. 2024, 56, 1–39. [Google Scholar] [CrossRef] [Scilit]
  15. Gao, C.; Zhang, X.; Liu, H.; Yun, W.; Jiang, J. A joint extraction model of entities and relations based on relation decomposition. Int. J. Mach. Learn. Cybern. 2022, 13, 1833–1845. [Google Scholar] [CrossRef] [Scilit]
  16. Zhang, M.; Wang, J.; Qu, J.; Li, Z.; Liu, A.; Zhao, L.; Chen, Z.; Zhou, X. A coarse-to-fine framework for entity-relation joint extraction. In Proceedings of the 2024 IEEE 40th International Conference on Data Engineering (ICDE); IEEE: Piscataway, NJ, USA, 2024; pp. 1009–1022. [Google Scholar] [CrossRef] [Scilit]
  17. Wang, Y.; Liu, X.; Kong, W.; Yu, H.T.; Racharak, T.; Kim, K.S.; Nguyen, L.M. A decoupling and aggregating framework for joint extraction of entities and relations. IEEE Access 2024, 12, 103313–103328. [Google Scholar] [CrossRef] [Scilit]
  18. Zeng, D.; Zhao, C.; Li, D.; Dai, J. BDCore: Bidirectional decoding with co-graph representation for joint entity and relation extraction. Knowl.-Based Syst. 2024, 294, 111781. [Google Scholar] [CrossRef] [Scilit]
  19. Zhang, Y.; Zhang, Y.; Wang, Z.; Peng, H.; Yang, Y.; Li, Y. Multi-information interaction graph neural network for joint entity and relation extraction. Expert Syst. Appl. 2024, 235, 121211. [Google Scholar] [CrossRef] [Scilit]
  20. Zhang, L.; Zheng, N. DIRel: Joint relational triple extraction through dual implicit relation. Neurocomputing 2025, 624, 129374. [Google Scholar] [CrossRef] [Scilit]
  21. Wei, Z.; Su, J.; Wang, Y.; Tian, Y.; Chang, Y. A novel cascade binary tagging framework for relational triple extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics; Association for Computational Linguistics: Online, 2020; pp. 1476–1488. [Google Scholar] [CrossRef] [Scilit]
  22. Cheng, J.; Zhang, T.; Zhang, S.; Ren, H.; Yu, G.; Zhang, X.; Gao, S.; Ma, L. A cascade dual-decoder model for joint entity and relation extraction. IEEE Trans. Emerg. Top. Comput. Intell. 2025, 9, 1130–1142. [Google Scholar] [CrossRef] [Scilit]
  23. Lu, Y.; Liu, Q.; Dai, D.; Xiao, X.; Lin, H.; Han, X.; Sun, L.; Wu, H. Unified structure generation for universal information extraction. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers); Muresan, S., Nakov, P., Villavicencio, A., Eds.; Association for Computational Linguistics: Dublin, Ireland, 2022; pp. 5755–5772. [Google Scholar] [CrossRef] [Scilit]
  24. Wang, X.; Zhou, W.; Zu, C.; Xia, H.; Chen, T.; Zhang, Y.; Zheng, R.; Ye, J.; Zhang, Q.; Gui, T.; et al. InstructUIE: Multi-task instruction tuning for unified information extraction. arXiv 2023, arXiv:2304.08085. [Google Scholar] [CrossRef] [Scilit]
  25. Wang, Y.; Yu, B.; Zhang, Y.; Liu, T.; Zhu, H.; Sun, L. TPLinker: Single-stage joint extraction of entities and relations through token pair linking. In Proceedings of the 28th International Conference on Computational Linguistics; Scott, D., Bel, N., Zong, C., Eds.; International Committee on Computational Linguistics: Barcelona, Spain, 2020; pp. 1572–1582. [Google Scholar] [CrossRef] [Scilit]
  26. Tang, W.; Xu, B.; Zhao, Y.; Mao, Z.; Liu, Y.; Liao, Y.; Xie, H. UniRel: Unified representation and interaction for joint relational triple extraction. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing; Goldberg, Y., Kozareva, Z., Zhang, Y., Eds.; Association for Computational Linguistics: Abu Dhabi, United Arab Emirates, 2022; pp. 7087–7099. [Google Scholar] [CrossRef] [Scilit]
  27. Wang, Z.; Nie, H.; Zheng, W.; Wang, Y.; Li, X. A novel tensor learning model for joint relational triplet extraction. IEEE Trans. Cybern. 2024, 54, 2483–2494. [Google Scholar] [CrossRef] [Scilit]
  28. Liu, W.; Wang, D.; Zhao, C.; Wang, N.; Zhang, X.; Su, P.; Song, S.; Zhang, N.; Chi, W. Causality extraction algorithm of medical text based on BERT and graph attention network. J. Shandong Univ. Health Sci. 2025, 63, 61–68. [Google Scholar] [CrossRef]
  29. Jiang, B.; Cao, J. Joint Extraction of Entities and Relations via Entity and Relation Heterogeneous Graph Attention Networks. Appl. Sci. 2023, 13, 842. [Google Scholar] [CrossRef] [Scilit]
  30. Yang, Y.; Zheng, Z.; Xu, Y.; Wei, H.; Yan, W. BioGSF: A graph-driven semantic feature integration framework for biomedical relation extraction. Brief. Bioinform. 2024, 26, bbaf025. [Google Scholar] [CrossRef] [Scilit]
  31. Su, J.; Ahmed, M.; Lu, Y.; Pan, S.; Bo, W.; Liu, Y. RoFormer: Enhanced transformer with rotary position embedding. Neurocomputing 2024, 568, 127063. [Google Scholar] [CrossRef] [Scilit]
  32. Su, J.; Zhu, M.; Murtadha, A.; Pan, S.; Wen, B.; Liu, Y. ZLPR: A novel loss for multi-label classification. arXiv 2022, arXiv:2208.02955. [Google Scholar] [CrossRef] [Scilit]
  33. Zhang, N.; Chen, M.; Bi, Z.; Liang, X.; Li, L.; Shang, X.; Yin, K.; Tan, C.; Xu, J.; Huang, F.; et al. CBLUE: A Chinese biomedical language understanding evaluation benchmark. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers); Muresan, S., Nakov, P., Vil-lavicencio, A., Eds.; Association for Computational Linguistics: Dublin, Ireland, 2022; pp. 7888–7915. [Google Scholar] [CrossRef] [Scilit]
  34. Shang, Y.-M.; Huang, H.; Mao, X. OneRel: Joint entity and relation extraction with one module in one step. arXiv 2022, arXiv:2203.05412. [Google Scholar] [CrossRef] [Scilit]
  35. Su, J. GPLinker: Joint Extraction of Entity Relations Based on Global Pointer. 2022. Available online: https://spaces.ac.cn/archives/8888 (accessed on 12 March 2025).
  36. Wang, Y.; Wang, Y.; Sun, Z.; Li, Y.; Hu, S.; Ye, Y. Deep purified feature mining model for joint named entity recognition and relation extraction. Inf. Process. Manag. 2023, 60, 103511. [Google Scholar] [CrossRef] [Scilit]
  37. Wang, Y.; Cao, P.; Fang, H.; Ye, Y. Span-aware pre-trained network with deep information bottleneck for scientific entity relation extraction. Neural Netw. 2025, 186, 107250. [Google Scholar] [CrossRef] [Scilit]
  38. Xu, S.; Lin, H.; Chen, X.; Liu, Y. Joint extraction of entity relationships for Chinese medical texts. In Proceedings of the 2025 21st International Conference on Natural Computation, Fuzzy Systems and Knowledge Discovery (ICNC-FSKD); IEEE: Hohhot, China, 2025; pp. 583–590. [Google Scholar]
  39. Sun, J.; Zhang, C.; Xing, L.; Zhang, L.; Cai, H.; Guo, M. BAMRE: Joint extraction model of Chinese medical entities and relations based on Biaffine transformation with relation attention. J. Biomed. Inform. 2024, 158, 104733. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.