Population evacuation flow prediction method based on multi-level causal counterfactual memory enhancement
By constructing a multi-level causal counterfactual memory enhancement system, combined with a large language model and counterfactual inference formulas, the problems of sparse data and insufficient memory capacity in crowd evacuation prediction during large-scale events are solved, achieving high-precision and self-iterative prediction results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU PUBLIC SECURITY BUREAU
- Filing Date
- 2026-04-09
- Publication Date
- 2026-07-14
AI Technical Summary
Existing crowd evacuation prediction methods suffer from overfitting problems due to data sparsity during large-scale events, and large language models have limitations in memory capacity and causal logic backtracking, making it difficult to achieve high-precision predictions in complex scenarios.
A multi-level causal counterfactual memory enhancement system is constructed, including semantic, episodic, and procedural memory. It uses a causal influence matrix and a road network node topology tree structure, combined with a large language model, to predict pedestrian traffic and uses counterfactual deduction formula templates for logical reasoning.
It improves the accuracy of crowd flow prediction in complex scenarios, achieves high-precision prediction with zero human intervention, and optimizes model performance through self-iteration.
Smart Images

Figure CN122390132A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer artificial intelligence, and in particular to a method for predicting crowd evacuation flow based on multi-level causal counterfactual memory enhancement. Background Technology
[0002] Crowd evacuation prediction is a core issue in public safety and emergency management, widely applied in crowd control for large-scale sporting events, open-air performances, and urban transportation hubs. Accurate crowd flow prediction not only assists managers in developing efficient evacuation and scheduling plans but also provides early warnings of potential congestion and stampede risks, playing a crucial role in ensuring public safety. Currently, mainstream methods utilize Spatiotemporal Graph Neural Networks (STGNNs) to simultaneously model temporal dependencies and spatial topological relationships, achieving significant success in traffic flow prediction and crowd flow analysis. However, in practical applications, the limited frequency of large-scale events leads to sparse historical data available for training, making models prone to overfitting and severely limiting their generalization ability. To alleviate this problem, existing techniques typically employ random augmentation methods (such as random edge deletion and feature perturbation), but these methods often neglect the complex spatiotemporal causal dependencies between nodes, resulting in augmented samples lacking physical plausibility and even introducing harmful noise.
[0003] Meanwhile, large language models (LLMs) possess powerful contextual understanding and logical reasoning capabilities, offering new approaches to processing multi-source, heterogeneous spatiotemporal trajectory data. However, current LLM agents suffer from fundamental limitations in their memory capabilities when performing crowd prediction tasks. Most LLM assistants operate in a "stateless" mode outside the current prompt window, making it difficult to persistently, abstractly, and reliably trace scene-specific long-term causal logic. Furthermore, existing memory architectures are mostly flat structures, lacking dedicated routing mechanisms to store information into specific memory types (such as procedural memory, semantic memory, or episodic memory). This results in low retrieval efficiency and an inability to effectively extract and retain key causal evolution information when processing massive amounts of spatiotemporal data. Therefore, how to deeply integrate the causal laws of the physical world with the long-term memory mechanisms of large language models to improve the accuracy of crowd flow prediction in complex scenarios has become a pressing technical challenge. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies by providing a crowd evacuation flow prediction method based on multi-level causal counterfactual memory enhancement.
[0005] The objective of this invention is achieved through the following technical solution: a crowd evacuation flow prediction method based on multi-level causal counterfactual memory enhancement, comprising: Acquire traffic monitoring data and corresponding geospatial location data, and establish a memory bank composed of semantic, plot, and procedural memories; Semantic memory: used to store the causal influence matrix I and the spatial hierarchical topology tree structure of the road network nodes; the causal influence matrix I is generated based on the spatiotemporal dataset, and the values of each element in the matrix are the causal weights; Episodic memory: Used to store time window segments extracted from the spatiotemporal dataset for abnormal congestion or when interventions take effect. The time window segments include node traffic distribution vectors, occurrence time characteristics, abnormal congestion status early warning information, and local population density evolution characteristics; the spatiotemporal dataset is constructed based on traffic monitoring data and geospatial location data. Program memory: used to store several intervention scripts, wherein the intervention scripts are node rate limiting strategies; If the current traffic monitoring data is determined to be in an abnormal congestion state and is a historical regular congestion snapshot data, then the causal weights, time window segments, and intervention scripts that match the current situation are extracted from the memory and injected into the prompt words of the large language model; the prompt words are then input into the large language model to predict the traffic flow.
[0006] Furthermore, the construction of the spatial hierarchical topology tree structure of the road network nodes includes: Geographic points in spatiotemporal data are clustered into graph nodes, and a spatial hierarchical topology tree structure of road network nodes is constructed based on the physical spatial connectivity and geographical affiliation between nodes.
[0007] Furthermore, the causal influence matrix I is generated based on a spatiotemporal dataset, including: Calculate the maximum cross-correlation coefficient of node pairs under different lags. The candidate node set is selected based on the maximum cross-correlation coefficient, and a correlation weight matrix is generated. ; For the node candidate set, a linear Granger causality test is used to determine whether there is a time-lag directed prediction relationship, in order to generate a linear causal weight matrix. ; For the node candidate set, the transfer entropy of the quantized nonlinear information flow is integrated. To generate the transfer entropy weight matrix ; Based on the correlation weight matrix Linear causal weight matrix and the transitive entropy weight matrix Generate the causal influence matrix I.
[0008] Furthermore, if the current traffic monitoring data is determined to be in an abnormal congestion state but is also a spatiotemporal drift abnormal data, the causal influence matrix in the semantic memory is updated.
[0009] Furthermore, the program memory also stores counterfactual deduction formula templates for different causal models; the counterfactual deduction formula templates for different causal models include: The derivation formula for the causal chain transmission model is as follows: in, Indicates at time Downstream The predicted flow values for each node; These are the original observations; The diffusion attenuation coefficient in spatiotemporal conduction; The causal weight strength between adjacent nodes stored in semantic memory; The intensity of intervention at the source node; The derivation formula for the hub-and-spoke radiation transmission model is as follows: in, Indicates at time The predicted flow value of that neighboring node at that time; Indicates at time The original observed flow value of that neighboring node at that time; Refers to the identified hub node; It is a first-order neighbor node of this hub; This is a sign function used to determine the positive or negative correlation of causal effects; a positive correlation indicates synchronous growth, while a negative correlation indicates divergence. It is a radiation intensity adjustment factor; For the hub node at time Changes in flow rate; The community-driven collaborative model can be derived from the following formula: in, Indicates at time The predicted traffic vector is the set of nodes belonging to the same functional community. Indicates at time The original observed flow vector of the set of nodes belonging to the same functional community; This represents the average autocorrelation strength of the nodes within the community. Community collaboration coefficient; Indicates the triggering intensity of sudden external environmental factors; The derivation formula for the critical node stress testing mode is as follows: in, Indicates at time The predicted traffic distribution vector of all nodes in the global road network after time intervention; Indicates at time The initial traffic distribution vector of all nodes in the global road network before intervention; This indicates the application of Pearl's causal interference econometrics, forcibly applying critical nodes. Set the flow rate to 0 or a very small value; This represents the global causal influence matrix in conjunction with semantic memory in LLM. Recalculate the distribution after flow balance; Based on the current spatiotemporal data and its corresponding causal influence matrix, the pattern corresponding to the current scene is determined. The large language model combines the prompt words and the counterfactual inference formula template of the pattern to perform counterfactual inference and generate the traffic flow prediction result.
[0010] Furthermore, based on the current spatiotemporal data and its corresponding causal influence matrix, the pattern corresponding to the current scene is determined, including: When there exists a continuous directed path consisting of multiple nodes in the causal influence matrix I, and the causal weights between adjacent nodes are... If all values are greater than the preset chain propagation threshold, it is determined to be a causal chain propagation mode; When a node in the causal influence matrix I If the out-degree centrality of a node is greater than the preset hub threshold, and the current spatiotemporal data shows that the node experiences a sudden change in flow, then it is judged to be a hub radiation transmission mode. Based on the connectivity of the causal influence matrix I, a set of functional communities is defined. When the current spatiotemporal data shows that multiple nodes within a community exhibit synchronous abnormal traffic fluctuations, it is determined to be a community collaborative driving mode. By calculating the betweenness centrality or PageRank value of each node in the causal influence matrix I, the key nodes with the top-K global scores are selected. When extreme intervention instructions are received for such nodes or spatiotemporal data shows that they are blocked, it is judged as a key node stress test mode.
[0011] Furthermore, it also includes verifying the predicted pedestrian flow results through comprehensive evaluation indicators, including time smoothness, magnitude of change, and relative reasonableness of change.
[0012] Furthermore, time smoothness Evaluation via second-order difference: in, It is a second-order difference operator; The magnitude of change score is evaluated by calculating the norm of the perturbation vector: in, This is the penalty factor for scaling the amplitude. Denotes the L2 norm; Reasonableness score of relative change Spearman's rank correlation coefficient was used. )measure: in, This represents the Spearman rank correlation coefficient function; This represents a ranking function that sorts the values of each node in the traffic matrix; this formula ensures that intervention simulations do not disrupt the relative macroscopic hierarchical relationships between nodes in the road network; The overall assessment score is: in, It is an indicator function. This represents the predicted traffic distribution matrix generated by the large language model; , , These are the weighting coefficients for each rating dimension.
[0013] Furthermore, a preset rating confidence threshold is defined. If the overall evaluation score of the generated prediction sample is greater than or equal to the rating confidence threshold, it will be judged as a high-confidence high-rated sample. The selected high-rated samples will be fed back and added to the plot memory.
[0014] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described crowd evacuation flow prediction method based on multi-level causal counterfactual memory enhancement.
[0015] Compared with the prior art, the beneficial effects of the present invention are: by transforming discrete video surveillance data into knowledge with causal logic through a multi-agent memory system, it overcomes the limitations of large language models in long-sequence prediction, which are difficult to persist and backtrack to long-term causal logic. This enables LLM to make high-precision predictions based on real physical rules and achieves continuous self-iteration of prediction accuracy with zero human intervention in extreme scenarios, significantly improving the accuracy of crowd prediction in complex environments of large-scale events. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart of a method for predicting urban population movement behavior based on a large-scale language model.
[0018] Figure 2 This is a framework diagram of a hierarchical mobile behavior prediction method. Detailed Implementation
[0019] The present invention will now be described in detail with reference to the accompanying drawings. Unless otherwise specified, the features of the following embodiments and implementations can be combined with each other.
[0020] This invention provides a method for predicting crowd evacuation flow based on multi-level causal counterfactual memory enhancement, see [link to relevant documentation]. Figure 1 and Figure 2 This includes the following steps: Step 1: Construct a multi-dimensional memory system based on hierarchical causal discovery. Obtain a spatiotemporal dataset, recover the physical transmission paths between road network nodes through a hierarchical causal discovery mechanism, construct a causal influence matrix I, and establish a memory bank composed of semantic, plot, and procedural memories based on this matrix.
[0021] This step includes: This embodiment collects data from large sports venues (such as the Hangzhou Olympic Sports Center) and key surrounding roads during major sporting events, focusing on pedestrian flow dynamics. The original data sources include traffic monitoring data from surveillance cameras and geospatial location data processed by computer vision. The system detects and counts pedestrians in video frames in real time, mapping them onto a hexagonal grid map to form structured spatiotemporal data containing crowd density, abnormal status warnings, and refined spatiotemporal distribution. The data covers key nodes such as stadium entrance bridges and surrounding intersections, recording the entire process of pedestrian flow evolution from entry to exit. The spatiotemporal data is then preprocessed: first, the MiniBatchKMeans algorithm is used to cluster geographic points into N=800 graph nodes; then, based on the physical spatial connectivity and geographic affiliation between nodes (e.g., the top-down inclusion relationship of the stadium core area—surrounding main roads—outer evacuation traffic grid), a spatial hierarchical topology tree structure of the road network nodes is constructed to characterize the hierarchical features of graph nodes at different spatial scales; finally, the time series is resampled to 2-minute intervals and Z-score normalization is performed.
[0022] A hierarchical causal discovery mechanism is used to reconstruct the physical transmission paths between road network nodes. The system first calculates the maximum cross-correlation coefficient of node pairs under different lags. Initial screening: in, Represents a node At any moment Traffic flow; Indicates the time lag step; This represents the Pearson correlation coefficient; Indicates the set time lag step. The formula takes the maximum value within the range and is used to initially identify a candidate set of nodes with spatiotemporal correlation.
[0023] The specific steps for the system to initially identify and screen candidate sets of nodes with spatiotemporal correlation are as follows: Global correlation calculation: Traverse all node pairs in the road network graph Within the preset maximum historical lag time window Inside, sliding computation source node With the target node Pearson correlation coefficients under different lag steps.
[0024] Extracting the maximum response: For each pair of nodes, extract the maximum absolute value of the correlation coefficient within the above time window and record it as the spatiotemporal correlation index of that node pair. .
[0025] Threshold filtering and candidate set generation: The system presets a correlation strength threshold. To satisfy all The node pairs are retained, and the nodes are considered to be Historical state of nodes The current state of the nodes exhibits significant spatiotemporal statistical correlation. The set of nodes that meets this condition constitutes the candidate set of nodes for subsequent causal testing. This initial screening mechanism effectively eliminates a large number of weakly correlated node pairs in the road network, thereby significantly reducing the search space for subsequent complex causal calculations.
[0026] Subsequently, for the candidate set, a linear Granger causality test is used to determine whether a time-lag directed predictive relationship exists. The following autoregressive model is constructed: Constrained model: Unrestricted model: in, and Representing the target node respectively and source node At any moment The state; The maximum lag order; and These are the autoregressive coefficients; and This is the residual term. If a source node is introduced... If historical information can significantly reduce the prediction residual (verified by the F-test), then it is determined that there is [a problem]. The linear causal edges are identified, and the test results are recorded in the linear causal weight matrix. middle.
[0027] Furthermore, the transfer entropy of quantized nonlinear information flow is integrated. : in, It is a joint probability distribution; It is a node The future state of the node; this formula measures the node's future state. Historical information helps reduce nodes The degree to which future state uncertainty contributes to the identification of directed causal relationships, nodes. and nodes All nodes are from the node candidate set. Finally, a causal influence matrix is generated and stored in semantic memory. The values of each element in this matrix are the causal weights, which physically characterize the strength and direction of causal transmission from the state of a source node to the future state of a target node in the road network. , , Adjustment weights for each metric; This represents the spatiotemporal correlation (i.e., the maximum cross-correlation number) based on the initial screening stage. The correlation weight matrix constructed; This represents the linear causal weight matrix constructed based on the results of the linear Granger causality test; Indicated based on transitive entropy The constructed transfer entropy weight matrix for quantifying nonlinear information flow.
[0028] Based on this, a multi-dimensional memory bank composed of semantic, plot, and procedural memory is established. The specific meanings and construction methods of the three are as follows: Semantic memory: used for persistent storage of global, static physical "common sense" and causal relationship rules of the road network system. The system will calculate the global causal influence matrix. It also persistently stores the spatial hierarchical topology tree structure of the road network nodes. In subsequent tasks, it provides the basic causal weights and network topology dependencies between nodes for the large language model.
[0029] Episodic memory: This is used to record snapshots of specific dynamic scenarios and abnormal events that actually occurred in history. During the system's construction phase, it traverses historical spatiotemporal datasets to identify and extract historical time windows where abnormal congestion or specific interventions took effect. The node traffic distribution vectors, occurrence time characteristics, abnormal congestion warning information, and local population density evolution characteristics of these segments are packaged and stored as an experience sample library. This provides a historical precedent-based analogy reference for large language models when processing similar sudden scenarios.
[0030] Program memory: Used to solidify the deductive logic and "operating procedures" under specific causal evolution patterns. At this stage, the system pre-writes and categorizes various intervention scripts (SOPs) and counterfactual deduction formula templates for different causal patterns (such as chain propagation, hub radiation, community collaboration, etc.). The intervention scripts include batch pulse release strategies (e.g., forcibly attenuating the node outflow rate to 30% of the peak within a specific time window), unidirectional flow guidance and forced diversion strategies (e.g., severing topological connectivity in a specific direction and forcibly reducing the local causal weights between adjacent nodes to zero), and extreme physical blocking strategies (e.g., directly setting the physical capacity limit of a specific gate node). (Set to 0). When the system faces specific evacuation or prediction tasks, the large language model can directly call the rule template in memory to perform logical deduction, instead of generating it from scratch.
[0031] Step 2: Execute dynamic task routing based on the meta-memory manager. The system analyzes the content type of traffic monitoring data in real time (including spatiotemporal drift anomaly data, historical pattern congestion snapshot data, and evacuation intervention instruction data), and the meta-memory manager distributes it to the corresponding expert management agents (semantic management agent, plot management agent, and program management agent) to realize the dynamic updating of the corresponding memory bank or the retrieval and calling of target knowledge.
[0032] This step includes: 1) Content Analysis and Feature Extraction: The meta-memory manager receives data in real time through dual channels. On one hand, it receives grid flow vectors from sensors (such as monitors); on the other hand, it receives structured evacuation intervention commands issued by the traffic control command center or authorized personnel terminals through system communication interfaces (such as API interfaces or message queues). For sensor flow data, the system presets pressure factor thresholds. When a certain node The ratio of real-time density to historical average When the current state is "abnormal congestion," the meta-manager determines it to be in an "abnormal congestion state" and further extracts its spatiotemporal features to determine whether the state belongs to spatiotemporal drift anomaly data or historical regular congestion snapshot data. The specific determination logic is as follows: the system calls the existing causal influence matrix I in semantic memory and calculates the residual value between the currently observed actual traffic distribution and the expected traffic distribution derived based on the existing matrix. If this residual value is greater than a preset drift determination threshold... (For example, setting) = 0.30), indicating that an event such as a sudden road closure has occurred in the road network that disrupts the original topology, and the existing causal physical transmission path has become invalid. This state is judged to be spatiotemporal drift anomaly data. Conversely, if the residual value is less than or equal to the threshold, it means that the current congestion transmission path still conforms to the known historical causal rules, and it is only a surge in the absolute value of local traffic. This state is judged to be historical regular congestion snapshot data.
[0033] 2) Dynamic Routing Decision: The meta-memory manager executes routing based on the defined content type. It also invokes three different types of expert management agents designed in the underlying architecture to perform these functions. The specific execution mechanism is as follows: For spatiotemporal drift anomaly data: If the current traffic pattern exhibits significant spatiotemporal drift (i.e., the original causal influence matrix I cannot explain the current transmission path, and is judged as spatiotemporal drift anomaly data), the meta-manager instructs the semantic management agent to restart the Hierarchical Causal Discovery (HCC) mechanism to dynamically correct the causal weights in the semantic memory. This agent is designed at the system's underlying level as an execution module integrating a graph computing engine and statistical algorithm interfaces. Its specific execution method is as follows: using newly collected spatiotemporal data as input, it recalculates the cross-correlation coefficients between nodes, the linear Granger causality test, and the transit entropy, updates the element values of the causal influence matrix I, and persistently overwrites the new matrix parameters into the semantic memory to adapt to the new transmission path.
[0034] For historical pattern snapshot data: If the current congestion conforms to historical patterns (determined as historical pattern congestion snapshot data), the event management agent is instructed to perform feature packaging. This agent is designed as a feature extraction and vectorization mapping engine oriented towards high-dimensional tensors. Specifically, it extracts traffic distribution snapshots from the current 12 time steps, concatenates them with the aforementioned local population density evolution features and abnormal congestion state warning information using tensors; simultaneously, through a built-in preset template mechanism, it automatically converts the above numerical features into structured descriptive text (i.e., background prompts for abnormal events), and finally packages the above information as a new "abnormal event" and stores it in the database ("abnormal event" refers to a continuous spatiotemporal data slice that deviates from normal traffic flow but conforms to a specific historical congestion evolution pattern) for subsequent analogical reasoning.
[0035] Regarding evacuation intervention command data: When the current traffic monitoring data indicates an abnormal congestion state and is a historical snapshot of regular congestion, the external traffic control command center or authorized terminal issues evacuation intervention command data. The meta-manager then switches to "retrieval flow" ("retrieval flow" refers to the system transitioning from data monitoring and memory writing to data querying and extraction of parameters for downstream tasks), activating the program management agent to execute retrieval scheduling. This agent is essentially an expert scheduling engine based on semantic matching and command rule parsing. Its specific execution method is as follows: First, the input structured evacuation intervention command is semantically parsed to extract key intervention targets and action types; then, using these as search terms, precise matching is performed in the program memory to extract the corresponding intervention standard operating procedure (SOP, i.e., intervention script). This routing mechanism ensures that the agent can spontaneously update or extract specific knowledge partitions according to environmental changes.
[0036] Step 3: Obtain the causal background through active retrieval. Based on the current traffic monitoring data, identify nodes in an abnormal congestion state, and extract the causal weights matching the nodes in the current abnormal congestion state from the memory. Combine the causal influence matrix I to identify the nodes affecting the abnormal congestion state, and match the corresponding intervention scripts from the program memory based on these nodes. Retrieve historical time window segments matching the current traffic monitoring data from the plot memory. Inject the causal weights, intervention scripts, and historical time window segments into the prompt words of the large language model.
[0037] This step includes: The search topic is automatically inferred: Based on the current traffic monitoring data, nodes in an abnormally congested state are identified, and the causal influence matrix I is used to determine the nodes affecting the abnormally congested state. For example, when congestion is detected at Exit 6 of Honglu Station, the topic is automatically inferred as "causal linkage and carrying capacity limit between Exit 6 of Honglu Station and Exit A of Metro Station".
[0038] Multi-strategy iterative retrieval: The system first uses vector matching to perform coarse-grained semantic search, retrieving relevant historical time window segments from the episodic memory in the memory bank. If the similarity of the retrieved results is lower than a preset value (e.g., setting the cosine similarity threshold to 0.80), the program management agent determines that a deeper look is needed and automatically switches to keyword-based matching or geographic ID-based retrieval, retrieving relevant historical segments from the episodic memory in the memory bank.
[0039] Knowledge Injection: The causal weights between retrieved nodes, SOP scripts, and relevant historical time window fragments retrieved from episodic memory are transformed into structured labels (i.e., cue words). For example, the common-sense physical fact that "node 102 has a causal weight of 0.85 on its downstream" is injected into the contextual input of the LLM, enabling the model to shift from numerical fitting to regularity deduction.
[0040] Step 4: Perform behavioral prediction based on causal constraints and counterfactual reasoning. Based on the current spatiotemporal data and its corresponding causal influence matrix, determine the pattern corresponding to the current scenario. The large language model combines the prompt words and the counterfactual reasoning formula template of the pattern to perform counterfactual reasoning, simulate the traffic evolution process under a specific intervention scenario, and generate a traffic prediction result (i.e., a predicted traffic distribution matrix) that conforms to physical consistency.
[0041] This step includes: The Large Language Model (LLM) invokes counterfactual intervention scripts stored in the program's memory. Based on the current spatiotemporal data and its corresponding causal influence matrix I, it determines the corresponding causal evolution pattern. Its judgment relies primarily on the extraction of graph topological features from the causal influence matrix I (such as out-degree centrality, connected paths, and betweenness centrality) and the structured analysis of anomalous distributions in the spatiotemporal data. Logical deduction is performed on the four causal evolution patterns identified in the road network, rather than simple numerical mapping. The specific prediction logic is as follows: Prediction of causal chain transmission patterns. Criterion: When there exists a continuous directed path consisting of multiple nodes in the causal influence matrix I, and the causal weights between adjacent nodes are... This mode is triggered when all values exceed a preset chain propagation threshold (the causal weight threshold is set to 0.60). This mode is used to simulate the sequential propagation of traffic in physically confined linear spaces (such as corridors or overpasses). LLM performs the following derivation formula: in, Indicates at time Downstream The predicted flow values for each node; These are the original observations; The diffusion attenuation coefficient in spatiotemporal conduction; The causal weight strength between adjacent nodes stored in semantic memory; The intensity of the intervention at the source node (e.g., the increase in inflow). This formula simulates the physical process of disturbance decaying with increasing distance through the cumulative effect of causal weights.
[0042] Prediction of hub-and-spoke radiation transmission patterns. Criterion: When a node in the causal influence matrix I... This mode is triggered when the out-degree centrality (i.e., the sum of the causal weights of the column containing the node) is greater than a preset hub threshold (e.g., setting the hub's out-degree threshold to 1.50, or taking the top 5% of the global out-degree ranking), and when current spatiotemporal data shows a sudden change in traffic at the core node. This mode is used to simulate the radial influence of transportation hubs (such as subway entrances or the center of large plazas) as core nodes on their surrounding neighboring nodes. Its derivation logic is as follows: in, Indicates at time The predicted flow value of that neighboring node at that time; Indicates at time The original observed flow value of that neighboring node at that time; Refers to the identified hub node; It is a first-order neighbor node of this hub; This is a sign function used to determine the positive or negative correlation of causal effects (positive correlation indicates synchronous growth, negative correlation indicates divergence). It is a radiation intensity adjustment factor; For the hub node at time The formula ensures that when congestion occurs at a core node, the model can accurately predict the pressure diffusion to surrounding scattered areas.
[0043] Community-driven collaborative model prediction. Judgment criteria: Using community discovery algorithms (such as the Louvain algorithm), based on the connectivity of the causal influence matrix I, a set of functional communities with high internal connectivity strength is identified. The high internal connectivity strength mentioned here is determined by modularity (or simply modularity). The value needs to be strictly quantified, that is, the overall result of the community division is required to be... The value is greater than the preset structural threshold (e.g., set). Furthermore, the average causal weight between nodes within a community is significantly greater than the average causal weight between nodes across communities. This mode is triggered when current spatiotemporal data shows synchronized abnormal traffic fluctuations among multiple nodes within a community. This mode is used to simulate the collaborative evolution of areas with similar functions (such as multiple parking lots around a venue or streets in the same commercial area) under the influence of external environmental factors. LLM uses the following logic for prediction: in, Indicates at time The predicted traffic vector is the set of nodes belonging to the same functional community. Indicates at time The original observed flow vector of the set of nodes belonging to the same functional community; This represents the average autocorrelation strength of the nodes within the community. Community collaboration coefficient; This indicates the trigger strength of sudden external environmental factors (such as sudden rainfall or activity termination signals). This formula helps the model capture synchronous surges or dissipation trends in traffic at the overall regional level.
[0044] Predictive Stress Test Mode for Key Nodes. Judgment Criteria: By calculating the betweenness centrality or PageRank value of each node in the causal influence matrix I, key "bridge" nodes with the Top-K global scores are selected. This mode is triggered when the system receives extreme intervention commands targeting such nodes or spatiotemporal data shows severe congestion. This mode is used to perform counterfactual scenario simulations under extreme conditions (including: sudden large-scale network outages causing navigation failure, complete physical closure of main roads or key entrances / exits due to accidents, large-scale power outages and failures of key hub turnstiles, and severe crowd congestion caused by sudden severe weather, etc.), such as simulating the impact of a key path blockage or a turnstile failure on the redistribution of global traffic. in, Indicates at time The predicted traffic distribution vector of all nodes in the global road network after time intervention; Indicates at time The initial traffic distribution vector of all nodes in the global road network before intervention; This indicates the application of Pearl's causal interference econometrics, forcibly applying critical nodes. Set the flow rate to 0 or a very small value; This represents the global causal influence matrix in conjunction with semantic memory in LLM. The distribution of traffic after balance is recalculated. This model does not rely on a single formula, but instead utilizes the multi-step long chain inference (CoT) capability of LLM to assess the risk of secondary congestion after node failure.
[0045] Through the alternating invocation and logical combination of the above four modes, LLM can switch the prediction logic in real time according to the scenario identified by the meta-memory manager.
[0046] For example, in the early stages of crowd dispersal, the hub-and-spoke model is primarily used; however, once the crowd enters a narrow section, it automatically switches to a causal chain transmission model for more refined analysis. This prediction method based on causal logic effectively avoids the "predictive inertia" problem caused by traditional models relying solely on historical numerical patterns, significantly improving prediction accuracy in scenarios of sudden intervention. This invention was compared with existing mainstream prediction methods on real datasets (see Table 1).
[0047] Table 1 Step 5: Execute closed-loop evolution of memory using a quality assessment system. Construct a comprehensive evaluation index that includes dimensions such as value range validity and temporal smoothness to verify the prediction results. Use a dynamic rejection sampling mechanism to filter high-confidence samples and feed them back to the plot memory component to achieve continuous self-iteration of prediction accuracy.
[0048] This step includes: Construct a comprehensive quality assessment score To ensure that the prediction results conform to the laws of physics: in, It is an indicator function; if the flow exceeds... Then take 0; This represents the predicted traffic distribution matrix generated by the large language model; , , These are the weighting coefficients for each rating dimension. The calculation logic for each specific rating dimension is as follows: Time smoothness Evaluation via second-order difference: in, It is a second-order difference operator; This represents the total number of nodes in the road network; This represents the predicted traffic time series for node i using a large language model; This represents the variance function; the formula ensures the smoothness of the predicted sequence over time by penalizing unnatural, abrupt changes in flow.
[0049] The magnitude of change score measures the magnitude of predicted flow abrupt changes and is evaluated by calculating the norm of the disturbance vector: in, This is the penalty factor for scaling the amplitude. denoted by L2 norm; this formula aims to limit the extent to which counterfactual prediction samples deviate from the true historical physical manifold.
[0050] Reasonableness score of relative change Spearman's rank correlation coefficient is used to assess the consistency of the current prediction results with the hierarchical ranking relative to historical states. )measure: in, This represents the Spearman rank correlation coefficient function; This represents a ranking function that sorts the values of each node in the traffic matrix; this formula ensures that intervention simulations do not disrupt the relative macroscopic hierarchical relationships between nodes in the road network.
[0051] The system is based on the final score Dynamic rejection sampling is performed, meaning the system presets a comprehensive score confidence threshold. (In practical applications, this threshold is generally set to 0.85). When the generated predicted sample's final score meets... At this point, the system classifies it as a high-confidence, high-scoring sample. The high-scoring samples selected in this step belong to the high-quality virtual simulation results autonomously generated by the large language model based on counterfactual intervention. Their specific content includes: 1) Initial state and intervention premise: the initial flow distribution vector that triggered this simulation and the corresponding counterfactual intervention command parameters (such as the specific flow-limiting node ID and intensity); 2) Causal evolution mode label: the specific physical transmission logic invoked in this simulation (such as causal chain transmission or hub radiation mode, etc.); 3) High-quality simulation result tensor: the predicted flow distribution matrix generated by the large language model and verified through comprehensive evaluation. 4) Comprehensive evaluation score record: The specific scoring indicators of the sample in terms of time smoothness, change range, and relative change rationality. These high-scoring prediction samples will be fed back and added to the plot memory component as a high-quality virtual simulation experience snapshot. This mechanism enables the system to expand the analog experience pool by accumulating high-quality virtual samples that conform to physical laws, even in the absence of real extreme congestion data, thereby achieving continuous self-iteration of prediction accuracy without human intervention.
[0052] The selected high-scoring samples are fed back into the plot memory system, completing the system's self-iteration.
[0053] The present invention also provides an electronic device, including a memory and a processor, wherein the memory (non-volatile memory) is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-described crowd evacuation flow prediction method based on multi-level causal counterfactual memory enhancement.
[0054] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described crowd evacuation flow prediction method based on multi-level causal counterfactual memory enhancement.
[0055] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described crowd evacuation flow prediction method based on multi-level causal counterfactual memory enhancement.
[0056] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0057] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0058] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0059] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0060] The above embodiments are only used to illustrate the design concept and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, all equivalent changes or modifications made based on the principles and design ideas disclosed in the present invention are within the protection scope of the present invention.
Claims
1. A crowd evacuation flow prediction method based on multi-level causal counterfactual memory enhancement, characterized in that, include: Acquire traffic monitoring data and corresponding geospatial location data, and establish a memory bank composed of semantic, plot, and procedural memories; Semantic memory: used to store the causal influence matrix I and the spatial hierarchical topology tree structure of the road network nodes; the causal influence matrix I is generated based on the spatiotemporal dataset, and the values of each element in the matrix are the causal weights; Episodic memory: used to store time window segments extracted from spatiotemporal datasets for abnormal congestion or effective interventions. The time window segments include node traffic distribution vectors, occurrence time characteristics, abnormal congestion state warning information, and local population density evolution characteristics. The spatiotemporal dataset is constructed based on traffic monitoring data and geospatial location data; Program memory: used to store several intervention scripts, wherein the intervention scripts are node rate limiting strategies; If the current traffic monitoring data is determined to be in an abnormal congestion state and is a historical regular congestion snapshot data, then the causal weights, time window segments, and intervention scripts that match the current situation are extracted from the memory and injected into the prompt words of the large language model; the prompt words are then input into the large language model to predict the traffic flow.
2. The method according to claim 1, characterized in that, The construction of the spatial hierarchical topology tree structure of road network nodes includes: Geographic points in spatiotemporal data are clustered into graph nodes, and a spatial hierarchical topology tree structure of road network nodes is constructed based on the physical spatial connectivity and geographical affiliation between nodes.
3. The method according to claim 1, characterized in that, The causal influence matrix I is generated based on a spatiotemporal dataset and includes: Calculate the maximum cross-correlation coefficient of node pairs under different lags. The candidate node set is selected based on the maximum cross-correlation coefficient, and a correlation weight matrix is generated. ; For the node candidate set, a linear Granger causality test is used to determine whether there is a time-lag directed prediction relationship, in order to generate a linear causal weight matrix. ; For the node candidate set, the transfer entropy of the quantized nonlinear information flow is integrated. To generate the transfer entropy weight matrix ; Based on the correlation weight matrix Linear causal weight matrix and the transitive entropy weight matrix Generate the causal influence matrix I.
4. The method according to claim 1, characterized in that, If the current traffic monitoring data is determined to be in an abnormal congestion state but is also an abnormal data of spatiotemporal drift, update the causal influence matrix in semantic memory.
5. The method according to claim 1, characterized in that, The program memory also stores counterfactual deduction formula templates for different causal models; the counterfactual deduction formula templates for different causal models include: The derivation formula for the causal chain transmission model is as follows: in, Indicates at time Downstream Predicted flow values for each node; These are the original observations; It is the diffusion attenuation coefficient in spatiotemporal conduction; The causal weight strength between adjacent nodes stored in semantic memory; The intensity of intervention at the source node; The derivation formula for the hub-and-spoke radiation transmission model is as follows: in, Indicates at time The predicted flow value of that neighboring node at that time; Indicates at time The original observed flow value of that neighboring node at that time; Refers to the identified hub node; It is a first-order neighbor node of this hub; This is a sign function used to determine the positive or negative correlation of causal effects; a positive correlation indicates synchronous growth, while a negative correlation indicates divergence. It is a radiation intensity adjustment factor; For the hub node at time Changes in flow rate; The community-driven collaborative model can be derived from the following formula: in, Indicates at time The predicted traffic vector is the set of nodes belonging to the same functional community. Indicates at time The original observed flow vector of the set of nodes belonging to the same functional community; This represents the average autocorrelation strength of the nodes within the community. Community collaboration coefficient; Indicates the triggering intensity of sudden external environmental factors; The derivation formula for the critical node stress testing mode is as follows: in, Indicates at time The predicted traffic distribution vector of all nodes in the global road network after time intervention; Indicates at time The initial traffic distribution vector of all nodes in the global road network before intervention; This indicates the application of Pearl's causal interference econometrics, forcibly applying critical nodes. Set the flow rate to 0 or a very small value; This represents the global causal influence matrix in conjunction with semantic memory in LLM. Recalculate the distribution after flow balance; Based on the current spatiotemporal data and its corresponding causal influence matrix, the pattern corresponding to the current scene is determined. The large language model combines the prompt words and the counterfactual inference formula template of the pattern to perform counterfactual inference and generate the traffic flow prediction result.
6. The method according to claim 5, characterized in that, Based on the current spatiotemporal data and its corresponding causal influence matrix, determine the pattern corresponding to the current scene, including: When there exists a continuous directed path consisting of multiple nodes in the causal influence matrix I, and the causal weights between adjacent nodes are... If all values are greater than the preset chain propagation threshold, it is determined to be a causal chain propagation mode; When a node in the causal influence matrix I If the out-degree centrality of a node is greater than the preset hub threshold, and the current spatiotemporal data shows that the node experiences a sudden change in flow, then it is judged to be a hub radiation transmission mode. Based on the connectivity of the causal influence matrix I, a set of functional communities is defined. When the current spatiotemporal data shows that multiple nodes within a community exhibit synchronous abnormal traffic fluctuations, it is determined to be a community collaborative driving mode. By calculating the betweenness centrality or PageRank value of each node in the causal influence matrix I, the key nodes with the top-K global scores are selected. When extreme intervention instructions are received for such nodes or spatiotemporal data show that they are blocked, it is judged as a key node stress test mode.
7. The method according to claim 1 or 5, characterized in that, It also includes verifying the predicted flow of people through comprehensive evaluation indicators, including time smoothness, magnitude of change, and relative reasonableness of change.
8. The method according to claim 7, characterized in that, Time smoothness Evaluation via second-order difference: in, It is a second-order difference operator; The magnitude of change score is evaluated by calculating the norm of the perturbation vector: in, This is the penalty factor for scaling the amplitude. Denotes the L2 norm; Reasonableness score of relative change Spearman's rank correlation coefficient was used. )measure: in, This represents the Spearman rank correlation coefficient function; This represents a ranking function that sorts the values of each node in the traffic matrix; this formula ensures that intervention simulations do not disrupt the relative macroscopic hierarchical relationships between nodes in the road network; The overall assessment score is: in, It is an indicator function. This represents the predicted traffic distribution matrix generated by the large language model; , , These are the weighting coefficients for each rating dimension.
9. The method according to claim 8, characterized in that, Preset rating confidence threshold If the overall evaluation score of the generated prediction sample is greater than or equal to the rating confidence threshold, it will be judged as a high-confidence high-rated sample. The selected high-rated samples will be fed back and added to the plot memory.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements a crowd evacuation flow prediction method based on multi-level causal counterfactual memory enhancement as described in any one of claims 1-9.