Different strategy learning method based on state similarity and reward experience replay

By introducing state similarity and high-reward experience replay algorithm into reinforcement learning, the problem that the experience replay mechanism in the existing technology cannot distinguish important experiences is solved, the learning efficiency and performance are improved, and it is demonstrated in continuous control tasks Higher sample efficiency and strategy performance.

CN118839747APending Publication Date: 2024-10-25NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410850333.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-10-25

Smart Images

  • Figure CN118839747A_ABST
    Figure CN118839747A_ABST
Patent Text Reader

Abstract

Experience replay is a very important technology in different strategy learning, experience is obtained by constructing an experience pool to store interaction between an intelligent agent and an environment, repeated utilization of the experience is achieved, and time correlation between the experiences is broken. In the previous work, priorities are allocated to all experiences in an experience pool and reallocated after the experiences are updated, which occupies a large amount of computing resources and needs to consume time which is nearly twice that of the original experiences. There are many past experiences in the experience pool, which are derived from previous policies that deviate from the current policy, which are detrimental to updating of the policy network. The invention introduces a new experience replay priority evaluation mode, designs a high reward evaluation method, and uses the similarity of state characteristics and high rewards as priorities, which is called as state similarity and reward-based experience replay (SSRER).
Need to check novelty before this filing date? Find Prior Art

Description

Technical field:

[0001] With the significant improvement of computing power and the continuous advancement of data collection technology, reinforcement learning, as an important machine learning strategy, has made great strides in theory and practical application. In the field of reinforcement learning, intelligent agents need to interact in unknown environments, gradually optimize their decision-making strategies through repeated experiments and based on environmental feedback, so as to maximize the cumulative rewards. In order to cope with the increasing complexity of environmental states and behaviors, researchers began to combine reinforcement learning with deep learning, approximating functions through deep neural networks, so that intelligent agents can learn complex nonlinear strategies in the absence of prior knowledge. The successful application of this technology has greatly promoted the research and commercialization process in the field of artificial intelligence, and provided new perspectives and tools for solving practical problems.

[0002] In the past few years, compared with traditional machine learning techniques, deep reinforcement learning has made significant breakthroughs in the field of sequential decision-making tasks and has been successfully applied to Atari games, continuous control, robotics, and board games. However, in these applications, if only the immediate experience obtained from the current interaction is used to update the model, it will violate the basic assumption of independent and identical distribution that the stochastic gradient descent method relies on. For this reason, experience replay technology came into being. It stores past experience in the replay buffer instead of discarding it directly after using it once, allowing the model to learn by randomly sampling past experience during the update process. This method effectively reduces the temporal correlation between experience samples, thereby improving the efficiency of learning and the stability of the model. Despite this, the current experience replay mechanism has not yet been able to distinguish the importance of different experiences, and further optimization is still needed to prioritize the learning of those critical experiences and speed up the learning process. Background technology:

[0003] Markov Decision Process:

[0004] Deep reinforcement learning solves complex decision-making problems based on the framework of Markov decision process. Consider a Markov decision process, defined as a quintuple M = {S, A, P, R, γ}, where S represents the state space; A represents the action space; P represents the state space in a certain state S i Next, take action a∈A to transfer to S i+1 The probability of the state; R represents the reward obtained by taking action a∈A in the current state S; γ represents the discount factor, which discounts future rewards and represents the current value of future rewards.

[0005] The state of the agent at time t∈[0,T] is s t ∈S, selects action a∈A according to strategy π(a|s), and after interacting with the environment, selects action a∈A according to state transition probability P(s t+1|s t , a t ) gets the state s′ at the next moment t+1, and gets the reward r∈R. The goal of reinforcement learning is to find the optimal strategy π * , so that the agent obtains the maximum cumulative discounted reward. The maximum cumulative reward is defined as the return:

[0006]

[0007] Among them, γ is the discount factor, which is used to measure the importance of future rewards. t Next, take action a according to policy π t The state action value function formula after is as follows:

[0008]

[0009] Deep Q-Network algorithm:

[0010] Deep Q-Network is an improved algorithm that combines Q-learning with deep learning. It abandons the use of tables to store Q(s, a) in Q-learning, where Q(s, a) represents the state action value, and instead uses a deep neural network Q(s, a, θ) with a parameter of θ to approximate Q(s, a). This enables DQN to handle tasks in high-dimensional state environments.

[0011] In order to update the parameter θ, the temporal difference error (TD-error) is used as the loss function to be optimized. TD-error reflects the difference between the predicted value function and the actual observed reward. Specifically, the maximum state action value of the reward and the next state is used as the target Q value, and the state action value of the current state is used as the estimated Q value. The difference between the target Q value and the estimated Q value is calculated. TD-errorδ can be expressed as:

[0012]

[0013] Among them, θ′ is the parameter of the target network, and then we can get the loss function Loss=E(δ 2 ).

[0014] Soft Actor-Critic Algorithm:

[0015] The SAC algorithm uses the maximum entropy framework to train a random policy, which adds entropy to the basic goal of standard RL. Therefore, the optimal policy of SAC is:

[0016] #(4) Where α is the temperature factor, which controls the importance of entropy and reward. Strategy entropy Indicates the randomness of the strategy. The randomness of the strategy is inversely proportional to the entropy. Strategy entropy It can be expressed as:

[0017]

[0018] The introduction of entropy increases the exploratory nature of the intelligent agent, making it less likely to fall into a local optimal solution and improving the robustness of the algorithm.

[0019] Experience replay method:

[0020] In early reinforcement learning algorithms, the data obtained by the agent each time it interacts with the environment is discarded after updating the parameters once, even if the data may be rare. DQN first uses the experience replay pool to store past experiences, and each experience is represented as e = (s, a, r, s'). Therefore, the experience replay pool can be represented as D = (e1, e2...e i ). The capacity of the experience replay pool is usually fixed. When the number of experiences is greater than the capacity of the experience pool, the earliest generated experience will be overwritten. The traditional experience replay method has a key limitation: it treats all experiences equally and ignores the different contributions of different experiences to the learning process. To solve this problem, the Priority Experience Replay (PER) algorithm was proposed. PER improves the mechanism of traditional experience replay by assigning a priority to each experience in the experience pool to determine how often it is repeatedly sampled during the learning process. These priorities are determined based on the time difference error (TD-error) size of each experience. The larger the TD-error of the experience, the more learning value the experience can provide, so it should be sampled more frequently. The problem with PER is that whenever the data in the experience replay pool changes, the priority of each experience needs to be recalculated, which greatly consumes computing resources. Even if PER uses the SumTree structure to ensure that sampling is completed according to the priority in O(log N) time, the overall time consumption of the PER algorithm is still more than twice that of the ordinary ER algorithm.

[0021] Cicek improved PER by using KL divergence to sort experiences, but the improvement was limited and the high time consumption of PER was not solved. Wei et al. combined experience replay technology with quantum characteristics and distributed architecture to analyze and study the key factors for performance improvement. Novati believes that even for off-policy algorithms, when the strategies from which the experiences in the experience pool come are very different from the current strategies, using these experiences will affect the update of the current strategies. Sun et al. suggested replaying experiences that are highly similar to the current strategies, but it requires different similarity measurement methods to be set according to different environments, and the generalization is poor. The ReF-ER algorithm evaluates the degree of policy deviation and adjusts the policy deviation speed according to the Kullback-Leibler divergence, but it consumes a lot of computing resources. Summary of the invention:

[0022] This paper proposes a new experience replay algorithm, called State Similarity and Reward Experience Replay (SSRER). The SSRER algorithm proposes a new way to calculate the priority of experience, and prioritizes it based on high rewards and the similarity between the states contained in the experience pool and the agent's state, rather than using random or uniform sampling. When comparing state similarities, the inner product of state features is used as the result. When screening rewards, only those experiences with rewards far greater than other experiences are selected from the many experiences, giving these experiences a higher priority.

[0023] The contributions of the present invention can be summarized as follows:

[0024] (1) We propose a new experience replay method, SSRER, which uses the similarity between states and high rewards as metrics to improve the training efficiency and performance of off-policy reinforcement learning algorithms without any algorithm changes.

[0025] (2) It is proposed to use the absolute median difference detection method to screen out a small number of experiences with high rewards and ensure that high-reward experiences are not excessive.

[0026] (3) Experiments were conducted on continuous control tasks on the MuJoCo platform. The results showed that in most continuous control tasks, SSRER uses fewer training steps to achieve higher average rewards and has higher sample efficiency. The final converged strategy can achieve higher average rewards than other algorithms and has better performance. Description of the drawings:

[0027] Figure 1 The calculation method for state similarity measure is

[0028] Figure 2 To get new batches from the experience replay pool for updating gradients.

[0029] Figure 3 The figure is a schematic diagram of the overall process of the SSRER algorithm of the present invention, taking the Soft Actor-Critic algorithm as an example. Specific implementation method:

[0030] Next, we will introduce the key components of the SSRER algorithm from three aspects: state similarity analysis, reward priority and batch generation strategy.

[0031] State similarity analysis:

[0032] When using a deep neural network to update a strategy, the strategy may change significantly. At this time, if the experience gained from past strategies with large differences is used to update the current strategy, it will lead to a large estimation error, affecting the strategy update. The estimation error of the neural network is related to whether the experience of similar states has been trained before, that is, the more similar the current state is to the trained state, the smaller the estimation error of the neural network. Therefore, in the algorithm of the present invention, the inner product of the intermediate representation of the state after being processed by some layers in the deep neural network is used as one of the priority criteria.

[0033] The SSRER algorithm uses the similarity between the current state and the state in experience as a metric, which is different from general similarity comparison methods such as KL divergence. Figure 1 As shown, first the state is passed through a multi-layer fully connected neural network to obtain the feature representation ψ, and then the inner product of the feature representation is calculated, ψ current The feature representation of the current state, ψ buffer The feature representation of a small batch of experience states in the experience pool is represented, and the result P1 is the similarity metric. The feature representation ψ is then passed through a linear layer to obtain the mean and variance of the action.

[0034] Reward Priority:

[0035] During the learning process, the agent will receive rewards based on its state and actions. A high reward indicates that the actions taken by the agent are in line with expectations or goals, which will motivate the agent to continue taking similar actions. However, repeated use of the same batch of experiences will cause the neural network to fall into overfitting, and excessive use of high-value experiences also poses the risk of falling into local optimality. Reasonable use of high-value rewards can also improve the performance of the algorithm in some non-sparse reward environments. There is no need to worry about high-reward experiences being repeatedly selected, because the screening range is randomly sampled from the experience pool, and there is almost no situation where experiences are repeatedly selected like in PER.

[0036] In a non-sparse reward environment, there are many positive feedback rewards. This paper designs a high reward evaluation method, which is applicable to any non-sparse reward environment and does not need to be modified according to the specific environment. Assume that there is a set of experience sets T = {τ1, τ2…τ n}, where each τ i ={ si , a i , r i , s′ i}, the reward set in T is R = {r1, r2...r n}, define the absolute median difference of reward as:

[0037] R MAD =median({|r i -median(r)|))#(6)

[0038] Among them, r i is an element in R. Then define the high reward set R * for:

[0039] R * ={r∈R|(λ×R MAD -|r i -median(r)|)<0}#(7)

[0040] Among them, λ is a proportional factor used to control the number of high reward experiences. Next, define T * To contain the corresponding R * The experience set rewarded in:

[0041] T * ={τ i ∈T|r i ∈R *}#(8)

[0042] The larger λ is, the higher the standard for limiting rewards is, and the less experience is eligible, and vice versa.

[0043] High reward experience has a greater impact on the strategy at the beginning of training. At the end of training, there is no shortage of high reward experience because the experience pool contains a large amount of experience. Therefore, linear annealing is performed on λ from the initial value λ0 to 5 to reduce the number of high reward experiences at the end of training and improve the stability of the algorithm when it converges. Batch generation strategy:

[0044] In order to optimize the calculation time and ensure the stability of the algorithm, the range of calculation priority is narrowed. Figure 2 As shown in the figure, k batches of experience are first selected from the experience pool using random sampling, and then these k*n experiences are sorted according to state similarity priority and high reward priority (assuming the batch size is n), and finally the top n experiences are integrated into a new batch.

[0045] SSRER uses similarity between states and high rewards as priorities, and uses a new batch generation strategy to improve the training efficiency and performance of the different-strategy reinforcement learning algorithm. The flowchart after combining it with the SAC algorithm is shown in the attached figure. Figure 3 shown.

Claims

1. A cross-strategy learning method based on state similarity and reward experience replay, Features: This is a new way to prioritize experience replay, using similarity of state features and high rewards as priorities, and proposes a new batch generation strategy that can be easily applied to any off-policy reinforcement learning algorithm that uses an actor-critic architecture.

2. The different-strategy learning method based on state similarity and reward experience replay according to claim 1, Features: The specific steps of similarity of the state characteristics are as follows: (1) The agent interacts with the environment. This process can be abstracted as a Markov decision process, which can be represented by a five-tuple M = {S, A, P, R, γ}, where S represents the state space, A represents the action space, and P represents the state space in a certain state S. i Next, take action a∈A to transfer to S i+1 The probability of the state, R represents the reward obtained by taking action a∈A in the current state S, γ represents the discount factor, which discounts the future rewards and represents the current value of the future rewards; (2) The results of the interaction are stored in the experience replay pool. Each interaction result is an experience, which can be expressed as e = (s, a, r, s′). The experience replay pool can be expressed as D = (e 1 , e 2 ...e i ), the capacity of the experience replay pool is fixed. When the amount of experience is greater than the capacity of the experience pool, the earliest generated experience will be overwritten; (3) Prioritize the experience in the experience pool. First, pass the state through a multi-layer fully connected neural network to obtain the feature representation ψ. Then calculate the inner product of the feature representation, ψ current The feature representation of the current state, ψ buffer Represents the feature representation of a small batch of experience states in the experience pool, and the result P=<ψ current , ψ buffer ) is the similarity metric; (4) Compare the state similarities of different experiences. The larger the inner product P is, the higher the priority is, and the experience should be selected first.

3. The different-strategy learning method based on state similarity and reward experience replay according to claim 1, Features: In the reward priority, the rewards contained in the experience are used as the priority standard when prioritizing the experience. A high reward evaluation method is designed, which is applicable to any non-sparse reward environment and does not need to be modified according to the specific environment. Assume that there is a set of experience sets T = {τ 1 , τ 2 ...τ n }, where each τ i ={s i , a i , r i , s′ i }, the reward set in T is R = {r 1 , r 2 ...r n }, define the absolute median difference of reward as: R MAD =median({|r i -median(r)|})#(1) Among them, r i is an element in R, and then defines the high reward set R * for: R * ={r∈R|(λ×R MAD -|r i -median(r)|)<0}#(2) Among them, λ is a proportional factor used to control the number of high reward experiences. Next, define T * To contain the corresponding R * The experience set rewarded in: T * ={τ i ∈T|r i ∈R * }#(3) The larger λ is, the higher the standard for limiting rewards is, and the less experience is eligible, and vice versa.

4. The different-strategy learning method based on state similarity and reward experience replay according to claim 1, Features: In the batch generation strategy, in order to optimize the computing time and ensure the stability of the algorithm, consider narrowing the range of computing priorities, select k batches of experience from the experience pool by random sampling, and sort these k*n experiences according to priority. Assuming that the batch size is n, specifically, the high reward experience T is obtained by the high reward evaluation method. * , assuming T * The number of experiences is m, and the state similarity is measured for k*n experiences. The experiences are sorted according to the similarity, and the nm experiences with the greatest similarity are screened out and merged with the m high-reward experiences as a new batch.

Citation Information

Cited By

  • Updating method and device of deep reinforcement learning model

    CN119902789A