Multi-view task prior offline reinforcement learning routing method, device and storage medium

By constructing a multi-view task prior offline reinforcement learning routing method, combining semantics, behavioral trajectories, and dynamic nodes, calculating content and global matching scores, generating expert weights, and performing weighted fusion, the problem of the inability of global task structure information and local context information to provide coordinated guidance is solved, thereby improving generalization ability and decision stability.

CN123178041APending Publication Date: 2026-11-27PEKING UNIV SHENZHEN GRADUATE SCHOOL +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611717786.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-11-02
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing offline reinforcement learning methods cannot coordinate the use of global task structure information and local context information to guide hybrid expert routing decisions, resulting in unstable expert selection and frequent negative transfer phenomena. Furthermore, their generalization ability is limited in multi-task heterogeneous scenarios.

Method used

By constructing semantic task nodes, behavioral trajectory nodes, and potential dynamic nodes, and combining them with a policy backbone network and a task guidance router, content matching scores and global matching scores are calculated. Expert weights are generated and weighted fusion is performed to form a closed-loop iterative decision-making system that integrates global task structure information with local contextual information.

Benefits of technology

It significantly improves the generalization ability and decision stability of offline meta-reinforcement learning under distribution bias and few-sample conditions, and achieves a technical leap from single routing to dual-score fusion, and from task independence to structural modeling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178041A_ABST
    Figure CN123178041A_ABST
Patent Text Reader

Abstract

The application discloses a multi-view task prior offline reinforcement learning routing method and device and a storage medium, comprising: acquiring a plurality of training tasks, and constructing a function node for each training task; inputting the function node and an input sequence to a policy backbone network to calculate a content matching score and a global matching score for each expert of a mixed expert structure; taking the sum of the content matching score and the global matching score as an expert routing score, normalizing the routing score into an expert weight, weighting and fusing action predictions output by each expert of the mixed expert structure to generate a final action output; and receiving a new state and a new reward feedback from an environment and updating the input sequence until a preset termination condition is met. The application extracts global task prior through three-view task nodes, adds a local content matching score to fuse the two types of information, makes the routing decision consider both the global structure and the local context, and improves the few-sample generalization capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of reinforcement learning technology, and in particular to a multi-view task prior offline reinforcement learning routing method, device and storage medium. Background Technology

[0002] Reinforcement learning techniques have been widely applied in continuous control tasks such as robot control, autonomous driving, and intelligent decision-making. However, traditional reinforcement learning methods typically require large amounts of online interactive data, resulting in high training costs, and direct online interaction in real-world physical scenarios poses security risks. Therefore, offline reinforcement learning has emerged.

[0003] Hybrid expert structures have been introduced into the field of reinforcement learning to alleviate gradient conflicts and negative transfer problems in multi-task training. The core idea is to combine multiple expert subnetworks through a gating routing mechanism, so that different experts can focus on processing different types of input data.

[0004] However, existing routing mechanisms in hybrid expert structures typically rely on token-level or local hidden states for expert selection, lacking global task-level structural priors. Due to this lack of understanding of the overall task characteristics, expert selection results are susceptible to instability caused by local noise and prone to negative transfer. Furthermore, existing methods often utilize only a single information source, failing to comprehensively model task semantic information, behavioral trajectory features, and environmental dynamics, thus limiting the comprehensiveness and robustness of task representation.

[0005] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0006] The main objective of this application is to provide a multi-view task prior offline reinforcement learning routing method, device, and storage medium, aiming to solve the technical problem that the global task structure information and local context information cannot collaboratively guide hybrid expert routing decisions in existing offline meta-reinforcement learning.

[0007] To achieve the above objectives, this application proposes a multi-view task prior offline reinforcement learning routing method, applied to a multi-view task prior offline reinforcement learning routing device, the method comprising: Multiple training tasks are obtained from the offline meta-reinforcement learning task set, and functional nodes are constructed for each training task. The functional nodes include semantic task nodes, behavioral trajectory nodes, and potential dynamic nodes. The semantic task nodes are generated by the task description of the training task, the behavioral trajectory nodes are generated by clustering the offline trajectory states of the training task, and the potential dynamic nodes are obtained by temporal encoding of the state sequence, action sequence, and reward sequence through a recurrent neural network. The functional nodes and the input sequence of the current policy model are input together into a policy backbone network based on a decision transformer. Through the task guidance router of the policy backbone network, a content matching score and a global matching score are calculated for each expert in the hybrid expert structure. The input sequence includes historical trajectory segments. The content matching score measures the local matching degree between the input sequence and the expert, while the global matching score measures the global matching degree between the task structure information (composed of the semantic task nodes, behavioral trajectory nodes, and latent dynamics nodes) and the expert. The calculation of the content matching score and the global matching score includes: extracting a hidden state sequence from the historical trajectory segments of the input sequence; calculating the dot product similarity between the hidden state sequence and the feature prototypes of each expert to obtain the content matching score; concatenating the semantic task nodes, behavioral trajectory nodes, and latent dynamics nodes into a joint task vector; and calculating the distance between the joint task vector and the task preference vectors of each expert to obtain the global matching score. Based on the current task type, weight coefficients are dynamically retrieved from the pre-configured weight library. The content matching score of the same expert is weighted and summed with the global matching score, and then used as the routing score of the expert. Apply a dynamic bias to each expert's routing score that is correlated with the current task difficulty level, the value of which is positively correlated with the task difficulty level; The routing score after applying dynamic bias is input into the flexible maximum function to obtain the normalized intermediate weight; The weight change rate is calculated based on the expert weight distribution of the previous time step. When the weight change rate exceeds the preset fluctuation threshold, the intermediate weights are smoothed and filtered to obtain the expert weights at the current time. The action predictions output by each expert in the hybrid expert structure are weighted and fused according to the expert weights to generate the final action output at the current moment. The final action output is sent to the environment for execution. The environment provides feedback on new states and rewards. After updating the input sequence with the new states and rewards, the steps from building functional nodes to generating the final action output are repeated until the preset termination condition is met.

[0008] In one embodiment, before the step of inputting the input sequence of the functional node and the current policy model into the policy backbone network based on the decision transformer, the method further includes: Collect expert demonstration data, which includes a complete trajectory segment of status, action, and reward; The policy backbone network is initially trained using a behavior cloning method to ensure that the action predictions output by the policy backbone network are consistent with the actions in the expert demonstration data. After the behavior clone training is completed, the parameters of the policy backbone network are saved as initial parameters for subsequent joint training with the hybrid expert structure and the task-guided router.

[0009] In one embodiment, the step of weightedly fusing the action predictions output by each expert in the hybrid expert structure according to the expert weights to generate the final action output at the current moment includes: Obtain the original action prediction value output by each expert in the hybrid expert structure, wherein the original action prediction value includes continuous control quantity or discrete action selection probability; The original action prediction value output by each expert is multiplied element by element by the corresponding expert weight as the weighted action component. The weighted action components of all experts are then added bit by bit to obtain the fused action vector. When the global matching score is determined to be lower than a preset confidence threshold, the amplitude of the fused action vector is reduced to obtain the final action output.

[0010] In one embodiment, the steps of sending the final action output to the environment for execution, receiving new states and new rewards from the environment, and updating the input sequence with the new states and new rewards include: The new state is appended to the end of the historical trajectory segment in chronological order to form an extended input sequence, and the new reward is embedded as auxiliary information into the state feature vector corresponding to the input sequence. When the length of the input sequence exceeds the preset context window size, the data of one or more earliest time steps at the beginning of the sequence is discarded, maintaining an input sequence of constant length.

[0011] In one embodiment, after the step of sending the final action output to the environment for execution and receiving new status and new reward feedback from the environment, the method further includes: Based on the new state, safety constraint indicators are calculated, including collision risk coefficient and boundary crossing probability; When the security constraint index exceeds the preset security threshold, a security protection action is generated to replace the final action output, and the security protection action is sent to the environment for execution. Receive the new security protection status and new security protection reward fed back by the environment when it performs the security protection action, and update the new security protection status and new security protection reward to the input sequence.

[0012] In one embodiment, the multi-view task prior offline reinforcement learning routing method further includes: The policy backbone network, the hybrid expert structure, and the task guidance router are jointly trained using an offline dataset. The offline dataset contains only trajectory data of multiple training tasks and does not contain any test task data. After the joint training is completed, a small number of context trajectory fragments of one or more unseen test tasks are obtained, the data of which was not used in the joint training process; Semantic task nodes and behavioral trajectory nodes of the test task are extracted from the context trajectory fragment, and potential dynamic nodes based on the context trajectory fragment are output through a pre-trained world model. The semantic task node, the behavior trajectory node, and the potential dynamic node are input into the policy backbone network. The task guidance router of the policy backbone network performs expert selection and action generation, and outputs the final action sequence of the unseen test task. During execution, the calculation weight of the global matching score is dynamically adjusted based on the real-time feedback from the unseen test tasks, thereby achieving adaptive generalization of the task under conditions of few samples.

[0013] Furthermore, to achieve the above objectives, this application also proposes a multi-view task prior offline reinforcement learning routing device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the multi-view task prior offline reinforcement learning routing method as described above.

[0014] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the multi-view task prior offline reinforcement learning routing method as described above.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: Multiple training tasks are acquired from an offline meta-reinforcement learning task set, and functional nodes are constructed for each training task. These functional nodes include semantic task nodes, behavioral trajectory nodes, and latent dynamic nodes. The semantic task nodes are generated using the task description of the training task; the behavioral trajectory nodes are generated by clustering the offline trajectory states of the training task; and the latent dynamic nodes are obtained by temporally encoding the state sequence, action sequence, and reward sequence using a recurrent neural network. The functional nodes and the input sequence of the current policy model are input into a policy backbone network based on a decision transformer. The task-guided router of the policy backbone network calculates the content matching score and global matching score for each expert in the hybrid expert structure. The input sequence includes historical trajectory fragments, wherein the content matching score... The global matching score is used to measure the degree of local matching between the input sequence and the experts. It measures the degree of global matching between the task structure information (composed of the semantic task nodes, the behavior trajectory nodes, and the potential dynamics nodes) and the experts. The sum of the content matching score and the global matching score is used as the routing score for each expert, and the routing score is normalized into an expert weight. The action predictions output by each expert in the hybrid expert structure are weighted and fused according to the expert weights to generate the final action output at the current moment. The final action output is sent to the environment for execution, and new states and rewards are received from the environment. After updating the input sequence with the new states and rewards, the steps from constructing functional nodes to generating the final action output are repeated until a preset termination condition is met.

[0016] The technical solution of this application integrates global task structure information and local context information into the routing decision closed loop, enabling expert selection to be guided by both global priors and local matching. This solves the technical problem of task representation and routing decision being separated and local and global information being unable to be used in a coordinated manner. It achieves a technical leap from single routing to dual-score fusion and from task independence to structural modeling, significantly improving the generalization ability and decision stability of offline meta-reinforcement learning under distribution shift and few-sample conditions. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating the first embodiment of the multi-view task prior offline reinforcement learning routing method of this application. Figure 2 This is a detailed process diagram based on step S20 in the first embodiment; Figure 3 This is a detailed schematic diagram of step S30 in the first embodiment; Figure 4 This is a detailed schematic diagram of step S40 in the first embodiment; Figure 5 This is a detailed process diagram based on step S50 in the first embodiment; Figure 6 This is a flowchart illustrating the second embodiment of the multi-view task prior offline reinforcement learning routing method of this application. Figure 7 This is a flowchart illustrating the third embodiment of the multi-view task prior offline reinforcement learning routing method of this application. Figure 8 This is a flowchart illustrating the fourth embodiment of the multi-view task prior offline reinforcement learning routing method of this application; Figure 9 This is a schematic diagram of the overall process of an offline meta-reinforcement learning expert routing method based on multi-view task priors and world models. Figure 10 This is a schematic diagram of the device structure of the hardware operating environment involved in the multi-view task prior offline reinforcement learning routing method in the embodiments of this application.

[0020] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0022] In the field of offline meta-reinforcement learning, existing techniques typically employ decision transformer architectures based on historical trajectory cues. These architectures use trajectory fragments as contextual inputs to generate actions, or introduce hybrid expert structures to mitigate gradient conflicts during multi-task training. However, these approaches generally treat different tasks as independent entities, lacking explicit modeling of the structural relationships between tasks. Their routing mechanisms are mostly based on token-level local hidden states for expert selection, failing to leverage prior knowledge of the global task structure to guide decisions. When there is a distributional shift between the test and training tasks, relying solely on local trajectories is insufficient to accurately identify task identities, leading to unstable expert selection, frequent negative transfer, and severely limited few-shot generalization capabilities. Comprehensive analysis reveals that the core challenge faced by these technical approaches lies in the disconnect between global task structural information and local contextual information, failing to form a closed loop that collaboratively guides expert routing. This makes it difficult for the model to achieve stable and efficient knowledge transfer in heterogeneous multi-task scenarios.

[0023] To address the aforementioned shortcomings, this application proposes a multi-view task prior offline reinforcement learning routing method. This method extracts global task priors from three dimensions: task description, state space access patterns, and environmental dynamics, by constructing semantic task nodes, behavioral trajectory nodes, and latent dynamics nodes. These three types of nodes, along with historical trajectory fragments, are input into a policy backbone network based on a decision transformer. A task-guided router calculates a content matching score and a global matching score for each expert. The content matching score measures the degree of matching between the local context and the expert, while the global matching score measures the degree of matching between the task structure information and the expert. The two scores are summed to obtain the routing score, which is then normalized to become the expert weight. The action predictions output by each expert are weighted and fused to generate the final action. This action is then sent to the environment for execution, receiving new states and rewards and updating the input sequence, forming a closed-loop iteration until the termination condition is met. During the training phase, the policy backbone network, hybrid expert structure, and task-guided router are jointly trained using an offline dataset. During the testing phase, for unseen tasks, only a small amount of contextual trajectories are input, and latent dynamics nodes can be generated using a pre-trained world model, completing expert selection and action generation.

[0024] Through the above-mentioned technical means, this application integrates the global structural information and local contextual information of the task into the routing decision closed loop, so that the expert selection is simultaneously guided by the global prior and local matching. This solves the technical problem of the separation between task representation and routing decision and the inability to use local and global information in a coordinated manner. It realizes the technical leap from single routing to dual-score fusion and from task independence to structural modeling, and significantly improves the generalization ability and decision stability of offline meta-reinforcement learning under distribution offset and few-sample conditions.

[0025] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0026] Based on this, embodiments of this application provide a multi-view task prior offline reinforcement learning routing method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the multi-view task prior offline reinforcement learning routing method of this application. In this embodiment, the multi-view task prior offline reinforcement learning routing method includes steps S10~S60: Step S10: Obtain multiple training tasks from the offline meta-reinforcement learning task set, and construct functional nodes for each training task. The functional nodes include semantic task nodes, behavioral trajectory nodes, and potential dynamic nodes. Specifically, the semantic task nodes are generated by the task description of the training task, the behavioral trajectory nodes are generated by clustering the offline trajectory states of the training task, and the potential dynamic nodes are obtained by temporal encoding the state sequence, action sequence, and reward sequence through a recurrent neural network. In this embodiment, multiple training tasks are acquired from the offline meta-reinforcement learning task set, and functional nodes are constructed for each training task. Functional nodes include semantic task nodes, behavioral trajectory nodes, and latent dynamics nodes. Semantic task nodes are generated through the task descriptions of the training tasks and are used to represent high-level prior information at the task level.

[0027] In the implementation, each training task is accompanied by a natural language description text, which describes the task's macro-level objectives, environmental constraints, or behavioral preferences. A task encoder encodes the description text using a pre-trained language model, outputting a fixed-dimensional semantic feature vector, denoted as the semantic task node z^sem. Behavioral trajectory nodes are generated by clustering the offline trajectory states of the training task, describing the task's access patterns in the state space. The offline trajectory data contains state samples from multiple time steps. State data from all trajectories under this task are collected, and these state vectors are unsupervised clustered using a Gaussian mixture model or K-means clustering algorithm. After clustering, multiple cluster centers are obtained, each representing a typical state region. The behavioral trajectory node z^traj consists of the set of these cluster centers and their corresponding weight distributions, reflecting the state space regions frequently accessed by the agent in this task.

[0028] The latent dynamic nodes are obtained by temporally encoding the state sequence, action sequence, and reward sequence using a recurrent neural network. For a training task, a complete or partial trajectory segment is sampled, and the state vector s, action vector a, and reward value r in this segment are aligned by time steps and then sequentially input into a dynamic encoder composed of a gated recurrent unit or a long short-term memory network. The operation of this encoder can be expressed as follows: Here, RNN represents the temporal encoding process of a recurrent neural network. The encoder progressively updates its hidden states, and the hidden state at the final time step, or the aggregated result of the hidden states at all time steps, serves as the latent dynamic node. .

[0029] To capture the dynamic evolution of the environment, an additional world model is trained. This world model takes the current state and action as input and predicts the next state and immediate reward. During training, the output of the dynamic encoder should not only characterize the dynamic features of the trajectory but also contribute to the world model's accurate prediction of future states. By jointly optimizing the prediction losses of the dynamic encoder and the world model, This allows them to carry key information about the probability of environmental transitions. The dimensions of the three nodes mentioned above have been normalized to ensure they are on the same numerical order of magnitude, facilitating subsequent fusion. After constructing the functional nodes for all training tasks, each task corresponds to a set of triples. The triple describes the structural features of the task at the semantic, state space, and dynamic evolution levels, respectively, providing a global prior basis for subsequent task guidance and routing.

[0030] Step S20: Input the input sequence of the functional node and the current policy model together into the policy backbone network based on the decision transformer. Through the task guidance router of the policy backbone network, calculate the content matching score and the global matching score for each expert in the hybrid expert structure. The input sequence includes historical trajectory segments. The content matching score is used to measure the local matching degree between the input sequence and the expert. The global matching score is used to measure the global matching degree between the task structure information composed of the semantic task node, the behavior trajectory node and the potential dynamic node and the expert. In this embodiment, the aforementioned functional nodes and the input sequence of the current policy model are jointly input into the policy backbone network based on the decision transformer. The input sequence includes historical trajectory segments, which are composed of states, actions, and rewards from several past time steps arranged chronologically. The decision transformer adopts an architecture similar to transformers in natural language processing, treating each time step in the input sequence as a token and capturing the dependencies between tokens through a self-attention mechanism. The policy backbone network simultaneously receives the input sequence at the current moment and the pre-built functional nodes.

[0031] In one fusion approach, functional nodes are treated as additional special tokens, appended to the start or end of the input sequence, enabling the transformer to interact with task-level global information and local historical trajectories during self-attention computation. Another fusion approach encodes functional nodes as conditional vectors at each layer of the transformer and injects them into the representation of the input sequence through a cross-attention module. Overall, the input can be represented as... ,in Hints representing segments of historical trajectory.

[0032] The task-guided router within the policy backbone network calculates content matching scores and global matching scores for each expert in the hybrid expert architecture. The hybrid expert architecture comprises multiple expert networks, each a feedforward neural network or a small transformer module, specifically designed to handle a particular type of decision pattern. The content matching score measures the degree of local matching between the input sequence and the expert. The router first extracts the hidden state sequence corresponding to the input sequence from an intermediate layer of the transformer, typically selecting the hidden state of the last token or the pooled result of all token hidden states as the representation of the current local context. This local representation is then compared with the feature prototype of each expert, a learnable vector that gradually converges during training to represent the local patterns that the expert excels at handling. Similarity calculation methods can employ dot product or temperature-coefficient cosine similarity, outputting a scalar score denoted as `score_content`.

[0033] The global matching score measures the degree of global matching between the task structure information (composed of semantic task nodes, behavioral trajectory nodes, and potential dynamics nodes) and the expert. The router concatenates these three functional nodes into a joint task vector, which integrates task descriptions from semantic, state-space, and dynamic perspectives. Each expert maintains an additional task preference vector, expressing their applicability to different task structures. The global matching score is obtained by calculating the distance metric between the joint task vector and the expert's task preference vector, such as using negative Euclidean distance or negative Mahalanobis distance, where a higher score is obtained when the joint task vector and preference vector are closer, denoted as `score_global`. The content matching score and global matching score evaluate the fit between the expert and the current decision-making context from both local dynamic and global static dimensions, providing complementary information sources for subsequent route fusion.

[0034] Step S30: The sum of the content matching score and the global matching score is used as the routing score for each expert, and the routing score is normalized into expert weights. In this embodiment, the sum of the content matching score and the global matching score is used as the routing score for each expert, and this routing score is normalized into an expert weight. For the i-th expert in the hybrid expert structure, the content matching score calculated for it by the task-guided router is first obtained. Matching score with global score These two scores, presented as scalars, represent the expert's suitability in the local context dimension and the global task structure dimension, respectively. Adding them directly yields the expert's original routing score, i.e., The addition operation maintains the independence of the two types of information while allowing them to compensate for each other: when an expert scores low on local matching but has a high fit on the global structure, their total score may still be high; conversely, experts with extremely high local matching but global mismatch will also be suppressed. This additive fusion method does not require additional learnable parameters, avoiding the overfitting risk introduced by parametric fusion.

[0035] After obtaining the raw routing scores of all experts, a flexible maximum function, also known as a normalized exponential function, is used to convert these raw scores into normalized expert weights. The input to the flexible maximum function is a vector containing the raw routing scores of all experts, and the output is a probability distribution, with each component corresponding to the weight value of an expert. Specifically, for the i-th expert, its weight w_i = exp(score_i) / Σ_j exp(score_j). This weight value is between 0 and 1, and the sum of all expert weights is 1. Through exponential operations, the flexible maximum function amplifies the difference between high-scoring and low-scoring experts, giving significantly higher weights to higher-scoring experts and weights approaching zero for lower-scoring experts. This property helps achieve sparse activation, where a small number of experts most relevant to the current task and context are assigned substantial weights, thereby reducing computational overhead and mitigating the risk of negative migration.

[0036] During training, additional regularization constraints can be imposed on the aforementioned weights. For example, a load balancing loss can be introduced to encourage the router to distribute weights more evenly among different experts, preventing a few experts from being overused while others remain idle for extended periods. The load balancing loss is typically calculated as the difference between the average weight of all experts and the ideal uniform distribution. The final expert weights not only determine the proportion of each expert's contribution to the final action but are also fed back into the optimization objective of the task-guided router, enabling the router to automatically adjust its scoring strategy based on decision performance in subsequent iterations.

[0037] Step S40: The action predictions output by each expert in the hybrid expert structure are weighted and fused according to the expert weights to generate the final action output at the current moment. In this embodiment, the action predictions output by each expert in the hybrid expert structure are weighted and fused according to the aforementioned expert weights to generate the final action output at the current moment. Each expert network independently receives a certain intermediate representation of the current policy backbone network as input and outputs a raw action prediction value. In continuous control tasks, the raw action prediction value is a multi-dimensional continuous vector, with each dimension corresponding to a control variable, such as joint torque or steering wheel angle. In discrete control tasks, the raw action prediction value is a probability distribution vector, with each component representing the probability of selecting a discrete action. The raw action prediction values ​​of all experts in the hybrid expert structure are obtained separately and then multiplied element-wise with the corresponding expert weights. For a continuous action vector, the weight is multiplied by each component of the vector; for a discrete probability distribution, the weight is multiplied by the probability value of each action. The weighted action component reflects the actual contribution of the expert to the final decision under the global weight constraints.

[0038] The weighted action components of all experts are summed bit-by-bit to obtain a fused action vector. Let the original action prediction output by the i-th expert be a_i, and the corresponding weight be w_i, then the fused action vector a_fused = Σ_i w_i Since the sum of the weights is 1, the fused action vector typically remains within a reasonable range of the original actions under continuous control. Under discrete control, the fused vector yields a mixed probability distribution, where the final probability of each action is a weighted average of the probabilities from each expert. Next, action space constraint pruning is performed on the fused action vector. The action space typically has predefined boundaries, such as minimum and maximum joint angles. If any component values ​​in the fused action vector exceed these boundaries, they are pruned to the nearest boundary value. This pruning operation ensures that the final output action is physically executable, preventing system malfunction due to abnormal actions.

[0039] After pruning, the final action output `a_out` at the current time step is obtained. This action output will be sent to the environment for execution and simultaneously recorded in an internal buffer for subsequent sequence updates and gradient backpropagation to the router. During the training phase, the final action output is compared with the rewards from real expert actions or environmental feedback to calculate the loss function and update the parameters of the policy backbone network, the hybrid expert structure, and the task-guided router. Through this weighted fusion and pruning mechanism, not only is soft integration of multi-expert decision-making achieved, but the safety and feasibility of the output action are also guaranteed.

[0040] Step S50: Send the final action output to the environment for execution, receive the new state and new reward from the environment, update the input sequence with the new state and new reward, and repeat the steps from building the functional node to generating the final action output until the preset termination condition is met.

[0041] In this embodiment, the final action output is sent to the environment for execution, and the environment provides feedback on the new state and reward. The environment updates its internal state based on the received action, generating a new state observation s', and simultaneously calculates an immediate reward value r', which reflects the effectiveness of the action in achieving the task objective. This new information, along with the previously saved state and action, is used to update the input sequence. Specifically, the new state is appended to the end of the historical trajectory segment in chronological order, forming an extended input sequence. To maintain computational resource efficiency, when the length of the input sequence exceeds a preset context window size, the data from one or more of the earliest time steps at the beginning of the sequence is discarded, retaining only the most recent time steps. This sliding window mechanism controls computational complexity while allowing the model to focus on the most relevant recent history.

[0042] The new reward is embedded as auxiliary information into the state feature vector corresponding to the input sequence. One implementation is to standardize the reward value and directly append it to the end of each state vector to form enhanced state features. Another implementation is to allocate a separate embedding channel for the reward in the input embedding layer of the transformer, alongside the embedding channels for the state and action. In any case, the reward information will be used by subsequent self-attention layers, thus affecting the content matching score in the next round of routing score calculation. When updating the input sequence, the state sequence s_t, action sequence a_t, and corresponding reward r_t from the historical trajectory segment are retained, allowing the recurrent neural network or transformer to re-extract the hidden states.

[0043] After updating the input sequence, all steps from building functional nodes to generating the final action output are repeated until a preset termination condition is met. The termination condition can be triggered by a task success flag, such as the robot reaching the target location or an autonomous vehicle completing parking; it can also be the cumulative time steps reaching the maximum allowed number of steps; or it can be adaptive termination based on safety monitoring, such as detecting a state entering a dangerous area or the reward falling below a threshold for multiple consecutive steps. At the end of each loop, it is determined whether the above conditions are met. If met, iteration stops, and the final cumulative action sequence and total reward are output; if not met, the updated input sequence is used as the input for the next loop, and the loop is restarted. This cyclical process enables continuous interaction between the policy and the environment, allowing the model to continuously adjust expert choices based on gradually accumulated experience, thereby adapting to dynamically changing scenario requirements. Through this row-level closed-loop mechanism, the latest environmental feedback is used to correct subsequent decisions in each iteration, ultimately converging to a high-quality action sequence that meets the termination condition.

[0044] Furthermore, you can also view Figure 2 , Figure 2This is a detailed process diagram based on step S20 in the first embodiment. Figure 2 The step of calculating the content matching score and the global matching score for each expert in the hybrid expert structure through the task-guided router of the policy backbone network includes S21~S22: Step S21: Extract the hidden state sequence from the historical trajectory segment of the input sequence, and calculate the dot product similarity between the hidden state sequence and the feature prototypes of each expert to obtain the content matching score; Step S22: The semantic task node, the behavior trajectory node, and the potential dynamics node are concatenated into a joint task vector, and the distance metric is calculated between the joint task vector and the task preference vector of each expert to obtain the global matching score. Step S23: Dynamically retrieve weight coefficients from the pre-configured weight library according to the current task type, and use the weighted sum of the content matching score and the global matching score of the same expert as the routing score of the expert.

[0045] Within the framework of the task-guided router calculating content matching scores and global matching scores, this embodiment further presents a specific method for calculating and fusing these two scores. The router extracts a hidden state sequence from the historical trajectory fragments of the input sequence. These historical trajectory fragments are composed of states, actions, and rewards from several past time steps, concatenated chronologically. The policy backbone network is based on a decision transformer architecture, which contains multiple layers of self-attention modules. For the current input sequence, the hidden state vector corresponding to each token is obtained from the last layer or an intermediate layer of the transformer. These tokens correspond to various time steps in the historical trajectory fragment; therefore, the length of the hidden state sequence is equal to the number of time steps contained in the historical trajectory fragment. To obtain a compact representation of the current local context, a pooling operation is performed on the hidden state sequence, such as average pooling or extracting the hidden state of the last token, resulting in a fixed-dimensional local context vector.

[0046] Subsequently, a dot product similarity calculation is performed between this local context vector and the feature prototype of each expert in the hybrid expert structure. Each expert's feature prototype is a learnable vector with the same dimension as the local context vector, which gradually converges during training to represent the local dynamic patterns that the expert excels at handling. The dot product similarity is calculated as score_content_i = h_local · p_i, where h_local is the local context vector and p_i is the feature prototype of the i-th expert. A larger dot product result indicates a better match between the current local trajectory and the expert's area of ​​expertise. This dot product operation is performed sequentially for all experts to obtain a content matching score for each expert.

[0047] The router concatenates the semantic task nodes, behavioral trajectory nodes, and latent dynamics nodes constructed above into a joint task vector. The semantic task node z^sem comes from the encoding of the task description text, typically with a dimension of 768 or 1024; the behavioral trajectory node z^traj comes from the cluster center set of state clustering, flattened into a fixed-dimensional vector; and the latent dynamics node z^dyn comes from the temporal encoding of a recurrent neural network, with its dimension aligned with the aforementioned nodes. These three node vectors are concatenated end-to-end to obtain the joint task vector z_task = concat(z^sem, z^traj, z^dyn). This vector integrates global structural information of the task across three dimensions: semantic understanding, state space coverage, and dynamic evolution. Each expert additionally maintains a task preference vector q_i, which has the same dimension as the joint task vector and expresses the expert's preference for different task structures. The global matching score is obtained by calculating the distance metric between the joint task vector and the expert's task preference vector. A common implementation uses negative Euclidean distance, i.e., score_global_i = - ||z_task - q_i||_2. The smaller the distance, the higher the score, indicating that the expert's global task preference is more consistent with the current task structure. This distance metric is calculated for each expert to obtain their respective global matching score.

[0048] The final routing score for an expert is calculated by weighting and summing their content matching score with the global matching score. This weighted summation incorporates a weighting coefficient dynamically retrieved from a pre-configured weight library based on the current task type. The weight library is a queryable mapping table where the key is the task type identifier and the values ​​are a pair of weight coefficients (α, β) satisfying α + β = 1. The task type can be determined by the clustering results of semantic task nodes or keywords in the task description. For example, for tasks requiring precise trajectory tracking, local contextual information is more critical, so α is set higher and β lower; for scenarios with ambiguous task objectives that rely on global semantic understanding, β is set higher and α lower. The dynamic retrieval process is as follows: first, the task type is classified based on the current task's description text or semantic nodes; then, the corresponding weight coefficients are read from the weight library; and finally, the final routing score, score_i = α, is calculated. score_content_i + β `score_global_i`. This score considers both local dynamic matching and global structural matching, allowing for flexible adjustment of their relative importance under different task types. The final routing scores of all experts are output to step S30 for subsequent normalization and expert weight generation. This implementation achieves an interpretable and adjustable dual-score routing mechanism, providing fine-grained control for stable decision-making in hybrid expert structures.

[0049] Furthermore, you can also view Figure 3 , Figure 3 This is a detailed process diagram based on step S30 in the first embodiment. Figure 3 The step of using the sum of the content matching score and the global matching score as the routing score for each expert, and normalizing the routing score into expert weights, includes S31~S33: Step S31: Apply a dynamic bias to the routing score of each expert, which is associated with the current task difficulty level. The value of the dynamic bias is positively correlated with the task difficulty level. Step S32: Input the routing score after applying dynamic bias into the flexible maximum value function to obtain the normalized intermediate weight; Step S33: Calculate the weight change rate based on the expert weight distribution of the previous time step. When the weight change rate exceeds a preset fluctuation threshold, perform smoothing filtering on the intermediate weights to obtain the expert weights at the current time.

[0050] In this embodiment, the sum of the content matching score and the global matching score is used as the original routing score for each expert, and this routing score is normalized into expert weights. This embodiment further provides an enhanced normalization process aimed at improving the stability and task adaptability of expert weights.

[0051] A dynamic bias is applied to each expert's routing score, correlated with the current task difficulty level. This dynamic bias is positively correlated with the task difficulty level; the more difficult the task, the larger the dynamic bias. The task difficulty level can be evaluated online in several ways. One approach is to statistically analyze the variance of rewards or the frequency of negative rewards in historical trajectory segments for the current task; a larger variance or denser negative rewards indicate a higher task difficulty. Another approach utilizes semantic task nodes, inputting them into a pre-trained difficulty regressor that outputs a difficulty coefficient between 0 and 1. The dynamic bias is calculated using the formula: bias_i = γ The `difficulty` parameter is defined as follows: `γ` is a preset bias magnitude hyperparameter, and `difficulty` is the task difficulty coefficient. Since the original range of routing scores may differ among experts, this dynamic bias can be applied uniformly to the routing scores of all experts, or a different bias can be applied based on the historical activation frequency of each expert. The purpose of applying the bias is to improve the overall level of routing scores in difficult tasks, thereby increasing the entropy of the flexible maximum function output distribution, making the expert weight distribution more uniform, and preventing a single expert from prematurely dominating the decision. This mechanism is similar to encouraging exploration in difficult scenarios and preventing the model from getting trapped in local optima.

[0052] The routing scores, after applying dynamic bias, are input into a flexible maximum function to obtain normalized intermediate weights. Let the original routing score of the i-th expert be score_i, and the score after applying dynamic bias be score'_i = score_i + bias_i. The flexible maximum function is calculated as w'_i = exp(score'_i) / Σ_j exp(score'_j), where w'_i is the normalized intermediate weight. This intermediate weight still maintains the relative magnitude of the original routing scores, but amplifies the score differences through exponential operations. Furthermore, due to the addition of dynamic bias, the weight distribution becomes flatter in difficult tasks. This intermediate weight has not yet undergone stability filtering, and therefore may fluctuate drastically with small changes in the input sequence.

[0053] The weight change rate is calculated based on the expert weight distribution from the previous time step. When this weight change rate exceeds a preset fluctuation threshold, the intermediate weights are smoothed using a smoothing filter to obtain the final expert weights for the current time step. There are several ways to define the weight change rate. A common method is to take the Euclidean or cosine distance between the intermediate weight vector of the current time step and the final expert weight vector of the previous time step, i.e., the change rate Δ = ||w't - w{t-1}||_2. The fluctuation threshold is a preset hyperparameter, for example, set to 0.2. When Δ is less than or equal to this threshold, the intermediate weights are directly used as the expert weights for the current time step, i.e., w_t = w't. When Δ exceeds the threshold, a smoothing filter is performed. A simple and effective filtering method is the exponential moving average, i.e., w_t = λ. w{t-1} + (1-λ) w'_t, where λ is the smoothing coefficient, typically ranging from 0.7 to 0.9.

[0054] Another approach is median filtering or sliding window averaging. Smoothing filtering can suppress abrupt changes in expert weights caused by noise or local anomalies, ensuring continuity in expert choices across different time steps and thus improving decision stability. In the early stages of training or task switching, the weights of the previous time step may not yet be defined; therefore, intermediate weights are used directly as the current weights. Through the above, expert weights are finely controlled in terms of both task difficulty perception and temporal stability. This allows routing decisions to maintain appropriate exploration diversity in difficult tasks while avoiding frequent expert switching caused by local noise, ultimately outputting a smooth and task-adaptive expert weight distribution.

[0055] Furthermore, you can also view Figure 4 , Figure 4 This is a detailed process diagram based on step S40 in the first embodiment. Figure 4The step of determining whether the current task status meets the termination condition based on the visual measurement image and the callback text includes S41~43: Step S41: Obtain the original action prediction value output by each expert in the hybrid expert structure. The original action prediction value includes continuous control quantity or discrete action selection probability. Step S42: The original action prediction value output by each expert is multiplied element by element by the corresponding expert weight as a weighted action component. The weighted action components of all experts are then added together bit by bit to obtain the fused action vector. Step S43: When it is determined that the global matching score is lower than a preset confidence threshold, the amplitude of the fused action vector is reduced to obtain the final action output.

[0056] Within the expert weighted fusion framework, this embodiment further presents a refined action generation method that combines action fusion with global matching confidence assessment.

[0057] The raw motion prediction value output by each expert in the hybrid expert structure is obtained separately. The hybrid expert structure contains multiple expert networks, and each expert network independently outputs a raw motion prediction after receiving shared features provided by the policy backbone network. For continuous control tasks, such as robot joint torque control or lateral acceleration control of autonomous vehicles, the raw motion prediction value is a multi-dimensional continuous vector, with each dimension corresponding to a control variable. Its numerical range is usually determined by the action space boundary of the task, for example, the joint angle variation range is between -1 and +1. For discrete control tasks, such as selecting a movement direction in a grid world, the raw motion prediction value is a probability distribution vector, with each component representing the probability of selecting the corresponding discrete action, and the sum of all components is one. In each decision time step, all expert networks are called in parallel for forward computation, collecting the raw motion prediction value output by each expert, and associating it with the expert weights already calculated in the current time step. The expert weights reflect the applicability of each expert in the current local context and global task structure.

[0058] The original action predictions output by each expert are element-wise multiplied with their corresponding expert weights to obtain the weighted action component for each expert. For continuous action vectors, the weighting process involves multiplying each component of the expert's output vector by that expert's weight scalar, resulting in a scaled vector. For discrete action probability distributions, the weighting process involves multiplying the probability value of each action output by the expert by the expert's weight, resulting in a weighted probability distribution.

[0059] After weighting all experts, the weighted action components of all experts are summed bitwise, that is, summed dimension-wise over a continuous vector, or summed over the probability values ​​of each action in a discrete probability distribution, to obtain the fused action vector. This fusion process can be expressed mathematically as a_fused = Σ_i w_i Let a_i be the weight of the i-th expert and w_i be the original action prediction value output by that expert. Since the sum of the weights of all experts is one, the fused action vector usually falls within the range of the original action space under continuous control; in the discrete case, the sum of the probabilities of each action after fusion is still one, forming an effective mixed policy distribution.

[0060] When the global matching score falls below a preset confidence threshold, the amplitude of the fused action vector is reduced to obtain the final action output. The global matching score reflects the overall degree of fit between the current task structure information and the expert task preference vector. When this score is low, it means that all experts have failed to form a good match with the global structure of the current task, and the policy is in a state of high uncertainty. To prevent the model from making risky actions in the low-confidence region, an adaptive scaling mechanism is introduced.

[0061] Specifically, a confidence threshold T_conf is preset, typically between zero and one. When the maximum value among all calculated global matching scores of all experts, or the average global matching score of all experts, falls below this threshold, an amplitude reduction operation is triggered. The reduction operation uses a scaling factor η, which is related to the global matching score; for example, η = max(η_min, score_global / T_conf), where η_min is a preset minimum scaling factor, such as 0.3. For continuous actions, each component of the fused action vector is multiplied by η before output; for discrete actions, amplitude reduction is manifested as interpolating the probability distribution towards a uniform distribution, i.e., a_out = η. a_fused + (1-η) a_uniform, where a_uniform represents a uniform distribution. The resulting action output retains the decision-making direction of expert fusion while reducing the aggressiveness of the actions, thus improving the system's safety in uncertain scenarios. Through the above, a complete transformation from expert output to safe and executable actions is achieved, and the action magnitude is dynamically adjusted based on the global task confidence level, achieving a balance between decision-making caution and task adaptability.

[0062] Furthermore, you can also view Figure 5 , Figure 5 This is a detailed process diagram based on step S50 in the first embodiment. Figure 5The steps of sending the final action output to the environment for execution, receiving new states and new rewards from the environment, and updating the input sequence with the new states and new rewards include S51~S52: Step S51: The new state is appended to the end of the historical trajectory segment in chronological order to form an extended input sequence, and the new reward is embedded as auxiliary information into the state feature vector corresponding to the input sequence. Step S52: When the length of the input sequence exceeds the preset context window size, discard the data of one or more earliest time steps at the beginning of the sequence to maintain an input sequence of constant length.

[0063] Within the framework of environment interaction and input sequence update, this embodiment further presents a refined update method that combines historical trajectory appending, reward information embedding, and sequence length maintenance.

[0064] Specifically, the new states from the environment are appended to the end of the historical trajectory segment in chronological order, forming an extended input sequence. The historical trajectory segment is essentially a queue arranged by time step index; each time step contains the state observation, the action performed, and the reward received. When the agent sends the final action output to the environment, the environment executes the action and returns a new state s' and an immediate reward r'. First, the new state s' is appended to the end of the state sequence, and simultaneously, the previously executed action a_out is appended to the end of the action sequence, and the received reward r' is appended to the end of the reward sequence, thus obtaining a new time step. This appending operation maintains the integrity of the chronological order, enabling the policy backbone network to perceive the complete decision history during subsequent self-attention calculations.

[0065] Furthermore, the new reward is embedded as auxiliary information into the state feature vector corresponding to the input sequence. The original state vector typically only contains environmental observation information, such as the robot's joint angles, position coordinates, or image features. To integrate reward information into the state representation, a feature enhancement strategy is employed. Specifically, a normalized reward value is appended to each state vector. For example, if the original state vector has dimension d, the reward value is scaled to the range of zero to one and appended to the end of the vector, forming a d+1 dimension enhanced state vector. Another alternative is to learn a separate embedding matrix for the reward in the input embedding layer of the transformer, mapping the reward value to a dense vector, and then adding it to the state embedding vector. Regardless of the method used, the reward information enters the self-attention layer along with the input sequence, thus affecting the extraction of hidden states in the content matching score during the next round of routing score calculation. By incorporating the reward as part of the state features, the model can directly incorporate the consequences of past actions into decision-making, forming a complete reinforcement learning loop.

[0066] The system monitors the length of the input sequence and discards one or more of the earliest time steps at the beginning of the sequence when it exceeds a preset context window size, maintaining a constant input sequence length. Decision transformer architectures typically have an upper limit on the length of the input sequence, determined by the model's context window size, for example, set to 512 time steps. As more time steps are added, the length of the input sequence gradually increases. Once the sequence length reaches the upper limit of the context window size, subsequent additions of new time steps require discarding older time steps first. A first-in, first-out (FIFO) queue management strategy is employed: when the sequence length exceeds the context window size, the earliest complete time step at the beginning of the sequence is removed; this time step contains the state, action, and reward information for that step.

[0067] After the discarding operation, the sequence length is reduced by one or more time steps. The new time steps are then appended to the end, ensuring the sequence length never exceeds a preset window limit. This sliding window mechanism guarantees controllability of computational resources because the computational complexity of the transformer is proportional to the square of the sequence length, and a fixed sequence length helps maintain stable inference time. Simultaneously, this mechanism naturally focuses the model's attention on recent historical information, as earlier time steps are already outside the context.

[0068] For scenarios requiring long-term memory, information loss can be mitigated by expanding the context window or introducing additional memory modules. Through content, dynamic management of historical trajectories and deep integration of reward information are achieved. This satisfies the transformer's requirement for fixed-length input while ensuring maximum retention of effective information, providing a high-quality input foundation for subsequent repeated execution of the loop from building functional nodes to generating the final action output.

[0069] Furthermore, you can also view Figure 6 , Figure 6 This is a flowchart illustrating the second embodiment of the multi-view task prior offline reinforcement learning routing method of this application, based on the shown... Figure 6 Before the step of inputting the input sequence of the functional node and the current policy model into the policy backbone network based on the decision transformer, the method further includes steps S60 to S80: Step S60: Collect expert demonstration data, which includes a complete trajectory segment of status, action, and reward; Step S70: The policy backbone network is initially trained using a behavior cloning method so that the action predictions output by the policy backbone network are consistent with the actions in the expert demonstration data. Step S80: After the behavior clone training is completed, the parameters of the policy backbone network are saved as initial parameters for subsequent joint training with the hybrid expert structure and the task-guided router.

[0070] In this embodiment, before inputting the above-mentioned functional nodes and the input sequence of the current policy model into the policy backbone network based on the decision transformer, this embodiment provides a pre-training method for the policy backbone network. This pre-training stage does not rely on the task-guided router and the hybrid expert structure, but uses expert demonstration data to perform behavioral cloning initialization on the policy backbone network, providing a stable and high-performance parameter starting point for subsequent joint training.

[0071] Collect expert demonstration data. Expert demonstration data consists of a series of complete trajectory segments, each recording the complete interaction process of an expert in a task from the initial state to the final state. A trajectory segment contains a chronologically ordered sequence of states s_0, s_1, ..., s_T, a corresponding sequence of actions a_0, a_1, ..., a_T, and a reward sequence r_0, r_1, ..., r_T. This data typically originates from human expert operation records, logs of deployed traditional controllers, or simulation replays of validated high-performance policies. To ensure the effectiveness of pre-training, the collected expert demonstration data should cover the core behavioral patterns of various training tasks in the offline meta-reinforcement learning task set, such as obstacle avoidance paths in navigation tasks and grasping actions in robotic arm control. The length of each trajectory segment can vary, but all should reflect the optimal or suboptimal decision logic for that task. Store all collected expert demonstration data in a separate data buffer pool. This buffer pool can partially overlap with the offline dataset used for subsequent joint training, but only the expert demonstration data is used during the pre-training phase.

[0072] A behavior cloning approach is used to initially train the policy backbone network, ensuring that the action predictions output by the network are consistent with those in the expert demonstration data. Behavior cloning is an imitation learning technique whose core objective is to directly replicate the expert's decision-making behavior onto the agent. During training, a batch of trajectory segments is randomly sampled from the expert demonstration data buffer. For each time step in each sampled segment, the current state s_t is input into the policy backbone network, and the network outputs an action prediction value a_pred_t. For continuous control tasks, this prediction value is typically the mean of a Gaussian distribution, and the network also outputs the variance. For discrete control tasks, the prediction value is an action probability distribution. The loss function adopts the maximum likelihood estimation form: for continuous actions, the negative log-likelihood loss of the action prediction is calculated, i.e., minimizing the difference between the expert action a_exp_t and the prediction distribution; for discrete actions, cross-entropy loss is used. Stochastic gradient descent or its variant optimizer, such as Adam, is used to iteratively update the parameters of the policy backbone network. Training continues for multiple rounds until the action prediction accuracy on the validation set converges or the preset maximum number of iterations is reached. During this process, the strategy backbone network gradually learns to imitate the behavior of experts, and can produce reasonable action outputs even in the absence of reward signals.

[0073] After behavior clone training is complete, the parameters of the policy backbone network are saved as initial parameters, serving as the starting point for subsequent joint training with the hybrid expert architecture and task-guided router. Specifically, the trained network parameters are persistently stored as files, such as .pt files in PyTorch or .ckpt files in TensorFlow. In subsequent joint training phases, these initial parameters are loaded to initialize the policy backbone network, while the expert networks and task-guided routers in the hybrid expert architecture are initialized randomly or independently. The saved initial parameters carry the basic control capabilities learned from expert demonstrations, such as maintaining balance and tracking target trajectories. With these initial parameters, the joint training phase no longer needs to learn basic control policies from scratch, but instead focuses on learning how to utilize multi-view task priors and the task-guided router for expert selection and knowledge transfer across different tasks. This accelerates the convergence speed of joint training and improves the performance of the final model on few-shot generalization tasks. Through the above steps, a complete pre-training process is completed, which includes acquiring prior knowledge from expert demonstrations, learning basic policies through behavior cloning, and solidifying parameters for subsequent end-to-end optimization. This provides a high-quality initialization foundation for the policy backbone network in the main loop.

[0074] Furthermore, you can also view Figure 7 , Figure 7 This is a flowchart illustrating the third embodiment of the multi-view task prior offline reinforcement learning routing method of this application, based on the shown... Figure 7 After sending the final action output to the environment for execution and receiving the new state and new reward feedback from the environment, the process further includes steps S90~S110: Step S90: Calculate safety constraint indicators based on the new state. The safety constraint indicators include collision risk coefficient and boundary crossing probability. Step S100: When the safety constraint index exceeds the preset safety threshold, a safety protection action is generated to replace the final action output, and the safety protection action is sent to the environment for execution. Step S110: Receive the new security protection status and new security protection reward fed back by the environment when performing the security protection action, and update the new security protection status and the new security protection reward to the input sequence.

[0075] In this embodiment, after sending the final action output to the environment for execution and receiving feedback on the new state and new reward from the environment, this embodiment further introduces a safety protection mechanism to proactively intervene in the decision output when a potential danger is detected, aiming to improve the operational safety of the system in a real physical environment or a high-fidelity simulation environment.

[0076] The safety constraint metrics are calculated based on the new state obtained from the received environmental feedback. These metrics include a collision risk coefficient and a boundary violation probability. The collision risk coefficient measures the likelihood of the agent colliding with environmental obstacles or other interactive objects in the next moment. In robot control tasks, an environmental map or obstacle list is maintained. The minimum distance is calculated by comparing the position information in the new state with the obstacle positions. The collision risk coefficient can be defined as the ratio of the minimum distance to the safe distance when the minimum distance is lower than a preset safe distance threshold; otherwise, it is zero. Another approach is based on velocity prediction, calculating whether a collision will occur within a certain number of time steps in the future under the current action. If a collision occurs, a higher risk coefficient is assigned. The boundary violation probability assesses whether the agent's position or joint angle exceeds a preset boundary range. For example, in robotic arm control tasks, each joint has an upper and lower limit for its allowed motion angle. When the joint angle in the new state approaches these boundaries, the boundary violation probability is calculated inversely proportional to the boundary distance. For mobile robots, the boundary violation probability can be defined as the probability that the current position exceeds a predefined drivable area. The collision risk coefficient and the boundary violation probability can be output as two independent scalars, or they can be weighted and summed into a comprehensive safety constraint index. The calculation of this index does not depend on the policy backbone network or hybrid expert structure, but uses an independent sensor data processing module or geometric calculation method, thus enabling rapid response and being unaffected by the quality of the model output.

[0077] When the aforementioned safety constraints exceed preset safety thresholds, a safety protection action is generated to replace the final action output, and this action is sent to the environment for execution. The safety threshold is one or more predefined values; for example, the collision risk coefficient threshold is set to 0.3, and the boundary violation probability threshold is set to 0.2. The safety protection mode is triggered whenever any indicator exceeds its corresponding threshold. The specific content of the safety protection action depends on the task type and the preset safety strategy. For robot obstacle avoidance tasks, the safety protection action is typically emergency braking or reversing along a predetermined avoidance path. For autonomous driving scenarios, the safety protection action could be immediate deceleration and steering wheel straightening to keep the vehicle centered in the current lane. Multiple safety protection action templates are pre-configured internally, and the most suitable action is dynamically selected based on the current risk type. Simultaneously, the triggering reason and time of this safety protection event are recorded. Once the safety protection action is generated and sent, it completely bypasses the original output of the policy backbone network and hybrid expert structure, ensuring that no actions that might exacerbate the danger are executed under high-risk conditions.

[0078] The system receives the new security protection state and reward from the environment's execution of security protection actions, and updates the input sequence with these new states and rewards. After executing a security protection action, the environment updates its state according to its internal dynamics model, returning a new state observation and an immediate reward value. At this point, the security protection action has replaced the original final action output; therefore, the new state fed back by the environment is based on the security protection action, not on the original policy network output. This new state is marked as the new security protection state, and the corresponding reward is marked as the new security protection reward.

[0079] Subsequently, following the described update method, the new safety protection state is appended to the end of the historical trajectory segment, and the new safety protection reward is embedded as auxiliary information into the state feature vector. Simultaneously, it is recorded that the actual action executed at this time step is a safety protection action rather than the original policy action, so that the sample is labeled as a safety-related sample in subsequent training. Through the above update operations, the safety protection event is fully incorporated into the historical trajectory, enabling the policy backbone network to perceive the occurrence and consequences of the previous safety protection in the next iteration, thus having the opportunity to learn to avoid similar high-risk states. After the update is completed, the repetitive loop continues, that is, all steps from building functional nodes to generating the final action output. This closed-loop mechanism of safety protection and state feedback ensures that the system maintains operational safety without disrupting the continuity of decision-making and environmental interaction.

[0080] Furthermore, you can also view Figure 8 , Figure 8 This is a flowchart illustrating the fourth embodiment of the multi-view task prior offline reinforcement learning routing method of this application, based on the shown... Figure 8 The multi-view task prior offline reinforcement learning routing method also includes S120~S160: Step S120: Jointly train the policy backbone network, the hybrid expert structure, and the task guidance router using an offline dataset. The offline dataset contains only trajectory data of multiple training tasks and does not contain any test task data. Step S130: After the joint training is completed, a small number of context trajectory fragments of one or more unseen test tasks are obtained, wherein the data of the unseen test tasks was not used in the joint training process; Step S140: Extract the semantic task nodes and behavioral trajectory nodes of the test task from the context trajectory segment, and output the potential dynamic nodes based on the context trajectory segment through the pre-trained world model; Step S150: Input the semantic task node, the behavior trajectory node and the potential dynamics node into the policy backbone network. The task guidance router of the policy backbone network performs expert selection and action generation, and outputs the final action sequence of the unseen test task. Step S160: During execution, the calculation weight of the global matching score is dynamically adjusted based on the real-time feedback of the unseen test task, so as to achieve adaptive generalization of the task under the condition of few samples.

[0081] This embodiment provides a complete process from offline joint training to online testing and generalization. This process covers the parameter learning of the policy backbone network, hybrid expert structure and task-guided router, as well as the few-sample adaptation process for unseen tasks after training.

[0082] We jointly train the policy backbone network, hybrid expert architecture, and task-guided router using an offline dataset. The offline dataset contains only trajectory data from multiple training tasks, excluding any test task data. Each training task corresponds to a set of pre-collected trajectory segments, each consisting of a sequence of states, actions, and rewards. The joint training employs an end-to-end optimization approach, with a loss function consisting of three parts: action prediction loss (mean squared error or cross-entropy between the final action output by the policy backbone network and the actual actions in the offline data); routing stability loss (encouraging the task-guided router to maintain the smoothness of expert weights across different time steps); and expert load balancing loss (preventing the overuse of a few experts).

[0083] During training, forward computation is performed according to the main loop, followed by backpropagation to update all trainable parameters. For each expert network in the hybrid expert architecture, gradient truncation or independent learning rate strategies are employed to avoid intense parameter competition among experts. The entire joint training continues for multiple epochs until the average reward and action prediction accuracy on the validation set converge. Since the offline dataset does not contain any test task data, the training process does not prematurely reveal information about unseen tasks, ensuring the fairness of subsequent generalization evaluation.

[0084] After joint training is complete, a small number of context trajectory fragments for one or more unseen test tasks are acquired. An unseen test task is a new task that has a distributional offset from all training tasks in the offline dataset in terms of task parameters, environmental dynamics, or objective function; its data was never used during joint training. These small context trajectory fragments typically contain only a few to dozens of time steps, such as five or ten consecutive state-action-reward tuples. These fragments serve as cues to help the model quickly infer the structural features of the current test task. These fragments are acquired online from the test environment or read from a small validation set prepared specifically for that task.

[0085] Semantic task nodes and behavioral trajectory nodes for the test task are extracted from the aforementioned context trajectory fragments, and latent dynamic nodes based on these context trajectory fragments are output through a pre-trained world model. The extraction method for semantic task nodes is the same as in the training phase. If the test task is accompanied by task description text, the same language model is used for encoding; otherwise, the most similar embedding vector is retrieved from a learnable task embedding dictionary based on the features of the context trajectory. Behavioral trajectory nodes are obtained by online clustering of the states in the context trajectory fragments. Due to the short length of the fragments, the number of cluster centers can be appropriately reduced. The generation of latent dynamic nodes relies on the pre-trained world model: the state, action, and reward sequences from the context trajectory fragments are input into a recurrent neural network encoder to obtain fixed-dimensional dynamic nodes. This world model has already learned the general laws of environmental dynamic evolution during the training phase, thus enabling it to extract meaningful dynamic features from a small number of trajectories even when faced with unseen tasks.

[0086] The semantic task nodes, behavioral trajectory nodes, and potential dynamic nodes obtained above are input into the policy backbone network. The task-guided router within the policy backbone network performs expert selection and action generation, outputting the final action sequence for the unseen test task. The specific forward computation process is consistent with the calculation method of the content matching score and global matching score mentioned above; that is, the router calculates the content matching score and the global matching score, adds them together to obtain the routing score, normalizes it into expert weights, and then performs a weighted fusion of the predictions of each expert action. Since there are no available reward signals to update the network parameters during the testing phase, inference is performed using the fixed parameters that have been trained.

[0087] During execution, the calculation weight of the global matching score is dynamically adjusted based on real-time feedback from unseen test tasks. During the testing phase, an online weight adjuster is maintained. This adjuster dynamically changes the proportion of the global matching score in the final routing score based on the cumulative rewards or task progress metrics of the most recent steps, using a lightweight reinforcement learning controller or heuristic rules. For example, when task progress stagnates, the weight of the global matching score is increased, making the model more reliant on task structure priors; when task performance is good, the weight of the global matching score is decreased, allowing local context to play a greater role. This adaptive adjustment is achieved only by modifying the weighted summation coefficients, resulting in minimal computational overhead. Through the above, a complete technical path from offline multi-task joint training to online few-shot task generalization is completed.

[0088] Furthermore, you can also view Figure 9 , Figure 9 This is a schematic diagram illustrating the overall process of an offline meta-reinforcement learning expert routing method based on multi-view task priors and a world model. Figure 9 This paper illustrates a complete offline meta-reinforcement learning training and testing process. First, an offline dataset containing multiple training tasks is acquired. For each training task, three types of functional nodes are constructed in parallel. Semantic task nodes are obtained by inputting the natural language description of the task into a pre-trained text encoder, outputting a fixed-dimensional vector. Behavioral trajectory nodes collect state samples of all trajectories under that task, clustering them into several clusters using a Gaussian mixture model, with the center of each cluster forming the node's representation. The construction of latent dynamics nodes requires training a world model: randomly sampling trajectory segments of dozens of time steps from the task, inputting the state, action, and reward sequences into a gated recurrent unit encoder, outputting a latent vector; simultaneously, inputting the current state and action into a prediction network, outputting predicted values ​​for the next state and reward. The encoder and predictor are jointly trained, with the loss function being the sum of the state prediction error and the reward prediction error. After training convergence, the latent vector output by the encoder for any trajectory segment serves as the latent dynamics node, carrying key information about the dynamic evolution of the task environment.

[0089] After constructing the three nodes for all training tasks, the world model enters the pre-training phase. The world model consists of a recurrent neural network encoder and a state-reward predictor. Trajectory fragments from all training tasks are sampled from the offline dataset, without distinguishing task labels, and general environmental dynamics are learned in a self-supervised manner. The encoder compresses the input state, action, and reward sequence into a low-dimensional latent variable, and the predictor outputs the distribution of the next state and reward based on the current state and action. This phase does not involve policy networks or routing mechanisms; the goal is to enable the world model to master cross-task environmental transition priors. After pre-training, the encoder parameters are fixed, and subsequently used only to generate latent dynamic nodes from arbitrary trajectory fragments.

[0090] Next, the policy backbone network, hybrid expert structure, and task-guided router are jointly trained. The policy backbone network adopts a decision transformer architecture, and its input sequence is composed of historical trajectory fragments and the three types of functional nodes mentioned above. The hybrid expert structure contains multiple expert networks, each of which is a two-layer feedforward network that receives shared features from the transformer output and outputs action predictions. The task-guided router contains two sub-modules: a content matching module that performs a dot product between the hidden state of the input sequence and the feature prototype of each expert to obtain a content matching score; and a global matching module that performs a negative Euclidean distance between the concatenated vector of the three functional nodes and the task preference vector of each expert to obtain a global matching score. The two are added together and then passed through a flexible maximum function to obtain the expert weights. The training loss includes the mean squared error of action prediction, the load balancing loss of the router weights, and the diversity regularization term of the expert outputs. The optimizer uses Adam, and the learning rate uses a cosine annealing strategy. Joint training continues for multiple rounds until the action accuracy and task reward on the validation set converge.

[0091] After joint training, all network parameters are fixed, and the testing phase begins. For an unseen test task, only a small number of context trajectory fragments, such as five consecutive time steps, are collected from the environment. These fragments are input into the trained world model, whose encoder outputs the latent dynamic nodes for the test task. Simultaneously, behavioral trajectory nodes are obtained from the states of the context fragments through online clustering. If the task is accompanied by descriptive text, semantic nodes are extracted; otherwise, the most similar semantic embedding is retrieved from a learnable embedding table based on trajectory features. These three nodes, along with the context fragments, are input into the policy backbone network. The task guidance router calculates the content matching score and global matching score for each expert, sums and normalizes them, and then performs a weighted fusion of the expert actions to output the action at the current moment. As the testing process progresses, newly generated states and rewards are continuously added to the input sequence, and the earliest time step is discarded according to the sliding window mechanism, forming a continuous closed loop. The process terminates when the task completion flag is triggered or the maximum number of steps is reached. The entire process verifies that this method, using only a small amount of context, can achieve rapid generalization and stable control of unseen tasks by leveraging a pre-trained world model and multi-view task priors.

[0092] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the multi-view task prior offline reinforcement learning routing method of this application. Any simple transformations based on this technical concept are within the protection scope of this application.

[0093] This application provides a multi-view task prior offline reinforcement learning routing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the multi-view task prior offline reinforcement learning routing method in Embodiment 1 above.

[0094] The following is for reference. Figure 10 The diagram illustrates a structural schematic of a multi-view task prior offline reinforcement learning routing device suitable for implementing embodiments of this application. The multi-view task prior offline reinforcement learning routing device in embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 10 The multi-view task prior offline reinforcement learning routing device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0095] like Figure 10 As shown, the multi-view task prior offline reinforcement learning routing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. RAM 1004 also stores various programs and data required for the operation of the multi-view task prior offline reinforcement learning routing device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the multi-view task prior offline reinforcement learning routing device to communicate wirelessly or wiredly with other devices to exchange data. Although various multi-view task prior offline reinforcement learning routing devices are shown in the figures, it should be understood that it is not required to implement or possess all of them. More or fewer may be implemented alternatively.

[0096] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0097] The multi-view task prior offline reinforcement learning routing device provided in this application, employing the multi-view task prior offline reinforcement learning routing method described in the above embodiments, can solve the technical problem that in existing offline meta-reinforcement learning, global task structure information and local context information cannot collaboratively guide hybrid expert routing decisions. Compared with the prior art, the beneficial effects of the multi-view task prior offline reinforcement learning routing device provided in this application are the same as those of the multi-view task prior offline reinforcement learning routing method provided in the above embodiments, and other technical features in this multi-view task prior offline reinforcement learning routing device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0098] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0099] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0100] This application provides a storage medium, which is a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the multi-view task prior offline reinforcement learning routing method in the above embodiments.

[0101] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be executed by instructions, used by devices, or used in conjunction with them. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0102] The aforementioned computer-readable storage medium may be included in the multi-view task prior offline reinforcement learning routing device; or it may exist independently and not be assembled into the multi-view task prior offline reinforcement learning routing device.

[0103] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the multi-view task prior offline reinforcement learning routing device, enable the multi-view task prior offline reinforcement learning routing device to implement the technical content of the multi-view task prior offline reinforcement learning routing method embodiment shown above.

[0104] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0105] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using dedicated hardware-based implementations that perform the specified functions or operations, or can be implemented using a combination of dedicated hardware and computer instructions.

[0106] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0107] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described multi-view task prior offline reinforcement learning routing method. This solves the technical problem in existing offline meta-reinforcement learning where task global structure information and local context information cannot collaboratively guide hybrid expert routing decisions. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the multi-view task prior offline reinforcement learning routing method provided in the above embodiments, and will not be repeated here.

Claims

1. A multi-view task prior offline reinforcement learning routing method, characterized in that, The multi-view task prior offline reinforcement learning routing method includes the following steps: Multiple training tasks are obtained from the offline meta-reinforcement learning task set, and functional nodes are constructed for each training task. The functional nodes include semantic task nodes, behavioral trajectory nodes, and potential dynamic nodes. The semantic task nodes are generated by the task description of the training task, the behavioral trajectory nodes are generated by clustering the offline trajectory states of the training task, and the potential dynamic nodes are obtained by temporal encoding of the state sequence, action sequence, and reward sequence through a recurrent neural network. The functional nodes and the input sequence of the current policy model are input together into a policy backbone network based on a decision transformer. Through the task-guided router of the policy backbone network, a content matching score and a global matching score are calculated for each expert in the hybrid expert structure. The input sequence includes historical trajectory fragments. The content matching score measures the local matching degree between the input sequence and the expert, and the global matching score measures the global matching degree between the task structure information composed of the semantic task nodes, the behavioral trajectory nodes, and the latent dynamics nodes and the expert. The task-guided router of the policy backbone network calculates the content matching score and the global matching score for each expert in the hybrid expert structure. The steps for each expert in the structure to calculate a content matching score and a global matching score include: extracting a hidden state sequence from the historical trajectory segment of the input sequence; calculating the dot product similarity between the hidden state sequence and the feature prototypes of each expert to obtain the content matching score; concatenating the semantic task node, the behavior trajectory node, and the latent dynamics node into a joint task vector; calculating the distance between the joint task vector and the task preference vector of each expert to obtain the global matching score; dynamically retrieving weight coefficients from a pre-configured weight library according to the current task type; and weighting and summing the content matching score and the global matching score of the same expert to obtain the routing score of the expert. The sum of the content matching score and the global matching score is used as the routing score for each expert, and the routing score is normalized into expert weights. The step of using the sum of the content matching score and the global matching score as the routing score for each expert and normalizing the routing score into expert weights includes: applying a dynamic bias associated with the current task difficulty level to the routing score of each expert, the value of which is positively correlated with the task difficulty level; inputting the routing score after applying the dynamic bias into a flexible maximum function to obtain normalized intermediate weights; calculating the weight change rate based on the expert weight distribution of the previous time step; and when the weight change rate exceeds a preset fluctuation threshold, performing smoothing filtering on the intermediate weights to obtain the expert weights at the current time step. The action predictions output by each expert in the hybrid expert structure are weighted and fused according to the expert weights to generate the final action output at the current moment. The final action output is sent to the environment for execution. The environment provides feedback on new states and rewards. After updating the input sequence with the new states and rewards, the steps from building functional nodes to generating the final action output are repeated until the preset termination condition is met.

2. The multi-view task prior offline reinforcement learning routing method as described in claim 1, characterized in that, Before the step of inputting the input sequence of the functional node and the current policy model into the policy backbone network based on the decision transformer, the method further includes: Collect expert demonstration data, which includes a complete trajectory segment of status, action, and reward; The policy backbone network is initially trained using a behavior cloning method to ensure that the action predictions output by the policy backbone network are consistent with the actions in the expert demonstration data. After the behavior clone training is completed, the parameters of the policy backbone network are saved as initial parameters for subsequent joint training with the hybrid expert structure and the task-guided router.

3. The multi-view task prior offline reinforcement learning routing method as described in claim 1, characterized in that, The step of weightedly fusing the action predictions output by each expert in the hybrid expert structure according to the expert weights to generate the final action output at the current moment includes: Obtain the original action prediction value output by each expert in the hybrid expert structure, wherein the original action prediction value includes continuous control quantity or discrete action selection probability; The original action prediction value output by each expert is multiplied element by element by the corresponding expert weight as the weighted action component. The weighted action components of all experts are then added bit by bit to obtain the fused action vector. When the global matching score is determined to be lower than a preset confidence threshold, the amplitude of the fused action vector is reduced to obtain the final action output.

4. The multi-view task prior offline reinforcement learning routing method as described in claim 1, characterized in that, The steps of sending the final action output to the environment for execution, receiving new states and rewards from the environment, and updating the input sequence with the new states and rewards include: The new state is appended to the end of the historical trajectory segment in chronological order to form an extended input sequence, and the new reward is embedded as auxiliary information into the state feature vector corresponding to the input sequence. When the length of the input sequence exceeds the preset context window size, the data of one or more earliest time steps at the beginning of the sequence is discarded, maintaining an input sequence of constant length.

5. The multi-view task prior offline reinforcement learning routing method as described in claim 1, characterized in that, After sending the final action output to the environment for execution and receiving the new state and new reward feedback from the environment, the process further includes: Based on the new state, safety constraint indicators are calculated, including collision risk coefficient and boundary crossing probability; When the security constraint index exceeds the preset security threshold, a security protection action is generated to replace the final action output, and the security protection action is sent to the environment for execution. Receive the new security protection status and new security protection reward fed back by the environment when it performs the security protection action, and update the new security protection status and new security protection reward to the input sequence.

6. The multi-view task prior offline reinforcement learning routing method as described in claim 1, characterized in that, Multi-view task prior offline reinforcement learning routing methods also include: The policy backbone network, the hybrid expert structure, and the task guidance router are jointly trained using an offline dataset. The offline dataset contains only trajectory data of multiple training tasks and does not contain any test task data. After the joint training is completed, a small number of context trajectory fragments of one or more unseen test tasks are obtained, the data of which was not used in the joint training process; Semantic task nodes and behavioral trajectory nodes of the test task are extracted from the context trajectory fragment, and potential dynamic nodes based on the context trajectory fragment are output through a pre-trained world model. The semantic task node, the behavior trajectory node, and the potential dynamic node are input into the policy backbone network. The task guidance router of the policy backbone network performs expert selection and action generation, and outputs the final action sequence of the unseen test task. During execution, the calculation weight of the global matching score is dynamically adjusted based on the real-time feedback from the unseen test tasks, thereby achieving adaptive generalization of the task under conditions of few samples.

7. A multi-view task prior offline reinforcement learning routing device, characterized in that, The multi-view task prior offline reinforcement learning routing device stores a computer program, which, when executed by a processor, implements the multi-view task prior offline reinforcement learning routing method according to any one of claims 1-6.

8. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the multi-view task prior offline reinforcement learning routing method according to any one of claims 1-6.