A state-aware multi-entity temporal relationship prediction method and system
Patent Information
- Application Number
- CN202611443491.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-17
- Publication Date
- 2026-10-20
Smart Images

Figure FT_1 
Figure FT_2 
Figure SMS_83
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence, computer neural networks, multivariate time series data processing, sparse conditional computation, and relational representation learning. In particular, it relates to a state-aware multi-entity time series relation prediction method and system, which is applicable to multi-entity historical observation joint prediction scenarios such as equipment monitoring, network operation analysis, traffic condition prediction, energy load estimation, industrial process control, environmental observation, and service quality prediction. Background Technology
[0002] In scenarios involving equipment monitoring, network operation analysis, traffic condition prediction, energy load estimation, industrial process control, environmental observation, service quality prediction, and other computer data processing, it is often necessary to simultaneously process historical observations of multiple entities and predict the target responses of each entity at future times. These entities may share the same type of observation features, or they may be in different operating states, different local environments, or different relational structures. Such data is typically organized in computer systems as a three-dimensional tensor consisting of the number of entities, the length of historical time, and the number of features.
[0003] Existing time series forecasting methods typically treat each entity as an independent sequence and use recurrent neural networks, temporal convolutional networks, attention networks, state-space networks, or multilayer perceptrons to extract temporal dependencies. While these methods can characterize the local changes of individual entities, they do not explicitly utilize the states of other entities at the same time. When multiple entities are affected by common external conditions, topological connectivity, spatial proximity, functional similarity, resource competition, or propagation paths, independent sequence forecasting loses the relational context that can be used to determine relative and shared changes.
[0004] Another approach employs a unified shared-temporal encoder to process all entities. Shared parameters facilitate the reuse of recurring temporal patterns across multiple entities and time windows, reducing parameter redundancy associated with training models individually for each entity. However, the temporal structural complexity of different entity windows varies. Some windows exhibit smooth changes, requiring only low-capacity transformations to achieve stable representations; others contain rapid reversals, multi-stage changes, continuous oscillations, sudden shocks, or complex couplings between multiple features, necessitating higher-capacity transformations. A fixed-width, fixed-layer shared encoder performing the same computations on all windows can easily lead to unnecessary computations on simple windows or insufficient representation on complex windows.
[0005] Hybrid expert methods can select different branches based on the input, but in existing practices, multiple branches often have the same width and depth. In this case, the router can only switch between several capacity transformations and cannot change the actual processing capacity based on the window state. Other methods perform routing independently at each time marker, which may cause adjacent time positions within the same entity window to be assigned to inconsistent branches, making it difficult to use the overall state of the complete window as the basis for capacity allocation.
[0006] In multi-entity relationship modeling, existing methods typically employ predefined connection graphs, spatial adjacency graphs, functional label graphs, or fixed relationship graphs derived from historical correlations. While fixed relationship graphs provide stable structural support, their connection set remains unchanged after construction, failing to cover relationships that temporarily appear within the current time window or exceed the existing connection set. If relationship propagation is always confined to a fixed neighborhood, cross-neighborhood dependencies revealed by the current entity state require multiple layers of propagation to reach indirectly, or may even be completely unmodelable.
[0007] Other methods learn fully connected relationships entirely from the current representation. Fully connected relationships have high adaptability, but when the sample size is limited, the number of entities is large, or the observation noise is strong, the model lacks reusable historical structure support and is prone to mistaking short-term accidental similarities for stable relationships. Using fixed priors alone or using the current semantic relationships alone cannot simultaneously satisfy the two requirements of "preserving evidence of long-term relationships" and "supplementing new current relationships".
[0008] Existing mask reconstruction pre-training typically involves randomly masking time markers within a single sequence and reconstructing based on the visible portions of that sequence. While this approach can learn general temporal context, single-sequence reconstruction cannot guarantee sufficient training of the relation module during the pre-training phase when downstream tasks require simultaneous comparison of multiple entities or depend on propagation relationships between entities. Furthermore, if the encoding path used in pre-training differs from that used in downstream joint prediction, the parameters obtained during pre-training may experience transfer decay during fine-tuning.
[0009] Therefore, a new computer implementation scheme is needed to simultaneously address the following technical issues within a unified backbone network: reusing temporal knowledge among different entities while allocating different processing capacities based on the window state of each entity; allowing the current representation to establish global interactions beyond the fixed set of relationships while preserving stable relationship support based on historical trajectories; and ensuring consistency between pre-trained paths and downstream prediction paths. Summary of the Invention
[0010] To address the aforementioned shortcomings of existing technologies, this invention provides a state-aware multi-entity temporal relationship prediction method and system. By combining a shared temporal encoder with heterogeneous capacity routing, different entities can reuse temporal encoding parameters while adaptively selecting processing capacity based on the entity's historical window state. Through a dual-tower structure of semantic relation tower and prior relation tower in parallel, global interaction can be established in the current representation while preserving historically stable relationships. By pre-training through multi-entity mask reconstruction, the pre-training path is kept consistent with the downstream prediction path, thereby improving the adaptability of multi-entity temporal prediction and the integrity of relation representation.
[0011] The specific technical solution of the present invention is as follows: This invention employs a technical solution that combines shared-time coding, heterogeneous capacity routing, dual-relationship towers, and multi-entity mask reconstruction.
[0012] First, multiple entities are divided into groups of length 1000. The corresponding history window Dimensional observation organization as input tensor The input embedding layer is shared across entities and time points, mapping the original features to... Hidden space.
[0013] Secondly, a shared temporal encoder is used to extract the temporal dependencies of each entity sequence. The shared temporal encoder can employ stacked temporal convolutions or other sequence units that satisfy causal or window visibility constraints. The output of the temporal encoder enters a unified branch space.
[0014] Next, multiple processing branches with the same input and output dimensions but different bottleneck widths are set up. The window-level router reads the full window representation of each entity, calculates the routing score of that entity for each branch, and selects the branch with the highest routing score. Each branch participates in the computation. By using sparse selection, only a subset of branches are activated, thus creating combinations of different processing capacities while avoiding the simultaneous execution of all branches by each entity.
[0015] Subsequently, a fixed relation prior is constructed using historical reference trajectories from the training interval. Preferably, a dynamic time-warped distance is used to select several historical neighborhoods for each entity, allowing trajectories with similar shapes but slightly offset local changes to still form relational connections. This relation prior is not reconstructed outside the training interval to avoid using future data.
[0016] Relation modeling employs a parallel structure of semantic relation towers and prior relation towers. The semantic relation tower performs global attention on all valid entities at the same time point, with relation weights determined by the current entity representation. The prior relation tower uses a fixed relation mask and performs attention only within the historical neighborhood. The two relation towers have independent parameters and recalculate attention weights at each time point. Thus, the prior relation tower retains reusable historical relation support, while the semantic relation tower supplements interactions beyond the fixed relation set in the current state.
[0017] During the pre-training phase, entity-time locations are randomly selected, and the complete feature vector of that location is replaced with a masking vector. The masked complete multi-entity temporal panel still undergoes input embedding, shared temporal encoding, heterogeneous capacity branching, semantic relation tower, and prior relation tower. The reconstruction head recovers the masked features based on this backbone output. The masked location can utilize information from other time locations of the same entity, as well as the relational context formed by other entities at the corresponding and adjacent time locations.
[0018] After pre-training, the reconstruction head is removed, retaining the input embeddings and time-relation backbone. The prediction head first maps each time position to a scalar along the feature dimension, and then aggregates them into entity-level predictions along the time dimension. Supervised fine-tuning simultaneously optimizes point value prediction errors and pairwise ordering errors between entities, ensuring that the output is close to the true target value while maintaining the relative order within the same prediction time.
[0019] The beneficial technical effects of this invention are as follows: 1. Enhance the reuse and state adaptation capabilities of temporal knowledge, forming a window-level sparse routing mechanism. A shared temporal encoder allows multiple entities and historical windows to reuse the same parameters. Heterogeneous capacity branches further allocate different capacity combinations based on the complete window state, avoiding parameter redundancy caused by independent encoding and preventing the application of uniform fixed capacity to all windows. The router uses the complete historical window representation of the entity as input, rather than routing separately for individual time locations, ensuring that capacity selection aligns with window-level trends, oscillations, transitions, and multi-stage changes. Each forward propagation activates only the branches with the highest routing scores; unselected branches do not undergo corresponding bottleneck transformations, controlling the number of active parameters and computational load while preserving multi-capacity expressive capabilities. 2. Enhance the integrity and data security of relationship modeling. The prior relationship tower aggregates within the neighborhood of historical trajectories, while the semantic relationship tower models among all valid entities. This parallel dual-tower structure avoids fixed relationship sets becoming closed interaction spaces and also prevents fully dynamic relationships from lacking historical structural constraints. Fixed relationship priors are constructed using only reference trajectories from the training interval and remain unchanged in subsequent stages. The verification and inference stages do not read future intervals to update the relationship set, thereby reducing data leakage in the construction of historical relationships. 3. Improve the consistency and efficiency of pre-training and inference paths. Mask reconstruction uses the same input embeddings, shared temporal encoders, heterogeneous capacity branches, and dual relational towers as supervised prediction, enabling the relational module to directly participate in parameter learning during the pre-training stage and reducing transfer decay caused by using different backbones during pre-training and fine-tuning. The reconstruction head is only used during the pre-training stage and is removed before supervised fine-tuning. Deploying inference only retains the input embeddings, temporal-relational backbone, and prediction head, without adding deployment inference paths. 4. Optimize prediction output methods and expand application scenarios. Point value error constrains the output numerical value, while pairwise sorting error constrains the relative order between entities, suitable for computational tasks that focus on both absolute response and entity ranking at the same time. Input requires multiple entities to have alignable multivariate historical observations; relational priors are based on relational support formed by historical trajectories within the training interval, supplemented by spatial proximity, topological connectivity, or functional similarity relations. All relational sources jointly form a fixed prior for the current model version during the offline preparation phase to adapt to different entity types and target responses. Attached Figure Description
[0020] Figure 1 This is a schematic diagram of the overall process of the state-aware multi-entity temporal relationship prediction method of the present invention; Figure 2 This is a schematic diagram of the overall architecture and key substructures of the state-aware multi-entity temporal relationship prediction system of the present invention. Detailed Implementation
[0021] The present invention will be further described below with reference to the accompanying drawings and embodiments. The described embodiments are for explaining the present invention, not for limiting the present invention. Any equivalent substitutions made to the time coding unit, branch transformation form, relation distance, fusion method, masking strategy, or prediction head under the technical concept of the present invention should be included within the protection scope of the present invention.
[0022] First, as the core method of this invention, this embodiment provides a state-aware multi-entity temporal relationship prediction method.
[0023] like Figure 1 As shown, this method includes the following seven steps: S1, acquisition and input construction of multi-entity historical time-series data; S2, shared temporal coding and adaptive capacity modeling; S3, construction of historical trajectory relationship priors; S4, dual-relationship tower interaction modeling; S5, masked panel reconstruction pre-training; S6, supervised fine-tuning of the prediction head; S7, outputting multi-entity target response prediction results. Input embedding, shared temporal coding, and heterogeneous capacity routing all belong to step S2.
[0024] The above step numbers correspond to the functional stages of the method. Step S3 is completed offline before model training begins and provides a fixed relation prior to step S4; step S5 first masks the input formed in step S1, and then calls steps S2 and S4 and the reconstruction head to complete pre-training. Step S6 is performed after pre-training is completed, and step S7 only uses the fine-tuned model to perform prediction, without re-performing pre-training or supervised fine-tuning.
[0025] In this invention, vectors, matrices, and tensors are distinguished by their definitions, subscripts, and dimensions; real number field symbols retain double-line fonts, while sets and operators retain their respective conventional fonts. Wavy lines represent the representation after branching and weighting, and are not the same variables as the original representation.
[0026] In one implementation, the model receives continuous... The prediction head outputs a multi-entity panel at each historical time step and predicts the target response value for each entity at the next time step. The prediction target can be a continuous value, a discrete level, a direction of change, a risk score, a state score, or other supervised targets. For continuous prediction tasks, the prediction head outputs... For multi-step tasks, the output can be expanded to... ,in To predict the number of steps, For the target dimension.
[0027] Step S1: Acquisition and Input Construction of Multi-Entity Historical Time Series Data Get Multivariate observations of an entity within a historical window. For the first entity... The entity, the first The time position and the first Each feature is denoted as an observation. The complete set of observations consists of: .
[0028] Constructing a validity tensor when different entities have missing observations Or a broadcast mask. The validity tensor can be related to... Homomorphism can also be When an entity has no valid observations at a certain time location, it is first filled with zero values, forward values, statistical values, or learnable missing vectors, and the model distinguishes between true observations and filled values through validity labels.
[0029] The standardized parameters of continuous features are calculated only from the training interval. For features... Available for use: , in, and These are the mean and standard deviation of the training interval, respectively. To prevent division by zero constants, for data with significant differences in entity scale, entity-based normalization or maximum absolute value normalization using only training interval statistics can be employed. Window-based normalization is an alternative preprocessing method, as its statistics come only from the currently visible historical window and do not include future observations; this alternative method is not used in implementations based solely on training interval statistics.
[0030] In a preferred embodiment, the history window length is set to 16, and the number of input features is set to 24. The 24 dimensions are merely an example and do not constitute a limitation on the scope of protection. Input features can consist of original observations, differences, rates of change, rolling mean, rolling standard deviation, local amplitude, periodic statistics, neighborhood statistics, and global environmental context.
[0031] Step S2: Shared Temporal Coding and Adaptive Capacity Modeling (1) Input embedding Using a linear layer shared across all entities and all time locations will Dimensional input mapping to Hidden Space: , in, For the input embedding weight matrix, With the input embedding bias, we get: .
[0032] Optionally, embedding time location, entity type, missing state, or time interval can be used with... Add them together. If the entity set needs to be expanded during the offline preparation phase of the next model version, it is preferable not to use strong entity embeddings bound to fixed entity numbers, or to use only scalable entity attribute embeddings.
[0033] (2) Shared time coding The shared time encoder has a length of 1 for each entity. The hidden sequences are subjected to the same transformation independently: , in, Represents a convolutional encoder, and .
[0034] In a preferred embodiment, It consists of multiple temporal convolutional blocks, each including one-dimensional convolution, normalization, activation function, random deactivation, and residual connections. Convolution is performed along the temporal dimension, with parameters shared across the physical dimension. Optionally, the convolutional blocks may employ dilated convolution to expand the temporal receptive field, or depthwise separable convolution to reduce computational cost.
[0035] In another embodiment, the shared temporal encoder can be replaced by a cyclic encoder, a causal attention encoder, a bidirectional window encoder, or a state-space encoder. As long as different entities reuse the same set of temporal encoding parameters and maintain the independence of entity dimensions at this stage, it falls under the shared temporal encoding described in this invention.
[0036] The technical role of shared time coding is to map recurring time patterns such as local rises, local falls, periodic changes, sudden turns, continuous oscillations and plateau changes in multiple entities to a common representation space, avoiding the need to set up a separate time network for each entity.
[0037] (3) Branch space projection and heterogeneous capacity branching For the Time coding results of each entity The branch space representation is obtained by projecting the shared input: , in, , Let be the dimension of the branch space. and These are the weight matrix and bias of the branch space projection, respectively; set up Capacity Branch The input and output dimensions of each branch are both... This allows its outputs to be directly weighted and combined; the intermediate bottleneck width of each branch. Different. For example, it can be set as follows: ; The above values represent a preferred embodiment. In actual implementation, 2 to 16 branches can be set, and the bottleneck width can be set to monotonically increasing, grouped repeating, or non-uniform according to computing resources.
[0038] No. Each branch can be written as: , in, Will Dimension mapping to dimension, Will Dimension Mapping Back dimension, It can be a Gaussian error linear unit (GELU), a sigmoid function linear unit (SiLU), a modified linear unit (ReLU), or a gated activation function.
[0039] Different bottleneck widths result in branches with varying parameter counts and nonlinear processing capacities. Narrower branches are suitable for handling windows with simpler structures or more stable changes, while wider branches can handle windows with multi-stage changes, strong nonlinearity, or multi-feature coupling. It should be noted that branches are not pre-bound to specific semantic categories; the specific division of labor is determined by data-driven training.
[0040] The above branching formula uses the convention of row-based time position and column-based feature dimension, consistent with the input embedding: the dimension of the first weight matrix is the input feature dimension multiplied by the bottleneck width, and the dimension of the second weight matrix is the bottleneck width multiplied by the input feature dimension; the bias is broadcast along the time dimension. Therefore, the output of each branch still has the same window length and feature dimension as the input, and residual summation and branch fusion can be performed.
[0041] (4) Window-level state routing Router with the first A complete window representation of an entity For input, window-level mapping can first perform average pooling, attention pooling, end-reading, or flattening mapping along the time dimension, and then output. Dimensional branching score.
[0042] During the training phase, noisy routing can be used: , in, The random term is used to increase branch exploration early in training, preventing the router from becoming fixed to a few branches too early. During the inference phase, the random term is reduced to zero.
[0043] Select the route with the highest score. Branches: , The corresponding weights are: , in, For the first The fusion weights of each branch; The weighted fusion yields: , in, The target branch outputs a weighted and fused representation, with a wavy line above it to distinguish it from the input representation before fusion. Then map back through output projection Dimension, to obtain the state-aware time representation: , Perform the above process on all entities to obtain a complete multi-entity state-aware temporal representation: .
[0044] In a preferred embodiment, the number of branches , Choose option 2 or 3. Since each entity only executes a portion of the branches, the number of active parameters is less than the total number of branch parameters. Optionally, a route balancing regularization can be added during training to ensure that different branches are used at a reasonable frequency within a batch or time period.
[0045] The difference between window-level routing and time-stamped routing is that: for a complete window of the same entity, a unified routing decision is first formed, and then the same branch combination is used to process all time positions of the window, so that the capacity allocation corresponds to the complete time state.
[0046] Step S3: Constructing Prior Relationships Based on Historical Trajectories Select a historical reference trajectory for each entity that reflects its long-term changing patterns. The reference trajectory can be a raw feature, a projection of multiple features, a principal component sequence, a target-related surrogate sequence, or a historical summary generated by the encoder.
[0047] In a preferred embodiment, a single continuous reference feature within the training interval is used. First, missing data imputation and standardization are performed on each entity reference trajectory, then the dynamic time-warped distance between entity pairs is calculated. , Dynamic time warping allows two trajectories to align non-linearly on a local time axis. Therefore, when two entities have similar phases of rise, fall, plateau, or transition, but the corresponding changes occur at slightly different times, they may still be able to achieve a small distance.
[0048] To reduce offline computation on large-scale entity sets, candidate sets can be selected first using Euclidean distance, correlation distance, cosine distance, or low-dimensional approximation, and then dynamic time-warped distance can be calculated only within the candidate sets. Alternatively, long reference trajectories can be downsampled and the range aligned using strip constraints.
[0049] For each entity Choose the one with the smallest distance. Other entities as historical neighbors: , in This indicates selecting the one with the smallest distance. One element; After adding a self-join, a fixed set of relations is formed: ; Construct relational mask:
[0050] The relation priors are built offline before training begins and are used only during the training interval. The same relation set is reused in subsequent training, validation, and inference. This fixed relation set is used throughout the training, validation, testing, and deployment inference phases of the same model version. Relation updates for newly added entities are completed during the offline training preparation phase of the next model version and are not rewritten online during the deployment inference process of the current version.
[0051] In addition to dynamic time warping, other trajectory distances (such as Euclidean distance, cosine distance, correlation distance, or learning distance) can be used to construct prior historical relationships. Physical connections, spatial proximity, functional labels, service call relationships, communication topology, and device types can serve as supplementary relationship sources, which can be used in conjunction with the relationship support formed by historical trajectories in the training interval. The priors are used to provide relationship support and do not directly replace the semantic relationships driven by the current representation.
[0052] Step S4: Dual Relationship Tower Interaction Modeling At each time location Take the state-aware time representation for all entities: , Parallel processing of semantic relation tower and prior relation tower The two relational towers use mutually independent parameters.
[0053] Semantic relation tower computation: , , , in, , , These are the query, key, and value projection matrices of the semantic relation tower, respectively.
[0054] The semantic relation output is: , The tower maintains global relational support among all valid entities. Its relational weights are recalculated based on the current representation at each input window and each time location.
[0055] Independent calculation of the a priori relation tower: , , , in, , , These are the query, key, and value projection matrices of the prior relation tower, respectively; The prior relation output is: , The relation mask only restricts visible entity pairs and does not fix the attention weights within the neighborhood. Even if the fixed set of relations remains unchanged, the prior relation tower will still recalculate the weights of each allowed connection based on the current input.
[0056] Each of the two relation towers can stack one or more multi-head relation attention blocks. Each layer can include multi-head attention, residual connections, normalization, and feedforward networks. Different numbers of layers can be selected for different datasets or deployment conditions.
[0057] The dual-tower output uses element-wise addition: ; For all After executing at each time point, the following results are obtained: .
[0058] In another implementation, gated fusion can be used: , , in It is a sigmoid activation function. and Learnable parameters for gating fusion; Regardless of the fusion method used, the semantic relation tower maintains direct interaction capabilities beyond those supported by fixed relations, and the prior relation tower retains support for historical relations.
[0059] Step S5: Masking panel reconstruction pre-training Construct a binary mask: , when At that time, Complete Replace the dimensional vector with a learnable occlusion vector By occluding all features at the same location, the model can avoid directly recovering the target features based solely on the unoccluded features at the same location.
[0060] The masked input sequentially passes through input embedding, shared-temporal encoding, window-level heterogeneous capacity routing, and a dual-relational pyramid. The reconstruction head outputs for each entity-time location. Dimensional reconstruction value: , in Indicates the reconstruction header; Calculate the mean square reconstruction error only at the occluded location: .
[0061] Because the complete multi-solid panel passes through a dual-relationship tower, the reconstruction of the obscured location can be utilized simultaneously: ① The temporal context of the same entity at other time locations; ②The prior relational context of other entities in the historical relational neighborhood; ③ The global semantic relation tower inferred from the currently visible representation of cross-entity context.
[0062] In a preferred embodiment, the occlusion ratio is selected from 0.1, 0.2, 0.3, or 0.4, and pre-training is performed for 20 rounds. The occlusion locations can be randomly distributed, or continuous block, entity-level, time-slice-level, or multi-scale hybrid occlusion can be used. As long as the occluded data is reconstructed through the same time-relationship backbone, it belongs to the multi-entity mask reconstruction of this invention. Occlusion sampling only selects entity-time locations with real and valid observations, and the reconstruction error does not use missing padding values as the real target. Each sample participating in the reconstruction loss calculation contains at least one valid occlusion location; windows that do not meet this condition do not participate in the reconstruction loss calculation to avoid the denominator being zero.
[0063] Routing load balancing regularization can be added during pre-training: , in For routing load balancing losses, Its weighting coefficient; Routing regular expressions are used to avoid all entities consistently selecting a few branches in the long run, without changing the main goal of the refactoring.
[0064] Step S6: Predictive head supervised fine-tuning (1) Predicting head structure The prediction head first maps each time position to a scalar along the hidden feature dimension: , Therefore, the first Each entity receives a length of Scalar history summary: , Then aggregate along the time dimension: .
[0065] This structure first compresses the hidden features at each time point, and then learns the contribution of different historical positions to the prediction target. Another implementation can first perform pooling along the time dimension, and then output the target value through a multilayer perceptron; it can also output multiple future positions according to the needs of multi-step prediction.
[0066] The prediction head is shared across all entities to avoid setting independent parameters for each entity. The shared prediction head, together with the shared temporal encoder, enables the model to handle entities whose prediction parameters were not individually set during training. New entities must still follow the handling methods described later regarding offline expansion and model version switching; objects not included in the frozen entity set should not be directly integrated into the current deployment version.
[0067] (2) Supervision and fine-tuning The reconstruction head is removed after pre-training. The prediction head uses independently initialized parameters, while the input embedding, shared-temporal encoder, heterogeneous capacity branch, and dual relational tower load the pre-trained parameters.
[0068] For the true target value and predicted value The point loss is: , For any entity pair within the same prediction time The pairwise sorting loss is: , The overall supervisory objective is: , Point loss makes the predicted values approximate the true response, while ranking loss ensures that the predicted difference and the true difference have the same direction. For tasks that only require numerical prediction, we can let... For tasks that focus more on the relative order of entities, it can improve... When the sorting error weight is zero, it is a simplified variant without sorting constraints; when performing the point value and sorting joint supervision fine-tuning in this embodiment, the weight takes a positive value.
[0069] During fine-tuning, the routing load balancing regularity can continue to be used, but it should be recorded separately from the supervision target to clarify the definition of point values and ranking targets. When missing labels exist, the point value error is summed only for entities with valid labels, and the ranking error is summed only for entity pairs where both labels are valid; if there are fewer than two valid labels, the ranking item is not calculated, and windows without valid labels do not participate in this supervision update.
[0070] Step S7: Output the multi-entity target response prediction results Masking is not performed during the deployment inference phase, nor is a reconstruction head used. After the complete history window is entered, input embedding, shared temporal encoding, window-level routing, selected capacity branch, semantic relation tower, prior relation tower, relation fusion, and prediction head are executed sequentially.
[0071] For any entity, only the selected ones are calculated. Each branch has a capacity. Historical relationship priors are pre-stored in the offline stage, and the relationship mask is directly read during inference, eliminating the need to repeatedly calculate the distance of all historical trajectories.
[0072] When the valid set of entities changes over time, an entity validity mask can be added to relational attention. Invalid entities are neither included in the query output nor participate as keys or values in other entity aggregations.
[0073] The above steps constitute the core of the method of this invention. Correspondingly, this invention also provides a state-aware multi-entity temporal relationship prediction system, which can be deployed in servers, workstations, edge computing nodes, cloud computing nodes, or computing devices with accelerated processing units.
[0074] Figure 2 The system's overall architecture and key substructures are presented in four sections: (I) The overall process demonstrates two paths: reconstruction pre-training and supervised fine-tuning, covering data input, input embedding, capacity encoding, dual relational towers, reconstruction, and prediction; (II) The adaptive capacity encoder expands on the internal processing of shared-time encoding, window routing, and heterogeneous capacity branches; (III) The historical relation prior construction demonstrates historical trajectory distance, neighborhood selection, and the formation of relation sets; (IV) The dual relational tower expands on the internal interaction between the semantic relational tower and the prior relational tower. The four sections in the diagram are for organizational structure illustration and do not represent that the system contains only four functional modules. The dual relational tower in the diagram is a simplified structural diagram: the matrix multiplication of query and key includes the transpose of the key matrix; after scaling, the semantic relational tower and the prior relational tower are both scaled and superimposed with relational masks, and both first execute the normalized exponential function before performing matrix multiplication with the value representation. The dynamic time-warped relational set and its mask in the diagram correspond to the fixed relational set and relational mask formed when using dynamic time-warped distance in step S3. The system in this embodiment includes the following eight functional modules: Data Reading and Tensor Construction Module: Reads the original time-series records of multiple entities, aligns them according to a unified time index, generates a missing mask and a set of valid entities, and writes the aligned data into a three-dimensional input tensor in memory or video memory.
[0075] Input embedding and shared temporal encoding module: maps the original features to the hidden space; and performs shared-parameter temporal convolution or other temporal encoding independently on each entity to extract the temporal dependencies of each entity within the historical window.
[0076] Window routing and heterogeneous capacity branching module: Reads the complete entity window representation, calculates the branch selection score, and saves multiple branches with different bottleneck widths or different calculation depths. Performs sparse condition calculations based on the routing results to achieve adaptive allocation of processing capacity according to the entity's historical window state.
[0077] Historical Relationship Prior Construction Module: It uses the historical reference trajectory of entities within the training interval to calculate and store the historical neighborhood and relationship mask of entities offline, so as to provide stable relationship support in subsequent training and inference.
[0078] The dual-relationship tower module is used to perform global relationship attention on the current valid entities, while performing masked relationship attention in the neighborhood of historical relationships, and achieves complementarity between fixed relationship support and dynamic global relationships through parallel modeling.
[0079] The relation fusion and prediction module is used to fuse the outputs of two relation towers; and outputs the target response prediction values of each entity during the fine-tuning and inference phases; and receives the representation obtained by the backbone network from the latest historical window during the inference service phase, and returns the entity-level prediction vector and optional sorting results.
[0080] Multi-entity mask reconstruction module: used to generate masked inputs and output reconstructed values during the pre-training stage; at the same time, it calculates the reconstruction loss and optional route load balancing regularization term to support self-supervised pre-training.
[0081] Supervised fine-tuning module: used to delete or deactivate the reconstruction head after pre-training, load backbone parameters and initialize the prediction head; it uses point value prediction error and pairwise sorting error to jointly optimize the prediction head and time-relationship backbone network, and can add routing load balancing regularization terms during training.
[0082] Each module can be implemented by one or more software processes, or by a processor, graphics processor, tensor processor, neural network accelerator, or programmable logic device working together.
[0083] Furthermore, for the key modules in the above method steps S2 and S3, the present invention also provides a variety of alternative implementation methods to adapt to the differentiated needs of different application scenarios.
[0084] (1) Regarding the heterogeneous capacity branch in step S2, its specific implementation is not limited to the differentiation of bottleneck width. It can also be implemented in a variety of other ways to configure different processing capacities, thereby adapting to historical window states of different complexities.
[0085] In the first replacement scheme, each branch has the same width but different numbers of layers. The low-capacity branch contains one layer of feedforward transform, the medium-capacity branch contains two layers, and the high-capacity branch contains three or more layers, with the difference in the number of layers distinguishing the different capacities.
[0086] In the second alternative, different temporal convolution kernels are used for each branch. Branches with small convolution kernels are biased towards local variations, while branches with large convolution kernels or dilated convolutions cover a longer time range, achieving differentiation of different capacities through differences in receptive fields.
[0087] In the third alternative, each branch uses a gated feedforward network with different scaling ratios. The router still selects branches based on the full window, ensuring that the state-aware capacity allocation logic remains unchanged.
[0088] In the fourth alternative scheme, multiple capacity branches share partial input projections or output projections to reduce the number of parameters; the intermediate transformations of each branch remain independent, thereby maintaining capacity differentiation while controlling computational overhead.
[0089] In the fifth alternative, the router uses average pooling, attention pooling, end-to-end reading, max pooling, or a flattened multilayer perceptron to generate window summaries. As long as the routing input covers the entire historical window, rather than just individual timestamps, it is considered a window-level state route.
[0090] (2) Regarding the method of “constructing fixed relationship priors based on the historical reference trajectories of each entity in the training interval” in step S3, it is not limited to neighborhood selection based on dynamic time regularization distance. Fixed relationship sets can also be constructed through various other methods to adapt to the characteristics of entity relationships in different application scenarios.
[0091] First, fixed relationship support is constructed based on historical reference trajectories within the training interval. Building upon this, physical connections can be added when entities have a clear physical topology; distance thresholds or nearest neighbor relationships can be added when entities have spatial locations; and common categories or call relationships can be added when entities have functional categories or service call records. These supplementary relationships, together with the trajectory relationships, form the fixed priors for the current model version, without omitting the historical trajectory relationship construction step.
[0092] Furthermore, multiple prior sources can be combined. For the first... Seek priors and construct a mask. Or bias The a priori relation pyramid can be used as follows: The maximum value in the following formula is calculated element-wise: if any prior a priori allows the entity pair, the corresponding mask element is zero; only when all priors disallow the entity pair is negative infinity. Therefore, this operation is equivalent to first finding the union of the sets of all prior allowed relations, and then constructing the relation mask, without directly performing logical operations on the values of zero and negative infinity. , or: , in, These are fixed or learnable weights.
[0093] Furthermore, when the fixed relationship is not a hard connection but similarity, distance can be converted into an attention bias: , or: .
[0094] The bias is applied by incorporating the attention score from the prior relation tower within the fixed relation support and before the normalized exponential function (softmax); positions outside the fixed relation support are still excluded by the mask. This preserves historical trajectory similarity information and dynamically adjusts the attention weights within allowed relations based on the current input. The semantic relation tower maintains global relation support unrestricted by fixed priors.
[0095] In the actual training and deployment of the model, reasonable hyperparameter configuration and computational performance evaluation are important aspects of engineering implementation.
[0096] In a preferred training configuration, the history window length is set to 16, the number of input features is set to 24, and the hidden dimension is selected from 16, 32, or 64 depending on the data size. The adaptive capacity module in step S2 has six branches, a bottleneck width of [16, 32, 64, 128, 192, 256], and a routing selection number... It can be 2 or 3.
[0097] The dual-relationship tower employs 1 to 3 layers of relationship attention, with 4 attention heads per layer. Historical neighborhood size. The selection can be made from 8, 16, or 32. The mask ratio can be made from 0.1, 0.2, or 0.3. The number of pre-training epochs can be set to 20, the maximum number of supervised training epochs can be set to 50, and early stopping is performed based on the validation set sorting correlation or point value error.
[0098] The optimizer can employ either Adaptive Moment Estimation (Adam) or Adaptive Moment Estimation with Decoupled Weight Decay (AdamW), and the initial learning rate can be set to... The gradient norm pruning threshold can be set to 1.0. The batch size can be set based on the number of entities and the memory capacity. All hyperparameters can be selected based on the verification interval and do not constitute a limitation on the protection scope.
[0099] From a computational complexity perspective, shared-time encoding and window-level routing, under fixed hidden dimensions and fixed branch settings, exhibit approximately linear growth with the number of entities and the window length, and their complexity can be denoted as [formula missing]. Multiply by the single-entity time coding constant.
[0100] The global semantic relation tower computes inter-entity attention at each time point, and its main complexity is: ; If the a priori relation tower is implemented using a dense mask, its theoretical matrix form is also as follows: If a sparse implementation is used based on a fixed neighborhood, relation computation can be restricted to each entity. Within each neighborhood, the complexity of relation aggregation is reduced to: .
[0101] The dynamic time-warped neighborhood is computed offline before training and is not repeated in each training iteration or inference. The mask reconstruction head exists only during the pre-training phase. Through sparse routing and sparse prior aggregation, this invention can control the amount of active computation when the number of entities is large.
[0102] Finally, the method proposed in this invention can be widely applied to various practical scenarios and has a complete fault-tolerant handling mechanism for various anomalies or boundary conditions.
[0103] In equipment status prediction, each entity represents a piece of equipment. Inputs include sensor values, control variables, and operational statistics. The target response can be the status value at the next moment, a failure risk score, or a remaining life-related indicator. Historical relationship priors are constructed from the similarity of long-term operating trajectories within the training interval and can be supplemented by equipment model or process chain connections.
[0104] For example, for multiple devices on the same production line, using temperature, vibration amplitude, current, rotational speed, and their historical variation statistics as inputs, and the temperature of each device at the next sampling time as the target response, the data is first aligned according to a unified sampling time, and then normalized using training interval statistics to construct a fixed neighborhood based on the temperature trajectory of the training interval. Next, masking reconstruction pre-training is performed, and the point value error and the pairwise sorting error of temperatures between devices at the same time are calculated using the temperature label of the next time moment. During deployment, the most recent historical window is input, and the predicted temperature of each device is output. If necessary, inverse normalization is performed using training statistics. The predicted temperature or temperature sorting can be given to the equipment monitoring system for early warning or scheduling of inspections.
[0105] In communication network prediction, each entity represents a node, link, or service instance. Inputs include throughput, latency, packet loss rate, queue length, and resource consumption. The target response can be future load, quality of service, or congestion risk. Historical relationship priors are constructed from long-term traffic trajectories within the training interval and can supplement topological connectivity. The semantic relationship tower in step S4 is used to supplement synchronous changes across the topology.
[0106] In traffic condition prediction, each entity represents a road segment, station, or region. Inputs include traffic flow, speed, occupancy rate, and event statistics. Historical relationship priors are constructed from the similarity of historical trajectories within the training interval and can be supplemented with spatial adjacency. Semantic relationship towers are used to model synchronous changes between non-adjacent regions caused by common events.
[0107] In environmental monitoring, each entity represents a monitoring station. Inputs include observations such as temperature, humidity, concentration, wind speed, and precipitation. The target response can be future environmental values or anomaly levels. Historical relationships can be constructed from geographical distance and long-term trajectories.
[0108] In service quality prediction, each entity represents a service, interface, or user group. Inputs include request volume, response time, error rate, and resource utilization. The target response can be the future service level or the probability of anomalies. Heterogeneous capacity routing can select different computational capacities based on the varying complexity of different service windows.
[0109] The above applications are only used to illustrate the general adaptability of the present invention to multi-entity time series data, and do not constitute a limitation on entity type, input features or prediction target.
[0110] For abnormal or boundary situations, this implementation method adopts the following unified approach: When the number of valid entities within a given time window is small, shared time encoding, window-level capacity routing, and dual relational towers are retained, and calculations are performed only on valid entities. When there is only one valid entity, the valid relational support of both towers degenerates into self-connections, and the core modules are not omitted. During offline prior construction, if other candidate entities are insufficient for the preset neighborhood size, all available candidate entities are used and added to the self-connection. During model runtime, invalid entities are excluded only from the already frozen relational support; neighbors are not reselected or new connections are introduced due to a decrease in valid entities.
[0111] When an entity's historical trajectory within the training interval is insufficient to calculate a reliable distance, its prior relation support is temporarily set to self-connection and frozen in the current model version; entities with sufficient trajectories still construct their historical neighborhoods according to step S3. If the available history is insufficient to form an input window, the entity is marked as invalid, and no predicted value for that entity is output.
[0112] When a new entity appears during the deployment phase, the current version does not modify the frozen entity set and relation priors online. The new entity is included in the training interval during the offline preparation phase of the next version, and the expanded relation set is built according to step S3 and the corresponding training or fine-tuning is completed; after verification, the model and prior version are switched as a whole, and the prior is kept frozen after the switch.
[0113] When the input contains outliers, truncation, robust normalization, or quantile transformation can be used at the input layer. The above preprocessing does not alter the shared-time coding, heterogeneous capacity routing, and dual-relationship tower core structures of this invention.
[0114] Although the embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. Therefore, the present invention is not limited to the specific details without departing from the general concept defined by the claims and their equivalents.
Claims
1. A state-aware multi-entity temporal relationship prediction method, characterized in that, Includes the following steps: Step S1, Acquisition and Input Construction of Multi-Entity Historical Time Series Data: Acquire multivariate time series data of multiple entities within a historical window, and construct the input tensor according to the entity dimension, time dimension, and feature dimension: , in, Indicates the number of entities. Indicates the length of the history window. This represents the number of observed features for each entity at each time step; Step S2, Shared Temporal Coding and Adaptive Capacity Modeling: Perform shared input embedding and shared temporal coding on the input tensor to obtain the temporal representation of each entity within the historical window; for any entity, calculate the window-level routing score based on the temporal representation corresponding to the complete historical window of the entity, select at least one target branch from multiple branches with different processing capacities based on the routing score, and perform weighted fusion on the output of the target branch to obtain the state-aware entity temporal representation; Step S3: Constructing prior knowledge of historical trajectory relationships: Constructing fixed prior knowledge of relationships based on the historical reference trajectories of each entity within the training interval; Step S4, Dual Relationship Tower Interactive Modeling: At each time position, the state-aware entity time representation is input into the semantic relationship tower and the prior relationship tower respectively; wherein, the semantic relationship tower calculates the relationship weight driven by the current representation among all valid entities, and the prior relationship tower calculates the relationship weight within the relationship support defined by the fixed relationship prior; the outputs of the semantic relationship tower and the prior relationship tower are fused to obtain a multi-entity time-relationship representation; Step S5, Masking Panel Reconstruction Pre-training: In the self-supervised pre-training stage, some entity-temporal locations in the input tensor are masked. Using the time-relation backbone network including the shared temporal encoding, each processing capacity branch, semantic relation tower and prior relation tower, the masked observations are reconstructed based on the unmasked temporal context of the same entity and the relational context of other entities. Step S6, Prediction Head Supervision Fine-tuning: After completing the self-supervised pre-training, remove the reconstruction head, retain the time-relationship backbone network, add a prediction head on the time-relationship backbone network, and use a supervision target that includes point value prediction error and pairwise ranking error between entities to jointly fine-tune the prediction head and the time-relationship backbone network. Step S7: Output multi-entity target response prediction results: The fine-tuned prediction head outputs the target response prediction values corresponding to each entity. The obtained prediction results are used for entity sorting, filtering, or status judgment.
2. The method according to claim 1, characterized in that, In step S1, the entity includes at least one of sensing devices, computing nodes, network nodes, space stations, industrial units, service objects, user objects, environmental monitoring objects, or other objects with alignable historical observations; The multivariate time series includes observed values and derived features calculated based on the observed values; the observed values include at least one of state values, flow values, load values, count values, intensity values, location values, quality values, environmental values, control values, or event statistics; the derived features include at least one of rate of change, rolling statistics, or contextual features. Step S1 further includes: aligning observations of multiple entities according to a unified time index; generating at least one of a validity marker, a missing mask, or a time interval feature for missing observations; performing standardization or normalization on continuous features based solely on training interval statistics; and encoding entity identifiers, time location identifiers, observation features, and the validity markers together as a tensor in computer memory or video memory.
3. The method according to claim 1, characterized in that, The shared temporal encoding in step S2 includes: using at least one of the following: shared one-dimensional temporal convolution, dilated convolution, depthwise separable convolution, recurrent unit, attention unit, or state space unit, to independently extract temporal dependencies from the historical sequence of each entity, and to enable different entities to reuse the same set of temporal encoding parameters.
4. The method according to claim 1, characterized in that, In step S2, multiple branches have the same input and output dimensions, but different intermediate bottleneck widths, number of layers, convolutional kernel sizes, expansion ratios, or nonlinear transform depths to form different processing capacities; any branch satisfy: , in, For branch input, For the first A bottleneck transformation For the first The bottleneck width of each branch; The window-level router in step S2 takes the complete historical window representation of any entity as input, rather than routing independently for each individual time stamp; the routing score during training consists of deterministic routing entries and random exploration entries. , in, For the first A complete window representation of an entity, and For learnable window-level mappings, The noise is random; the random noise is removed during inference. The routing and fusion method is as follows: From Choose the branch with the highest routing score There are 1 branch, among which For the total number of branches, and according to the above... The scores corresponding to each branch are weighted and fused after being processed by the normalized exponential function softmax. , in, For the first The set of target branches corresponding to each entity. Unselected branches do not participate in the branch transformation of this entity's current forward propagation. Output the weighted and fused representation for the target branch.
5. The method according to claim 1, characterized in that, The fixed relation prior in step S3 is constructed as follows: a one-dimensional or multi-dimensional historical reference trajectory is selected for each entity from the training interval; missing data processing, standardization, and optional downsampling are performed on the reference trajectory; at least one of the following is calculated between entity pairs: dynamic time-warped distance, Euclidean distance, cosine distance, correlation distance, or learned distance; Among them, when using dynamic time warping distance, for entities and entity Historical reference trajectory and ,calculate and based on the distance, it is an entity. Select historical neighborhood ; For each entity, select the entity with the smallest distance or the highest similarity. Each entity is treated as a historical neighborhood, and its own connections are added to obtain a fixed set of relationships; The fixed relation prior is constructed using only training interval data and remains unchanged during validation, testing, and deployment inference.
6. The method according to claim 1, characterized in that, In step S4, the semantic relation tower and prior relation tower execute independent queries, key-value mappings in parallel at each time point; for any given time point... The output of the semantic relation tower is: , The output of the prior relation tower is: , in, This is a relation mask or relation bias matrix. To hide dimensions; for entity pairs within a fixed set of relations, the relation mask is set to a value that allows attention computation; for entity pairs outside the fixed set of relations, the relation mask is set to a masking value that makes the attention weight zero; the semantic relation tower is not subject to the fixed relation mask; The fusion method in step S4 includes at least one of element-wise addition, linear mapping after concatenation, gated weighting, or residual normalization; in the element-wise addition fusion method: 。 7. The method according to claim 1, characterized in that, The masking operation in step S5 includes: constructing a binary mask. ,when At that time, the entity In time location Complete The dimensional feature vectors are replaced with learnable masking vectors; the reconstruction head generates a reconstruction tensor based on the output of the time-relationship backbone network. And the reconstruction loss is calculated only at the occluded entity-time location: 。 8. The method according to claim 1, characterized in that, The supervision objective in step S6 is: , The first term constrains the point value error between the predicted and actual target response values, while the second term constrains the consistency between the predicted and actual order of different entities at the same prediction time. The weights are for sorting error. During training, a routing load balancing regularization term can also be added, which is calculated separately from the supervision target.
9. The method according to claim 1, characterized in that, The prediction head in step S7 is configured to: first map the relational representation of each entity at each time position into a scalar sequence, and then perform weighted aggregation along the time dimension. , , in, and These are the weights and biases of the feature dimension mapping, respectively. For the first The target response prediction value for each entity. and These are the weights and biases for the time-dimensional aggregation, respectively.
10. A state-aware multi-entity temporal relationship prediction system, used to perform the method according to any one of claims 1-9, characterized in that, include: The data reading and tensor construction module is used to acquire multivariate time series data of multiple entities and construct input tensors. The input embedding and shared temporal encoding module is used to map the input tensor to the hidden space and extract the temporal representation of each entity using shared parameters; The window routing and heterogeneous capacity branching module is used to sparsely select the target branch from multiple branches with different processing capacities and perform weighted fusion based on the complete historical window status of the entity. The historical relationship prior construction module is used to construct a fixed relationship set based on the historical reference trajectories of entities within the training interval; The dual-relationship tower module is used to compute the global relations driven by the current representation among all valid entities and to compute the prior relations within a fixed set of relations, and output the two types of relation representations respectively; The relation fusion and prediction module is used to fuse the outputs of the two relation towers and generate the target response prediction values for each entity. A multi-entity masking reconstruction module is used to mask part of the entity-time location and reconstruct the corresponding observation during the pre-training stage; The supervised fine-tuning module is used to jointly optimize the prediction head and time-relationship backbone network with point value error and pairwise sorting error after removing the reconstruction head.