Financial risk prediction method, device, equipment, storage medium and program product
By performing multi-scale time feature analysis and dynamic node selection on the time-series heterogeneous graph of financial transaction data, the problem of insufficient adaptability of graph structure is solved, and the real-time accuracy and adaptability of financial risk prediction are improved.
Patent Information
- Application Number
- CN202611378860.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-04
- Publication Date
- 2026-11-24
AI Technical Summary
In financial risk control tasks, existing technologies lack the ability to adaptively adjust to changes in data distribution in graph structures. This can lead to the introduction of redundant historical information or omission of key temporal relationships in scenarios such as concept drift or sudden attacks, affecting the timeliness and accuracy of risk prediction.
By acquiring the time-series heterogeneous graph of the financial transaction relationship database, and combining multi-scale time features and gating prediction networks, the feature vectors and association ranges of nodes related to the current risk are dynamically filtered. Graph neural networks are used for adaptive modeling to remove redundant historical information and retain key time-series associations.
It improves the real-time performance and accuracy of financial risk prediction, adapts to the temporal evolution and sudden changes in financial transaction data, reduces historical noise interference, and enhances the adaptability and accuracy of risk prediction.
Smart Images

Figure CN123160264A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence and graph data processing technology, and in particular to a financial risk prediction method, apparatus, device, storage medium and program product. Background Technology
[0002] In financial risk control tasks, to fully explore the relationships between trading entities, multi-table transaction data in relational databases is typically converted into a graph structure and combined with time-series models or graph neural networks for real-time risk identification. Financial transaction data itself possesses significant dynamic characteristics. On the one hand, fraud patterns, user spending habits, and risk preferences evolve rapidly over time, resulting in concept drift. On the other hand, cybercrime attacks often erupt in concentrated bursts within a short period, creating sudden risk patterns. These two phenomena place high demands on the dynamic adaptability of graph structures.
[0003] However, current mainstream solutions generally adopt pre-defined graph mapping rules and a unified time window or backtracking range. The graph structure lacks the ability to adapt to changes in data distribution. In scenarios of concept drift or sudden attacks, it is easy to introduce redundant historical information or omit key temporal correlations, resulting in insufficient characterization of risk propagation and limited prediction timeliness and accuracy.
[0004] Therefore, improving the adaptability and real-time prediction accuracy of risk relationship modeling under conditions of temporal evolution and sudden changes has become an urgent technical problem to be solved. Summary of the Invention
[0005] This application provides a financial risk prediction method, apparatus, device, storage medium, and program product to solve the aforementioned technical problems. This solution addresses the dynamic correlation scenarios corresponding to financial transaction relationship databases. Combining temporal evolution characteristics and relational structure characteristics, it adaptively models risk-related information under different time-series conditions. In heterogeneous time-series relationships, it dynamically highlights node feature vectors and correlation ranges more relevant to the current risk assessment, thereby improving the ability to characterize financial risk propagation and the real-time performance and accuracy of risk prediction.
[0006] In a first aspect, embodiments of this application provide a financial risk prediction method, including:
[0007] Obtain the temporal heterogeneous graph corresponding to the financial transaction relationship database; the temporal heterogeneous graph includes multiple nodes and their corresponding initial feature vectors; time-encode the current time to obtain temporal feature vectors at multiple scales; input the temporal feature vectors at each scale into a gating prediction network to obtain column-level and table-level gating values at each scale; fuse the column-level and table-level gating values at each scale using fusion weights to obtain fused column-level and fused table-level gating values; filter the initial feature vectors and nodes of the temporal heterogeneous graph based on the fused column-level and fused table-level gating values to obtain a filtered temporal heterogeneous graph; extract the node representation of each node based on the filtered temporal heterogeneous graph; generate financial risk prediction results based on the node representation of the target object's corresponding node.
[0008] In one possible embodiment, the temporal feature vectors at each scale are input into the gated prediction network to obtain column-level and table-level gate values at each scale, including:
[0009] For each node type, the time feature vector corresponding to each scale is mapped to the log odds value at each scale through the multilayer perceptron corresponding to that node type; differentiable sampling is performed on the log odds value at each scale to obtain the column-level gate value and table-level gate value of the node type at each scale.
[0010] In one possible embodiment, the initial feature vectors of nodes and nodes of the temporal heterogeneous graph are filtered based on the fused column-level gating value and the fused table-level gating value, respectively, to obtain the filtered temporal heterogeneous graph, including:
[0011] For each node type, the initial feature vectors of each node of the node type are filtered based on the fusion column-level gate value corresponding to the node type to obtain the node feature vectors of each node of the node type; the nodes of the node type are filtered based on the fusion table-level gate value corresponding to the node type to remove the corresponding nodes and their connected directed edges to obtain the filtered temporal heterogeneous graph; wherein, the filtered temporal heterogeneous graph includes the retained nodes and node feature vectors.
[0012] In one possible embodiment, based on the filtered temporal heterogeneous graph, node representations of each node are extracted, including:
[0013] For each node in the filtered temporal heterogeneous graph, the backtracking chain length of the node is determined based on the node's historical transaction data; based on the node's backtracking chain length, historical records are extracted from the node's historical record sequence; based on the extracted historical records, a temporal edge set for the corresponding node is constructed; the temporal edge sets of each node are merged into the filtered temporal heterogeneous graph to obtain a temporally enhanced heterogeneous graph; based on the temporally enhanced heterogeneous graph, the node representation of each node is extracted.
[0014] In one possible implementation, the backlink length of a node is determined based on its historical transaction data, including:
[0015] Based on the node's historical transaction data, determine the node's historical activity and transaction amount indicators; obtain the node's risk score; and based on the node's risk score, historical activity, and transaction amount indicators, determine the node's backtracking chain length.
[0016] In one possible embodiment, based on the time-enhanced heterogeneous graph, node representations of each node are extracted, including:
[0017] For each node type, the number of newly added nodes of that node type within the detection window is counted. If the number of newly added nodes is greater than the product of a preset coefficient and the historical average addition rate of the node type, a temporary shortcut edge is constructed between the newly added nodes and risk nodes of the node type in the time-series enhanced heterogeneous graph, and the weight of the temporary shortcut edge is configured to obtain a dynamically enhanced heterogeneous graph. Among them, risk nodes are nodes with historical risk records. The weight configured for the temporary shortcut edge decays with the duration of the temporary shortcut edge. Based on the dynamically enhanced heterogeneous graph, the node representation of each node is extracted.
[0018] In one possible embodiment, the method further includes:
[0019] Configure a lifetime for temporary shortcut edges; after the duration of a temporary shortcut edge reaches the configured lifetime, remove the temporary shortcut edge and its dynamic weight from the dynamically enhanced heterogeneous graph.
[0020] In one possible embodiment, based on the dynamically enhanced heterogeneous graph, node representations of each node are extracted, including:
[0021] The dynamically enhanced heterogeneous graph is input into the graph neural network. The graph neural network calculates the time interval between the source node and the target node in the message passing path, and calculates the time decay factor of the message passing path based on the time interval and the time decay rate. In the message passing layer of the graph neural network, the node feature vectors of each node are time-weighted based on the time decay factor and the node feature vectors are updated. After processing through multiple message passing layers, the node representation of each node is obtained.
[0022] In one possible embodiment, based on a time decay factor, the node feature vectors of each node are time-weighted and updated, including:
[0023] For each node in the dynamically enhanced heterogeneous graph, determine the neighbor nodes of the node under multiple relation types; call the message function corresponding to the relation type, and generate the neighbor message of the node under the relation type based on the node feature vector of the neighbor node of the node under the relation type and the node feature vector of the node; weight the neighbor message based on the time decay factor, and aggregate the weighted neighbor message under multiple relation types to obtain the aggregated neighbor message; update the node feature vector of the node according to the aggregated neighbor message.
[0024] In one possible embodiment, financial risk prediction results are generated based on the node representations of each node, including:
[0025] The node representations of each node are input into the multilayer perceptron prediction head to obtain the financial risk prediction result. The loss function of the multilayer perceptron prediction head during end-to-end training includes: task-supervised learning loss term, variational information bottleneck loss term, dynamic structural sparsity penalty term, and temporal smoothing regularization term. The task-supervised learning loss term is used to represent the deviation between the financial risk prediction result and the true risk label. The variational information bottleneck loss term is calculated based on the distribution of node representations and is used to filter redundant information in node representations. The dynamic structural sparsity penalty term is calculated based on the gate value and is used to impose sparsity constraints on the gate value, causing the graph structure to tend to be sparse. The temporal smoothing regularization term is calculated based on the gate value of adjacent time steps and is used to constrain the change range of the gate value of adjacent time steps.
[0026] In one possible embodiment, obtaining the time-series heterogeneous graph corresponding to the financial transaction relationship database includes:
[0027] Multiple business data tables are read from a financial transaction database, and the metadata of each business data table and the foreign key constraints between the tables are parsed. For each data record in each business data table, the timestamp of the data record is extracted, the numerical features in the data record are normalized, and the categorical features in the data record are encoded to obtain preprocessed data features. Based on the metadata of each business data table, the node type is determined, and the business entity corresponding to each data record is mapped to a node of the corresponding node type. The preprocessed data features of the data record are used as the initial feature vector of the node. According to the foreign key constraints between the data tables, directed edges of corresponding relationship types are constructed between nodes of different node types to form a heterogeneous graph structure. Based on the timestamp of each data record, the nodes and edges in the heterogeneous graph structure are grouped to construct time-series subgraphs at different time steps, resulting in a time-series heterogeneous graph.
[0028] Secondly, embodiments of this application provide a financial risk prediction device, comprising:
[0029] The system comprises the following modules: a temporal heterogeneous graph acquisition module, used to acquire the temporal heterogeneous graph corresponding to the financial transaction relationship database; the temporal heterogeneous graph includes multiple nodes and their corresponding initial feature vectors; a time encoding module, used to time-encode the current time to obtain time feature vectors at multiple scales; a gating prediction module, used to input the time feature vectors at each scale into a gating prediction network to obtain column-level and table-level gating values at each scale; a gating fusion module, used to fuse the column-level and table-level gating values at each scale using fusion weights to obtain fused column-level and fused table-level gating values; a feature and node filtering module, used to filter the initial feature vectors and nodes of the temporal heterogeneous graph based on the fused column-level and fused table-level gating values to obtain a filtered temporal heterogeneous graph; a node representation extraction module, used to extract the node representation of each node from the filtered temporal heterogeneous graph; and a risk prediction module, used to generate financial risk prediction results based on the node representation of the target object's corresponding node.
[0030] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, causing the processor to perform the method provided above.
[0031] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided above.
[0032] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the methods provided above.
[0033] The financial risk prediction method, apparatus, device, storage medium, and program product provided in this application, after obtaining the time-series heterogeneous graph corresponding to the financial transaction relationship database, combine it with the current time to form multi-scale time features, and then obtain column-level and table-level gate values at different scales. This enables adaptive filtering of features and nodes in the time-series heterogeneous graph, and can dynamically select nodes and node feature vectors that are more relevant to the current prediction task for time-series evolution, data distribution changes, and sudden risk scenarios. This reduces the interference of redundant historical information and retains key time-series correlations, effectively solving the problems of historical noise and omission of sudden risk features in fixed-time-window modeling. It improves the representation quality of the time-series heterogeneous graph and the accuracy, timeliness, and adaptability of financial risk prediction results. Attached Figure Description
[0034] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0035] Figure 1 A flowchart illustrating a financial risk prediction method provided in this application;
[0036] Figure 2 A schematic diagram of the financial risk prediction framework provided for this application;
[0037] Figure 3 A schematic diagram of the financial risk prediction device provided in this application;
[0038] Figure 4 A schematic diagram of the structure of the electronic device provided in this application.
[0039] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0040] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application.
[0041] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0042] Financial risk prediction technology is commonly used in real-time transaction risk control for banks, payment platforms, and consumer finance institutions. Business systems typically store account information, transaction logs, device identifiers, merchant data, and inter-table relationships in relational databases, and complete risk identification through the collaborative efforts of modules such as data access, real-time computation, model inference, and business decision-making.
[0043] In existing technologies, data tables, fields, and foreign key relationships in relational databases are typically converted into graph structures according to preset mapping rules. Then, time-series models or graph neural networks are used to perform risk scoring on target transactions, accounts, or merchants. Such solutions generally adhere to long-standing technical biases in the field: treating the conversion from relational databases to graph structures as a fixed preprocessing step before training. Once the graph topology, node types, edge relationships, and feature sets are determined, they are not dynamically adjusted. Subsequent technical optimizations focus only on iteratively updating internal model parameters such as graph neural network weights, time-series model parameters, and attention mechanisms, without adaptively optimizing the graph input itself. Furthermore, the time-series dynamic updates achieved by existing dynamic graph solutions are merely external data updates that iteratively generate new graph snapshots over time, without realizing the adaptive evolution of the graph topology itself.
[0044] While the fixed mapping approach based on this technical concept can complete routine risk identification when the data distribution is relatively stable, user behavior, fraud tactics, and risk preferences constantly change during the continuous operation of financial businesses. Fixed graph mapping rules struggle to adjust the retention range and feature representation of nodes in the graph in a timely manner, easily retaining outdated information in the graph structure for extended periods. Furthermore, uniform time windows and backtracking ranges fail to reflect the differences in activity, risk, and temporal correlation strength among different nodes, resulting in the truncation of some key relationships and the repeated introduction of redundant historical records.
[0045] In the event of sudden fraud, mass attacks, or a surge in short-term transactions, the aforementioned defects will be further amplified. The risk relationship propagation path will be insufficient, the effective signals in the graph will be drowned out by noise, the model's response speed to the latest anomaly patterns will decrease, and the accuracy and stability of real-time predictions will be affected.
[0046] To address the aforementioned technical challenges, this application provides a financial risk prediction method. This method overcomes inherent technical biases by no longer treating the graph structure corresponding to the financial transaction database as a fixed preprocessing result, but rather as an analytical object that can be adjusted according to changes in the current timeframe. By characterizing the prediction time at multiple scales, this application incorporates time information into the gating and filtering logic, enabling feature filtering at the field level and dynamic node retention at the entity level. It adaptively eliminates redundant and invalid information while retaining key temporal relationships, allowing the heterogeneous temporal graph of the input model to accurately match the current risk evolution state. This effectively adapts to scenarios involving financial data concept drift and sudden fraud risks, improving the accuracy and robustness of real-time financial risk prediction.
[0047] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0048] Figure 1 A flowchart illustrating a financial risk prediction method provided in this application is shown below. Figure 1 As shown, the method includes:
[0049] S101: Obtain the temporal heterogeneous graph corresponding to the financial transaction relationship database; wherein, the temporal heterogeneous graph includes multiple nodes and the node initial feature vector corresponding to each node.
[0050] In this application, the temporal heterogeneous graph serves as the graph representation object of the financial transaction relational database. It is used to uniformly represent different entities such as accounts, transactions, devices, merchants, bank cards, delivery addresses, and login sessions, as well as their relationships, into a heterogeneous graph structure with temporal attributes. The initial feature vector of each node is used to characterize the original attribute information of the corresponding business record, which is specifically formed by preprocessing the field values in the relational database.
[0051] When generating the time-series heterogeneous graph, each data record in the financial transaction relationship database is first mapped to a node according to its entity category. Different data tables correspond to different node types. For example, transaction log records are mapped to transaction nodes, account master records to account nodes, terminal identifier records to device nodes, merchant information records to merchant nodes, and delivery address records to address nodes. Foreign keys, business primary keys, or rule matching results between tables are mapped to edges. For example, an edge establishing an initiation relationship is established between a transaction node and an account node; an edge establishing a device usage relationship is established between a transaction node and a device node; an edge establishing a payment relationship is established between an account node and a merchant node; and an edge establishing a delivery relationship is established between an account node and an address node. Edges can be configured with direction and timestamp. The direction is used to distinguish the direction of relationship propagation, and the timestamp is used to mark the business time when the relationship was generated or became effective.
[0052] The initial feature vector of a node can be generated based on the fields of the corresponding data record. Numerical fields, including transaction amount, balance change, historical chargeback count, device login frequency, and merchant conversion rate, can be padded with missing values, truncated, normalized, or logarithmically transformed to obtain numerical features. Categorical fields, including account type, device system version, merchant industry code, channel number, and region code, can be converted into dense representations through one-hot encoding, target encoding, or embedded encoding. Time-related fields, including account opening duration, interval since last transaction, number of transactions in the last hour, and transaction amount percentile in the last day, can be converted into continuous value features and concatenated into the node's initial feature vector. The length of the initial feature vector can vary for different node types, or it can be projected to a uniform dimension, such as 64, 128, or 256 dimensions. If some nodes are missing fields, they are padded with predefined mask bits or zero values to ensure that the initial feature vector dimensions of nodes of the same type are consistent.
[0053] The temporal heterogeneous graph consists of a set of nodes and a set of directed edges. Different nodes correspond to different business entities, and each node possesses node information such as node type, initial feature vector, business primary key, and state vector. Node information is stored in a node index table. Directed edges represent business relationships between business entities, carrying attributes such as timestamp, edge type, and edge direction. These attributes are stored in an edge attribute tensor. The initial feature vector of a node is generated based on the node's original business data.
[0054] The temporal heterogeneous graph also has a corresponding time stamp to indicate the time when the temporal heterogeneous graph was generated; the time information of each node in the temporal heterogeneous graph can be obtained through the timestamp of the data record corresponding to that node.
[0055] The construction of the temporal heterogeneous graph also includes time slicing. Based on the current prediction time, a time range is set backward, such as backtracking data from the most recent 5 minutes, 30 minutes, 6 hours, 1 day, and 7 days, forming temporal subgraphs at different time granularities. The effective time of each node and edge is stored in a unified graph object. For continuously arriving transaction data, it is appended in chronological order, and edges and node states exceeding the maximum backtracking range are archived instead of being immediately discarded. This allows subsequent gating steps to dynamically decide whether to retain data based on the current time. The resulting temporal heterogeneous graph contains heterogeneous nodes, heterogeneous relationships, and the initial feature vectors of the nodes, while also preserving the event occurrence time, the order of relationship appearance, and the neighborhood evolution trajectory. This serves as the basic input for subsequent time encoding, gating prediction network processing, and the generation of financial risk prediction results.
[0056] S102: Time encoding is performed on the current time to obtain time feature vectors at multiple scales.
[0057] Here, the current time is the inference moment for executing this financial risk prediction. The time feature vector is the time code of the current time, which can be obtained by inputting the current time into the time encoder. The time feature vector at multiple scales represents the characterization of the same current time from different time ranges. These multiple scales include at least two scales, such as a short scale and a long scale; the short scale focuses on describing rapid changes in the immediate vicinity, while the long scale focuses on describing gradual changes across hours, days, or cycles.
[0058] Several time-series heterogeneous graph snapshots can be pre-generated periodically according to a preset cycle and stored in a snapshot pool. Each time-series heterogeneous graph snapshot has a time stamp. When a financial risk prediction request is received or the inference time is reached, the time-series heterogeneous graph snapshot with the time stamp closest to the inference time is selected from the snapshot pool as the base graph, i.e., the time-series heterogeneous graph used for this inference. Then, multi-scale time encoding is performed on the inference time to obtain time feature vectors of multiple scales.
[0059] The current time can be input into the time encoder, which will then generate time feature vectors at multiple scales based on the input time. The time encoder can be a learnable sine / cosine position encoder, a Transformer encoder, a recurrent neural network (RNN), or it can use normalized time values for encoding.
[0060] For example, the time encoder includes a periodic encoding unit and a scale projection unit. The periodic encoding unit performs sine / cosine transformations on periodic features such as hours, days of the week, and months to preserve the cyclical time structure. The scale projection unit maps time inputs at different scales to fixed dimensions, such as outputting a 32-dimensional or 64-dimensional vector for each scale.
[0061] In one possible embodiment, the multiple scales include at least short-scale, medium-scale, and long-scale. The short-scale may correspond to minute-level or hour-level windows to describe the activity status of short-term attacks, batch probing, and high-frequency abnormal payments around the current time; the medium-scale may correspond to day-level windows to describe intermediate behavioral differences such as weekdays versus weekends, and daytime versus nighttime; the long-scale may correspond to week-level or month-level windows to describe user behavior drift, merchant operating cycles, or changes in the activity of device groups.
[0062] Based on the above analysis, it can be seen that multi-scale temporal coding enables subsequent gating prediction networks to generate adjustment signals from different time ranges simultaneously when facing short-term sudden fraud and long-term behavioral drift, rather than relying solely on a single time window.
[0063] S103: Input the time feature vectors of each scale into the gated prediction network to obtain the column-level gate value and table-level gate value at each scale.
[0064] The gated prediction network is a learnable network, such as a multilayer perceptron (MLP) or an reactive neural network (RNN), used to generate column-level and table-level gate values based on the input temporal feature vector. The column-level gate value is used to determine whether or to what extent the features in each column of the node's initial feature vector are retained at the current time, while the table-level gate value is used to determine whether each node in the temporal heterogeneous graph participates in subsequent computations at the current time.
[0065] For a time feature vector at a certain scale, the time feature vector is input into a gated prediction network, which outputs column-level and table-level gate values at the corresponding scale. The gate values can be compressed to the 0-1 range using an activation function, or differentiable sampling can be used to form gated results that are close to discrete 0 or 1.
[0066] A gating value closer to 1 indicates a higher degree of preservation of the corresponding feature or node, while a value closer to 0 indicates a stronger degree of suppression. Differentiable sampling can be used during the training phase to obtain sparser selection results while maintaining gradient propagation. During the inference phase, the gating value can be used as the selection criterion to complete the selection of features and nodes.
[0067] By using the gating prediction networks corresponding to each node type, column-level gating and table-level gating at various scales can be obtained for each node type. The gating prediction networks corresponding to different node types can be networks with the same structure but different parameters.
[0068] Based on the above analysis, it can be seen that the gated prediction network, through time-driven multi-scale output, makes the retention rules of the field layer and entity layer no longer fixed in advance, thus providing a dynamic control basis for subsequent fusion and filtering.
[0069] S104: By fusing weights, the column-level gate values and table-level gate values at each scale are fused to obtain the fused column-level gate value and the fused table-level gate value.
[0070] Among them, the fusion weight is used to coordinate the contribution ratio of gating outputs at different scales, thereby integrating multi-scale judgments into a unified gating result.
[0071] The fusion weights are learnable parameters during the training phase and are continuously updated during the training process; during the inference phase, the fusion weights after training are directly used to complete the fusion calculation of multi-scale gating values.
[0072] Taking multiple scales as examples, with two scales (short and long), we can fuse the column-level gate values at the short and long scales using short-scale fusion weights to obtain a fused column-level gate value; similarly, we can fuse the table-level gate values at the short and long scales using short-scale fusion weights to obtain a fused table-level gate value. The corresponding relationship can be expressed as:
[0073]
[0074] in, and Here, represents the learnable fusion weights, and represents the short-scale fusion weights and long-scale fusion weights, respectively. and These represent the gate values at short and long scales, respectively, such as column-level gate values or table-level gate values; This indicates the fusion of gated values, such as fusion of column-level gated values or fusion of table-level gated values.
[0075] Gated values can be fused using a gating prediction network. The gating prediction network operates on multiple time scales, such as dual time scales. At short scales (minutes / hours), the gating value is updated frequently (e.g., every 5 minutes) using short-window time coding to quickly respond to sudden changes in trading patterns. At long scales (days / weeks / months), the gating value is updated less frequently (e.g., daily) using long-window time coding to progressively adapt to concept drift.
[0076] Based on the above analysis, it can be seen that this step is not a simple averaging of gating values across multiple scales, but rather a balance between rapid response at short scales and stable judgment at long scales achieved through learnable weights, thereby generating a unified gating sequence that adapts to the current risk environment.
[0077] In practice, if K time scales are set, each node type corresponds to K sets of column-level gate values and K sets of table-level gate values. The fusion weights can be set as global parameters for the scales or as parameters related to the node type.
[0078] In one possible implementation, the fusion weights are learnable parameters that are updated iteratively during training. The parameters can be initialized using a uniform distribution or a zero-mean, small-variance distribution, and jointly optimized with the risk prediction objective. In another implementation, the fusion weights can also be generated by an additional attention network. This involves inputting time feature vectors from multiple scales back into the attention module, dynamically outputting fusion weights for table-level and column-level gating values based on the current time context. This allows the scale fusion result to be automatically adjusted during holidays, nighttime peak hours, or marketing campaigns. To ensure the stability of the fusion gating values, the gating values for each scale can be pruned or normalized before fusion, and the result can be limited to the 0-1 range after fusion.
[0079] The dimension of the fused column-level gate value is consistent with the dimension of the initial feature vector of the corresponding node type, and can be directly multiplied element-wise with the initial feature vector of the node; the dimension of the fused table-level gate value is consistent with the number of nodes in the temporal heterogeneous graph, and can directly trigger node retention or removal operations.
[0080] Based on the above analysis, it can be seen that by introducing fusion weights, the impact of different time scales on gating decisions is explicitly modeled. Short time scales can form a rapid response to sudden attacks, while long time scales can provide constraints on periodic behavior and long-term stable attributes, ultimately obtaining a unified screening result that cannot be provided by a single scale.
[0081] S105: Filter the initial feature vectors and nodes of the temporal heterogeneous graph based on the fused column-level gating value and the fused table-level gating value respectively to obtain the filtered temporal heterogeneous graph.
[0082] Among them, the column-level gating value is used to suppress fields in the initial feature vector that have low correlation with risk identification at the current time from the feature dimension, while the table-level gating value is used to filter out nodes and their associated edges with low contribution at the current time in the time-series heterogeneous graph from the structural dimension.
[0083] Based on the fused column-level gating value, column-level filtering is performed on the initial feature vectors of each node in the temporal heterogeneous graph. Initial feature vector filtering can be achieved by element-wise multiplication of the fused column-level gating value with the initial feature vector. If certain features must remain usable, such as node identifier embeddings, type embeddings, or basic temporal difference features, these retained features can be placed in the ungated region, or the elements at the corresponding positions of the fused column-level gating value can be fixed to 1. For dimensions that have been suppressed to near 0, they can be directly set to zero, or a small residual term can be retained during the training phase to maintain gradient stability.
[0084] Node-level filtering is performed on the temporal heterogeneous graph based on the fusion table-level gating value. If a continuous gating method is used, the fusion table-level gating value can be directly used as the node weight in subsequent message passing. If a discrete filtering method is used, a threshold can be set, for example, 0.5. Nodes whose corresponding element in the fusion table-level gating value is greater than this threshold will be retained, while the remaining nodes will be removed. When a node is removed, the directed edges connected to that node are simultaneously deleted from the temporal heterogeneous graph. After removing some nodes through table-level gating, some high-order multi-hop paths in the original graph depend on the removed nodes for connectivity; these high-order paths become invalid after node removal. Therefore, the graph structure inside the adjacency index is recompressed: all incoming and outgoing edges corresponding to the removed nodes are cleared, dangling edge records pointing to the removed nodes are deleted, and the storage space of the adjacency index is compressed.
[0085] To ensure the preservation of critical nodes and their necessary context information, critical nodes can be designated as mandatory retention nodes, unaffected by table-level gating decisions. Simultaneously, minimum retention constraints are applied to adjacent nodes within the one-hop and two-hop neighborhoods of critical nodes. These minimum retention constraints are lower limits on the number of adjacent nodes to be retained, preventing all adjacent nodes within the neighborhood from being filtered out and removed by the gating mechanism. Even if the gating output tends to discard some adjacent nodes, the minimum retention constraints ensure that a certain number of adjacent nodes remain within the neighborhood, preventing structural filtering from disrupting the fundamental connectivity of the risk propagation chain and guaranteeing the integrity of the graph context for critical nodes.
[0086] The filtered temporal heterogeneous graph still retains its temporal attributes. The timestamps, edge types, and direction information on the retained directed edges continue to be stored in the edge attribute tensor, which can be used for subsequent computations to perform time-aware message passing; the latest state vectors, node types, and business primary keys of the retained nodes continue to be stored in the node index table to support the writing of inference results back to account, transaction, or merchant objects.
[0087] Based on the above analysis, it can be seen that by fusing column-level gating values and table-level gating values to simultaneously filter features and nodes, redundant historical fields and irrelevant entities are removed from the input graph, while key short-term relationships and still valid long-term relationships are preserved. This alleviates the noise accumulation caused by concept drift and provides a more compact temporal heterogeneous graph for subsequent node representation extraction.
[0088] S106: Based on the filtered temporal heterogeneous graph, extract the node representation of each node.
[0089] Among them, the node representation is the risk semantic representation of the corresponding node, which can be a comprehensive result reflecting the node's own attributes, neighborhood structure, relationship type and time evolution information.
[0090] A temporal graph neural network (GNN) can be used to perform message passing and representation aggregation on the filtered temporal heterogeneous graph. For each node, the node feature vector is first converted into an initial latent representation through a node-type-specific input mapping layer. Then, neighbor messages are aggregated according to edge type. For example, different relation transformation matrices are used for different directional relationships such as transaction to account, account to device, and transaction to merchant. The neighbor node representations are mapped together with the edge attributes and then summarized to obtain the neighbor aggregation result. The neighbor aggregation result is then fused with the node's initial latent representation to obtain the node representation.
[0091] In one possible embodiment, instead of performing global message passing on the fully filtered temporally heterogeneous graph, local backtracking subgraphs can be extracted around the nodes to perform computations and obtain node representations.
[0092] For example, starting from the target node, the graph neural network traces back outward along relationships such as accounts, devices, addresses, and merchants to obtain a local temporally heterogeneous subgraph related to the target node. Subsequently, the graph neural network performs message passing on this local subgraph, enabling the target node to aggregate the association information of its relevant neighbors without loading the entire graph for computation.
[0093] Based on the above analysis, it can be seen that the node representation extraction process compresses the risk propagation relationships, structural context, and temporal correlations in the filtered temporal heterogeneous graph into a fixed-dimensional representation, thereby providing a stable input for the next step of risk result generation.
[0094] S107: Generate financial risk prediction results based on the node representation of the target object's corresponding node.
[0095] The target object can be one or more nodes (referred to as target nodes), which are the nodes for which risk prediction needs to be performed. The financial risk prediction result can be the risk assessment output of a single node or a transaction cluster containing multiple nodes, and can be expressed as risk probability, risk score, risk level, or binary classification result.
[0096] The node representation of the target node in the filtered time-series heterogeneous graph can be input into the prediction head, such as MLP, to obtain financial risk prediction results, such as the default probability and fraud risk score of the target node.
[0097] The target object or target node can be determined by the parameters carried in the risk prediction request. Specifically, the transaction, account, merchant, or device node specified in the prediction request can be directly identified as the target node, or the target node can be obtained by backtracking and matching based on the business identifier, relationship, and query scope carried in the request.
[0098] For example, if the business scenario is real-time transaction interception, the target object is the newly arrived transaction node; if the business scenario is account inspection or merchant alert, the target object is the account node or merchant node.
[0099] After identifying the target node, its node representation is read from the filtered set of node representations in the temporal heterogeneous graph, and then input into the prediction head. The prediction head can be a multilayer perceptron prediction head, comprising at least one fully connected layer, a non-linear activation layer, and an output layer. For binary classification tasks, the output layer can use a single neuron and obtain the risk probability using the sigmoid function; for multi-level risk tasks, the output layer can use multiple neurons and obtain the probability distribution of each risk category using the softmax function. The risk probability can be further mapped to business decision labels such as pass, review, or interception based on a preset threshold, or the probability value can be converted into a risk score from 0 to 100.
[0100] During model training, the prediction head, time encoder, gated prediction network, fusion weights, and node representation extraction network are jointly trained end-to-end. Training sample labels can be derived from manual review results, chargeback feedback, fraud confirmation records, or review conclusions after rule matching. The loss function can be cross-entropy loss, with gating sparsity constraints or class imbalance correction terms added. During inference, the system returns the generated financial risk prediction results to the business application layer, where the strategy engine deployed in the business application layer triggers corresponding actions based on the score range, such as continuing to allow, secondary verification, manual review, or direct blocking.
[0101] If there are multiple target nodes, the financial risk prediction results (such as risk probabilities) of multiple target nodes within the same connected subgraph can be aggregated to form a cluster-level financial risk prediction result.
[0102] The financial risk prediction method provided in this embodiment encodes the current time into time feature vectors of multiple scales, generates unified column-level and table-level dynamic gating results using a gating prediction network and fusion weights, and then performs feature filtering and structure filtering on the time-series heterogeneous graph, so that the graph structure adapts to changes over time. Subsequently, node representations are extracted and risk prediction is performed based on the filtered graph structure, and the financial risk prediction results are output. This method can reduce the continuous accumulation of outdated information in the graph under the conditions of continuous operation of financial business and changes in risk patterns, enhance the synchronous expression of short-term abnormal relationships and effective historical relationships, and thus improve the pertinence, stability and accuracy of real-time financial risk prediction results.
[0103] Based on the aforementioned embodiments, the temporal feature vectors at each scale are further input into the gated prediction network to obtain column-level and table-level gate values at each scale. This includes: for each node type, mapping the temporal feature vectors at each scale to log-odds values at each scale using the multilayer perceptron corresponding to that node type; performing differentiable sampling on the log-odds values at each scale to obtain the column-level and table-level gate values for the node type at each scale.
[0104] Node types can include various heterogeneous types such as transactions, accounts, devices, and merchants. Different node types exhibit significant differences in business attributes, temporal evolution patterns, and risk performance. Therefore, in this embodiment, a gating value needs to be generated for each node type.
[0105] The gated prediction network receives multi-scale temporal feature vectors output by the time coding module. Then, for each node type The multi-scale temporal feature vector of this node type is then input into the multilayer perceptron corresponding to this node type to obtain the column-level gated log-odds and table-level gated log-odds for this node type at each scale. This process can be expressed as: ,in, Indicates node type Column-level gated log-probability or table-level gated log-probability at each scale This represents a multilayer perceptron. The network parameters of this multilayer perceptron, i.e., node type. A corresponding set of network parameters. A multilayer perceptron can consist of an input layer, hidden layers, and an output layer. The hidden layers use non-linear activation functions to enhance the fitting ability to time patterns.
[0106] After obtaining the log-odds values, namely the column-level gated log-odds and the table-level gated log-odds, the gated prediction network performs differentiable sampling on them. For example, a Hard-Concrete distribution can be used to achieve differentiable gated value sampling. The sampling process can be based on the idea of reparameterization to transform discrete gated judgments into continuous approximate outputs, and the node type is generated according to the sampling results. Column-level and table-level gating values at various scales. Taking column-level gating as an example, the process can be expressed as:
[0107]
[0108] in, , It represents a continuous uniform distribution in the interval from 0 to 1. This represents the vector dimension, which is the dimension of the initial feature vector (corresponding to the column-level gate log-odds value calculation). If calculating the table-level gate value, then... =1; For temperature parameters, For the stretching range; Node type Column-level gating values at various scales. Table-level gating values can be obtained by sampling in the same way. .
[0109] By using a multilayer perceptron corresponding to each node type, log-odd values are obtained by mapping multi-scale temporal feature vectors. Then, differentiable sampling is used to obtain column-level and table-level gating values at the corresponding scales. Independently configured multilayer perceptrons adapt to the temporal characteristics of different node types; differentiable sampling solves the problem of discrete gating's inability to backpropagate gradients, supporting end-to-end training. Table-level gating completes node-level granularity selection, and column-level gating completes feature-dimensional granularity selection. Gating is generated at multiple scales, capturing the dynamic importance of different time dimensions and improving the feature selection accuracy of temporally heterogeneous graphs.
[0110] Based on the aforementioned embodiments, further, the initial feature vectors and nodes of the temporal heterogeneous graph are filtered based on the fused column-level gating value and the fused table-level gating value, respectively, to obtain a filtered temporal heterogeneous graph. This includes: for each node type, filtering the initial feature vectors of each node of the node type based on the fused column-level gating value corresponding to the node type to obtain the node feature vectors of each node of the node type; filtering the nodes of the node type based on the fused table-level gating value corresponding to the node type to remove the corresponding nodes and their connected directed edges, to obtain a filtered temporal heterogeneous graph; wherein, the filtered temporal heterogeneous graph includes the retained nodes and node feature vectors.
[0111] In this embodiment, the time-series heterogeneous graph can be obtained by mapping from a financial transaction relationship database. The node types can include accounts, merchants, devices, and transaction records. The initial feature vector of each node can be formed by concatenating field codes, statistical features, and time codes.
[0112] For the same node type, the fused column-level gate value can correspond to each feature dimension of each node under that node type, and the fused table-level gate value can correspond to the retention probability or removal probability of each node under that node type.
[0113] When filtering the initial feature vector of a node, weighted retention can be applied to different dimensions of the vector based on the gating value, thereby forming the node feature vector of that node. When filtering a node, the fusion table-level gating value can be used to determine whether the node should be removed from the graph, and the incoming and outgoing edges associated with the node should be deleted at the same time when it is removed. The remaining nodes and their node feature vectors constitute the filtered temporal heterogeneous graph.
[0114] Column-level gating value The initial feature vector of the corresponding node is applied element-wise to achieve feature dimension filtering. This process can be represented as: ;in, This represents the feature matrix composed of the initial feature vectors of each node under the corresponding node type. For the vector obtained by element-wise multiplication... Values close to 0 will suppress the output of the corresponding feature dimension, while values close to 1 will retain the information of the corresponding feature dimension, thus completing the filtering of the feature dimension.
[0115] After column-level filtering, for node types Generate scalar-gated values, i.e., table-level gated values. , can be represented as: .
[0116] Based on table-level gating values Filtering can be represented as: This enables node filtering in time-series heterogeneous graphs. By leveraging Hard-Concrete differentiable sampling, the table-level gate value is between 0 and 1, specifically approximating 0 or 1, thus achieving approximately discrete filtering.
[0117] This filtering mechanism first performs feature-level screening and then structural-level screening, ensuring that the graph input possesses both strong representational relevance and structural compactness. Since node feature vectors and node retention decisions are controlled by different gate values, the same node type can retain key feature dimensions while eliminating invalid nodes and their directed edges. This allows subsequent node representation extraction to be calculated only for the retained graph structure. Using this implementation, the filtered temporal heterogeneous graph reduces the continuous accumulation of redundant nodes, invalid edges, and noisy features, retaining structural and attribute information relevant to the current risk state. This makes subsequent representation extraction and risk prediction inputs more focused on effective signals, thereby improving the relevance of graph modeling and the stability of prediction results.
[0118] In one possible implementation, based on the filtered temporal heterogeneous graph, the node representation of each node is extracted, including: for each node in the filtered temporal heterogeneous graph, determining the backtracking chain length of the node based on the node's historical transaction data; extracting historical records from the node's historical record sequence based on the node's backtracking chain length; constructing a temporal edge set for the corresponding node based on the extracted historical records; merging the temporal edge sets of each node into the filtered temporal heterogeneous graph to obtain a temporally enhanced heterogeneous graph; and extracting the node representation of each node based on the temporally enhanced heterogeneous graph.
[0119] The backtracking chain length characterizes the time span or record span that a single node needs to trace in the historical transaction sequence. Its value can be determined based on one or more of the following: the node's transaction frequency within a preset time interval, the fluctuation range of transaction amount, the number of associated peers, and changes in risk score. Historical transaction data comes from transaction logs, account interaction records, or device association records associated with the node. After being sorted by time, a historical record sequence of the node is formed. Therefore, after determining the backtracking chain length, historical records within the corresponding time period are extracted from the historical record sequence based on the backtracking chain length, serving as the basis for constructing subsequent temporal edges. Temporal edges characterize the temporal sequence relationship between a node and related nodes in its historical record, carrying the corresponding transaction time, interaction direction, and relationship type. The temporal edge set consists of all the temporal edges of that node. The temporal-enhanced heterogeneous graph is an extended graph formed by incorporating the temporal edge sets of each node into the graph structure based on the filtered temporal heterogeneous graph. It is used to carry the structural and temporal information of the nodes.
[0120] After obtaining the filtered temporal heterogeneity graph, for each retained node... The system retrieves the historical transaction data of the node, sorts it by timestamp to obtain the historical transaction sequence, and performs feature calculations. Based on the calculated features, it determines the node's position at the current time. Length of backtracking chain .
[0121] It can be based on the node's historical activity. Average transaction amount Wait, calculate the node at the current time. Length of backtracking chain .
[0122] Among them, historical activity It is represented by the number of transactions per unit of time.
[0123] For nodes with high historical activity and large average transaction amount, the backtracking chain length is longer, thus covering a longer historical period; for nodes with low historical activity and small average transaction amount, the backtracking chain length is shorter, to ensure that the historical records are strongly correlated with the current state.
[0124] Determining the backtrack chain length Then, based on the length of the backtracking chain Locate the start and end positions from the node history sequence, extract the history set, and construct directed edges according to the transaction parties, occurrence time, and relationship attributes in the records. , Then, all temporal edges corresponding to the same node are aggregated into a temporal edge set. ,in, .
[0125] After the temporal edge set of each node is uniformly incorporated into the filtered temporal heterogeneous graph, a temporal enhanced heterogeneous graph containing static heterogeneous relationships and dynamic transaction evolution relationships is formed. Then, based on the temporal enhanced heterogeneous graph, a graph neural network, a temporal attention network, or a message passing network is input to extract node representations, thus obtaining node representations that take into account both local structure and historical evolution.
[0126] By determining the backtracking chain length corresponding to a node based on historical transaction data, a differentiated historical backtracking window can be set for different nodes, rather than using a uniform fixed length. Based on the determined backtracking chain length, historical records are truncated from the historical sequence, filtering out historical behaviors that are too old or have weak reference value, retaining only the valid historical information within the window, and suppressing interference from invalid historical data. This avoids the problems of sequence expansion and excessive computational overhead caused by full historical data and mitigates the risk of gradient vanishing in long sequences. A temporal edge set is constructed using the truncated historical records, supplementing the filtered heterogeneous graph with the temporal interactions within the window, allowing node representations to focus on recent behavior patterns, balancing computational efficiency and temporal modeling accuracy.
[0127] Based on the aforementioned embodiments, further, the backtracking chain length of a node is determined based on the node's historical transaction data, including: determining the node's historical activity and transaction amount indicators based on the node's historical transaction data; obtaining the node's risk score; and determining the node's backtracking chain length based on the node's risk score, historical activity, and transaction amount indicators.
[0128] Historical activity is used to characterize the activity level of a node in historical transactions, which can be represented by the number of transactions per unit of time; transaction amount is used to characterize the scale of a node's historical transactions, such as the average amount of historical transactions. Risk Score The risk level of a node is typically reflected in the results of a node-related risk assessment, such as those provided by a risk control model, and can be stored as a node attribute. This risk control model can periodically or irregularly assess the risk of nodes to update their risk scores.
[0129] During operation, a node's historical transaction data is used to characterize the node's behavioral intensity and risk status. Based on this, the system dynamically determines the backtracking chain length, ensuring that the range subsequently extracted from the historical record sequence matches the node's current activity level and risk level. For nodes with frequent transactions and high risk scores, the backtracking chain length can be increased accordingly to retain longer related transaction paths; for nodes with low activity and low risk scores, the backtracking chain length can be decreased accordingly to reduce redundant historical information entering the subsequent graph structure.
[0130] First, the historical transaction data of the target node is summarized and statistically analyzed to obtain the transaction frequency, transaction interval, and continuous active duration within the specified observation period, and the historical activity level is calculated accordingly. Simultaneously, the historical transaction amount of the node is summed, averaged, or quantile-based to form a transaction amount indicator. The node's risk score can be output from an existing risk control model, rule engine, or external scoring service, and input along with the historical activity level and transaction amount indicator into the chain length calculation function to generate the corresponding backtracking chain length.
[0131] The chain length calculation function can be implemented using linear weighting, segmented mapping, or normalization fusion. The value of the backtracking chain length can be limited to a preset integer range to adapt to subsequent historical record truncation and temporal edge construction.
[0132] For example, the chain length calculation function can be expressed as:
[0133]
[0134] in, The maximum backtracking chain length is set. and These are the weighting coefficients. and The normalized transaction amount indicator and risk score; Indicates rounding down; This is a clamping function that restricts the calculation results to the interval [ ].
[0135] This chain length calculation function enables high-frequency, low-risk nodes to use short chains, while low-frequency, high-risk nodes use long chains.
[0136] By combining node risk scores, transaction frequency, and transaction amount metrics to characterize node risk, the backtracking chain length of each node is determined. This allows for the allocation of longer backtracking chain lengths to nodes with higher risk levels, enabling the retrieval of more historical records and fully uncovering risk behavior clues hidden within long-term time-series data. Conversely, shorter backtracking chain lengths are used for low-risk nodes to filter out redundant and distant historical data, reducing the computational overhead of time-series processing. While controlling sequence length and mitigating the gradient problem of long sequences, this approach prioritizes time-series information resources for risk nodes, enhancing the ability of heterogeneous time-series graphs to capture risk patterns.
[0137] Based on the aforementioned embodiments, further, based on the time-enhanced heterogeneous graph, the node representation of each node is extracted, including: for each node type, counting the number of newly added nodes of the node type within the detection window; if the number of newly added nodes is greater than the product of a preset coefficient and the historical average addition rate of the node type, then a temporary shortcut edge is constructed between the newly added node of the node type and the risk node in the time-enhanced heterogeneous graph, and the weight of the temporary shortcut edge is configured to obtain a dynamically enhanced heterogeneous graph; wherein, the risk node is a node with historical risk records; the weight configured for the temporary shortcut edge decays with the duration of the temporary shortcut edge; based on the dynamically enhanced heterogeneous graph, the node representation of each node is extracted.
[0138] The detection window is used to statistically analyze the new additions of each node type within a set time range. The number of new nodes represents the number of nodes that first appear within that time range or re-enter the graph structure after being filtered from the historical graph. The historical average addition rate characterizes the average growth level of a node type over a longer historical period, and the preset coefficient is used to adjust the growth threshold for different node types. Risk nodes are nodes that have been marked as risk-related in historical transactions, account behaviors, or device associations. They carry historical risk records, and whether a node is a risk node can be determined through the stored node information.
[0139] Maintain statistics on the number of newly added nodes for each node type. During the time window Internal statistics on the number of newly added nodes The number of newly added nodes of a certain node type within the detection window. Exceeding the preset coefficient Compared with the historical average growth rate of this node type When multiplying, that is If this indicates an abnormal increase in the node type within the current window, confirming a sudden pattern, then a temporary shortcut edge needs to be injected between the new node and historical risk nodes. This can be achieved by establishing a temporary shortcut edge between the new node and its nearest risk node. Subsequently, based on the dynamically enhanced heterogeneous graph after adding the temporary shortcut edge, the graph neural network performs message aggregation and representation updates on each node, outputting node representations that include local structural information, temporal correlation information, and risk propagation information.
[0140] Temporary shortcut edges can take the form of directed edges or bidirectional edges. The edge weight can be initialized based on the risk score of the new node, the similarity between the new node and the risk node, the frequency of interaction, or the intensity of risk propagation. The duration of the temporary shortcut edge is recorded, or a countdown of a preset duration is started so that the temporary shortcut edge is removed when the countdown ends.
[0141] The weight of a temporary shortcut edge decays over time, which can be achieved through an exponential decay function or a piecewise decreasing function. As the duration of the temporary shortcut edge increases, the edge weight gradually decreases, so that the influence of the temporary shortcut edge naturally fades away as the sudden event subsides.
[0142] For example, the expression for the weight of a temporary shortcut edge is:
[0143]
[0144] in, The duration of a newly added node can be represented by the time difference between the time the temporary node appeared and the current time. The attenuation rate; It is an exponential function.
[0145] The dynamic weight that decays over time is used to ensure that temporary connections only participate in graph message passing during periods when newly added nodes are unusually active, thus avoiding long-term persistence of historical sudden associations.
[0146] By constructing temporary shortcut edges for newly added nodes, these nodes can quickly establish intra-graph connections, addressing the issues of insufficient native edges and cold start, enabling them to participate rapidly in graph message passing. The temporary shortcut edges are configured with weights that decay over time, gradually reducing their contribution percentage. Initially, shortcut edges quickly introduce neighbor information, compensating for the lack of interaction data for newly added nodes; later, the weights decay, gradually reducing the impact of temporary shortcut edges, with the model relying more on the temporal edges generated by the nodes themselves for representation learning. This approach alleviates the cold start problem for newly added nodes while avoiding long-term interference from temporary shortcut edges on graph features, balancing the initial information supplementation of newly added nodes with subsequent modeling of real behavior, and improving the overall representation quality of temporally heterogeneous graphs.
[0147] In one possible implementation, the method further includes: configuring a lifetime for the temporary shortcut edge; and removing the temporary shortcut edge and its dynamic weight in the dynamically enhanced heterogeneous graph after the duration of the temporary shortcut edge reaches the configured lifetime.
[0148] The lifecycle parameter limits the effective retention time of temporary shortcut edges in a dynamically enhanced heterogeneous graph. Once constructed, the temporary shortcut edge is written with its corresponding lifecycle parameter, which can be preset to a fixed duration or configured according to node type, historical risk record density, and detection window length. The dynamic weight characterizes the change in association strength of the temporary shortcut edge during its continuous retention. Its value decreases with duration and is managed in conjunction with the lifecycle parameter. When the temporary shortcut edge reaches its preset duration, both the weight and the edge entity become invalid.
[0149] After generating a temporary shortcut edge, the generation time, expiration time, and current weight value are recorded for each edge. This information is then bound to the edge identifier and stored in the dynamic graph cache or edge attribute table. During the inference cycle, the difference between the current time and the generation time is continuously compared, or the remaining valid duration of the edge is directly compared. When the duration is detected to have reached the lifecycle threshold, the edge cleanup logic is triggered, deleting the temporary shortcut edge from the dynamically enhanced heterogeneous graph and simultaneously deleting its corresponding dynamic weight record, so that subsequent graph aggregations will no longer read this temporary relationship.
[0150] In one implementation, temporary shortcut edges can be represented using an edge structure with expiration tags. These tags include the edge type, source node, target node, creation time, expiration time, and weight index, facilitating rapid location during incremental updates. If the dynamically enhanced heterogeneous graph uses an adjacency list or edge set for storage, the corresponding entry in the adjacency list is removed during expiration cleanup, and the corresponding index in the weight tensor or weight mapping table is simultaneously set to null or reclaimed.
[0151] By configuring lifecycles for temporary shortcut edges and removing their dynamic weights upon expiration, temporary risk propagation channels in heterogeneous graphs can be dynamically enhanced and released on time, preventing the continuous amplification of expired correlation signals due to the long-term accumulation of temporary edges. As a result, the graph structure size remains controlled, the effective relationships upon which node representation extraction relies are more focused on the abnormal propagation links in the current period, and the financial risk prediction results respond more consistently to short-term fraud patterns.
[0152] In one possible implementation, node representations of each node are extracted based on a dynamically enhanced heterogeneous graph, including: inputting the dynamically enhanced heterogeneous graph into a graph neural network; calculating the time interval between the source node and the target node in the message passing path through the graph neural network; and calculating the time decay factor of the message passing path based on the time interval and the time decay rate; performing time-series weighting on the node feature vectors of each node in the message passing layer of the graph neural network based on the time decay factor and updating the node feature vectors; and obtaining the node representations of each node after processing through multiple message passing layers.
[0153] The node feature vector is a multi-dimensional numerical vector representing node attribute information, including features retained after the aforementioned gating and filtering, and may also include risk scores, historical activity, transaction amount indicators, etc. The node feature vector serves as input to the graph neural network's message passing layer, where it undergoes temporal weighting and iterative updates in conjunction with a time decay factor. After multiple layers of network computation, the final output is the node representation.
[0154] The graph neural network dynamically enhances the node feature vectors and corresponding timestamps carried by each node in the heterogeneous graph. After receiving the graph, it first reads the timestamps of the source and target nodes for each message passing path, calculates the difference between them as the time interval, and generates a time decay factor according to a preset or trained time decay rate and a decay function. The decay function can adopt an exponential decay form, so that interactions closer to the current time have higher weights, and interactions farther away have decreasing weights over time. Subsequently, in the message passing layer, the time decay factor is applied to the message vectors from neighboring nodes, and the node feature vectors are time-weightedly aggregated, and the node feature vector of the target node is updated. This update process can be repeated in multiple message passing layers to fuse local neighborhood information, temporal information, and cross-type association information layer by layer, and finally outputs the node representation of each node.
[0155] Because a time decay factor, formed by time intervals and time decay rates, is introduced during message passing, the aggregation weight of node feature vectors can dynamically change with the interaction time, allowing recent effective relationships to occupy a higher proportion in node representation. After multiple layers of message passing, the resulting node representation can simultaneously reflect graph structure associations and temporal evolution characteristics, thereby making subsequent risk prediction models more sensitive to the latest abnormal behaviors and improving the accuracy and stability of node representations of dynamic financial transaction relationships.
[0156] Based on the aforementioned embodiments, further, based on the time decay factor, the node feature vectors of each node are time-weighted and updated, including: for each node in the dynamically enhanced heterogeneous graph, determining the neighbor nodes of the node under multiple relation types; calling the message function corresponding to the relation type, generating neighbor messages of the node under the relation type based on the node feature vectors of the neighbor nodes of the node under the relation type and the node feature vector of the node; weighting the neighbor messages based on the time decay factor, and aggregating the weighted neighbor messages under multiple relation types to obtain aggregated neighbor messages; updating the node feature vectors of the node based on the aggregated neighbor messages.
[0157] Among them, the relation type is used to distinguish neighbor information under different semantic relations in the dynamically enhanced heterogeneous graph, the neighbor node is used to propagate neighbor messages to the current node, the message function is used to generate neighbor messages under the corresponding relation type based on the feature vectors of the node and its neighbor nodes, the neighbor message is used to carry the influence of the neighbor node under a certain relation type on the current node, and the aggregated neighbor message is used to merge the weighted neighbor messages under multiple relation types and serve as the basis for updating the node feature vector.
[0158] The nodes in a dynamically enhanced heterogeneous graph can include various node types such as account nodes, transaction nodes, device nodes, and merchant nodes.
[0159] For each node in the dynamically augmented heterogeneous graph, its one-hop or multi-hop connected nodes (i.e., neighbor nodes) are retrieved under different relation types, forming a neighbor set partitioned by relation type. For each relation type, the message function bound to that relation type is called, and the corresponding neighbor message is generated by combining the feature vectors of the neighbor nodes and the feature vector of the current node. The message function can be implemented by a neural network with different parameter sets.
[0160] The time decay factor of neighbor messages is calculated as described above. Then, each neighbor message is weighted according to the time decay factor, and finally, summed or concatenated according to the relation type to form aggregated neighbor messages. Based on the aggregated neighbor messages, the node feature vectors are updated, such as by gated fusion, linear transformation, or residual update to generate new node feature vectors.
[0161] For each message delivery path (in As the source node, (for the target node), calculate the time interval. (must meet) (To ensure causality); calculate the time decay factor according to the following formula. : ,in, This is a learnable time decay rate; this time decay factor is incorporated into the message aggregation at each layer of the heterogeneous GNN, and the process is expressed as:
[0162]
[0163] in, For nodes In relation types The set of neighboring nodes below, For message functions under a specific relation type, AGG represents aggregation operations (such as mean pooling or sum pooling). For the first Nodes output by the message passing layer The updated node feature vector; the number of message passing layers is .go through Node obtained after layer message passing Node representation ; This is a collection of relation types for the original temporal heterogeneous graph. This is the set of relation types corresponding to temporary shortcut edges.
[0164] Through the aforementioned node representation generation process, interactions that are more recent in time receive a higher message transmission weight, thereby making recent transaction behavior dominate the node representation update.
[0165] This processing method can model the influence of neighbors received by nodes under different relational semantics separately. Simultaneously, it uses a time decay factor to suppress the weight of excessively old interaction messages, reducing the interference of outdated historical information. This ensures that the updated node feature vector focuses on effective interaction information near the current moment. Therefore, the node representation output by dynamically enhancing the heterogeneous graph can be iteratively updated synchronously with the evolution of transaction behavior, providing input features that fit the real-time business status of nodes for subsequent risk identification tasks. This strengthens the model's ability to capture and respond to newly generated abnormal transaction relationships, improving the accuracy of risk identification in financial time-series scenarios.
[0166] Building upon the aforementioned embodiments, further, based on the node representations of each node, financial risk prediction results are generated, including:
[0167] The node representations of each node are input into the multilayer perceptron prediction head to obtain the financial risk prediction result. The loss function of the multilayer perceptron prediction head during end-to-end training includes: task-supervised learning loss term, variational information bottleneck loss term, dynamic structural sparsity penalty term, and temporal smoothing regularization term. The task-supervised learning loss term is used to represent the deviation between the financial risk prediction result and the true risk label. The variational information bottleneck loss term is calculated based on the distribution of node representations and is used to filter redundant information in node representations. The dynamic structural sparsity penalty term is calculated based on the gate value and is used to impose sparsity constraints on the gate value, causing the graph structure to tend to be sparse. The temporal smoothing regularization term is calculated based on the gate value of adjacent time steps and is used to constrain the change range of the gate value of adjacent time steps.
[0168] Node representation Input the MLP prediction header to obtain financial risk prediction results. ,Right now .
[0169] In practical implementation, node representations are first normalized before being input into the MLP prediction head. The output layer can be set to a single neuron with sigmoid activation to obtain binary risk results. For multi-risk level tasks, the output layer can be set to neurons corresponding to the number of risk levels and activated with softmax. During training, the four types of losses are summed according to preset weights and backpropagated. Task-related information in the node representations is preserved, redundant historical patterns are suppressed, and the gating values form a sparse selection in the structural dimension and maintain a smooth change in the temporal dimension.
[0170] End-to-end joint training can be performed on graph neural networks, gated prediction networks, and MLP prediction heads: forward propagation sequentially completes graph filtering, dynamic backtracking chain length calculation, time-series message passing, and node representation extraction, and then the MLP prediction head outputs the financial risk prediction results; during the training process, the four types of losses are weighted and summed according to preset weights to obtain the total loss, and the total loss is backpropagated to synchronously update the gate parameters, graph neural network parameters, and MLP prediction head parameters.
[0171] The loss function used to calculate the total loss during end-to-end training. It can be represented as:
[0172]
[0173]
[0174]
[0175]
[0176] in, For task-monitored learning loss items, This represents the financial risk prediction result output by the MLP prediction head during the training phase. This is a true risk label. This is the variational information bottleneck loss term, used to compress redundant information in the node representation; This is a dynamic structural sparsity penalty term, used to encourage structural sparsity; The time-series smoothing regularization term is used to suppress sharp oscillations in the gate value over time; , , , All are weighting coefficients; Let KL divergence be a metric. It is a standard normal distribution with a mean of 0 and a variance of the identity matrix; The posterior distribution of the representation of the node; It represents the mathematical expectation.
[0177] The total loss incorporates four constraints to achieve end-to-end joint optimization. The task supervision loss provides supervision signals for the main risk identification task, ensuring the model learns towards business objectives. The variational information bottleneck loss constrains the representation distribution according to node type, compressing redundant information in node representations and retaining effective task features. The dynamic structural sparsity penalty term applies sparse constraints to structural gating and feature gating for different node types, driving the model to adaptively filter invalid edges and features, reducing graph computation overhead. The temporal smoothing regularization term constrains the gating change amplitude between adjacent time steps, avoiding drastic gating oscillations over time and ensuring temporal stability of the gating output. These multiple losses work together to balance task accuracy, representation compression, structural sparsity, and temporal smoothing, improving the generalization ability of dynamic heterogeneous graphs in financial risk scenarios.
[0178] In one possible implementation, obtaining the temporal heterogeneity graph corresponding to the financial transaction relation database includes:
[0179] Multiple business data tables are read from a financial transaction database, and the metadata of each business data table and the foreign key constraints between the tables are parsed. For each data record in each business data table, the timestamp of the data record is extracted, the numerical features in the data record are normalized, and the categorical features in the data record are encoded to obtain preprocessed data features. Based on the metadata of each business data table, the node type is determined, and the business entity corresponding to each data record is mapped to a node of the corresponding node type. The preprocessed data features of the data record are used as the initial feature vector of the node. According to the foreign key constraints between the data tables, directed edges of corresponding relationship types are constructed between nodes of different node types to form a heterogeneous graph structure. Based on the timestamp of each data record, the nodes and edges in the heterogeneous graph structure are grouped to construct time-series subgraphs at different time steps, resulting in a time-series heterogeneous graph.
[0180] When reading business data tables, table names, field names, field types, and constraint information can be obtained through the database connection interface, and a correspondence is established between foreign key fields and primary key fields. For each record, the transaction time is first extracted and converted into a unified time format. Then, numerical fields such as amount, frequency, and balance are processed according to range scaling or standardization. Discrete fields such as merchant category and device identifier are processed using one-hot encoding or embedded encoding to form the initial feature vector of the node. The node type is determined according to the business semantics of the table. For example, the account table is mapped to account nodes, and the transaction table is mapped to transaction nodes. The entity instance corresponding to the record is used as the graph node carrier. Based on foreign key constraints, directional relationship edges are constructed between parent table nodes and child table nodes. Nodes and their associated edges are assigned to the corresponding time steps according to the timestamp, forming multiple time-series subgraphs, which are then concatenated into a time-series heterogeneous graph.
[0181] It can read data from multiple tables in a financial transaction relational database, associate each data record with a timestamp, and extract the table name, field name, field type, and foreign key constraint information. Based on the timestamp and foreign key constraint information, the data records in the relational database are converted into a time-series heterogeneous graph, where nodes correspond to data records, edges correspond to foreign key constraint information, and each node carries a timestamp.
[0182] This time-series heterogeneous graph unifies the structural relationships and temporal evolution in the database into a single graph representation, enabling subsequent models to utilize both entity relationships and temporal change information to form a more consistent input for the latest transaction status. Since the node feature vectors have undergone unified preprocessing of numerical and categorical values, and edge relationships are directly generated from foreign key constraints, the graph structure maintains traceable consistency with the original database, thus providing a stable data foundation for subsequent risk characterization extraction and financial risk prediction results generation.
[0183] Targeting financial transaction relationship databases The process involves reading metadata from all tables (table name, field name, field type); parsing foreign key constraints; extracting timestamps for each data record (e.g., transaction time, account opening time); normalizing numerical features and encoding categorical features; and preprocessing the multi-table data along with its timestamps and foreign key relationship graph. for A finite set of tables, For the set of foreign key constraints, each table Contains several attributes Each data record is associated with a timestamp. Map each tuple of the preprocessed multi-table data to a node. Node type Map the attributes of each tuple to the initial feature vector of the node. For each foreign key constraint Create directed edges between the corresponding nodes, edge type Reflects foreign key relationships; for nodes with timestamps, records their time information. ; Construct a subgraph based on the principle of time consistency, for the predicted time Includes only timestamps The nodes are used to prevent future information leakage. Through the aforementioned steps, a temporal heterogeneous graph is obtained. and its time stamp .
[0184] By adopting this implementation method, multiple business tables, inter-table constraints, and record time information can be synchronously mapped into a computable time-series heterogeneous graph, preserving the heterogeneous relationships and time evolution characteristics between different entities, reducing the semantic loss when the original relational database is directly used for graph models, and making subsequent financial risk prediction more sensitive to short-term anomalies and correlation propagation.
[0185] In this application, multiple business data tables are read from a financial transaction relation database. The metadata of each business data table and the foreign key constraints between the tables are parsed. For each data record in each business data table, a timestamp is extracted. Numerical features are normalized, and categorical features are encoded to obtain preprocessed data features. Based on the metadata of each business data table, node types are determined, and the business entity corresponding to each data record is mapped to a node of the corresponding node type. The preprocessed data features are used as the initial feature vectors of the nodes. Then, based on the foreign key constraints between the data tables, directed edges of corresponding relationship types are constructed between nodes of different node types to form a heterogeneous graph structure. The nodes and edges in the heterogeneous graph structure are grouped according to the timestamp of each data record to construct time-series subgraphs at different time steps, resulting in a time-series heterogeneous graph corresponding to the financial transaction relation database.
[0186] In one possible implementation, temporal encoding is performed for the current time to generate temporal feature vectors at multiple scales, and these vectors are then input into a gated prediction network. For each node type, a multilayer perceptron with the corresponding parameter set is invoked to map the temporal feature vectors at each scale to log-odds values at each scale. Differentiable sampling is then performed on these log-odds values at each scale to obtain column-level and table-level gate values for that node type at each scale. Subsequently, fusion weights are used to fuse the column-level and table-level gate values at each scale to obtain fused column-level and fused table-level gate values for each node type. For each node type, based on the fused column-level gate value, the initial feature vectors of each node of that type are filtered to obtain the node feature vectors. Then, based on the fused table-level gate value, the nodes of that type are filtered, removing the filtered nodes and their connected directed edges, forming a filtered temporal heterogeneous graph containing the retained nodes and their feature vectors.
[0187] For each node in the filtered temporal heterogeneous graph, the backtracking chain length is determined by combining the node's historical transaction data and node feature vectors. First, historical activity and transaction amount metrics are calculated based on the node's historical transaction data, and a risk score is obtained for that node. Then, the backtracking chain length is jointly determined based on the risk score, historical activity, and transaction amount metrics. Based on the backtracking chain length of each node, corresponding historical records are extracted from the historical record sequence of each node, and a temporal edge set for the corresponding node is constructed based on the extraction results. Finally, the temporal edge sets of each node are merged into the filtered temporal heterogeneous graph to obtain the temporally enhanced heterogeneous graph. Subsequently, for each node type, the number of newly added nodes within the detection window is counted. When the number of newly added nodes is greater than the product of a preset coefficient and the historical average addition rate of that node type, a temporary shortcut edge is constructed between the newly added node and the risk node of that node type in the time-series enhanced heterogeneous graph, and a dynamic weight is configured for the temporary shortcut edge. The risk node is a node with historical risk records, and the dynamic weight decays with the duration of the temporary shortcut edge. At the same time, a lifecycle is configured for the temporary shortcut edge. After the duration reaches the configured lifecycle, the temporary shortcut edge and its dynamic weight are removed from the graph, resulting in a dynamically enhanced heterogeneous graph that participates in node representation extraction.
[0188] The dynamically augmented heterogeneous graph is input into the graph neural network. During message passing, the time interval between the source node and the target node on each message passing path is calculated, and the corresponding time decay factor is calculated based on the time interval and the time decay rate. Within the message passing layer, for each node in the dynamically augmented heterogeneous graph, its neighbor nodes under multiple relation types are determined. The message function corresponding to each relation type is called, and neighbor messages are generated based on the node feature vectors of the neighbor nodes under that relation type and the node feature vector of the current node. The neighbor messages are then weighted using the time decay factor, and the weighted neighbor messages under multiple relation types are aggregated to obtain aggregated neighbor messages. The node feature vectors are updated based on the aggregated neighbor messages. After iterative processing through multiple message passing layers, the node representation of each node is output.
[0189] After obtaining the node representations of each node, these representations are input into the multilayer perceptron prediction head, which outputs the financial risk prediction results. During the end-to-end training phase, the multilayer perceptron prediction head employs a loss function that includes a task-supervised learning loss term, a variational information bottleneck loss term, a dynamic structural sparsity penalty term, and a temporal smoothing regularization term. The task-supervised learning loss term represents the deviation between the financial risk prediction results and the actual risk labels; the variational information bottleneck loss term is calculated based on the distribution of node representations; the dynamic structural sparsity penalty term is calculated based on the gating value; and the temporal smoothing regularization term is calculated based on the gating values of adjacent time steps.
[0190] Figure 2 This is a schematic diagram of the financial risk prediction framework provided in this application. This framework is used to implement the financial risk prediction method provided in the foregoing embodiments, wherein solid arrows represent forward data flow and dashed arrows represent backward gradient flow; as shown... Figure 2 As shown, the financial risk prediction framework includes: a data acquisition and preprocessing module, a time-series heterogeneous graph construction module, a dynamic structure optimization module, a time-series-aware graph neural network module, and a prediction output module.
[0191] The data acquisition and preprocessing module reads a multi-table relational database, performs metadata parsing, timestamp extraction, and feature encoding normalization. The time-series heterogeneous graph construction module completes tuple-node mapping and foreign key-heterogeneous edge mapping, and performs time-series consistency pruning (only retaining information before prediction time tn, filtering future information) to obtain a heterogeneous time-series graph. The dynamic structure optimization module includes three sub-modules: dual-timescale adaptive gating, node adaptive chain length, and temporary shortcut edge injection, to realize gating filtering, differential backtracking, and temporary edge injection of nodes and features in the graph structure. The time-series-aware graph neural network module includes a time decay attention layer and a heterogeneous message passing aggregation layer, which are stacked to output the final node representation. The prediction output module uses an MLP prediction head, takes the node representation as input, and outputs the financial risk prediction result, such as a risk probability of 0.87.
[0192] Specifically, the data acquisition and preprocessing module reads various data tables in the relational database, including user tables, account tables, transaction tables, device tables, etc., as well as the metadata and foreign key constraint information of the data tables. The metadata includes table name, fields, types, etc., and extracts the timestamps of the data tables. The extracted data is then feature-encoded and normalized to obtain the initial feature vector of the nodes.
[0193] The dual-timescale adaptive gating submodule consists of a time encoder and a gating prediction network, outputting column-level gating values (vectors of 0s and 1s) and table-level gating values (e.g., 0.7) to perform filtering at both the feature and node levels. The node adaptive chain length submodule, based on node historical characteristics including transaction frequency, average transaction amount, and risk score, calculates the backtracking chain length using a chain length calculation function. Using this backtracking chain length, it obtains the temporal backtracking edge for that node, enabling differentiated temporal backtracking for each node. The temporary shortcut edge injection submodule, through burst detection, identifies newly added nodes and risky nodes. It uses a comparison of the number of newly added nodes with a threshold to determine whether a mutation mode has been entered. If a mutation mode is entered, a temporary shortcut edge with dynamically decaying weights is injected between the node and its nearest risky node.
[0194] The time decay attention layer calculates the time decay factor and assigns high weight to recent interactions and low weight to long-term interactions; the heterogeneous message passing aggregation layer performs heterogeneous message passing aggregation, which integrates three types of edge relationships: original relationships, time-series backtracking edges, and temporary shortcut edges; after L layers of stacking operations, the final node representation is output.
[0195] The model performs end-to-end joint optimization, adding the task loss (corresponding to the task-supervised learning loss term), variational information bottleneck loss, dynamic structure sparsity penalty, and temporal smoothing regularization term to obtain the total loss. The gradient is then backpropagated to each module through backpropagation to update the parameters of each module synchronously.
[0196] Bottom-end joint optimization link: The total loss is obtained by weighted summation of the task-supervised learning loss term, variational information bottleneck loss term, dynamic structure sparsity penalty term, and temporal smoothing regularization term; the total loss is backpropagated to backpropagate the gradient to all upstream modules, realizing end-to-end joint training of the overall framework.
[0197] In accordance with the methods provided in the foregoing embodiments, this application also provides an apparatus. Figure 3 A schematic diagram of the financial risk prediction device provided in this application is shown below. Figure 3 As shown, the financial risk prediction device provided in this embodiment includes:
[0198] The temporal heterogeneous graph acquisition module is used to obtain the temporal heterogeneous graph corresponding to the financial transaction relationship database; wherein, the temporal heterogeneous graph includes multiple nodes and the node initial feature vector corresponding to each node;
[0199] The time encoding module encodes the current time to obtain time feature vectors at multiple scales. The gating prediction module inputs the time feature vectors at each scale into the gating prediction network to obtain column-level and table-level gating values at each scale. The gating fusion module fuses the column-level and table-level gating values at each scale using fusion weights to obtain fused column-level and fused table-level gating values. The feature and node filtering module filters the initial feature vectors and nodes of the temporal heterogeneous graph based on the fused column-level and fused table-level gating values to obtain a filtered temporal heterogeneous graph. The node representation extraction module extracts the node representation of each node from the filtered temporal heterogeneous graph. The risk prediction module generates financial risk prediction results based on the node representation of the corresponding node of the target object.
[0200] In one possible embodiment, the gating prediction module is specifically used for:
[0201] For each node type, the time feature vector corresponding to each scale is mapped to the log odds value at each scale through the multilayer perceptron corresponding to that node type; differentiable sampling is performed on the log odds value at each scale to obtain the column-level gate value and table-level gate value of the node type at each scale.
[0202] In one possible embodiment, the feature and node filtering module is specifically used for:
[0203] For each node type, the initial feature vectors of each node of the node type are filtered based on the fusion column-level gate value corresponding to the node type to obtain the node feature vectors of each node of the node type; the nodes of the node type are filtered based on the fusion table-level gate value corresponding to the node type to remove the corresponding nodes and their connected directed edges to obtain the filtered temporal heterogeneous graph; wherein, the filtered temporal heterogeneous graph includes the retained nodes and node feature vectors.
[0204] In one possible embodiment, the node representation extraction module includes:
[0205] The backtracking chain length determination unit is used to determine the backtracking chain length of each node in the filtered temporal heterogeneous graph based on the node's historical transaction data. The temporal edge set construction unit is used to extract historical records from the node's historical record sequence based on the node's backtracking chain length, and to construct the temporal edge set of the corresponding node based on the extracted historical records. The temporal edge merging unit is used to merge the temporal edge sets of each node into the filtered temporal heterogeneous graph to obtain the temporal enhanced heterogeneous graph. The node representation extraction unit is used to extract the node representation of each node based on the temporal enhanced heterogeneous graph.
[0206] In one possible embodiment, the backtracking chain length determination unit is specifically used for:
[0207] Based on the node's historical transaction data, determine the node's historical activity and transaction amount indicators; obtain the node's risk score; and based on the node's risk score, historical activity, and transaction amount indicators, determine the node's backtracking chain length.
[0208] In one possible embodiment, the node representation extraction unit includes:
[0209] The temporary edge injection subunit is used to count the number of newly added nodes of each node type within the detection window. If the number of newly added nodes is greater than the product of a preset coefficient and the historical average addition rate of the node type, a temporary shortcut edge is constructed between the newly added node and the risk node in the time-series enhanced heterogeneous graph, and the weight of the temporary shortcut edge is configured to obtain the dynamically enhanced heterogeneous graph. Among them, the risk node is a node with historical risk records. The weight configured for the temporary shortcut edge decays with the duration of the temporary shortcut edge. The node representation extraction subunit is used to extract the node representation of each node based on the dynamically enhanced heterogeneous graph.
[0210] In one possible embodiment, the device further includes a temporary table period management module for:
[0211] Configure a lifetime for temporary shortcut edges; after the duration of a temporary shortcut edge reaches the configured lifetime, remove the temporary shortcut edge and its dynamic weight from the dynamically enhanced heterogeneous graph.
[0212] In one possible embodiment, the node represents the extraction sub-unit, specifically used for:
[0213] The dynamically enhanced heterogeneous graph is input into the graph neural network. The graph neural network calculates the time interval between the source node and the target node in the message passing path, and calculates the time decay factor of the message passing path based on the time interval and the time decay rate. In the message passing layer of the graph neural network, the node feature vectors of each node are time-weighted based on the time decay factor and the node feature vectors are updated. After processing through multiple message passing layers, the node representation of each node is obtained.
[0214] In one possible embodiment, when the node representation extraction subunit performs time-series weighting on the node feature vectors of each node based on the time decay factor and updates the node feature vectors, it is specifically used for:
[0215] For each node in the dynamically enhanced heterogeneous graph, determine the neighbor nodes of the node under multiple relation types; call the message function corresponding to the relation type, and generate the neighbor message of the node under the relation type based on the node feature vector of the neighbor node of the node under the relation type and the node feature vector of the node; weight the neighbor message based on the time decay factor, and aggregate the weighted neighbor message under multiple relation types to obtain the aggregated neighbor message; update the node feature vector of the node according to the aggregated neighbor message.
[0216] In one possible embodiment, the risk prediction module is specifically used for:
[0217] The node representations of each node are input into the multilayer perceptron prediction head to obtain the financial risk prediction result. The loss function of the multilayer perceptron prediction head during end-to-end training includes: task-supervised learning loss term, variational information bottleneck loss term, dynamic structural sparsity penalty term, and temporal smoothing regularization term. The task-supervised learning loss term is used to represent the deviation between the financial risk prediction result and the true risk label. The variational information bottleneck loss term is calculated based on the distribution of node representations and is used to filter redundant information in node representations. The dynamic structural sparsity penalty term is calculated based on the gate value and is used to impose sparsity constraints on the gate value, causing the graph structure to tend to be sparse. The temporal smoothing regularization term is calculated based on the gate value of adjacent time steps and is used to constrain the change range of the gate value of adjacent time steps.
[0218] In one possible embodiment, the time-series heterogeneity graph acquisition module is specifically used for:
[0219] Multiple business data tables are read from a financial transaction database, and the metadata of each business data table and the foreign key constraints between the tables are parsed. For each data record in each business data table, the timestamp of the data record is extracted, the numerical features in the data record are normalized, and the categorical features in the data record are encoded to obtain preprocessed data features. Based on the metadata of each business data table, the node type is determined, and the business entity corresponding to each data record is mapped to a node of the corresponding node type. The preprocessed data features of the data record are used as the initial feature vector of the node. According to the foreign key constraints between the data tables, directed edges of corresponding relationship types are constructed between nodes of different node types to form a heterogeneous graph structure. Based on the timestamp of each data record, the nodes and edges in the heterogeneous graph structure are grouped to construct time-series subgraphs at different time steps, resulting in a time-series heterogeneous graph.
[0220] The financial risk prediction device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0221] Figure 4A schematic diagram of the structure of the electronic device provided in this application. Figure 4 As shown, the electronic device 40 provided in this embodiment includes at least one processor 401 and a memory 402. Optionally, the electronic device 40 further includes a communication component 403. The processor 401, memory 402, and communication component 403 are connected via a bus 404.
[0222] In a specific implementation, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to perform the above-described method.
[0223] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0224] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0225] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0226] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0227] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0228] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0229] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0230] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0231] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0232] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0233] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0234] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0235] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0236] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A financial risk prediction method, characterized in that, include: Obtain the temporal heterogeneous graph corresponding to the financial transaction relationship database; wherein, the temporal heterogeneous graph includes multiple nodes and the node initial feature vector corresponding to each node; Time encoding is performed on the current time to obtain time feature vectors at multiple scales; Input the time feature vectors of each scale into the gated prediction network to obtain the column-level gate value and the table-level gate value at each scale; By fusing weights, the column-level gate values and table-level gate values at each scale are fused to obtain the fused column-level gate value and the fused table-level gate value. The initial feature vectors and nodes of the temporal heterogeneous graph are filtered based on the fused column-level gate value and the fused table-level gate value, respectively, to obtain the filtered temporal heterogeneous graph; Based on the filtered temporal heterogeneous graph, the node representation of each node is extracted. Financial risk prediction results are generated based on the node representation of the target object's corresponding node.
2. The method according to claim 1, characterized in that, The step of inputting the temporal feature vectors at each scale into the gated prediction network to obtain column-level and table-level gate values at each scale includes: For each node type, the time feature vector corresponding to each scale is mapped to the log odds value at each scale through the multilayer perceptron corresponding to the node type. Differentiable sampling is performed on the log-probability values at each scale to obtain the column-level gating value and table-level gating value of the node type at each scale.
3. The method according to claim 2, characterized in that, The process of filtering the initial feature vectors and nodes of the temporal heterogeneous graph based on the fused column-level gating value and the fused table-level gating value respectively to obtain the filtered temporal heterogeneous graph includes: For each node type, based on the fusion column-level gate value corresponding to the node type, the initial feature vector of each node of the node type is filtered to obtain the node feature vector of each node of the node type. Based on the fusion table-level gating value corresponding to the node type, the nodes of the node type are filtered, and the corresponding nodes and their connected directed edges are removed to obtain the filtered temporal heterogeneous graph; wherein, the filtered temporal heterogeneous graph includes the retained nodes and node feature vectors.
4. The method according to claim 1, characterized in that, The node representation of each node in the filtered temporal heterogeneous graph is extracted, including: For each node in the filtered temporal heterogeneous graph, the backtracking chain length of the node is determined based on the node's historical transaction data. Based on the backlink length of the node, extract historical records from the historical record sequence of the node; Based on the extracted historical records, construct a set of temporal edges for the corresponding nodes; The temporal edge sets of each node are merged into the filtered temporal heterogeneous graph to obtain a temporal enhanced heterogeneous graph; Based on the aforementioned time-enhanced heterogeneous graph, node representations of each node are extracted.
5. The method according to claim 4, characterized in that, Determining the backlink length of a node based on its historical transaction data includes: Based on the node's historical transaction data, determine the node's historical activity and transaction amount indicators; Obtain the risk score of the node; The backtracking chain length of the node is determined based on the node's risk score, historical activity, and transaction amount.
6. The method according to claim 4, characterized in that, The step of extracting node representations for each node based on the time-enhanced heterogeneous graph includes: For each node type, count the number of newly added nodes of that node type within the detection window; If the number of newly added nodes is greater than the product of a preset coefficient and the historical average addition rate of the node type, a temporary shortcut edge is constructed between the newly added nodes of the node type and the risk nodes in the time-series enhanced heterogeneous graph, and the weight of the temporary shortcut edge is configured to obtain a dynamically enhanced heterogeneous graph; wherein, the risk node is a node with historical risk records; the weight configured for the temporary shortcut edge decays with the duration of the temporary shortcut edge. Based on the dynamically enhanced heterogeneous graph, node representations of each node are extracted.
7. The method according to claim 6, characterized in that, The method further includes: Configure a lifecycle for the temporary shortcut edge; Once the duration of the temporary shortcut edge reaches the configured lifetime, the temporary shortcut edge and its dynamic weight in the dynamically enhanced heterogeneous graph are removed.
8. The method according to claim 6, characterized in that, The step of extracting node representations for each node based on the dynamically enhanced heterogeneous graph includes: The dynamically enhanced heterogeneous graph is input into a graph neural network. The graph neural network calculates the time interval between the source node and the target node in each message passing path of the dynamically enhanced heterogeneous graph. Based on the time interval and the time decay rate, the time decay factor of the message passing path is calculated. In the message passing layer of the graph neural network, based on the time decay factor, the node feature vectors of each node are time-weighted and updated; after processing through multiple message passing layers, the node representation of each node is obtained.
9. The method according to claim 8, characterized in that, The step of performing time-series weighted processing on the node feature vectors of each node based on the time decay factor and updating the node feature vectors includes: For each node in the dynamically enhanced heterogeneous graph, determine the neighbor nodes of the node under multiple relation types; Call the message function corresponding to the relationship type, and generate the neighbor message of the node under the relationship type based on the node feature vector of the node's neighbor nodes in the relationship type and the node feature vector of the node; The neighbor messages are weighted based on the time decay factor, and the weighted neighbor messages under the multiple relation types are aggregated to obtain aggregated neighbor messages; The node feature vector of the node is updated based on the aggregated neighbor messages.
10. The method according to any one of claims 1-9, characterized in that, The generation of financial risk prediction results based on the node representation of the target object's corresponding node includes: The node representation of the node corresponding to the target object is input into the multilayer perceptron prediction head to obtain the financial risk prediction result; The loss function of the multilayer perceptron prediction head during end-to-end training includes: task-supervised learning loss term, variational information bottleneck loss term, dynamic structure sparsity penalty term, and temporal smoothing regularization term. The task-supervised learning loss term is used to characterize the deviation between the financial risk prediction result and the true risk label; The variational information bottleneck loss term is calculated based on the distribution of the node representation and is used to filter redundant information in the node representation. The dynamic structure sparsity penalty term is calculated based on the gate value and is used to apply sparsity constraints to the gate value, causing the graph structure to tend to be sparse. The temporal smoothing regularization term is calculated based on the gate values of adjacent time steps and is used to constrain the variation range of the gate values of adjacent time steps.
11. The method according to any one of claims 1-10, characterized in that, The acquisition of the time-series heterogeneous graph corresponding to the financial transaction relationship database includes: Multiple business data tables are read from the financial transaction relationship database, and the metadata of each business data table and the foreign key constraint relationships between the data tables are parsed. For each data record in each business data table, the timestamp of the data record is extracted, the numerical features in the data record are normalized, and the categorical features in the data record are encoded to obtain preprocessed data features. The node type is determined based on the metadata of each business data table. The business entity corresponding to each data record is mapped to a node of the corresponding node type, and the preprocessed data features of the data record are used as the initial feature vector of the node. Based on the foreign key constraints between the data tables, directed edges of corresponding relationship types are constructed between nodes of different node types to form a heterogeneous graph structure; Based on the timestamps of each data record, the nodes and edges in the heterogeneous graph structure are grouped to construct temporal subgraphs at different time steps, thus obtaining the temporal heterogeneous graph.
12. A financial risk prediction device, characterized in that, include: A temporal heterogeneous graph acquisition module is used to acquire a temporal heterogeneous graph corresponding to a financial transaction relationship database; wherein, the temporal heterogeneous graph includes multiple nodes and the node initial feature vector corresponding to each node; The time encoding module is used to time-encode the current time to obtain time feature vectors at multiple scales. The gating prediction module is used to input the time feature vectors of each scale into the gating prediction network to obtain the column-level gating value and the table-level gating value at each scale. The gating fusion module is used to fuse column-level gating values and table-level gating values at each scale using fusion weights, to obtain fused column-level gating values and fused table-level gating values. The feature and node filtering module is used to filter the initial feature vectors and nodes of the temporal heterogeneous graph based on the fused column-level gate value and the fused table-level gate value, respectively, to obtain the filtered temporal heterogeneous graph. The node representation extraction module is used to extract the node representation of each node based on the filtered temporal heterogeneous graph. The risk prediction module is used to generate financial risk prediction results based on the node representation of the target object's corresponding node.
13. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-11.
15. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-11.
