Safety risk counterfactual reasoning method based on causal guidance and physical hard constraint

CN122839128APending Publication Date: 2026-09-29ZHONGDIAN XINGYUAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611307665.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-27
Publication Date
2026-09-29

AI Technical Summary

Technical Problem

[0011]为了实现上述目的,一种基于因果引导与物理硬约束的安全风险反事实推演方法,适用于工业现场,所述方法包括以下步骤:获取目标工业现场的多变量时序运行数据及其对应的风险标签,根据多变量时序运行数据中各运行变量之间的条件独立关系和时间优先关系,构建用于表征各运行变量之间的风险传导方向的时序因果图;基于风险标签,采用与样本类别相关的非对称重尾噪声调度策略对多变量时序运行数据进行前向加噪,并基于加噪后的多变量时序运行数据训练去噪网络,得到风险时序生成模型;获取针对目标风险诱因的反事实设定,基于目标风险诱因的反事实设定,利用风险时序生成模型进行反向去噪采样;在反向去噪采样过程中,根据时序因果图确定因果约束信息,基于因果约束信息对反向去噪采样过程中的生成方向进行修正,使生成的中间运行状态沿时序因果图表征的风险传导方向演化,将生成的中间运行状态代入与目标工业现场对应的物理约束关系,确定中间运行状态的物理残差,在物理残差不满足预设的物理可行条件的情况下,回退至前一个满足物理可行条件的中间运行状态,并对中间运行状态重新进行采样,直至重新采样得到的中间运行状态满足物理可行条件;重复执行反向去噪采样过程,最终得到目标风险诱因对应的至少一条满足风险传导方向和物理可行条件的风险演进路径,并基于风险演进路径确定目标风险诱因对应的安全风险反事实推演结果

Benefits of technology

[0021]本申请提出的一种基于因果引导与物理硬约束的安全风险反事实推演方法,与传统的工业安全分析方法相比,实现了以下提升。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122839128A_ABST
    Figure CN122839128A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of industrial safety and the technical field of generative artificial intelligence, in particular to a safety risk counterfactual reasoning method based on causal guidance and physical hard constraints, which comprises the following steps: acquiring multivariate time sequence operation data of a target industrial site and a corresponding risk label, constructing a time sequence causal graph according to conditional independent relations and time priority relations among operation variables; based on the risk label, performing forward noise addition on the multivariate time sequence operation data by adopting an asymmetric heavy-tailed noise scheduling strategy related to a sample category, training a noise removal network, and obtaining a risk time sequence generation model; acquiring a counterfactual setting for a target risk inducement, performing reverse noise removal sampling in combination with the risk time sequence generation model, finally obtaining at least one risk evolution path corresponding to the target risk inducement and satisfying a risk transmission direction and a physical feasible condition, and determining a safety risk counterfactual reasoning result corresponding to the target risk inducement based on the risk evolution path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of industrial safety technology and generative artificial intelligence technology, and in particular to a method for counterfactual inference of safety risks based on causal guidance and physical hard constraints. Background Technology

[0002] Industrial production processes typically involve multiple operating parameters such as temperature, pressure, flow rate, and vibration. These parameters are strongly coupled and continuously change with the production process. In industrial settings such as refining, chemical, power, and metallurgy, multiple sensors are typically used to continuously collect equipment operating data, and the collected multidimensional time-series data is used for equipment status monitoring and safety risk analysis.

[0003] Major leaks, explosions, and equipment failures are typically low-probability events. While a large amount of normal operating condition data can be obtained during actual production, historical data corresponding to accident conditions and their evolution is relatively scarce. Therefore, industrial safety data often exhibits a pronounced long-tail distribution. Furthermore, industrial accidents are usually not directly caused by a single parameter anomaly, but rather by the gradual transmission of abnormal factors among multiple operating parameters, ultimately leading to an accident state. Therefore, industrial safety analysis not only needs to determine the existence of risks but also needs to extrapolate the risk evolution path after a specific abnormal factor occurs or worsens.

[0004] In existing technologies, the most commonly used industrial safety analysis methods typically establish equipment operation models based on physical mechanisms such as thermodynamics, fluid mechanics, and dynamics, and simulate equipment state changes by solving corresponding equations. While these methods offer strong physical interpretation, they require the establishment of highly complex mechanistic models for high-dimensional, multivariable, and strongly coupled industrial systems. This process is computationally very costly and struggles to cover factors such as equipment aging, operational deviations, and non-standard operating conditions.

[0005] Another type of approach employs data-driven models such as Long Short-Term Memory (LSTM) networks and Transformers to learn from historical time-series data in order to predict future operating parameters or the probability of failure. However, these models are typically optimized based on the overall sample error. When the number of normal operating condition samples far exceeds the number of accident samples, the model parameters are mainly influenced by the normal samples, making it difficult to fully learn the extreme risk characteristics corresponding to accident samples. Therefore, this type of model has very limited ability to represent low-probability, high-hazard risk states and accident evolution patterns that have not been fully observed in historical data, making it difficult to meet practical needs.

[0006] Furthermore, existing data-driven models primarily learn the statistical correlations between different variables, making it difficult to further distinguish between causal and outcome variables in the risk evolution process. When multiple operating parameters are affected by common factors, even if the parameters are strongly correlated, it does not necessarily mean that they have a corresponding causal transmission relationship. Therefore, when generating a continuous risk evolution process, situations may occur where outcome variables change abnormally before causal variables, leading to inconsistencies between the generated path and the actual risk transmission sequence.

[0007] To obtain continuous industrial time-series scenarios, existing technologies employ diffusion generation models, generating future operational states through forward noise addition and backward denoising. However, conventional diffusion models typically use a uniform linear or cosine noise scheduling method, treating normal and accident samples the same. When the number of accident samples is small, the generation model still primarily learns the data distribution under normal operating conditions, making it difficult to fully generate extreme risk evolution paths. Furthermore, its backward sampling process mainly relies on random generation based on data distribution, lacking explicit constraints on the causal transmission direction of risk variables, and making it difficult to extrapolate subsequent risk processes based on specified abnormal triggers.

[0008] To improve the consistency between the generated results and industrial physical laws, some existing technologies further convert thermodynamic equations and fluid dynamics equations into physical residuals, which are then used as loss terms in model training. However, this approach is essentially a soft constraint, requiring a trade-off between data fitting loss and physical residual loss during model training. It is difficult to guarantee that every intermediate state in the generation process meets the preset physical conditions. Especially in the multi-step backsampling process of diffusion models, if a local generated state deviates from the physically feasible range, it may further affect the generation of subsequent risk paths.

[0009] It is evident that existing industrial safety risk simulation technologies still struggle to simultaneously address the generation of extreme risk states, constraints on the order of risk transmission, continuous counterfactual simulations under specified abnormal triggers, and physical feasibility control during the generation process, given a limited sample size of accidents. Consequently, the reliability of the generated results still needs improvement. Summary of the Invention

[0010] To address the aforementioned technical issues, embodiments of this application propose a counterfactual inference method for safety risks based on causal guidance and physical hard constraints. This method aims to achieve end-to-end counterfactual inference for industrial safety that integrates causal inference, improved diffusion generation, and real-time physical hard verification. Under the condition of a small number of accident samples, it can stably output multiple fault evolution paths that simultaneously satisfy causal timing, physical laws, and extreme risk characteristics.

[0011] To achieve the above objectives, a counterfactual inference method for safety risks based on causal guidance and physical hard constraints is proposed, applicable to industrial sites. The method includes the following steps: acquiring multivariate time-series operational data of the target industrial site and its corresponding risk labels; constructing a time-series causal graph to characterize the risk transmission direction among operational variables based on the conditional independence and time priority relationships among the operational variables in the multivariate time-series operational data; adding forward noise to the multivariate time-series operational data based on the risk labels using an asymmetric heavy-tailed noise scheduling strategy related to the sample category, and training a denoising network based on the denoised multivariate time-series operational data to obtain a risk time-series generation model; acquiring counterfactual settings for the target risk triggers; and performing reverse denoising sampling using the risk time-series generation model based on the counterfactual settings of the target risk triggers; during the reverse denoising sampling process... The process involves determining causal constraint information based on a time-series causal graph, correcting the generation direction during the reverse denoising sampling process based on this information, and ensuring that the generated intermediate operating states evolve along the risk transmission direction represented by the time-series causal graph. The generated intermediate operating states are then substituted into the physical constraint relationships corresponding to the target industrial site to determine the physical residuals. If the physical residuals do not meet the preset physical feasibility conditions, the process reverts to the previous intermediate operating state that meets the physical feasibility conditions and resamples the intermediate operating states until the resampled intermediate operating states meet the physical feasibility conditions. This reverse denoising sampling process is repeated until at least one risk evolution path that satisfies both the risk transmission direction and the physical feasibility conditions is obtained for the target risk trigger. Based on the risk evolution path, the counterfactual inference result of the safety risk corresponding to the target risk trigger is determined.

[0012] To achieve the above objectives, embodiments of this application also propose a counterfactual inference system for safety risks based on causal guidance and physical hard constraints, applicable to industrial sites, for implementing the aforementioned counterfactual inference method for safety risks based on causal guidance and physical hard constraints. The system includes: a time-series causal graph construction module, used to acquire multivariate time-series operational data of the target industrial site and its corresponding risk labels, and construct a time-series causal graph to characterize the risk transmission direction among the operational variables based on the conditional independence and time priority relationships among the operational variables in the multivariate time-series operational data; a forward noise addition module, used to add forward noise to the multivariate time-series operational data based on the risk labels using an asymmetric heavy-tailed noise scheduling strategy related to the sample category, and train a denoising network based on the noise-added multivariate time-series operational data to obtain a risk time-series generation model; and a reverse denoising module, used to acquire counterfactual settings for the target risk triggers, and based on the counterfactual settings for the target risk triggers... The method involves using a risk time-series generation model for reverse denoising sampling. During this process, causal constraint information is determined based on a time-series causal graph. The generation direction is then corrected based on this causal constraint information, causing the generated intermediate operating states to evolve along the risk transmission direction represented by the time-series causal graph. The generated intermediate operating states are then substituted with the physical constraints corresponding to the target industrial site to determine the physical residuals. If the physical residuals do not meet the preset physical feasibility conditions, the method reverts to the previous intermediate operating state that meets the physical feasibility conditions and resamples the intermediate operating states until the resampled intermediate operating states meet the physical feasibility conditions. A result output module is used to repeatedly execute the reverse denoising sampling process, ultimately obtaining at least one risk evolution path corresponding to the target risk cause that satisfies the risk transmission direction and physical feasibility conditions. Based on the risk evolution path, the method determines the counterfactual inference result of the safety risk corresponding to the target risk cause.

[0013] To achieve the above objectives, embodiments of this application also propose an electronic device, including a processor and a memory, wherein the memory stores instructions executable by the processor, and the processor is configured to execute the instructions such that the electronic device can implement a security risk counterfactual deduction method based on causal guidance and physical hard constraints as described above.

[0014] To achieve the above objectives, embodiments of this application also propose a computer-readable storage medium storing a computer program that, when executed by a processor, enables a security risk counterfactual deduction method based on causal guidance and physical hard constraints as described above.

[0015] Optionally, acquire multivariate time-series operational data of the target industrial site and its corresponding risk labels. Based on the conditional independence and time priority relationships among the operational variables in the multivariate time-series operational data, construct a time-series causal graph to characterize the risk transmission direction among the operational variables, including: Obtain multivariate time-series operational data and corresponding risk labels from the target industrial site. Let the multivariate time-series operational data be... , , Let the risk label be , ; in, For the first Multivariate time-series running data at each time step The total number of time steps. For dimension space, The number of runtime variables, This indicates normal operating conditions. Indicates the accident conditions; Perform a conditional independence test on any two running variables, and remove the connection edges between running variables that satisfy the conditional independence relationship based on the conditional independence test results to obtain the skeleton of the cause-effect graph; Obtain the state change times of two running variables that are connected in the skeleton of the cause-effect graph. Determine the direction of the connecting edge according to the time priority relationship between the state change times, so that the state change time of the running variable as the cause is earlier than the state change time of the running variable as the result. Directed connections are used as causal edges. A directed acyclic temporal causal graph is constructed based on the causal graph skeleton and causal edges, and the corresponding causal adjacency matrix is ​​determined. , ; in, for The Middle Line number Column elements, Indicates the existence of the first The runtime variable points to the first... Causal relationships between runtime variables, For dimension The space.

[0016] Optionally, based on risk labels, an asymmetric heavy-tailed noise scheduling strategy related to sample categories is used to forward-noise the multivariate time-series running data, and a denoising network is trained based on the noisy multivariate time-series running data to obtain a risk time-series generation model, including: Based on time step and risk labels Determine the corresponding noise scheduling parameters , is represented as: ; in, and These are the lower and upper limits of the noise scheduling parameters, respectively. This is the preset extreme magnification factor. , These are sampled values ​​from a Pareto heavy-tailed distribution. This is the lower bound parameter for the scale of the Pareto heavy-tailed distribution. The shape parameter of the Pareto heavy-tailed distribution; Based on noise scheduling parameters Determine cumulative scheduling parameters , is represented as: ; in, From 1 to Virtual time steps between; Based on cumulative scheduling parameters Asymmetric forward noise is added to both normal operating condition samples and accident operating condition samples, and then the noise is adjusted according to the loss function. Train the denoising network until convergence to obtain the risk time series generation model; Represented as: ; in, This represents the original multivariate time-series runtime data, that is, the original runtime state. This indicates the noise added during forward noise generation. This represents a denoising network. Indicates to , , , Seeking expectations.

[0017] Optionally, causal constraint information is determined based on the time-series causal graph, and the generation direction in the reverse denoising sampling process is corrected based on the causal constraint information, so that the generated intermediate operating state evolves along the risk transmission direction represented by the time-series causal graph, including: Construct a causal potential function based on the causal relationship edges in the time-series causal graph, at time step... The causal potential function is denoted as , is represented as: ; in, Let be the set of edges with causal relationships. Indicates the first One running variable For the first One running variable Cause variables, Given a linear rectified function, during the reverse denoising sampling process, for time step... , This is referred to as the currently generated intermediate running state; At time step Based on the currently generated intermediate running state Calculate the causal potential function with respect to the currently generated intermediate running state. The causal gradient, denoted as ; Injecting causal gradients into the backsampling process of the risk time series generation model allows the intermediate running states obtained through backsampling to be processed. By satisfying causal constraints, the intermediate operating states that violate the risk transmission direction represented by the generated temporal causal graph are corrected. Causal constraints are expressed as: ; ; in, For risk time series generation model in the first The sampling mean determined at each time step, The preset causal guidance strength coefficient, The larger the value, the stronger the causal constraint. This is the covariance matrix during the backsampling process. For the first Random noise scale at each time step Let be a random noise vector sampled from a standard normal distribution. For the first The cumulative scheduling parameters for each time step. for abbreviation, for abbreviation, It is an identity matrix.

[0018] Optionally, the generated intermediate operating states are substituted into the physical constraints corresponding to the target industrial site to determine the physical residuals of the intermediate operating states. If the physical residuals do not meet the preset physical feasibility conditions, the process reverts to the previous intermediate operating state that meets the physical feasibility conditions, and the intermediate operating states are resampled until the resampled intermediate operating states meet the physical feasibility conditions, including: Obtain at least one physical constraint function corresponding to the target industrial site. For candidate intermediate running states generated during the reverse denoising sampling process Calculate the candidate intermediate running states according to the following formula. Corresponding physical residuals : ; in, For physical residual functions, To obtain the L2 norm; physical residuals Compared with the preset physical residual threshold Compare; like Then accept the candidate intermediate running state. , that is to say and based on Continue with the reverse denoising sampling at the next time step; like Then reject the candidate intermediate running state. And trigger the intermediate running state of the candidate. The backsampling ensures that the candidate intermediate running states accepted during the reverse denoising sampling process meet the preset physical feasibility conditions.

[0019] Optionally, trigger a response to the candidate intermediate running state. The backsampling ensures that the accepted candidate intermediate running states during the reverse denoising sampling process meet preset physical feasibility conditions, including: Triggering the intermediate running state of the candidate After backsampling, calculate the physical residual. Compared to gradient ,based on A single-step gradient descent is performed into the physically feasible region, and annealing noise is added to obtain new candidate intermediate running states. , is represented as: ; ; in, The preset learning rate, This is the annealing temperature coefficient, which decreases with time. This represents the initial annealing temperature coefficient. The preset attenuation coefficient, To explore noise; The new candidate intermediate running state is calculated according to the following formula. The corresponding new physical residual : ; The new physical residual Compared with the preset physical residual threshold Compare; like Then accept the new candidate intermediate running state. , that is to say and based on Continue with the reverse denoising sampling at the next time step; like Then reject the new candidate intermediate running state. And trigger a new candidate intermediate running state. The backsampling ensures that the candidate intermediate running states accepted during the reverse denoising sampling process meet the preset physical feasibility conditions.

[0020] Optionally, the reverse denoising sampling process is repeated to obtain at least one risk evolution path corresponding to the target risk trigger that satisfies the risk transmission direction and physical feasibility conditions. Based on the risk evolution path, the counterfactual inference result of the safety risk corresponding to the target risk trigger is determined, including: Repeatedly execute the counterfactual setting corresponding to the same target risk factor. Second reverse denoising sampling, to obtain A risk evolution path that satisfies both the risk transmission direction and physical feasibility conditions; The set of risk evolution paths is denoted as , is represented as: ; in, The starting point of the counterfactual deduction. To determine the corresponding future time domain length in the counterfactual deduction, This represents the sequence number of the risk evolution path. For the first A risk evolution path; against Determine the first Frequency of exceeding limits for each running variable , is represented as: ; in, For the first One runtime variable, for The corresponding risk threshold, For indicator functions, when hour, , An index for future time steps; Determined based on the over-limit frequency of each operating variable. Corresponding risk entropy , is represented as: ; Among them, when At that time, it was agreed ; Based on the frequency of exceeding limits for each operating variable and the preset risk weights for each operating variable, determine Corresponding path risk value , is represented as: ; in, For the first Risk weights of each running variable , ; according to The path risk value corresponding to each risk evolution path is used to determine the risk prediction value corresponding to the target risk trigger. , ; Based on risk forecast values The confidence level was determined to be Risk confidence interval , is represented as: ; ; in, At the preset significance level, For degrees of freedom of Distribution critical value, for The sample standard deviation corresponding to the risk value of each path; According to the causal adjacency matrix Determine the causal contribution matrix by the gradient of future operating states relative to historical operating states. , is represented as: ; in, This indicates the Hadamard product. This represents the future operational state corresponding to the risk evolution path. This refers to the historical operating state before counterfactual deduction; According to the causal contribution matrix The contribution value corresponding to each causal relationship edge determines at least one key causal relationship edge, and the risk prediction value is then used to determine the key causal relationship edge. Risk confidence interval , Each risk evolution path and its corresponding path risk entropy are collectively determined as the counterfactual inference result of the security risk corresponding to the target risk cause and output.

[0021] This application proposes a counterfactual inference method for safety risks based on causal guidance and physical hard constraints, which achieves the following improvements compared with traditional industrial safety analysis methods.

[0022] First, it improves the ability to generate extreme risk scenarios with small sample sizes. Based on the risk labels corresponding to normal operating condition samples and accident operating condition samples, this application employs an asymmetric heavy-tailed noise scheduling strategy. This gives accident operating condition samples noise perturbation characteristics distinct from normal operating condition samples during the diffusion training process, thereby increasing the influence of accident samples on the parameter updates of the denoising network. This allows the risk time series generation model to more fully learn the extreme risk characteristics located at the tail of the data distribution. Even with a limited number of historical accident operating condition samples, it can still generate differentiated extreme risk evolution paths, improving the ability to extrapolate low-probability, high-hazard risk scenarios.

[0023] Second, it improves the causal rationality and interpretability of risk evolution paths. This application constructs a time-series causal graph based on the conditional independence and time priority relationships among various operating variables in multivariate time-series operational data. During the reverse denoising sampling process, causal constraint information is determined based on the time-series causal graph, and the generation direction is corrected. This ensures that the state changes of causal and outcome variables evolve according to the preset risk transmission direction. This reduces the problem of reversed order of risk causes and risks caused by generating based solely on statistical correlations of variables. The generated risk evolution path is more consistent with the actual transmission logic of industrial risks. At the same time, it can reflect the process of risk propagation from cause to effect through causal relationships, improving the interpretability of counterfactual inference results.

[0024] Third, it improves the physical feasibility of generated states during counterfactual simulation. Unlike soft constraints that only use physical equations as loss terms during model training, this application performs real-time physical residual verification on generated candidate intermediate operating states during the reverse denoising sampling process. When a candidate intermediate operating state does not meet the preset physical feasibility conditions, it is rejected, and the process reverts to the previous operating state that meets the physical feasibility conditions. New candidate intermediate operating states are obtained through physical correction and resampling until the preset physical feasibility conditions are met, at which point subsequent reverse denoising sampling continues. This suppresses the propagation of intermediate states that do not conform to thermodynamics, fluid mechanics, or other physical laws of the target industrial site, reducing the impact of non-physical risk paths on the final simulation results and improving the credibility of the safety risk counterfactual simulation results.

[0025] Fourth, it improves the controllability and decision support capabilities of counterfactual risk simulation. This application can set counterfactual conditions for specified target risk triggers and repeatedly execute risk path generation under the combined effect of causal and physical constraints to obtain multiple risk evolution paths corresponding to the target risk triggers. Furthermore, it determines the risk prediction results and corresponding uncertainty information based on these multiple risk evolution paths. Thus, it transforms the traditional generation of random risk scenarios into controllable counterfactual simulations oriented towards specified risk triggers, simultaneously outputting possible risk evolution trends and key risk transmission relationships, providing a more complete reference for accident trigger analysis, risk intervention location determination, and safety decision-making. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies of this application will be briefly introduced below. Obviously, the following drawings are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The drawings described herein are only used to explain this application and are not intended to limit this application.

[0027] Figure 1 This is a flowchart of a counterfactual inference method for security risks based on causal guidance and physical hard constraints, provided in one embodiment of this application; Figure 2 This is a schematic diagram of five sets of independently simulated hydrogen leakage risk values ​​provided in one embodiment of this application; Figure 3 This is a schematic diagram showing the top 3 risk contribution percentages of causal pathways provided in one embodiment of this application; Figure 4 This is a schematic diagram of the structure of a security risk counterfactual inference system based on causal guidance and physical hard constraints provided in another embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. Those skilled in the art will understand that many technical details have been presented in the embodiments of this application to facilitate better understanding. However, the technical solutions claimed in this application can be implemented even without these technical details and various variations and modifications based on the following embodiments. The division of the following embodiments is for ease of description and should not constitute any limitation on the specific implementation of this application. The following embodiments can be combined with and referenced by each other without contradiction.

[0029] In view of the four major defects of existing industrial safety timing simulation technology, namely, long-tail data failure, causal timing disorder, physical soft constraint distortion, and uncontrollable counterfactual simulation, this application aims to solve the following technical problems.

[0030] First, it addresses the problem that the scarcity of industrial accident samples and the long-tail distribution of data prevent conventional generative models from learning extreme risk distributions. Traditional linear or cosine noise scheduling treats normal and accident samples equally, resulting in the suppression of tail features in small samples, making it difficult for models to generate realistic extreme accident evolution paths.

[0031] Second, it addresses the problem that ordinary diffusion models only fit statistical correlations and lack causal time-series constraints, thus generating spurious paths that violate the logical sequence of risk transmission. Existing solutions lack mandatory constraints on the causal direction of variables, easily leading to logically inverted deductions such as temperature increases after leakage or pressure increases prior to increased vibration.

[0032] Third, address the problem of soft physical constraint failure in physical information neural networks. Existing technologies only use physical equations as training loss terms, without real-time verification and correction during the inference stage. To reduce loss, the model tolerates local physical violations, outputting a large number of invalid operating condition sequences that violate thermodynamics and fluid mechanics, resulting in severe false alarms.

[0033] Fourth, it addresses the issues of uncontrollable industrial risk simulations and the lack of explainable causal attribution. Traditional generative models use random sampling, making it impossible to conduct counterfactual hypothesis simulations based on specified fault causes, and they cannot pinpoint the core causal links of risk transmission, thus hindering precise intervention by safety officers.

[0034] To address the aforementioned technical problems, one embodiment of this application proposes a counterfactual inference method for safety risks based on causal guidance and physical hard constraints, applicable to industrial sites. The implementation details of this counterfactual inference method based on causal guidance and physical hard constraints are described below. These details are provided for ease of understanding and are not essential for implementing this solution.

[0035] The specific process of the counterfactual inference method for security risks based on causal guidance and physical hard constraints proposed in this embodiment can be as follows: Figure 1 As shown, it includes: Step 11: Obtain multivariate time-series operational data of the target industrial site and its corresponding risk labels. Based on the conditional independence and time priority relationships among the operational variables in the multivariate time-series operational data, construct a time-series causal graph to characterize the risk transmission direction among the operational variables.

[0036] In practical implementation, the first step in conducting counterfactual analysis of safety risks is to acquire multivariate time-series operational data (pressure, temperature, flow rate, etc.) of the target industrial site and their corresponding risk labels. Then, based on the conditional independence and time priority relationships among the operational variables in the multivariate time-series operational data, the Peter Clark conditional independence test algorithm is used to eliminate spurious correlations, retaining only causal edges with time priority (e.g., temperature increase → pressure increase, not the other way around), to construct a time-series causal graph representing the direction of risk transmission among the operational variables. This design ensures that the model understands the necessary sequence of risk transmission.

[0037] In one example, after obtaining the multivariate time-series operational data of the target industrial site and its corresponding risk labels, let the multivariate time-series operational data be... , , Let the risk label be , .in, For the first Multivariate time-series running data at each time step The total number of time steps. For dimension space, The number of operating variables, i.e., the dimensions of the sensors. This indicates normal operating conditions. This indicates an accident-related situation (which accounts for a very small percentage).

[0038] Next, conditional independence is tested for any two running variables. Based on the results of the conditional independence test, the connecting edges between running variables that satisfy the conditional independence relationship are removed, resulting in the skeleton of the causal graph.

[0039] Next, obtain the state change times corresponding to the two running variables that are connected in the cause-effect graph skeleton, and determine the direction of the connecting edge according to the time priority relationship between the state change times, so that the state change time of the running variable as the cause is earlier than the state change time of the running variable as the result.

[0040] Finally, directional connections are used as causal edges, and a directed acyclic temporal causal graph is constructed based on the causal graph skeleton and causal edges. , , This is a set of nodes, which is also a set of runtime variables. This is the set of edges, that is, the set of causal relationship edges, and it also determines the temporal causal graph. The corresponding causal adjacency matrix , .

[0041] in, for The Middle Line number Column elements, Indicates the existence of the first The runtime variable points to the first... Causal relationships between runtime variables, For dimension The space.

[0042] In one example, for any two runtime variables (the first...) The first running variable and the first Perform conditional independence tests on the given neighborhood set (each of the running variables). Next, calculate the partial correlation coefficient. ,like If the significance level is greater than the preset significance threshold (set to 0.05 based on experience), then the edge between the two is removed.

[0043] Step 12: Based on the risk label, an asymmetric heavy-tailed noise scheduling strategy related to the sample category is used to add noise to the multivariate time series running data in the forward direction, and a denoising network is trained based on the noisy multivariate time series running data to obtain the risk time series generation model.

[0044] In practical implementation, after constructing the temporal causal graph, an asymmetric heavy-tailed noise scheduling strategy related to sample categories can be used to forward-noise the multivariate temporal data based on risk labels. A denoising network is then trained based on the noisy multivariate temporal data to obtain a risk temporal generation model. The asymmetric heavy-tailed noise scheduling strategy forces the parameter space of the denoising network to tilt towards the "extreme tail data distribution" during training. During inference, simply increasing the scale of the initial noise allows the model to spontaneously generate high-confidence, diverse extreme accident evolution paths, completely solving the small sample failure problem.

[0045] In one example, during the forward noise addition process, it is first based on the time step. and risk labels Determine the corresponding noise scheduling parameters , is represented as: ; in, and These are the lower and upper limits of the noise scheduling parameters, respectively. This is the preset extreme magnification factor. (Based on experience, it can be set to 3.0). The sampled values ​​are from a Pareto heavy-tailed distribution, and their probability density function is: , , This is the lower bound parameter for the scale of the Pareto heavy-tailed distribution. The shape parameters of the Pareto heavy-tailed distribution (based on experiments and experience) It can be set to 1.0. It can be set to 1.2).

[0046] Next, based on the noise scheduling parameters Determine cumulative scheduling parameters , is represented as: ; in, From 1 to Virtual time steps between.

[0047] Then, based on the accumulated scheduling parameters Asymmetric forward noise is added to both normal operating condition samples and accident operating condition samples (also known as high-risk operating condition samples), and then the noise is adjusted according to the loss function. The denoising network is trained until convergence to obtain the risk time series generation model.

[0048] Represented as: ; in, This represents the original multivariate time-series runtime data, that is, the original runtime state. This indicates the noise added during forward noise generation. This represents a denoising network. Indicates to , , , Seeking expectations.

[0049] based on It is known that for accident case samples, the forward noise addition speed is extremely fast. This forces the denoising network to learn to identify the gradient direction of extreme distribution in the early time steps. Thus, during inference, as long as the initial noise is increased, the model will spontaneously generate extremely high-risk paths.

[0050] Step 13: Obtain the counterfactual setting for the target risk triggers, and perform reverse denoising sampling based on the counterfactual setting of the target risk triggers using the risk time series generation model.

[0051] Step 14: In the reverse denoising sampling process, causal constraint information is determined based on the time-series causal graph. The generation direction in the reverse denoising process is corrected based on the causal constraint information, so that the generated intermediate operating state evolves along the risk transmission direction represented by the time-series causal graph. The generated intermediate operating state is substituted into the physical constraint relationship corresponding to the target industrial site to determine the physical residual of the intermediate operating state. If the physical residual does not meet the preset physical feasibility conditions, it reverts to the previous intermediate operating state that meets the physical feasibility conditions and resamples the intermediate operating state until the resampled intermediate operating state meets the physical feasibility conditions.

[0052] In practical implementation, after forward denoising is completed, reverse denoising can begin. This involves obtaining counterfactual settings for the target risk factors and performing reverse denoising sampling using a risk time-series generation model based on these counterfactual settings. During reverse denoising sampling, causal constraint information is determined based on the time-series causal graph. The generation direction in the reverse denoising process is then corrected based on this causal constraint information, causing the generated intermediate operating states to evolve along the risk transmission direction represented by the time-series causal graph. The generated intermediate operating states are then substituted into the physical constraint relationships corresponding to the target industrial site to determine the physical residuals of the intermediate operating states. If the physical residuals do not meet the preset physical feasibility conditions, the process reverts to the previous intermediate operating state that meets the physical feasibility conditions and resamples the intermediate operating states until the resampled intermediate operating states meet the physical feasibility conditions.

[0053] Understandably, in the inference phase, traditional denoising diffusion probability models use random sampling. This embodiment explicitly adds a temporal causal graph Laplace regularization term to the score matching term in each denoising step. That is, when the model predicts the next state, if the predicted value causes the change in the parent node (cause) in the temporal causal graph to lag behind that of the child node (effect), a large gradient penalty is applied, forcibly "pulling" the erroneous path back onto a manifold that conforms to causal logic. This achieves counterfactual inference of risk.

[0054] It is important to note that both forward denoising and backward denoising use the same set of time steps. Forward denoising requires adding noise from the first time step to the second. At the [time step], reverse denoising requires starting from the [time step]. Adding noise to each time step and then to the first time step does not conflict with each other.

[0055] In one example, when correcting the generation direction in the reverse denoising sampling process, it is first necessary to construct a causal potential function based on the causal relationship edges in the temporal causal graph.

[0056] In this embodiment, time step The causal potential function is denoted as , is represented as: ; in, Let be the set of edges with causal relationships. Indicates the first One running variable For the first One running variable Cause variables, Given a linear rectified function, during the reverse denoising sampling process, for time step... , This is referred to as the currently generated intermediate running state.

[0057] Subsequently, in time step Based on the currently generated intermediate running state Calculate the causal potential function with respect to the currently generated intermediate running state. The causal gradient, denoted as .

[0058] Next, the causal gradient is injected into the backsampling process of the risk time series generation model, so that the intermediate running state obtained by backsampling is... By satisfying causal constraints, the intermediate operating states that violate the risk transmission direction represented by the generated temporal causal graph are corrected.

[0059] Causal constraints are expressed as: ; ; in, For risk time series generation model in the first The sampling mean determined at each time step, The preset causal guidance strength coefficient (which can be set to 0.5 based on experiments and experience). The larger the value, the stronger the causal constraint, and vice versa. This is the covariance matrix during the backsampling process. For the first Random noise scale at each time step Let be a random noise vector sampled from a standard normal distribution. For the first The cumulative scheduling parameters for each time step. for abbreviation, for abbreviation, It is an identity matrix.

[0060] This correction ensures that the direction of denoising at each step is "pulled" by the causal framework, and any generation path that attempts to violate the logic of temporal order will be pulled back to the legal manifold by the gradient term.

[0061] In one example, during the reverse denoising sampling process, at least one physical constraint function corresponding to the target industrial site is obtained. For candidate intermediate running states generated during the reverse denoising sampling process Calculate the candidate intermediate running states according to the following formula. Corresponding physical residuals : ; in, For physical residual functions, To obtain the L2 norm.

[0062] Next, the physical residuals Compared with the preset physical residual threshold Comparison (based on experiments and experience) It can be set to 0.05).

[0063] like Then accept the candidate intermediate running state. , that is to say and based on Continue with the inverse denoising sampling at the next time step.

[0064] like Then reject the candidate intermediate running state. And trigger the intermediate running state of the candidate. The backsampling ensures that the candidate intermediate running states accepted during the reverse denoising sampling process meet the preset physical feasibility conditions.

[0065] In one example, triggering a candidate intermediate running state After backsampling, the physical residuals need to be calculated. Compared to gradient ,based on A single-step gradient descent is performed into the physically feasible region, and annealing noise is added to obtain new candidate intermediate running states. , is represented as: ; ; in, The preset learning rate (based on experiments and experience, it can be set to 0.01). This is the annealing temperature coefficient, which decreases with time. This represents the initial annealing temperature coefficient. The preset attenuation coefficient (based on experiments and experience) It can be set to 1.0. It can be set to 0.1). To explore noise.

[0066] Next, calculate the new candidate intermediate running states according to the following formula. The corresponding new physical residual , .

[0067] Then, the new physical residuals Compared with the preset physical residual threshold Compare them.

[0068] like Then accept the new candidate intermediate running state. , that is to say and based on Continue with the inverse denoising sampling at the next time step.

[0069] like Then reject the new candidate intermediate running state. And trigger a new candidate intermediate running state. The backsampling ensures that the candidate intermediate running states accepted during the reverse denoising sampling process meet the preset physical feasibility conditions.

[0070] The backsampling mechanism prevents the model from outputting physically infeasible intermediate states. Even if the denoising network itself predicts non-physical values, it will be forcibly redirected due to hard truncation until it enters the threshold range. This is fundamentally different from simply using it as a loss term (allowing the final overall loss to be minimized but local physical violations).

[0071] Step 15: Repeat the reverse denoising sampling process to finally obtain at least one risk evolution path that satisfies the risk transmission direction and physical feasibility conditions corresponding to the target risk cause, and determine the counterfactual inference result of the safety risk corresponding to the target risk cause based on the risk evolution path.

[0072] In the specific implementation, we repeatedly execute the reverse denoising sampling process to finally obtain at least one risk evolution path that satisfies the risk transmission direction and physical feasibility conditions corresponding to the target risk cause, and determine the security risk counterfactual inference result corresponding to the target risk cause based on the risk evolution path.

[0073] In one example, the counterfactual setting corresponding to the same target risk factor is repeatedly executed. The reverse denoising sampling (based on experience, this can be repeated 5 times) yields... A risk evolution path that satisfies the risk transmission direction and physical feasibility conditions.

[0074] The set of risk evolution paths is denoted as , is represented as: ; in, The starting point of the counterfactual deduction. To determine the corresponding future time domain length in the counterfactual deduction, This represents the sequence number of the risk evolution path. For the first A risk evolution path.

[0075] against Determine the first Frequency of exceeding limits for each running variable , is represented as: ; in, For the first One runtime variable, for The corresponding risk threshold, For indicator functions, when hour, Conversely, it is 0. For indexing future time steps.

[0076] Determined based on the over-limit frequency of each operating variable. Corresponding risk entropy , is represented as: ; Among them, when At that time, it was agreed .

[0077] Based on the frequency of exceeding limits for each operating variable and the preset risk weights for each operating variable, determine Corresponding path risk value , is represented as: ; in, For the first Risk weights of each running variable , .

[0078] according to The path risk value corresponding to each risk evolution path is used to determine the risk prediction value corresponding to the target risk trigger. , .

[0079] Based on risk forecast values The confidence level was determined to be Risk confidence interval , is represented as: ; ; in, At the preset significance level, For degrees of freedom of Distribution critical value, for The sample standard deviation corresponding to each path risk value.

[0080] According to the causal adjacency matrix Determine the causal contribution matrix by the gradient of future operating states relative to historical operating states. , is represented as: ; in, This indicates the Hadamard product. This represents the future operational state corresponding to the risk evolution path. This refers to the historical operating state before the counterfactual deduction.

[0081] Finally, based on the causal contribution matrix The contribution value corresponding to each causal relationship edge determines at least one key causal relationship edge, and the risk prediction value is then used to determine the key causal relationship edge. Risk confidence interval , Each risk evolution path and its corresponding path risk entropy are collectively determined as the counterfactual inference result of the security risk corresponding to the target risk cause and output.

[0082] In one example, taking a hydrogen leak accident as an example, five independent simulations were performed, and the simulation results are as follows: Figure 2 As shown, under five independent and repeated simulation conditions, the hydrogen leakage risk value output by the model is stably distributed in the range of 0.63 to 0.65. The dispersion of the simulation results is small, which indicates that the model output is highly stable, the results caused by random initialization have low fluctuations, and it has good reproducibility.

[0083] In one example, taking a high-temperature oil pump seal leakage accident as an example, high-frequency data of the pump outlet pressure (Pres), sealing cavity temperature (Temp), bearing vibration (Vibra), and motor current (Current) over the past hour are obtained. The time-series causal graph is constructed to represent Temp→Pres→Vibra. During reverse denoising sampling, the model generates a set of data showing "sudden pressure drop but unchanged temperature". Substituting this into the gas state equation, it is found that Vibra remains unchanged. The decrease in Pres will inevitably lead to a decrease in Temp, resulting in excessive residuals. Therefore, this step is immediately removed, and the model is resampled with a disturbance introduced. Finally, the true leakage path that conforms to the adiabatic expansion law and shows a synchronous decrease in Pres and Temp is generated. Figure 3 The contribution percentages of the three core risk evolution paths are shown. Temp→Pres has the highest contribution percentage, making it the primary risk pathway; Pres→Vibra has the second highest contribution percentage, making it a secondary risk pathway; and Temp→Vibra has the lowest contribution percentage, making it an insignificant risk pathway. This completes the causal tracing of the high-temperature oil pump seal leakage.

[0084] This embodiment proposes a counterfactual inference method for safety risks based on causal guidance and physical hard constraints, which achieves the following improvements compared with traditional industrial safety analysis methods.

[0085] First, it improves the ability to generate extreme risk scenarios with small sample sizes. This embodiment employs an asymmetric heavy-tailed noise scheduling strategy based on the risk labels corresponding to normal operating condition samples and accident operating condition samples. This gives accident operating condition samples noise perturbation characteristics distinct from normal operating condition samples during the diffusion training process, thereby increasing the impact of accident samples on the parameter updates of the denoising network. This allows the risk time series generation model to more fully learn the extreme risk characteristics located at the tail of the data distribution. Even with a limited number of historical accident operating condition samples, it can still generate differentiated extreme risk evolution paths, improving the ability to extrapolate low-probability, high-hazard risk scenarios.

[0086] Second, it improves the causal rationality and interpretability of the risk evolution path. This embodiment constructs a time-series causal graph based on the conditional independence and time priority relationships among the operational variables in multivariate time-series operational data. During the reverse denoising sampling process, causal constraint information is determined based on the time-series causal graph, thereby correcting the generation direction. This ensures that the state changes of causal and outcome variables evolve according to the preset risk transmission direction. This reduces the problem of reversed order of risk causes and results caused by generating the risk path solely based on the statistical correlation of variables. The generated risk evolution path is more consistent with the actual transmission logic of industrial risks. At the same time, it can reflect the process of risk propagation from cause to result through causal relationships, improving the interpretability of the counterfactual inference results.

[0087] Third, it improves the physical feasibility of generated states during counterfactual simulation. This embodiment differs from the soft constraint approach that only uses physical equations as loss terms during model training. During the reverse denoising sampling process, it performs real-time physical residual verification on generated candidate intermediate operating states. When a candidate intermediate operating state does not meet the preset physical feasibility conditions, it is rejected, and the process reverts to the previous operating state that meets the physical feasibility conditions. New candidate intermediate operating states are obtained through physical correction and resampling until the preset physical feasibility conditions are met, at which point subsequent reverse denoising sampling continues. This suppresses the propagation of intermediate states that do not conform to thermodynamics, fluid mechanics, or other physical laws of the target industrial site, reducing the impact of non-physical risk paths on the final simulation results and improving the credibility of the safety risk counterfactual simulation results.

[0088] Fourth, it improves the controllability and decision support capabilities of counterfactual risk simulation. This embodiment can set counterfactual conditions for a specified target risk trigger and repeatedly execute risk path generation under the combined effect of causal and physical constraints to obtain multiple risk evolution paths corresponding to the target risk trigger. Furthermore, it determines the risk prediction results and corresponding uncertainty information based on these multiple risk evolution paths. Thus, it transforms the traditional generation of random risk scenarios into controllable counterfactual simulation oriented towards a specified risk trigger, simultaneously outputting possible risk evolution trends and key risk transmission relationships, providing a more complete reference for accident trigger analysis, risk intervention location determination, and safety decision-making.

[0089] The steps described above are merely for clarity in describing the technical solution. In actual implementation, they can be combined into one step, or certain steps can be broken down into multiple steps, as long as they involve the same logical relationship, they are all within the scope of protection of this application. Any insignificant modifications or designs added to the algorithm or process, as long as they do not change the core of the algorithm or process, are also within the scope of protection of this application.

[0090] Another embodiment of this application proposes a counterfactual deduction system for safety risks based on causal guidance and physical hard constraints, applicable to industrial sites, for implementing a counterfactual deduction method for safety risks based on causal guidance and physical hard constraints as described in the above method embodiments. The details of the counterfactual deduction system for safety risks based on causal guidance and physical hard constraints proposed in this embodiment are described below. The following implementation details are provided for ease of understanding and are not essential for implementing this solution.

[0091] Figure 4This is a schematic diagram of the structure of a security risk counterfactual inference system based on causal guidance and physical hard constraints proposed in this embodiment, including: a time-series causal graph construction module 21, a forward noise addition module 22, a reverse noise reduction module 23, and a result output module 24.

[0092] The time-series cause-effect graph construction module 21 is used to acquire multivariate time-series operational data of the target industrial site and its corresponding risk labels. Based on the conditional independence relationship and time priority relationship between each operational variable in the multivariate time-series operational data, a time-series cause-effect graph is constructed to characterize the risk transmission direction between each operational variable.

[0093] The forward noise module 22 is used to add forward noise to the multivariate time series running data based on the risk label and adopt an asymmetric heavy-tailed noise scheduling strategy related to the sample category, and train a denoising network based on the noise-added multivariate time series running data to obtain a risk time series generation model.

[0094] The reverse denoising module 23 is used to obtain the counterfactual setting for the target risk inducement. Based on the counterfactual setting of the target risk inducement, reverse denoising sampling is performed using a risk time series generation model. In the reverse denoising sampling process, causal constraint information is determined according to the time series causal graph. Based on the causal constraint information, the generation direction in the reverse denoising sampling process is corrected so that the generated intermediate operating state evolves along the risk transmission direction represented by the time series causal graph. The generated intermediate operating state is substituted into the physical constraint relationship corresponding to the target industrial site to determine the physical residual of the intermediate operating state. If the physical residual does not meet the preset physical feasibility conditions, it regresses to the previous intermediate operating state that meets the physical feasibility conditions and resamples the intermediate operating state until the resampled intermediate operating state meets the physical feasibility conditions.

[0095] The output module 24 is used to repeatedly execute the reverse denoising sampling process to finally obtain at least one risk evolution path that satisfies the risk transmission direction and physical feasibility conditions corresponding to the target risk cause, and to determine the safety risk counterfactual inference result corresponding to the target risk cause based on the risk evolution path.

[0096] It is worth noting that all modules involved in this embodiment are logical modules. In practical applications, a logical module can be a physical module, a part of a physical module, or an organic combination of multiple physical modules. Furthermore, to highlight the innovative aspects of this application, this embodiment does not introduce modules that are not closely related to solving the technical problems proposed in this application. However, this does not mean that other modules are absent from this embodiment.

[0097] It is not difficult to see that this embodiment is a system embodiment corresponding to the above method embodiments, and this embodiment can be implemented in conjunction with the above method embodiments. The relevant technical details and technical effects mentioned in the above method embodiments are still valid in this embodiment, and will not be repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the above method embodiments.

[0098] Another embodiment of this application provides an electronic device, such as Figure 5 As shown, it includes a processor 31 and a memory 32. The memory 32 stores instructions that the processor 31 can execute. When the processor 31 is configured to execute the instructions, the electronic device can realize a security risk counterfactual deduction method based on causal guidance and physical hard constraints as described in the above method embodiment.

[0099] The memory and processor are connected via a bus, which includes any number of interconnecting buses and bridges. The bus can connect various circuits of one or more processors and memories, as well as other circuits such as peripherals, voltage regulators, and power management circuits—all well-known in the art and therefore not described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which also receives and transmits data to the processor.

[0100] The processor manages the bus and handles general processing, providing various functions, including but not limited to timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory, on the other hand, is used to store data used by the processor during operation.

[0101] Another embodiment of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, can implement a security risk counterfactual deduction method based on causal guidance and physical hard constraints as described in the above method embodiments.

[0102] That is, those skilled in the art will understand that all or part of the steps in the above method embodiments can be implemented by a program instructing related hardware. The program is stored in a storage medium and includes several instructions to cause a device (such as a microcontroller, chip, etc.) or processor to execute all or part of the steps of the method described in the method embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.

[0103] It will be understood by those skilled in the art that the above embodiments are specific implementations of this application, and various changes in form and detail can be made in practical applications without departing from the spirit and scope of this application. For those skilled in the art, several improvements and modifications can be made without departing from the principles of this application, and these improvements and modifications are also considered to be within the scope of protection of this application.

Claims

1. A counterfactual inference method for safety risks based on causal guidance and physical hard constraints, applicable to industrial sites, characterized in that: The method includes: Acquire multivariate time-series operational data of the target industrial site and its corresponding risk labels. Based on the conditional independence and time priority relationships among the operational variables in the multivariate time-series operational data, construct a time-series causal graph to characterize the risk transmission direction among the operational variables. Based on risk labels, an asymmetric heavy-tailed noise scheduling strategy related to sample categories is used to forward-noise the multivariate time series running data, and a denoising network is trained based on the noisy multivariate time series running data to obtain a risk time series generation model. Obtain the counterfactual setting for the target risk triggers, and based on the counterfactual setting of the target risk triggers, use a risk time series generation model to perform reverse denoising sampling; In the reverse denoising sampling process, causal constraint information is determined based on the time-series causal graph. The generation direction in the reverse denoising sampling process is corrected based on the causal constraint information, so that the generated intermediate operating state evolves along the risk transmission direction represented by the time-series causal graph. The generated intermediate operating state is substituted into the physical constraint relationship corresponding to the target industrial site to determine the physical residual of the intermediate operating state. If the physical residual does not meet the preset physical feasibility conditions, it regresses to the previous intermediate operating state that meets the physical feasibility conditions and resamples the intermediate operating state until the resampled intermediate operating state meets the physical feasibility conditions. The reverse denoising sampling process is repeated to obtain at least one risk evolution path that satisfies the risk transmission direction and physical feasibility conditions corresponding to the target risk cause. Based on the risk evolution path, the counterfactual inference result of the safety risk corresponding to the target risk cause is determined.

2. The method for counterfactual inference of security risks based on causal guidance and physical hard constraints as described in claim 1, characterized in that, Acquire multivariate time-series operational data of the target industrial site and its corresponding risk labels. Based on the conditional independence and time priority relationships among the operational variables in the multivariate time-series operational data, construct a time-series causal graph to characterize the risk transmission direction among the operational variables, including: Obtain multivariate time-series operational data and corresponding risk labels from the target industrial site. Let the multivariate time-series operational data be... , , Let the risk label be , ; in, For the first Multivariate time-series running data at each time step The total number of time steps. For dimension space, The number of runtime variables, This indicates normal operating conditions. Indicates the accident conditions; Perform a conditional independence test on any two running variables, and remove the connection edges between running variables that satisfy the conditional independence relationship based on the conditional independence test results to obtain the cause-effect graph skeleton; Obtain the state change times of two running variables that are connected in the skeleton of the cause-effect graph. Determine the direction of the connecting edge according to the time priority relationship between the state change times, so that the state change time of the running variable as the cause is earlier than the state change time of the running variable as the result. Directed connections are used as causal edges. A directed acyclic temporal causal graph is constructed based on the causal graph skeleton and causal edges, and the corresponding causal adjacency matrix is ​​determined. , ; in, for The Middle Line number Column elements, Indicates the existence of the first The runtime variable points to the first... Causal relationships between runtime variables, For dimension The space.

3. The method for counterfactual inference of security risks based on causal guidance and physical hard constraints as described in claim 2, characterized in that, Based on risk labels, an asymmetric heavy-tailed noise scheduling strategy related to sample categories is used to forward-noise the multivariate time-series running data. A denoising network is then trained based on the noisy multivariate time-series running data to obtain a risk time-series generation model, including: Based on time step and risk labels Determine the corresponding noise scheduling parameters , is represented as: ; in, and These are the lower and upper limits of the noise scheduling parameters, respectively. This is the preset extreme magnification factor. , These are sampled values ​​from a Pareto heavy-tailed distribution. This is the lower bound parameter for the scale of the Pareto heavy-tailed distribution. The shape parameter of the Pareto heavy-tailed distribution; Based on noise scheduling parameters Determine cumulative scheduling parameters , is represented as: ; in, From 1 to Virtual time steps between; Based on cumulative scheduling parameters Asymmetric forward noise is added to both normal operating condition samples and accident operating condition samples, and then the noise is adjusted according to the loss function. Train the denoising network until convergence to obtain the risk time series generation model; Represented as: ; in, This represents the original multivariate time-series runtime data, that is, the original runtime state. This indicates the noise added during forward noise generation. This represents a denoising network. Indicates to , , , Seeking expectations.

4. The method for counterfactual inference of security risks based on causal guidance and physical hard constraints as described in claim 3, characterized in that, Causal constraint information is determined based on the time-series causal graph. The generation direction in the reverse denoising sampling process is then corrected based on this causal constraint information, causing the generated intermediate operating states to evolve along the risk transmission direction represented by the time-series causal graph. This includes: Construct a causal potential function based on the causal relationship edges in the time-series causal graph, at time step... The causal potential function is denoted as , is represented as: ; in, Let be the set of edges with causal relationships. Indicates the first One running variable For the first One running variable Cause variables, Given a linear rectified function, during the reverse denoising sampling process, for time step... , This is referred to as the currently generated intermediate running state; At time step Based on the currently generated intermediate running state Calculate the causal potential function with respect to the currently generated intermediate running state. The causal gradient, denoted as ; Injecting causal gradients into the backsampling process of the risk time series generation model allows the intermediate running states obtained through backsampling to be processed. By satisfying causal constraints, the intermediate operating states that violate the risk transmission direction represented by the generated temporal causal graph are corrected. Causal constraints are expressed as: ; ; in, For risk time series generation model in the first The sampling mean determined at each time step, The preset causal guidance strength coefficient, The larger the value, the stronger the causal constraint. This is the covariance matrix during the backsampling process. For the first Random noise scale at each time step Let be a random noise vector sampled from a standard normal distribution. For the first The cumulative scheduling parameters for each time step. for abbreviation, for abbreviation, It is an identity matrix.

5. The method for counterfactual inference of security risks based on causal guidance and physical hard constraints as described in claim 4, characterized in that, The generated intermediate operating states are substituted into the physical constraints corresponding to the target industrial site to determine the physical residuals of the intermediate operating states. If the physical residuals do not meet the preset physical feasibility conditions, the system reverts to the previous intermediate operating state that meets the physical feasibility conditions, and resamples the intermediate operating states until the resampled intermediate operating states meet the physical feasibility conditions, including: Obtain at least one physical constraint function corresponding to the target industrial site. For candidate intermediate running states generated during the reverse denoising sampling process Calculate the candidate intermediate running states according to the following formula. Corresponding physical residuals : ; in, For physical residual functions, To obtain the L2 norm; physical residuals Compared with the preset physical residual threshold Compare; like Then accept the candidate intermediate running state. , that is to say and based on Continue with the reverse denoising sampling at the next time step; like Then reject the candidate intermediate running state. And trigger the intermediate running state of the candidate. The backsampling ensures that the candidate intermediate running states accepted during the reverse denoising sampling process meet the preset physical feasibility conditions.

6. The method for counterfactual inference of security risks based on causal guidance and physical hard constraints as described in claim 5, characterized in that, Triggering the intermediate running state of the candidate The backsampling ensures that the accepted candidate intermediate running states during the reverse denoising sampling process meet preset physical feasibility conditions, including: Triggering the intermediate running state of the candidate After backsampling, calculate the physical residual. Compared to gradient ,based on A single-step gradient descent is performed into the physically feasible region, and annealing noise is added to obtain new candidate intermediate running states. , is represented as: ; ; in, The preset learning rate, This is the annealing temperature coefficient, which decreases with time. This represents the initial annealing temperature coefficient. The preset attenuation coefficient, To explore noise; The new candidate intermediate running state is calculated according to the following formula. The corresponding new physical residual : ; The new physical residual Compared with the preset physical residual threshold Compare; like Then accept the new candidate intermediate running state. , that is to say and based on Continue with the reverse denoising sampling at the next time step; like Then reject the new candidate intermediate running state. And trigger a new candidate intermediate running state. The backsampling ensures that the candidate intermediate running states accepted during the reverse denoising sampling process meet the preset physical feasibility conditions.

7. The method for counterfactual inference of security risks based on causal guidance and physical hard constraints according to claim 6, characterized in that, The reverse denoising sampling process is repeated to obtain at least one risk evolution path corresponding to the target risk trigger that satisfies the risk propagation direction and physical feasibility conditions. Based on the risk evolution path, the counterfactual inference result of the safety risk corresponding to the target risk trigger is determined, including: Repeatedly execute the counterfactual setting corresponding to the same target risk factor. Second reverse denoising sampling, to obtain A risk evolution path that satisfies both the risk transmission direction and physical feasibility conditions; The set of risk evolution paths is denoted as , is represented as: ; in, The starting point of the counterfactual deduction. To determine the corresponding future time domain length in the counterfactual deduction, This represents the sequence number of the risk evolution path. For the first A risk evolution path; against Determine the first Frequency of exceeding limits for each running variable , is represented as: ; in, For the first One runtime variable, for The corresponding risk threshold, For indicator functions, when hour, , An index for future time steps; Determined based on the over-limit frequency of each operating variable. Corresponding risk entropy , is represented as: ; Among them, when At that time, it was agreed ; Based on the frequency of exceeding limits for each operating variable and the preset risk weights for each operating variable, determine Corresponding path risk value , is represented as: ; in, For the first Risk weights of each running variable , ; according to The path risk value corresponding to each risk evolution path is used to determine the risk prediction value corresponding to the target risk trigger. , ; Based on risk forecast values The confidence level was determined to be Risk confidence interval , is represented as: ; ; in, At the preset significance level, For degrees of freedom of Distribution critical value, for The sample standard deviation corresponding to the risk value of each path; According to the causal adjacency matrix Determine the causal contribution matrix by the gradient of future operating states relative to historical operating states. , represented as: ; in, This indicates the Hadamard product. This represents the future operational state corresponding to the risk evolution path. This refers to the historical operating state before counterfactual deduction; According to the causal contribution matrix The contribution value corresponding to each causal relationship edge determines at least one key causal relationship edge, and the risk prediction value is then used to determine the key causal relationship edge. Risk confidence interval , Each risk evolution path and its corresponding path risk entropy are collectively determined as the counterfactual inference result of the security risk corresponding to the target risk cause and output.

8. A safety risk counterfactual deduction system based on causal guidance and physical hard constraints, applicable to industrial sites, used to implement the safety risk counterfactual deduction method based on causal guidance and physical hard constraints as described above, characterized in that... The system includes: The time-series cause-effect graph construction module is used to acquire multivariate time-series operational data of the target industrial site and its corresponding risk labels. Based on the conditional independence and time priority relationships between the operational variables in the multivariate time-series operational data, a time-series cause-effect graph is constructed to characterize the risk transmission direction between the operational variables. The forward noise module is used to add forward noise to multivariate time series running data based on risk labels and adopt an asymmetric heavy-tailed noise scheduling strategy related to sample categories. Based on the noise-added multivariate time series running data, a denoising network is trained to obtain a risk time series generation model. The reverse denoising module is used to obtain the counterfactual setting for the target risk trigger. Based on the counterfactual setting of the target risk trigger, reverse denoising sampling is performed using a risk time series generation model. In the reverse denoising sampling process, causal constraint information is determined according to the time series causal graph. Based on the causal constraint information, the generation direction in the reverse denoising sampling process is corrected so that the generated intermediate operating state evolves along the risk transmission direction represented by the time series causal graph. The generated intermediate operating state is substituted into the physical constraint relationship corresponding to the target industrial site to determine the physical residual of the intermediate operating state. If the physical residual does not meet the preset physical feasibility conditions, it regresses to the previous intermediate operating state that meets the physical feasibility conditions and resamples the intermediate operating state until the resampled intermediate operating state meets the physical feasibility conditions. The result output module is used to repeatedly execute the reverse denoising sampling process to finally obtain at least one risk evolution path that satisfies the risk transmission direction and physical feasibility conditions corresponding to the target risk cause, and to determine the safety risk counterfactual inference result corresponding to the target risk cause based on the risk evolution path.

9. An electronic device, characterized in that, include: A processor and a memory, wherein the memory stores instructions that the processor can execute, and the processor is configured to, when executing the instructions, enable the electronic device to implement a security risk counterfactual deduction method based on causal guidance and physical hard constraints as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it can implement a method for counterfactual deduction of security risks based on causal guidance and physical hard constraints as described in any one of claims 1 to 7.