A subscription to JoVE is required to view this content. Sign in or start your free trial.

Research Article

Constructing Legal Knowledge Graphs and Tracing Bias in Medical Artificial Intelligence Based on Graph Neural Networks

56 views

⸱

DOI:

10.3791/72648

⸱

September 15th, 2026

In This Article

Summary

Addressing legal text fragmentation and medical artificial intelligence (AI) bias-tracing issues, this study constructs a legal knowledge graph and employs relation-aware graph convolution for semantic alignment. It identifies biased sources via gradient-based backpropagation, with favorable experimental metrics to support a compliant medical AI application.

Abstract

In medical artificial intelligence (AI) legal compliance analysis, this paper addresses the ambiguity in liability determination caused by the semantic fragmentation of multi-source heterogeneous legal texts and difficulties in tracing algorithmic biases. It constructs a knowledge graph construction and bias propagation path detection method based on graph neural networks. Four types of heterogeneous nodes—legal clauses, medical behaviors, algorithm modules, and responsible parties—are structured and encoded, and a directed graph is constructed based on four types of legal semantic relationships: "violation", "basis", "trigger", and "attribution". Next, a relation-aware graph convolutional network, combined with edge-type-specific weights and an attention mechanism, is used to achieve multi-layer feature alignment for cross-modal legal semantics. Then, gradient-based backpropagation is used to identify edges that significantly contribute to bias, construct a bias-propagation subgraph, and use community discovery to locate root-node clusters. Finally, real-time decision flows are mapped to temporary nodes, compliance is verified by embedding similarity, and the dynamics of key edge weights are monitored to warn of systemic bias accumulation. Experiments show that, in terms of semantic alignment accuracy, the proposed method achieves an average entity alignment accuracy of at least 0.92 and an average relation preservation completeness of at least 0.88 across different knowledge graph density gradients. Regarding bias localization capability, the root node recall rate reaches 0.95±±0.02, and the propagation path precision reaches 0.93±±0.03. This research, to a certain extent, achieves a deep coupling between legal logic and algorithmic behavior, providing an explainable and verifiable compliance support system for the trustworthy deployment of medical AI.

Introduction

The profound involvement of medical AI in diagnosis and treatment support, resource allocation, and risk assessment has tied its decision-making to the assumption of legal responsibility1,2. The legal norms are highly structured but semantically distributed, and the behaviour of AI systems can be black-boxed, without a semantically alignable and traceable interface between the two3. In this context, developing a common representation framework that captures legal causal chains within algorithmic behavioral sequences has emerged as a necessary enabler to realize fine-grained attribution of responsibility and dynamic compliance4,5. This study is not only related to the legal testing of technology systems, but also involves the deep maintenance of medical fairness, algorithmic fairness, and institutional trust, and thus has great theoretical significance and practical urgency.

The fundamental issue in legal conformance analysis of medical AI today is the lack of a computable connective structure between legal semantics and algorithmic behavior6,7. Legal documents are available as plain text, and the relations between paragraphs are interwoven with dependencies, conflicts, and exceptions, causing problems when splitting them into logical units that can be interpreted by machines8,9. Although the AI system’s decision-making is encapsulated in a data-driven black box, and none of its output variations can be traced to specific breaches in legal duties or nodes for apportionment of liability10,11. Such disconnection (for example, training data bias, model design flaws, or the semantic interpretation of legal norms) cannot be experimentally isolated to identify the source of bias or to clarify legal duties for developers, deployers, or users12,13. Even more problematic, existing compliance procedures only check whether a final output meets a fixed specification, without considering the propagation path or amplification of bias in the "law-technology" network of interactions14,15. When medical AI is subject to multiple legal provisions simultaneously, and the system produces a chain of errors due to misinterpretation of one clause, conventional approaches cannot trace how the error diffuses through other related provisions and then reaches the liability16,17. In addition, there is a lack of a dynamic correlation mechanism between the real-time decision flow and the existing knowledge graph of law, resulting in delayed compliance evaluation during system operation, thus preventing a proactive monitoring of the trend of accumulation of bias18,19. These issues together lead to uncertainty in liability determination, fragile attribution, and delayed regulatory intervention, which significantly inhibit the trustworthy deployment of high-risk healthcare AI systems and the application of legal accountability.

Above all, traditional research studies legal texts in a structured form and builds knowledge bases of specific domains with ontologies or rules in order to support compliance questions and answers or risk notification20,21. Although these approaches can capture representations of some legal concepts, they tend to presuppose the law's internal logic as coherent and static, making it difficult to deal with inter-jurisdictional inconsistencies, exceptions, or vague formulations. Subsequent work introduced natural language processing technology, using pre-trained language models to extract legal entities and relationships, improving the breadth of knowledge extraction coverage22,23, but still remains at a shallow semantic level, failing to establish a mapping interface between legal and technical behaviors. In terms of algorithmic bias governance, research has mostly focused on the design of fairness constraints24,25, and its evaluation indicators are usually based on demographic variables, lacking alignment with legal attribution principles. Even some studies have attempted to encode legal rules as constraints and embed them into model training26,27, but due to the rigidity and coarse granularity of rule expression, they are difficult to adapt to complex clinical situations. In general, existing work treats legal compliance as an external verification task rather than an intrinsic computable attribute of the system architecture. This results in legal logic and algorithmic logic operating in parallel, failing to support joint reasoning and dynamic intervention on bias propagation paths.

In recent years, graph neural networks have been gradually introduced into the medical field due to their explicit modeling capabilities of relational structures28,29. Some studies utilize heterogeneous graphs to integrate case law, legal provisions, and party information, supporting case recommendations or sentencing predictions through node embeddings30,31, thereby verifying the effectiveness of graph structures in capturing legal connections. Other works abstract algorithmic components as graph nodes, using edges to represent data flows or call relationships for tracking error propagation32,33. These explorations demonstrate that graph structures can serve as a common carrier of legal and technological elements. However, existing graph models generally suffer from three limitations: first, they are limited to a single type of edge relationship, failing to distinguish between normative, causal, and attributional differences in legal semantics; second, the feature aggregation process ignores the semantic weights of edge types, leading to different legal logic paths being treated equally; and third, they lack a differentiable tracking mechanism for bias propagation, making it impossible to locate high-contribution edges and reconstruct responsibility paths. This paper constructs a relation-aware graph convolutional network that addresses the problem of semantic heterogeneity fusion by assigning a dedicated transformation matrix to each type of legal semantic edge and introducing an attention mechanism to dynamically adjust cross-type information flow. Furthermore, by combining gradient backpropagation and subgraph extraction, it enables an interpretable leap from macro-level compliance judgment to micro-level bias tracing, overcoming the bottleneck of traditional graph models that only support static reasoning.

Beyond the medical domain, recent advances in graph-based and evolutionary methods have demonstrated broad applicability to structured knowledge processing. For instance, Xue et al. proposed a multilayer hybrid genetic programming approach for adaptive similarity feature construction in ontology matching, achieving robust alignment across heterogeneous knowledge graphs34. Cheng et al. provided a comprehensive survey of graph convolutional network applications in image restoration, systematically categorizing methods for denoising, super-resolution, and deblurring35. Li et al. presented a thorough survey on evolutionary deep learning from the perspective of automated machine learning, covering principles, algorithms, applications, and open challenges36. Ma et al. developed a fuzzy neural architecture search framework for defect recognition under uncertainty, demonstrating the effectiveness of evolutionary search in handling ambiguous data37. These studies highlight the potential of integrating graph-structured representations and evolutionary optimization for complex decision-making tasks.

The core objective of this paper is to establish an end-to-end interpretable framework for legal compliance analysis of medical AI, with innovations at three levels. At the knowledge representation level, it is the first to model legal clauses, medical practices, algorithm modules, and responsible parties as four types of heterogeneous nodes. Based on legal practice, it extracts four types of directed relationships: "violation", "basis", "trigger", and "attribution", constructing a directed knowledge graph with legal causal logic, providing a structured semantic foundation for compliance analysis. At the source tracing of bias, it suggests a gradient-sensitivity-based edge contribution quantification method. By backpropagation, it finds the set of edges that maximizes the output bias, then applies a community discovery algorithm to cluster high-contribution nodes, turning "black-box bias" into "white-box responsibility clusters", which makes attribution based on an operable chain of evidence. At the level of real-time dynamic monitoring, it develops a temporary decision-node embedding mechanism that maps real-time AI outputs into the knowledge graph space. Based on the comparison of embedding proximity, it quantifies the degree of norm deviation and monitors the weight change of those essential legal-technical edges, so as to signal the accumulation of systemic bias. This paradigm addresses both semantic fragmentation and traceability conundrums and metamorphoses legal compliance from ex post verification into ex ante governance, offering a scalable technical avenue for the transparency of responsibility in high-risk AI systems.

Access restricted. Please log in or start a trial to view this content.

Protocol

Construction of graph neural network for medical AI legal knowledge graph

As shown in Figure 1, the proposed framework comprises three main modules. The input layer integrates multi‑source data into a heterogeneous graph via multimodal entity encoding and directed edge modeling. The relation‑aware GCN layer then performs cross‑modal semantic alignment through type‑specific weights and attention, producing unified node embeddings. Finally, these embeddings support bias tracing (via gradient backpropagation and community detection) and dynamic compliance monitoring (via real‑time node mapping and edge‑weight tracking), with the output delivering interpretable attribution evidence and risk alerts for regulators.

Knowledge graph construction with GNN model diagram; displays data flow from input to regulatory interface.
Figure 1: Legal knowledge graph and bias tracing architecture for medical AI. This diagram illustrates the overall workflow of the proposed framework. The input layer fuses multi‑source heterogeneous data (legal texts, clinical guidelines, algorithm audit reports), which are encoded into four entity types (legal clauses, medical behaviors, algorithm modules, responsible parties) and connected by four directed legal‑semantic relations (violation, basis, trigger, attribution). The relation‑aware GCN layer performs cross‑modal semantic alignment via type‑specific weights and attention. The bias tracing module uses gradient backpropagation to identify high‑contribution edges, then applies community detection to locate root‑node clusters. The dynamic compliance monitor maps real‑time decisions to temporary nodes, evaluates embedding similarity against legal clauses, and tracks edge weight evolution for early warning. Outputs include interpretable attribution evidence and risk alerts. Please click here to view a larger version of this figure.

Heterogeneous graph structured coding of legal entities and relationships

Four fundamental entities are consistently derived from medical AI regulatory laws, clinical practice guidelines, and algorithm audit reports: legal clauses, medical procedures, algorithm modules, and accountable entities. A separate feature representation learning model is proposed for each type of entity to be semantically distinguishable. The legal clause nodes are organized to contain the number of the legal clause, and this is used as a unique ID (identifier) for the legal clause. At the same time, a penalty severity quantification index is defined to indicate the level of legal responsibility associated with the clause, and consequently, a feature vector is established.

Neural network embedding equation; diagram; concise representation of vector operations. (1)

ci is the entry number, Emb(·) represents the low-dimensional embedding mapping, and [·;·] represents the vector concatenation operation. This representation preserves both the formal structure and the severity of punishment of the legal text, supporting cross-statement reasoning.

Medical behavior nodes are standardized and encoded based on a clinical operation classification system, extracting their risk level rj ∈ {1,2,3} and the set of applicable scenario labels sj ⊂ S, where S is the complete set of predefined scenario categories. Multi-hot encoding is used to process the label set, and it is concatenated with the risk level embedding to form an initial representation:

Graph neural network equation, node embedding, and multi-head attention formula. (2)

This strategy ensures that different types of medical behaviors have measurable distance relationships in the vector space, supporting cross-scenario comparisons. The text embedding function Emb(·) is implemented using the pre-trained Chinese legal language model Lawformer (pretrained on a large-scale Chinese legal corpus), with the output dimension fixed at 768.

Based on the logical dependencies and legal constraints between entities, four types of directed semantic relationships are established: "violation", "basis", "trigger", and "attribution", each corresponding to different legal causal patterns. Each edge eij ⊂ E is assigned a type of label tij ⊂ T = {violate, base, trigger, attribute} for subsequent message transmission for relationship awareness. Edge construction strictly follows the domain rule matching mechanism: when a medical behavior deviates from the normative requirements, a "violation" edge is established pointing from the behavior node to the relevant legal clause; when the legal clause serves as the technical compliance basis for an operation, a "basis" edge is established; if the output of the algorithm module directly triggers the execution of a specific medical behavior, a "trigger" edge is connected; the attribution of responsibility relationship is established based on the organization's responsibility documents and audit conclusions, establishing an "attribution" edge between the responsible party and the violation or algorithm defect.

After all nodes are initialized, a heterogeneous graph (V, E, H0) is formed, where V is the set of nodes, E is the set of directed edges with type labels, and H0 is the initial feature matrix. To enhance the semantic discriminative ability of the graph structure, the node features are normalized:

Equation for data normalization; formula: h̃ₖ⁽⁰⁾=hₖ⁽⁰⁾-μₖ/σₖ+ε, used in data preprocessing. (3)

μk and σk are the mean and standard deviation of the k-th node feature on the training set, respectively, and ∈ is a small constant to prevent division by zero. Normalization ensures that multi-source heterogeneous features participate in graph convolution operations on a uniform scale, preventing numerical dominance effects from interfering with semantic learning. The resulting structured graph model fully carries the relational topology of the four-dimensional elements of law, behavior, technology, and responsibility in the medical AI system, providing a computable graph basis for subsequent bias propagation analysis.

Graph convolution alignment enhancement for cross-modal legal semantics

A relation-aware graph convolutional network38,39, which extends the Relational Graph Convolutional Network (R-GCN) framework, is used to propagate features across multiple layers of the initial heterogeneous graph. While R-GCN introduces per-relation transformation matrices for general relational data, our approach further incorporates a learnable attention mechanism to dynamically weight neighbor contributions and defines four specific legal-semantic relation types (violation, basis, trigger, attribution) tailored to medical AI compliance analysis.. Each layer's operation independently parameterizes the transformation process based on the semantic type of the edges. For any target node, its neighborhood information is grouped and aggregated by the types of connecting edges. Each type of relation is equipped with a dedicated linear transformation matrix to differentiate the features transmitted along different legal semantic paths40,41. If the edge between the legal clause node and the medical behavior node is of "base" type, when the legal clause node receives a message from a medical behavior node, it applies the corresponding weight matrix to map the features of the neighbor spatially. In the same way, when a medical behavior node sends an output via the edge integration scheme module node "trigger" to an algorithm module, the parameter matrix triggered, associated with this relation, and performs feature transformation. This mimics the fluidity of different types of legal logic, realizing/informing different logic layers to maintain semantic independence during information flow without cross-modal noise. The aggregation is defined as follows:

Graph neural network equation; node embedding update; formula representation; mathematical symbols. (4)

mi(l) represents the comprehensive information collected by node i in layer l, Nil is its neighbor set under relation r, Wr is the linear transformation matrix, and hj(l−1) is the embedding representation of the neighbor node in the previous layer.

A learnable attention mechanism is introduced during message aggregation to dynamically adjust the influence intensity of different neighbor nodes on the target node representation update42,43. The attention coefficient is generated based on the dual factors of node attribute similarity and legal importance, without relying on fixed prior weights. For legal clause nodes, when receiving neighboring medical behavior features, the attention score is calculated based on the quantified value of the penalty intensity associated with the latter; when the algorithm module node fuses medical behavior information, it focuses on neighbors with higher operational risk levels. The attention weight is calculated in the following way:

Attention mechanism formula using Leaky ReLU; neural network equation illustrating computation. (5)

αij is the attention coefficient of node j to node i, and a is the learnable attention vector. This model allows for the automatic identification of high-risk or high-constraint connected paths during end-to-end training, assigning them higher attention. The final updated node embedding is determined by weighted messages and residual connections.

Graph neural network equation; symbol representation; σ function; adjacency weight; educational use. (6)

σ is the activation function, and residual design mitigates the gradient vanishing problem in deep propagation and guarantees stability in the presence of multiple semantic conflicts. Following L = 3 graph convolutional layers (each with a hidden dimension of 256 and ReLU activation), the embeddings of all nodes seamlessly incorporate cross-modal contextual information and become unified representations with legal semantic discrimination abilities.

Two alternative legal compliance analysis diagrams for the healthcare AI are depicted in Figure 2, with the objective of addressing the visualization of types of legal relationships and routes for bias propagation, indicating potential bias sources of this decision-making. Figure 2A displays the influence of various legal semantic relations, where four relation types are color-coded, and for each type the edges are distinguished by a different color. The thickness of the edge corresponds to the attention weight of that particular relation, i.e. how much this relation contributes to the AI decision. A thick edge indicates essentially a dominant legal relation in the decision and in this case it sufficiently motivated the outcome of the case. Node size is measured by its contribution to violations: larger nodes signify a stronger relationship between the conduct and specific legal clauses, and hence higher potential risk. The above visualization provides a crisp legal semantic layer, which enables us to identify the strongest and riskiest legal paths in AI decision-making. Figure 2B also indicates high-contribution paths (to bias propagation) with emphasis on edges with high contributions, which are bolded and accompanied by dashed lines (e.g. B1-B3) in the decision-making process. Doubling of the width of these edges represents their importance in disseminating systemic bias. Which combinations of legal rules and technical behaviors result in this amplification effect for bias is shown in Figure 2. This analysis not only discloses the path of bias propagation, but also facilitates identifying the origin of bias, based on which compliance auditing and responsibility of the AI tool can be established.

Edge relation types with attention and highlighted bias paths diagram; graph theory, network analysis.
Figure 2: Analysis of legal compliance and bias propagation in healthcare AI (Illustrative Example). (A) Color‑coded legal semantic relations: violation (red), basis (blue), trigger (green), attribution (orange). Edge thickness is proportional to attention weight, indicating the influence of each relation on the AI decision. Node size is proportional to its violation contribution, highlighting risky entities. (B) Bias propagation subgraph: high‑contribution edges are bolded and dashed (e.g., B1‑B3); double‑width edges indicate amplification of systemic bias. This visualization supports identification of dominant legal paths, bias origins, and compliance auditing. No measurement scales or error bars are applicable as this is a schematic illustration. Please click here to view a larger version of this figure.

Subgraph backtracking mechanism for bias propagation path

In this study, "bias" is defined as the systematic deviation of an AI system's output from the clinically and legally expected decision, measured by the discrepancy between the model's predicted risk score and the ground-truth compliance label. The bias signal is quantified as the cross-entropy loss between the algorithm's final output and a binary indicator of compliance (1 for compliant, 0 for non-compliant), aggregated over all decision instances in a batch.

After the graph neural network is trained, its differentiability is used to perform backpropagation analysis on the bias signal in the output layer. Starting from the algorithm decision node that detects anomalies, the gradient magnitude of the loss function with respect to each connecting edge is computed to quantify each edge's contribution to bias formation. This process is implemented through an automatic differentiation framework, backtracking layer by layer along the directed edges in the graph structure to obtain the influence strength of each edge parameter transformation on the final output change. The higher the absolute value of the gradient, the more dominant the legal-technical relationship carried by that edge is in the bias propagation. The contribution of an edge is defined as:

Mathematical gradient equation, gij=∂Lbias/∂wi, relevant in optimization analysis. (7)

Lbias is the differentiable loss defined for biased behavior, and wi is the entry weight vector corresponding to the edge type. This gradient value reflects the degree of participation of a specific semantic relationship in the current association bias. After all edges are scored in this way, a dynamic threshold τ is set to filter out the set of high-contribution edges Ehigh whose contribution exceeds gij > τ, forming the initial bias propagation subgraph Gbias = (Vbias, Ehigh). Specifically, τ is determined as the 85th percentile of the absolute gradient values across all edges in each training epoch, ensuring that only the top 15% most influential edges are retained for subgraph construction. This subgraph focuses on the key connection paths most likely to drive systematic bias, compressing the search space and improving the efficiency of source tracing.

Within the constructed bias-propagation subgraph, a spectral clustering-guided community detection algorithm is executed to identify highly in-line node cluster structures. This process is based on the normalized Laplace matrix factorization of the subgraph, mapping node embeddings to a low-dimensional spectral space and applying a density-aware clustering strategy in this space to ensure that cross-type nodes (such as legal clauses and algorithm modules) are grouped into the same cluster when functionally closely related. Each identified community represents a potential functional loop or responsibility aggregation unit. The community partitioning results are driven by the following optimization objectives:

Optimization equation ΣckLck/ckDck, mathematical formula analysis. (8)

L=D−A is the Laplacian matrix of the subgraph, A is the adjacency matrix, D is the degree matrix, ck is the indicator vector of the k-th community, and K is the preset number of communities. This criterion maximizes the minimum cut difference between communities, ensuring tight internal connections.

Now, cross-layer composite-based analysis is carried out on each community. If a community has legal clause nodes and algorithm module nodes, it is tagged as a potential source of bias. To test its causality, an intervening test is conducted: all edges in this region are removed temporarily from the graph, the same decision-making process is executed again, and differences in bias measurements are noticed. The causal validity measure is defined as:

Δ calculation formula, Δ=(B_orig-B_mask)/B_orig, equation for analysis in statistical method. (9)

Borig and Bmask represent the bias strength of the original model and the bias after masking, respectively. If the causal validity measure is substantially above the predetermined threshold, it implies that the node cluster has been identified as an explainable source of bias, which will guide later compliance correction and fault assignment.

Dynamic compliance verification of legal constraints

Real-time decision instances appearing during the operation of a medical AI system are introduced as transient nodes and embedded in a learned knowledge graph space. An initial feature vector is produced by each node by reading its input context, output behavior, and the algorithm's state. Then, this vector is fed into a graph neural network with frozen parameters to perform one-layer forward propagation, yielding an embedding aligned with the knowledge graph without altering the original graph structure. As such, it allows transient nodes and legal clause nodes to be compared in a common semantic space.

Then compute the cosine similarity between the transient node and each of the legal clause nodes:

Static equilibrium equation Sij=hTemp^T hjlow/||hTemp||*||hjlow|| formula for scientific analysis. (10)

htemp is the embedding of the temporary node, and hjlaw is the embedding of the j-th legal clause node. The similarity value virtually reflects the semantic matching degree between the current decision and each legal constraint. A dynamic compliance threshold θ is set based on the similarity distribution of historical compliance samples to adapt the judgment boundary under different application scenarios. Specifically, θ = µ - 2σ, where µ and σ are the mean and standard deviation of the cosine similarity distribution computed from a validation set of 500 known compliant decision instances.

If a cosine similarity score falls below the dynamic compliance threshold, the corresponding rule of law is considered violated, triggering the compliance alerting mechanism. The notification also includes the minimal matching legal clause number, the similarity value, and the direction of the divergence analysis, which should be sufficient for the regulators to act promptly. This approach provides an interpretable mapping from opaque decision-making to the space of legal semantics and facilitates on-the-fly compliance checking.

During continuous operation, the weight-change trend of key legal-technology connection edges in the bias propagation subgraph is tracked. Emphasis is placed on the edges connecting algorithm module nodes and legal clause nodes, as they directly represent the response strength of technical behavior to specific regulations. The transformation matrix parameters for each target edge are recorded during the inference, and their norm is extracted as a dynamic indicator of the evolution of the correlation strength between the two. Defining the edge strength sequence as:

Matrix norm equation diagram for static equilibrium analysis; linear algebra method in engineering. (11)

wt represents the Frobenius norm of the weight matrix corresponding to the relationship between edge eij at time stamp t, and Wkl(t) is the parameter matrix actually used in the model at that time. This indicator reflects the model's learning depth or dependence on the legal constraint.

A sliding-window monotonicity test is performed on the sequence, and an improved sign test is used to determine whether a significant upward trend is observed. If the increments over N consecutive time steps satisfy the positive dominance condition, then the edge is considered to exhibit an abnormal reinforcement phenomenon. Further combining historical gradient contribution data, if the edge has been identified as a high-impact path in the previous round of source tracing analysis, a systemic bias accumulation early-warning process is initiated.

Finally, a source-tracing report is generated, including information on the nodes at both ends of the target edge, weight change curves, statistics on the frequency of related decisions, and potential attribution recommendations. This mechanism realizes a leap from static compliance judgment to dynamic risk prediction, supporting proactive intervention in potential institutional deviations.

Experimental data and design

To verify the effectiveness of the proposed framework, this paper constructs a multi-source heterogeneous dataset that integrates real regulations and simulation data and designs rigorous control experiments. Data sources include national medical AI regulatory regulations, clinical treatment guidelines, open-source algorithm audit reports, and simulation decision logs. After preprocessing, a benchmark heterogeneous knowledge graph containing 285 nodes (85 legal clauses, 120 medical behaviors, 42 algorithm modules, and 38 responsible entities) and 1247 directed edges is constructed, as shown in Figure 3.

Node count by entity type, penalty intensity histogram, risk level pie chart analysis.
Figure 3: Distribution and characteristics of heterogeneous entity types. (A) Bar chart showing the number of nodes for each entity type: legal clauses (85), medical behaviors (120), algorithm modules (42), responsible parties (38). (B) Histogram of penalty intensity for legal clause nodes, binned into low (0‑0.33), medium (0.34‑0.66), and high (0.67‑1.0) categories; the vertical axis represents count. (C) Pie chart of risk level distribution among medical behavior nodes: low (19%), medium (43%), high (38%). All values are absolute counts or percentages; no error bars are presented because these are descriptive statistics of the dataset. Please click here to view a larger version of this figure.

Figure 3 illustrates the distribution and characteristics of entity nodes in the heterogeneous knowledge graph. Figure 3A shows the distribution of the number of four types of entity nodes, with "medical behavior" nodes being the most numerous (120), followed by "legal clauses" (85), while "algorithm modules" (42) and "responsible entities" (38) are relatively fewer. This is because the graph is structurally designed based on behavior and rules. Figure 3B presents the distribution of penalty intensities for nodes representing a unique legal clause, where intensity measures the severity of the legal liability. The data indicates that there are relatively few provisions with high penalty intensity, and most are in a medium-to-low intensity bracket, which is consistent with the reality that there are only a few severe violation clauses in real-world legal systems. Figure 3C illustrates the distribution of risk level in medical behavior nodes, where medium risk behaviors have the largest proportion 43% while low risk behaviors have the lowest proportion 19%, which reveals that medical scenarios are normally operated, and high-risk operations are subjected to more rigorous association constraints in the graph. These statistics collectively justify the entity disambiguation encoding scheme adopted in knowledge graph construction to provide feature support for subsequent graph convolutional alignment.

The entire dataset was randomly partitioned into training (70%), validation (10%), and test (20%) sets, stratified by node type and relation distribution to preserve the overall graph structure in each split. The same partition was used consistently for all baseline methods to ensure a fair comparison. In addition to this base partition, the three knowledge graph density gradients (sparse, medium, dense) and the three cross-jurisdictional complexity settings (single, bilateral, multilateral) described above serve as independent practical testbeds, that collectively evaluate the method's robustness under varying data completeness and regulatory overlap conditions. To construct ground-truth labels for bias localization evaluation, we adopted a two-step strategy: (1) Expert annotation—three legal and medical experts independently reviewed the decision logs and identified the root cause nodes and propagation paths for each recorded compliance violation, with discrepancies resolved by majority vote; (2) Simulated injection—for controlled testing, we artificially injected bias signals into 20 randomly selected decision paths by perturbing the edge weights in the knowledge graph, ensuring that the true source nodes and affected edges were known a priori.

For all baseline methods (TransE, ComplEx, Graph Neural Networks (GNN) Explainer, KG-BERT, and Node2Vec), we used the same training configuration (Adam optimizer, learning rate 1 × 10−3, batch size 64, 100 epochs) and the same data partitions as our method to ensure a fair comparison. For TransE and ComplEx, the embedding dimension was set to 256 with a margin of 1.0; for KG-BERT, we used the pre-trained BERT-base model with a batch size of 16 and a maximum sequence length of 128; for GNNExplainer, we used a 3-layer GCN with the same hidden dimension of 256; and for Node2Vec, we set the walk length to 80, the number of walks per node to 10, and the embedding dimension to 256.

To ensure a fair comparison, we adapted all baseline methods to the same bias localization tasks, namely root‑node identification and propagation‑path reconstruction. For TransE, ComplEx, and Node2Vec, which are not inherently explainable, we computed the gradient of the bias loss with respect to each node’s embedding and used the gradient magnitude as the node importance score; root nodes were selected by thresholding these scores, and propagation paths were reconstructed by retaining edges with the highest gradient contributions. For GNNExplainer, we directly used its built‑in edge‑importance and node‑mask mechanisms to obtain both root nodes and subgraphs. For KG‑BERT, which operates on triplets, we converted each graph edge into a textual triplet and used the model’s attention weights over entities to derive node importance, followed by the same thresholding strategy for path reconstruction. Through these adaptations, every baseline method produces both root‑node predictions and propagation‑path predictions, enabling a uniform evaluation across all methods.

The evaluation is centered around four fundamental capabilities: accuracy of semantic alignment, ability to localize bias, efficiency of accountability, and generalization across domains. It also presents three important control variables, mimicking real-world complexity.

1) Knowledge graph density gradient: To assess how the method performs at varying completeness levels of information, two subsets from the baseline full graph (density D = 1.0) are created based on a random edge discarding strategy as follows:

Sparse graph (D ~ 0.3): 30% of edges are retained randomly, simulating the stage of early knowledge construction with much information missing.

Medium-density graph (D ~ 0.6): 60% of edges are retained randomly, simulating a typical scenario of partially known knowledge structure.

Dense graph (D = 1.0): Using all 1247 edges, corresponding to a best-case scenario of relatively complete knowledge.

2) Medical AI decision frequency situation: Three artificial decision flow loads are set to test the real-time performance of dynamically compliance monitoring:

Low frequency 10 Hz: On average, 10 decision events are generated per second, simulating monitoring of small-scale or single-site systems.

Medium frequency 50 Hz: 50 decision events per second simulating the AI system load of regional or medium-scale medical institutions.

High frequency 100 Hz: 100 decision events per second simulate the high concurrency pressure scenarios for the AI services being deployed in a large hospital or cloud platform.

3) Cross-juridictional complexity gradient: To test the transferability of legal constraint modelling, three complexity-based test sets were constructed:

Single jurisdiction: Consists solely of current Chinese laws and regulations governing medical AI.

Bilateral jurisdiction: Incorporates the regulatory regimes of China and the European Union, with around 15% of the rules being conflicting and overlapping.

Multilateral jurisdiction: Building upon the first two, it further integrates privacy and security rules from the US HIPAA (Health Insurance Portability and Accountability Act), creating a test environment in which the legal systems of the three legal regimes intertwine, increasing the rule conflict rate to approximately 25%.

The following key indicators were used for quantitative evaluation:

1) Semantic alignment accuracy: Measures the graph's ability to model the relationships between legal and technical entities.

Entity alignment accuracy:

Accuracy equation Acceq=|Ppred∩Pgold|/|Pgold| formula, statistical measurement method. (12)

Ppred is the set of aligned entity pairs predicted by the model, and Pgold is the set of golden alignments annotated by experts.

Relation preservation integrity:

CompRel equation diagram showing comparison of R values in graph and text analysis. (13)

Rgraph is the reconstructed set of relations in the graph, and Rtext is the set of explicit relations extracted from the original legal text.

2) Bias Localization Ability: Evaluating the effectiveness of tracing the root causes and propagation paths of bias.

Root Node Recall Rate:

Recall calculation formula: Recall_root = |N_pred ∩ N_true|/|N_true|, mathematical equation. (14)

Npred is the set of bias source nodes identified by the model, and Ntrue is the set of true source nodes labeled by experts.

Propagation path accuracy:

Path precision formula, \( \text{Precision}_{\text{Path}} = \frac{|E_{\text{pred} \cap E_{\text{true}}}|}{|E_{\text{pred}}|} \). (15)

Epred is the edge set in the bias propagation subgraph inferred by the model, and Etrue is the true bias propagation edge set.

3) Accountability Tracing Efficiency: Test the system's performance in real-time monitoring scenarios.

Average Tracing Latency:

Latency average formula, Σ equation for performance analysis, educational research, math symbol (16)

M represents the total number of requests, and titrigger and tireport are the timestamps of the i-th bias trigger and the generation of the source report, respectively.

System throughput:

Throughput equation, N_processed/ΔT, formula for processing efficiency in systems analysis. (17)

Nprocessed represents the number of concurrent tracing requests successfully processed within the time window ΔT.

4) Cross-domain generalization ability: Verifying the adaptability of the method to different legal systems.

Jurisdictional coverage:

Coverage calculation formula; coverage_jur=|C_encoded|/|C_input|; equation for data analysis. (18)

Cencoded represents the number of different jurisdictional clauses successfully encoded into the graph, and Cinput represents the total number of input clauses.

Constraint conflict detection rate:

Static equilibrium: Detection_Conflict = |D_pred−D_gold|/|D_gold|; equation for prediction analysis. (19)

Dpred is the set of legal logic contradictions detected by the model, and Dgold is the set of all contradiction pairs annotated by experts.

All experiments were conducted using a workstation equipped with a multicore processor and a graphics processing unit; complete hardware specifications are provided in the Table of Materials.

The main hyperparameters of this approach and their values are listed in Table 1, encompassing model structure and training configuration as well as crucial thresholds, such as embedding dimension, number of convolutional layers, learning rate, and batch size. All the parameters were tuned with respect to the validation set through grid search, the trained model has stably converged, and the performance is best. Some thresholds are established together with domain criterion to fulfill the requirements of high reliability of medical AI compliance checking.

ParameterValueDescription
Embedding Dimension128Feature dimension size for node embeddings
Number of Convolution Layers3Depth of the relation-aware graph convolution network
Learning Rate0.001Initial learning rate for Adam optimizer
Batch Size32Number of subgraphs processed per batch
Dropout Rate0.1Dropout probability applied to node features during training
Number of Attention Heads8Number of heads in multi-head attention mechanism
L2 Regularization Coefficient5 × 10⁻⁴Weight decay coefficient for parameter regularization
Similarity Threshold0.75Minimum embedding similarity for compliance validation
Gradient Contribution Threshold0.01Threshold for selecting high-impact edges in bias subgraph construction
Monitoring Window Size10Time steps used for tracking edge weight dynamics

Table 1: Main parameter settings. List of key hyperparameters used in the experiments: embedding dimension (256), number of GCN layers (3), hidden dimension (256), learning rate (1 × 10−3), batch size (64), attention vector dimension, edge contribution threshold (85th percentile of gradient magnitudes), dynamic compliance threshold (µ‑2σ, where µ and σ are from the validation set of 500 compliant instances), number of communities K (determined by spectral clustering), and optimizer (Adam). These values were selected via grid search on the validation set.

Access restricted. Please log in or start a trial to view this content.

Results

Performance verification of bias origin tracing in medical AI legal knowledge graph

Performance of relationship-aware graph convolution

By training a relation-aware graph convolutional network, embedding similarities between legal clauses and medical behavior nodes across different convolutional layers were calculated, and the alignment effect of each layer was recorded. Secondly, the attention weights assigned to the four legal sem...

Access restricted. Please log in or start a trial to view this content.

Discussion

The integration of medical AI into clinical decisions raises legal challenges in responsibility attribution, hampered by the semantic gap between unstructured legal texts and black‑box algorithms. To bridge this, we proposed a GNN‑based knowledge graph that models legal clauses, medical behaviors, algorithm modules, and responsible parties as heterogeneous nodes, connected via four directed legal‑semantic relations (violation, basis, trigger, attribution). This structure provides a computable interface ...

Access restricted. Please log in or start a trial to view this content.

Disclosures

The manuscript has neither been previously published nor is under consideration by any other journal. The authors have all approved the content of the paper. The authors declare that they have no financial conflicts of interest.

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
ComplExOpen-source implementation (e.g., OpenKE)Version 1.0Complex embedding baseline for knowledge graph comparison
GNNExplainerOpen-source implementation (https://github.com/RexYing/gnn-explainer)Commit 7a3b6a2 (2021)GNN interpretability baseline for bias tracing
Intel Xeon Gold 6248 (CPU)Intel CorporationSRF7FCentral processor for model training and data preprocessing
KG-BERTHuggingFace Transformers + BERT-baseBERT-base-uncased (HuggingFace)Transformer-based KG embedding baseline for semantic alignment
Node2VecOpen-source implementation (https://github.com/aditya-grover/node2vec)Version 1.0Random-walk based node embedding baseline
NVIDIA Tesla V100 (GPU)NVIDIA Corporation900-2G500-0010-000High-performance GPU accelerating graph neural network training
Ours (Relation-aware GCN)Custom implementation in PyTorchPyTorch 1.12.0Proposed framework with per-relation transformations, attention, and gradient backtracking
TransEOpen-source implementation (e.g., OpenKE)Version 1.0Translational embedding baseline for knowledge graph comparison

References

  1. Wang Y, Ma Z. Ethical and legal challenges of medical AI on informed consent: China as an example. Dev World Bioeth. 2025;25(1):46-54.
  2. Sand M, Durán JM, Jongsma KR. Responsibility beyond design: Physicians' requirements for ethical medical AI. Bioethics. 2022;36(2):162-169.
  3. Schultz MD, Seele P. Towards AI ethics' institutionalization: knowledge bridges from business ethics to advance organizational AI ethics. AI Ethics. 2023;3(1):99-111.
  4. Magesh V, et al. Hallucination-Free? Assessing the reliability of leading AI legal research tools. J Empir Leg Stud. 2025;22(2):216-242.
  5. Patil S, Shankar H. Transforming healthcare: harnessing the power of AI in the modern era. Int J Multidiscip Sci Arts. 2023;2(2):60-70.
  6. Birkstedt T, Minkkinen M, Tandon A, Mäntymäki M. AI governance: themes, knowledge gaps and future agendas. Internet Res. 2023;33(7):133-167.
  7. Mohammad Amini M, et al. Artificial intelligence ethics and challenges in healthcare applications: a comprehensive review in the context of the European GDPR mandate. Mach Learn Knowl Extr. 2023;5(3):1023-1035.
  8. Pasham SD. Opportunities and difficulties of artificial intelligence in medicine existing applications, emerging issues, and solutions. The Metascience. 2023;1(1):67-80.
  9. Vearrier L, et al. Artificial intelligence in emergency medicine: benefits, risks, and recommendations. J Emerg Med. 2022;62(4):492-499.
  10. Peng Y, Rousseau JF, Shortliffe EH, Weng C. AI-generated text may have a role in evidence-based medicine. Nat Med. 2023;29(7):1593-1594.
  11. Alam MN, Kaur M, Kabir MS. Explainable AI in healthcare: enhancing transparency and trust upon legal and ethical consideration. Int Res J Eng Technol. 2023;10(6):1-9.
  12. Sorantin E, et al. The augmented radiologist: artificial intelligence in the practice of radiology. Pediatr Radiol. 2022;52(11):2074-2086.
  13. Borger JG, et al. Artificial intelligence takes center stage: exploring the capabilities and implications of ChatGPT and other AI-assisted technologies in scientific research and education. Immunol Cell Biol. 2023;101(10):923-935.
  14. Chikhaoui E, Alajmi A, Larabi-Marie-Sainte S. Artificial intelligence applications in healthcare sector: ethical and legal challenges. Emerg Sci J. 2022;6(4):717-738.
  15. Kerasidou CX, Kerasidou A, Buscher M, Wilkinson S. Before and beyond trust: reliance in medical AI. J Med Ethics. 2022;48(11):852-856.
  16. Polineni TNS, Maguluri KK, Yasmeen Z, Edward A. AI-driven insights into end-of-life decision-making: ethical, legal, and clinical perspectives on leveraging machine learning to improve patient autonomy and palliative care outcomes. Migr Lett. 2022;19(6):1159-1172.
  17. Galiana LI, Gudino LC, González PM. Ethics and artificial intelligence. Rev Clin Esp (Engl Ed). 2024;224(3):178-186.
  18. Paladugu PS, et al. Generative adversarial networks in medicine: important considerations for this emerging innovation in artificial intelligence. Ann Biomed Eng. 2023;51(10):2130-2142.
  19. Harris E. Large language models answer medical questions accurately, but can't match clinicians' knowledge. JAMA. 2023;330(9):792-794.
  20. İpek ZH, Gözüm AIC, Papadakis S, Kallogiannakis M. Educational applications of the ChatGPT AI system: a systematic review research. Educ Process Int J. 2023;12(3):26-55.
  21. Kim C, et al. Transparent medical image AI via an image-text foundation model grounded in medical literature. Nat Med. 2024;30(4):1154-1165.
  22. Wang YH, Lin GY. Exploring AI-healthcare innovation: natural language processing-based patents analysis for technology-driven road mapping. Kybernetes. 2023;52(4):1173-1189.
  23. Pruneski JA, et al. Natural language processing: using artificial intelligence to understand human language in orthopedics. Knee Surg Sports Traumatol Arthrosc. 2023;31(4):1203-1211.
  24. Chen RJ, et al. Algorithmic fairness in artificial intelligence for medicine and healthcare. Nat Biomed Eng. 2023;7(6):719-742.
  25. Yang Y, et al. The limits of fair medical imaging AI in real-world generalization. Nat Med. 2024;30(10):2838-2848.
  26. Almarshadi NF, et al. Clinical and medical coding: a new pathway for automation—an updated review. J Med Life Sci. 2024;6(4):633-651.
  27. Osifowokan AS, Agbadamasi TO, Adukpo TK, Mensah N. Regulatory and legal challenges of artificial intelligence in the US healthcare system: liability, compliance, and patient safety. World J Adv Res Rev. 2025;25(3):949-955.
  28. Hasan MT. Graph neural network models for detecting fraudulent insurance claims in healthcare systems. Am J Adv Technol Eng Solut. 2022;2(01):88-109.
  29. Johnson R, Li MM, Noori A, Zitnik M. Graph artificial intelligence in medicine. Annu Rev Biomed Data Sci. 2024;7:345-368.
  30. Lettieri N, Guarino A, Malandrino D, Zaccagnino R. Knowledge mining and social dangerousness assessment in criminal justice: metaheuristic integration of machine learning and graph-based inference. Artif Intell Law. 2023;31(4):653-702.
  31. Ma Y, et al. Incorporating structural information into legal case retrieval. ACM Trans Inf Syst. 2023;42(2):1-28.
  32. Jin Z, et al. GNNLens: a visual analytics approach for prediction error diagnosis of graph neural networks. IEEE Trans Vis Comput Graph. 2022;29(6):3024-3038.
  33. Shen Y, Zhang J, Song SH, Letaief KB. Graph neural networks for wireless communications: from theory to practice. IEEE Trans Wirel Commun. 2022;22(5):3554-3569.
  34. Xue X, et al. Adaptive similarity feature construction for ontology matching via multi-layer hybrid genetic programming. IEEE Transactions on Evolutionary Computation, 2025;30(2):519-533.
  35. Cheng T, et al. Graph convolutional network for image restoration: A survey. Mathematics, 2024;12(13): 2020.
  36. Li N, et al. Survey on evolutionary deep learning: Principles, algorithms, applications, and open issues. ACM Computing Surveys, 2023; 56(2): 1-34.
  37. Ma L, et al. A novel fuzzy neural network architecture search framework for defect recognition with uncertainties. IEEE Transactions on Fuzzy Systems, 2024; 32(5): 3274-3285.
  38. Fang Y, et al. Relation-aware graph convolutional networks for multi-relational network alignment. ACM Trans Intell Syst Technol. 2023;14(2):1-23.
  39. Schlichtkrull M, et al. Modeling relational data with graph convolutional networks//European semantic web conference. Cham: Springer International Publishing, 2018; 593-607.
  40. Ariai F, Mackenzie J, Demartini G. Natural language processing for the legal domain: a survey of tasks, datasets, models, and challenges. ACM Comput Surv. 2025;58(6):1-37.
  41. Xu Y, et al. BNet: batch normalization with enhanced linear transformation. IEEE Trans Pattern Anal Mach Intell. 2023;45(7):9225-9232.
  42. Guo MH, et al. Attention mechanisms in computer vision: a survey. Comput Vis Media. 2022;8(3):331-368.
  43. Guo MH, et al. Visual attention network. Comput Vis Media. 2023;9(4):733-752.

Access restricted. Please log in or start a trial to view this content.

Reprints and Permissions

Explore More Articles

Bias PropagationLegal Compliance AnalysisSemantic AlignmentAlgorithmic BiasEntity AlignmentCommunity DiscoveryCompliance Verification