Methods, apparatus, electronic devices and storage media for training intelligent agent policy networks

By processing training samples with a linear discriminator and correcting parameters using a loss function, the problem of poor training performance in traditional heterogeneous policy reinforcement learning is solved, achieving more efficient policy network training and improved decision-making performance.

CN117312815BActive Publication Date: 2026-04-03NANQI XIANCE (NANJING) HIGH TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In traditional heterogeneous policy reinforcement learning algorithms, the sampling policy for training samples prioritizes samples generated by the current policy, which makes it impossible to effectively train the policy network and affects the performance of the target policy network in the final application.

Method used

The training samples are processed by a pre-trained inline discriminator to obtain inline scores. The samples are then input into the state-action value network, the state-value network, and the policy network. The parameters are adjusted using the corresponding loss functions until the preset convergence condition is met, thus obtaining the target policy network.

Benefits of technology

It improves the training effect and speed of the policy network and enhances the decision-making performance of the target policy network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312815B_ABST
    Figure CN117312815B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, electronic device, and storage medium for training an intelligent agent policy network. The method includes: determining the linear score of a first training sample; inputting the current first training sample into a state-action value network, a state value network, and a policy network respectively, and determining a first actual output, a second actual output, and a third actual output; determining a first loss value based on the second actual output, the cumulative reward at a first historical time, the linear score, and a first loss function, and adjusting the parameters of the state-action value network; determining a second loss value corresponding to the state value network, and adjusting the parameters of the state value network accordingly; determining a third loss value corresponding to the policy network, and adjusting the parameters of the policy network based on the third loss value, to obtain the target policy network. This technical solution improves the training effect and speed of the policy network, enabling more accurate and convenient training of the target policy network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agent reinforcement learning technology, and in particular to an agent policy network training method, apparatus, electronic device and storage medium. Background Technology

[0002] Reinforcement learning has achieved remarkable success in various sequential decision-making problems, such as sequential recommendation systems, and learning motor skills in automation and robotics. Heteropolistically different policy reinforcement learning algorithms utilize diverse empirical data collected along the policy improvement path from previous policies, achieving higher data efficiency compared to online policy methods.

[0003] In related technologies, traditional heterogeneous policy reinforcement learning algorithms typically store historical (state, action, reward, next state) interaction transition quadruples sequentially in an experience pool. During the update process using the reinforcement learning algorithm, samples are taken from the experience pool, and the sampled data is used to update the neural network. However, during network updates, the sampling strategy for training samples usually prioritizes samples generated by the current policy. This results in the policy network being trained being unable to be trained based on historical policy samples, leading to poor training performance and impacting the performance of the target policy network in the final application. Summary of the Invention

[0004] This invention provides a method, apparatus, electronic device, and storage medium for training intelligent agent policy networks, which improves the training effect and speed of policy networks, enabling more accurate and convenient training of target policy networks, thereby enhancing the decision-making performance of target policy networks.

[0005] According to one aspect of the present invention, a method for training an agent policy network is provided, the method comprising:

[0006] For each first training sample obtained from the first experience pool, the current first training sample is processed based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample; wherein, the first training sample is a tuple, the tuple includes an initial state, the state at a first historical moment, the decision action at the first historical moment, the state at the next historical moment, the reward at the first historical moment, and the cumulative reward at the first historical moment; wherein, the next historical moment is the next moment corresponding to the first historical moment as the current moment;

[0007] The current first training sample is input into the state-action value network, the state value network, and the policy network respectively to obtain the first actual output corresponding to the state-action value network, the second actual output corresponding to the state value network, and the third actual output corresponding to the policy network.

[0008] The first actual output and the reward at the first historical moment are processed based on the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network to obtain a first loss value. The parameters in the state-action value network are then corrected based on the first loss value.

[0009] The second actual output and the reward at the first historical moment are processed according to the second loss function corresponding to the state value network to obtain a second loss value, and the parameters in the state value network are corrected according to the second loss value; and,

[0010] The third actual output and the decision action at the first historical moment are processed according to the third loss function corresponding to the policy network to obtain the third loss value. The parameters in the policy network are then corrected according to the third loss value until the preset convergence condition corresponding to the policy network is reached, at which point the training ends and the target policy network is obtained.

[0011] The third loss function is associated with the actual output of the state-action value network and the actual output of the state value network; the target policy network is used to judge the current state of the agent to obtain the target decision action at the current time.

[0012] According to another aspect of the present invention, an agent policy network training apparatus is provided, the apparatus comprising:

[0013] The training sample acquisition module is used to process each first training sample acquired from the first experience pool based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample; wherein, the first training sample is a tuple, the tuple including an initial state, the state at a first historical moment, the decision action at the first historical moment, the state at the next historical moment, the reward at the first historical moment, and the cumulative reward at the first historical moment; wherein, the next historical moment is the next moment corresponding to the first historical moment as the current moment;

[0014] The training sample processing module is used to input the current first training sample into the state-action value network, the state value network, and the policy network to be trained, respectively, to obtain a first actual output corresponding to the state-action value network, a second actual output corresponding to the state value network, and a third actual output corresponding to the policy network.

[0015] The first loss value determination module is used to process the first actual output and the reward at the first historical moment based on the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network to obtain a first loss value, and to correct the parameters in the state-action value network based on the first loss value; and,

[0016] The second loss value determination module is used to process the second actual output and the reward at the first historical moment according to the second loss function corresponding to the state value network to obtain a second loss value, and to correct the parameters in the state value network according to the second loss value; and,

[0017] The third loss value determination module is used to process the third actual output and the decision action at the first historical moment according to the third loss function corresponding to the policy network to obtain the third loss value, and to correct the parameters in the policy network according to the third loss value until the preset convergence condition corresponding to the policy network is reached, and the training ends to obtain the target policy network.

[0018] The third loss function is associated with the actual output of the state-action value network and the actual output of the state value network; the target policy network is used to judge the current state of the agent to obtain the target decision action at the current time.

[0019] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0020] At least one processor; and

[0021] A memory communicatively connected to the at least one processor; wherein,

[0022] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the agent policy network training method according to any embodiment of the present invention.

[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the agent policy network training method according to any embodiment of the present invention.

[0024] The technical solution of this invention involves processing each first training sample obtained from a first experience pool based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample. Then, the current first training sample is input into a state-action value network, a state value network, and a policy network to obtain a first actual output corresponding to the state-action value network, a second actual output corresponding to the state value network, and a third actual output corresponding to the policy network. Next, the first actual output and the reward at the first historical moment are processed according to the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network to obtain a first loss value. The parameters in the state-action value network are then corrected based on the first loss value. Finally, the parameters in the state-action value network are adjusted according to the state value network... The second loss function processes the second actual output and the reward at the first historical moment to obtain a second loss value, and the parameters in the state value network are corrected based on the second loss value. Similarly, the third loss function corresponding to the policy network processes the third actual output and the decision action at the first historical moment to obtain a third loss value, and the parameters in the policy network are corrected based on the third loss value. Training ends when the preset convergence condition corresponding to the policy network is met, resulting in the target policy network. This solves the problem in related technologies where the policy network to be trained cannot be trained based on historical policy samples, leading to poor training performance and affecting the performance of the final target policy network. It improves the training effect and speed of the policy network, enabling more accurate and convenient training of the target policy network, thereby enhancing the decision performance of the target policy network.

[0025] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 This is a flowchart of an agent policy network training method according to Embodiment 1 of the present invention;

[0028] Figure 2 This is a flowchart of an agent policy network training method according to Embodiment 2 of the present invention;

[0029] Figure 3 This is a schematic diagram of the structure of an agent policy network training device according to Embodiment 3 of the present invention;

[0030] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the intelligent agent policy network training method of the present invention. Detailed Implementation

[0031] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0032] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0033] Example 1

[0034] Figure 1 This is a flowchart of an agent policy network training method provided in Embodiment 1 of the present invention. This embodiment is applicable to any case of training a policy network included in a heterogeneous policy reinforcement learning algorithm. The method can be executed by an agent policy network training device, which can be implemented in hardware and / or software, and can be configured in a terminal and / or server. Figure 1 As shown, the method includes:

[0035] S110. For each first training sample obtained from the first experience pool, the current first training sample is processed based on the pre-trained linear discriminator to obtain the linear score corresponding to the current first training sample; wherein, the first training sample is a multivariate set, which includes the initial state, the state at the first historical moment, the decision action at the first historical moment, the state at the next historical moment, the reward at the first historical moment, and the cumulative reward at the first historical moment.

[0036] In this embodiment, the first experience pool can be a pre-built replay buffer used to store samples of agent-environment interactions. The samples stored in the first experience pool can be used to train the network. Accordingly, the first training sample is the historical interaction data generated after the agent interacts with the environment. The first training sample is a tuple-based sample. The tuple includes the initial state, the state at the first historical moment, the decision action at the first historical moment, the state at the next historical moment, the reward at the first historical moment, and the cumulative reward at the first historical moment. The business environment can be the environment in which the agent interacts. It should be noted that the agent and business environment change depending on the application scenario. For example, if the application scenario is a robot control scenario, the agent can be the controlled robot, and the business environment can be the environment in which the robot is located; if the application scenario is a game scenario, the agent can be the game object being manipulated in the game, and the business environment can be the game scene.

[0037] The initial state can be the state information of the business environment under initial conditions, or it can be understood as the environmental state observation value at the starting moment of the business environment. The state at the first historical moment can be the environmental state observation value at the first historical moment of the business environment. The decision action at the first historical moment can be the action executed by the agent based on the state at the first historical moment. The state at the next historical moment can be understood as the environmental state observation value at the next historical moment of the business environment determined after executing the decision action at the first historical moment based on the state at the first historical moment. The next historical moment is the next moment corresponding to the first historical moment as the current moment. It should be noted that the process of determining the state at the next historical moment in the business environment from the state at the first historical moment and the decision action at the first historical moment can be called the environment state transition. The reward at the first historical moment can be understood as the evaluation or reward made for the state at the first historical moment and the decision action at the first historical moment, or the output obtained by inputting the state at the first historical moment and the decision action at the first historical moment into a pre-set reward function is the reward at the first historical moment. The cumulative reward at the first historical moment can be understood as the total cumulative reward from the starting moment to the first historical moment.

[0038] For example, when the intelligent agent is a game object being manipulated in a game, and the business environment is a game scene, the initial state of the business environment can be the state at the beginning of any game round; the state at the first historical moment can be the state at the first historical moment in any game round, where the first historical moment can be any moment during the execution of the current game round by the game object; the decision action at the first historical moment can be the action that the game object decides to perform at the first historical moment based on the state at the first historical moment; the state at the next historical moment can be the state of the game environment after performing the decision action at the first historical moment; the reward at the first historical moment can be the game score corresponding to the first historical moment; and the cumulative reward at the first historical moment can be the cumulative game score up to the first historical moment.

[0039] The linear discriminator can be a pre-trained neural network model used to determine the degree of matching between the input sample and the current policy. It can also be understood as a neural network model that determines the time difference between the input sample and the current policy in the time dimension. That is, the smaller the time difference between the input sample and the current policy, the higher the degree of matching and the higher the linearity of the input sample; conversely, the larger the time difference, the lower the degree of matching and the lower the linearity. In this embodiment, the input sample of the linear discriminator can be historical samples from the experience pool. The linear discriminator can be a neural network model used to determine the degree of matching between historical samples and the currently executed policy. For example, the linear discriminator can be a deep convolutional neural network model. Correspondingly, the linearity score can be a score representing the degree of matching between the input sample and the current policy. In this embodiment, the linear score represents the degree of matching between the first training sample and the current policy; a higher linear score indicates a higher degree of matching between the first training sample and the current policy, while a lower linear score indicates a lower degree of matching. The linear score can be any value, optionally a random number between 0 and 1.

[0040] It should be noted that before applying the linear discriminator of this embodiment, the discriminator to be trained needs to be trained first. Optionally, the training process of the linear discriminator can be as follows: obtain multiple first training samples from a first experience pool and set a first theoretical score for each first training sample; obtain multiple second training samples from a second experience pool and set a second theoretical score for each second training sample; for each first training sample and each second training sample, input the current first training sample and the current second training sample into the discriminator to be trained to obtain a first actual score and a second actual score; process the first theoretical score and the first actual score according to the preset loss function corresponding to the discriminator to obtain a first unprocessed loss value; process the second theoretical score and the second actual score according to the loss function to obtain a second unprocessed loss value; and correct the parameters in the discriminator based on the first unprocessed loss value and the second unprocessed loss value to obtain the linear discriminator.

[0041] The first and second experience pools can be two experience replay buffers of different capacities. The capacity of the first experience pool is greater than that of the second experience pool. The ratio between the capacities of the first and second experience pools can be any value, optionally 10 times, meaning the size of the first experience pool can be 10 times the size of the second experience pool. In practical applications, during the interaction between the agent and the environment, and the determination of corresponding decision actions based on the policy network, the environmental state transition tuples at each time step can be stored in the first and second experience pools respectively as training samples. The training samples in the experience pools can be used to train the policy network corresponding to the agent. Optionally, the process of constructing training samples can be as follows: obtaining the state of the agent at the first historical moment in the target application scenario; inputting the state at the first historical moment into the policy network to be trained to obtain the decision action, the reward, and the cumulative reward at the first historical moment; determining the state at the next historical moment based on the state and decision action at the first historical moment; constructing training samples based on the state, decision action, reward, cumulative reward, and state at the next historical moment, and storing the training samples in the first experience pool and the second experience pool, respectively.

[0042] The target application scenario can be at least one of robot control, game playing, computer vision, and autonomous driving. In this embodiment, the training samples stored in the first experience pool can be the first training samples, and the training samples stored in the second experience pool can be the second training samples.

[0043] In practical applications, when an agent interacts with its environment in a target application scenario, its state at the first historical moment can be obtained. This state can then be input into the policy network to be trained, yielding the corresponding decision action. A pre-defined reward function determines the reward corresponding to both the state and the decision action at the first historical moment. A pre-defined cumulative reward function also determines the cumulative reward for that moment. Furthermore, the agent can be controlled to execute the corresponding decision action based on the state at the first historical moment to obtain the state at the next historical moment. Finally, training samples can be constructed based on the state, decision action, reward, cumulative reward, and state at the next historical moment. These training samples are stored in a first experience pool and a second experience pool, serving as the first training sample in the first experience pool and the second training sample in the second experience pool.

[0044] Furthermore, multiple first training samples can be obtained from the first experience pool and multiple second training samples from the second experience pool. Then, for each first training sample and each second training sample, the current first training sample and the current second training sample are input into the discriminator to be trained to obtain the first actual score and the second actual score. The first theoretical score and the first actual score are processed according to the preset loss function corresponding to the discriminator to obtain the first loss value to be processed. The second theoretical score and the second actual score are processed according to the loss function to obtain the second loss value to be processed. The parameters in the discriminator are corrected based on the first loss value to be processed and the second loss value to be processed to obtain the linear discriminator.

[0045] The first theoretical score can be any value, optionally 0. The second theoretical score can be any value, optionally 1. The parameters in the discriminator to be trained can be default values, and are corrected using training samples to obtain a linear discriminator. The first actual score can be the linear score output after inputting the first training sample into the discriminator to be trained. The second actual score can be the linear score output after inputting the second training sample into the discriminator to be trained. The preset loss function can be a pre-determined function used to characterize the degree of difference between the actual output and the theoretical output. In this embodiment, the preset loss function can be the cross-entropy loss function.

[0046] In practical applications, multiple first training samples can be obtained from a first experience pool, and a first theoretical score can be set for each first training sample. Similarly, multiple second training samples can be obtained from a second experience pool, and a second theoretical score can be set for each second training sample. Then, for each first training sample and each second training sample, the current first training sample and the current second training sample are simultaneously input into the discriminator to be trained, obtaining a first actual score corresponding to the current first training sample and a second actual score corresponding to the current second training sample. Further, a loss function can be applied to the first actual score and the first theoretical score to obtain a first unprocessed loss value. Similarly, a loss function can be applied to the second actual score and the second theoretical score to obtain a second unprocessed loss value. Further, the parameters in the discriminator to be trained can be corrected based on the first and second unprocessed loss values. Specifically, when correcting the parameters in the discriminator to be trained using the loss values, the convergence of the loss function can be used as a training objective, such as whether the training error is less than a preset error, whether the error change tends to stabilize, or whether the current iteration number is equal to a preset number. If the convergence condition is met, such as the training error of the loss function being less than a preset error, or the error trend stabilizing, it indicates that the discriminator to be trained has completed training, and iterative training can be stopped. If the convergence condition has not been met, other first training samples and other second training samples can be obtained to continue training the discriminator until the training error of the loss function is within a preset range. When the training error of the loss function converges, the trained discriminator can be used as a linear discriminator. That is, when the training samples with set theoretical scores are input into the linear discriminator, the linear scores corresponding to the training samples can be accurately obtained.

[0047] In practical applications, after obtaining multiple first training samples from the first experience pool, for each first training sample, the current first training sample can be input into the in-linear discriminator to process the current first training sample based on the in-linear discriminator, thereby obtaining the in-linear score corresponding to the current first training sample.

[0048] S120. Input the current first training sample into the state-action value network, the state value network, and the policy network respectively to obtain the first actual output corresponding to the state-action value network, the second actual output corresponding to the state value network, and the third actual output corresponding to the policy network.

[0049] The State-Action Value Network can be understood as a deep neural network that takes the state and decision action at the first historical moment as input and evaluates the decision action taken in the state at the first historical moment. The State-Action Value Network can be a neural network that includes a state-action value function. The input to the State-Action Value Network can be the state and decision action at the first historical moment, and the output can be the value corresponding to taking the decision action in response to the state at the first historical moment. The State Value Network can also be understood as a deep neural network that takes the state at the first historical moment as input and evaluates that state. The State Value Network can include a neural network with a state value function. The input to the State Value Network can be the state at the first historical moment, and the output can be the value obtained after evaluating the state at the first historical moment. The Policy Network can be understood as a deep neural network model that takes the state at the first historical moment as input and determines the decision action at the first historical moment after processing that state. The input to the Policy Network can be the state at the first historical moment, and the output can be the decision action at the first historical moment. It should be noted that the State-Action Value Network and the State-Value Network are the evaluation network in reinforcement learning algorithms (such as the Flexible Actor-Critics algorithm). They are "criticists" who do not directly take actions but evaluate the quality of actions. The policy network can be the policy network in reinforcement learning algorithms (such as the Flexible Actor-Critics algorithm). It is an "actor" used to determine the decision action based on the input state.

[0050] In practical applications, the state and action of the first historical moment in the current first training sample can be input into the state-action value network to obtain the first actual output; the initial state of the business environment, the state of the first historical moment, and the state of the next historical moment in the current first training sample can be input into the state value network to obtain the second actual output; and the state of the first historical moment in the current first training sample can be input into the policy network to obtain the third actual output.

[0051] The first actual output can be the evaluation value corresponding to the decision action taken at the first historical moment based on the state at the first historical moment. The second actual output can include the value of the initial state, the value of the state at the first historical moment, and the value of the state at the next historical moment. The third actual output can be the action that the agent will perform based on the state at the first historical moment.

[0052] S130. Process the first actual output and the reward at the first historical moment according to the second actual output, the cumulative reward at the first historical moment, the linear score and the first loss function corresponding to the state-action value network to obtain the first loss value, and correct the parameters in the state-action value network according to the first loss value.

[0053] The first loss function can be a pre-set original loss function corresponding to the state-action value network. In this embodiment, the first loss function can be used to characterize the degree of difference between the actual output of the state-action value network and the reward at the first historical moment.

[0054] It should be noted that the process of heterogeneous policy reinforcement learning can be understood as follows: during the interaction between the agent and the environment, the policy used for execution (i.e., the policy network) and the policy used for evaluation (i.e., the judge network) are different. The policy network can be trained by evaluating the quality of the decisions output by the policy network based on the judge network's assessment. Therefore, in this embodiment, during the training of the policy network, the loss function of the judge network used for training the policy network can be processed to weight the proportion of samples in the loss function. This facilitates faster and better learning of the policy network and improves its convergence speed.

[0055] Optionally, the first actual output and the cumulative reward at the first historical moment are processed according to the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network to obtain a first loss value, including: processing the first actual output and the cumulative reward at the first historical moment according to the first loss function to obtain an initial loss value; and processing the initial loss value according to the second actual output, the reward at the first historical moment, the linear score, and a predetermined temperature coefficient to obtain the first loss value.

[0056] The initial loss value can be the output value after inputting the first actual output and the reward at the first historical moment into the first loss function. The temperature coefficient can be a predetermined coefficient used to weight the proportion of samples in the loss function.

[0057] In practical applications, the first actual output and the reward at the first historical moment can be processed according to the first loss function to obtain the initial loss value. Then, the initial loss value can be processed according to the second actual output, the cumulative reward at the first historical moment, the linear score, and the temperature coefficient. The processed loss value can be used as the first loss value.

[0058] Optionally, the second actual output includes the actual value corresponding to the state at the next historical moment and the actual value corresponding to the initial state. Accordingly, based on the second actual output, the cumulative reward at the first historical moment, the linear score, and the predetermined temperature coefficient, the initial loss value is processed to obtain the first loss value, including: determining the look-ahead distribution weight based on the actual value corresponding to the state at the next historical moment, the actual value corresponding to the initial state, and the cumulative reward at the first historical moment; determining the product between the look-ahead distribution weight, the temperature coefficient, and the linear score to obtain the target weight; and multiplying the target weight and the initial loss value to obtain the first loss value.

[0059] The actual value corresponding to the state at the next historical moment can be the state value evaluation result output after inputting the state at the next historical moment into the state value network. The actual value corresponding to the initial state can be the state value evaluation result output after inputting the initial state of the business environment into the state value network. In this embodiment, after obtaining the actual value corresponding to the state at the next historical moment and the actual value corresponding to the initial state, the actual value corresponding to the state at the next historical moment, the actual value corresponding to the initial state, and the cumulative reward of the first historical moment in the current first training sample can be processed, and the processed values ​​can be used as the look-ahead distribution weights.

[0060] Optionally, the forward distribution weights are determined based on the actual value corresponding to the state at the next historical moment, the actual value corresponding to the initial state, and the cumulative reward at the first historical moment. This includes: adding the cumulative reward at the first historical moment and the actual value corresponding to the state at the next historical moment to obtain a first value; and determining the difference between the first value and the actual value corresponding to the initial state to obtain the forward distribution weights.

[0061] In practical applications, after obtaining the actual value corresponding to the state at the next historical moment and the actual value corresponding to the initial state, the actual value corresponding to the state at the next historical moment can be added to the cumulative reward of the first historical moment in the current first training sample. The resulting value can be used as the first value. Furthermore, the difference between the first value and the actual value corresponding to the initial state can be determined, and the obtained difference can be used as the lookahead distribution weight.

[0062] For example, the look-ahead distribution weights can be determined based on the following formula:

[0063] Forward distribution weight = cumulative reward at the first historical moment + actual value corresponding to the state at the next historical moment

[0064] - Actual value corresponding to the initial state

[0065] Furthermore, after obtaining the look-ahead distribution weights, the look-ahead distribution weights, temperature coefficients, and the product between linear scores can be determined, and this product can be used as the target weights.

[0066] For example, the target weight can be determined based on the following formula:

[0067] Target weight = Look-ahead distribution weight * Temperature coefficient * Linearity score

[0068] Furthermore, the target weight can be multiplied by the initial loss value to obtain the first loss value, which can then be used to adjust the parameters in the state-action value network.

[0069] S140. Process the second actual output and the reward at the first historical moment according to the second loss function corresponding to the state value network to obtain the second loss value, and correct the parameters in the state value network according to the second loss value.

[0070] The second loss function can be a pre-defined function used to characterize the difference between the actual output of the state value network and the reward at the first historical moment. In this embodiment, the second loss function can be a temporal difference function.

[0071] In practical applications, after obtaining the second actual output corresponding to the state-action value network, the actual value of the state at the first historical moment included in the second actual output, the actual value of the state at the next historical moment, and the reward of the first historical moment included in the current first training sample can be input into the second loss function to obtain the loss value, which can be used as the second loss value.

[0072] For example, the second loss function can be represented based on the following formula:

[0073] V(S t )←V(S t )+α[R t +γV(S t+1 )-V(S t )]

[0074] Among them, V(S) t ) can represent the actual value corresponding to the state at the first historical moment; α can represent the step size; R t γ can represent the reward at the first historical moment; γ can represent the discount rate; V(S) t+1 ) can represent the state at the next historical moment; γV(S) t+1 () can be a training target.

[0075] Furthermore, after obtaining the second loss value, the parameters in the state value network can be corrected based on the second loss value.

[0076] S150. Process the third actual output and the decision action at the first historical moment according to the third loss function corresponding to the policy network to obtain the third loss value, and correct the parameters in the policy network according to the third loss value until the preset convergence condition corresponding to the policy network is reached, and the training ends to obtain the target policy network.

[0077] It should be noted that S130, S140 and S150 do not have a temporal execution order; these three steps can be executed in parallel.

[0078] The third loss function can be predetermined and represents the degree of difference between the actual output of the policy network and the decision action at the first historical moment. In this embodiment, the third loss function can be the policy network loss function included in the flexible actor-critic algorithm. It should be noted that the training of the policy network depends on the evaluation network's assessment of the actual output of the policy network (i.e., the actual output of the state-action value network and the actual output of the state value network). Therefore, the third loss function can be associated with the actual output of the state-action value network and the actual output of the state value network. For example, the policy network is like a gymnast; after performing an action, the judge scores the action. The judge is like the evaluation network (state-action value network and state value network). The gymnast strives to improve their technique to get a higher score from the judge. The judge's score is the supervisory signal (i.e., the actual output of the state-action value network and the actual output of the state value network). The gymnast improves their technique based on the judge's score. Updating the parameters in the evaluation network is to make the evaluation network's scoring more accurate, thereby better estimating the total future reward. By training the judging network and the strategy network, athletes' scores are getting higher and higher, and judges' scores are becoming more and more accurate.

[0079] The preset convergence condition can be a pre-set termination condition for the policy network training process. Optionally, the preset convergence condition may include the training error being less than a preset error, the error change trend stabilizing, or the current number of training iterations reaching a preset number. The target policy network is used to determine the current state of the agent to obtain the target decision action at the current moment.

[0080] In practical applications, after obtaining the third actual output, a loss function can be applied to the third actual output and the decision action at the first historical moment to obtain the third loss value. Furthermore, the parameters in the policy network can be adjusted based on the third loss value. Specifically, the training error of the third loss function in the policy network, i.e., the loss parameter, can be used as a condition to detect whether the current loss function has reached convergence. For example, whether the training error is less than a preset error, whether the error trend is stable, or whether the current number of model iterations is equal to a preset number. If the convergence condition is met, such as the training error of the loss function being less than the preset error or the error trend being stable, it indicates that the current policy network training is complete, and iterative training can be stopped. If the convergence condition is not met, the policy network can be further trained using the current first training sample until the training error of the loss function is within a preset range. When the training error of the loss function converges, the currently trained policy network can be used as the target policy network.

[0081] The technical solution of this invention involves processing each first training sample obtained from a first experience pool based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample. Then, the current first training sample is input into a state-action value network, a state value network, and a policy network to obtain a first actual output corresponding to the state-action value network, a second actual output corresponding to the state value network, and a third actual output corresponding to the policy network. Next, the first actual output and the reward at the first historical moment are processed according to the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network to obtain a first loss value. The parameters in the state-action value network are then corrected based on the first loss value. Finally, the parameters in the state-action value network are adjusted according to the state value network... The second loss function processes the second actual output and the reward at the first historical moment to obtain a second loss value, and the parameters in the state value network are corrected based on the second loss value. Similarly, the third loss function corresponding to the policy network processes the third actual output and the decision action at the first historical moment to obtain a third loss value, and the parameters in the policy network are corrected based on the third loss value. Training ends when the preset convergence condition corresponding to the policy network is met, resulting in the target policy network. This solves the problem in related technologies where the policy network to be trained cannot be trained based on historical policy samples, leading to poor training performance and affecting the performance of the final target policy network. It improves the training effect and speed of the policy network, enabling more accurate and convenient training of the target policy network, thereby enhancing the decision performance of the target policy network.

[0082] Example 2

[0083] Figure 2 This is a flowchart of an intelligent agent policy network training method provided in Embodiment 2 of the present invention. Based on the foregoing embodiments, after obtaining the target policy network, the state at any time can be processed according to the target policy network to obtain the decision action corresponding to any time. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.

[0084] like Figure 2 As shown, the method includes:

[0085] S210. For each first training sample obtained from the first experience pool, the current first training sample is processed based on the pre-trained linear discriminator to obtain the linear score corresponding to the current first training sample; wherein, the first training sample is a multivariate set, which includes the initial state, the state at the first historical moment, the decision action at the first historical moment, the state at the next historical moment, the reward at the first historical moment, and the cumulative reward at the first historical moment.

[0086] S220. Input the current first training sample into the state-action value network, the state value network, and the policy network respectively to obtain the first actual output corresponding to the state-action value network, the second actual output corresponding to the state value network, and the third actual output corresponding to the policy network.

[0087] S230. Process the first actual output and the reward at the first historical moment according to the second actual output, the cumulative reward at the first historical moment, the linear score and the first loss function corresponding to the state-action value network to obtain the first loss value, and correct the parameters in the state-action value network according to the first loss value.

[0088] S240. Process the second actual output and the reward at the first historical moment according to the second loss function corresponding to the state value network to obtain the second loss value, and correct the parameters in the state value network according to the second loss value.

[0089] S250. Process the third actual output and the decision action at the first historical moment according to the third loss function corresponding to the policy network to obtain the third loss value, and correct the parameters in the policy network according to the third loss value until the preset convergence condition corresponding to the policy network is reached, and the training ends to obtain the target policy network.

[0090] S260. Obtain the current state of the intelligent agent in the target application scenario.

[0091] The current state can be an observation of the environmental state in the business environment at the current moment. It should be noted that the current state can be the state of the agent at the current moment, or the state of the environment interacting with the agent at the current moment. The form of the current state can be determined according to the specific target application scenario, and this embodiment does not impose specific limitations on it. For example, when the target application scenario is a game-playing scenario, the agent is a game object being manipulated in the game, and the business environment is a game scenario, the current state can be the state of the game at the current moment in the current game round; when the target application scenario is a robot control scenario, the agent can be the controlled robot, and the current state can be the spatial coordinates of the robot's various joints.

[0092] In practical applications, during the interaction between the intelligent agent and the environment, the current state of the intelligent agent in the target application scenario can be obtained.

[0093] S270. Process the current state based on the target policy network to obtain the target decision action at the current time, and control the agent to execute the target decision action in order to obtain the state at the next time step.

[0094] In this context, the target decision action at the current moment can be understood as the action to be executed by the agent based on the current state determined by the target policy network.

[0095] In practical applications, after obtaining the current state, it can be input into the target policy network. The target policy network then processes the current state to obtain the target decision action for the current moment. Furthermore, the agent can be controlled to execute the target decision action to determine the state for the next moment based on the current state and the target decision action.

[0096] The technical solution of this invention involves processing each first training sample obtained from a first experience pool based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample. Then, the current first training sample is input into a state-action value network, a state value network, and a policy network to obtain a first actual output corresponding to the state-action value network, a second actual output corresponding to the state value network, and a third actual output corresponding to the policy network. Next, the first actual output and the reward at the first historical moment are processed according to the second actual output, the cumulative reward at the first historical moment, the linear score, and a first loss function corresponding to the state-action value network to obtain a first loss value. The parameters in the state-action value network are then corrected based on the first loss value. Finally, the second actual output and the reward at the first historical moment are processed according to a second loss function corresponding to the state value network. The actual output and the reward at the first historical moment are processed to obtain a second loss value, and the parameters in the state value network are corrected based on the second loss value. Furthermore, the actual output and the decision action at the first historical moment are processed according to the third loss function corresponding to the policy network to obtain a third loss value, and the parameters in the policy network are corrected based on the third loss value. Training ends when the preset convergence condition corresponding to the policy network is met, resulting in the target policy network. Further, the current state of the agent in the target application scenario is obtained, and the current state is processed based on the target policy network to obtain the target decision action at the current moment. The agent is then controlled to execute the target decision action to obtain the state at the next moment. This improves the training effect and speed of the policy network, allowing for more accurate and convenient training of the target policy network, thereby enhancing the decision performance of the target policy network.

[0097] Example 3

[0098] Figure 3 This is a schematic diagram of the structure of an agent policy network training device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a training sample acquisition module 310, a training sample processing module 320, a first loss value determination module 330, a second loss value determination module 340, and a third loss value determination module 350.

[0099] The training sample acquisition module 310 is used to process each first training sample acquired from the first experience pool based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample. The first training sample is a multivariate set, which includes an initial state, a state at a first historical moment, a decision action at the first historical moment, a state at the next historical moment, a reward at the first historical moment, and a cumulative reward at the first historical moment. The next historical moment is the next moment when the first historical moment is taken as the current moment. The training sample processing module 320 is used to input the current first training sample into the state-action value network, the state value network, and the policy network to obtain a first actual output corresponding to the state-action value network, a second actual output corresponding to the state value network, and a third actual output corresponding to the policy network. The first loss value determination module 330 is used to determine the loss value based on the second actual output, the cumulative reward at the first historical moment, the linear score, and the value of the state-action value network. A first loss function processes the first actual output and the reward at the first historical moment to obtain a first loss value, and corrects the parameters in the state-action value network based on the first loss value; and a second loss value determination module 340 processes the second actual output and the reward at the first historical moment according to the second loss function corresponding to the state value network to obtain a second loss value, and corrects the parameters in the state value network based on the second loss value; and a third loss value determination module 350 processes the third actual output and the decision action at the first historical moment according to the third loss function corresponding to the policy network to obtain a third loss value, and corrects the parameters in the policy based on the third loss value, until the training ends when the preset convergence condition corresponding to the policy network is reached, thus obtaining a target policy network; wherein, the third loss function is associated with the actual output corresponding to the state-action value network and the actual output corresponding to the state value network; the target policy network is used to judge the current state of the agent to obtain the target decision action at the current moment.

[0100] The technical solution of this invention involves processing each first training sample obtained from a first experience pool based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample. Then, the current first training sample is input into a state-action value network, a state value network, and a policy network to obtain a first actual output corresponding to the state-action value network, a second actual output corresponding to the state value network, and a third actual output corresponding to the policy network. Next, the first actual output and the reward at the first historical moment are processed according to the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network to obtain a first loss value. The parameters in the state-action value network are then corrected based on the first loss value. Finally, the parameters in the state-action value network are adjusted according to the state value network... The second loss function processes the second actual output and the reward at the first historical moment to obtain a second loss value, and the parameters in the state value network are corrected based on the second loss value. Similarly, the third loss function corresponding to the policy network processes the third actual output and the decision action at the first historical moment to obtain a third loss value, and the parameters in the policy network are corrected based on the third loss value. Training ends when the preset convergence condition corresponding to the policy network is met, resulting in the target policy network. This solves the problem in related technologies where the policy network to be trained cannot be trained based on historical policy samples, leading to poor training performance and affecting the performance of the final target policy network. It improves the training effect and speed of the policy network, enabling more accurate and convenient training of the target policy network, thereby enhancing the decision performance of the target policy network.

[0101] Optionally, the first loss value determination module 330 includes: an initial loss value determination submodule and a first loss value determination submodule.

[0102] The initial loss value determination submodule is used to process the first actual output and the reward at the first historical moment according to the first loss function to obtain the initial loss value;

[0103] The first loss value determination submodule is used to process the initial loss value based on the second actual output, the cumulative reward at the first historical moment, the linear score, and a predetermined temperature coefficient to obtain the first loss value.

[0104] Optionally, the second actual output includes the actual value corresponding to the state at the next historical moment and the actual value corresponding to the initial state; correspondingly, the first loss value determination submodule includes: a look-ahead distribution weight determination unit, a target weight determination unit, and a first loss value determination unit.

[0105] The forward distribution weight determination unit is used to determine the forward distribution weight based on the actual value corresponding to the state at the next historical moment, the actual value corresponding to the initial state, and the cumulative reward at the first historical moment.

[0106] The target weight determination unit is used to determine the product of the look-ahead distribution weight, the temperature coefficient, and the linear score to obtain the target weight.

[0107] The first loss value determination unit is used to multiply the target weight and the initial loss value to obtain the first loss value.

[0108] Optionally, the look-ahead distribution weight determination unit includes: a first numerical determination subunit and a look-ahead distribution weight determination subunit.

[0109] The first value determination subunit is used to add the cumulative reward at the first historical moment and the actual value corresponding to the state at the next historical moment to obtain the first value;

[0110] The look-ahead distribution weight determination subunit is used to determine the difference between the first value and the actual value corresponding to the initial state, and to obtain the look-ahead distribution weight.

[0111] Optionally, the device further includes: a training sample acquisition module, an actual score determination module, a loss processing module, and a parameter correction module.

[0112] The training sample acquisition module is used to acquire multiple first training samples from a first experience pool and set a first theoretical score for each first training sample, and to acquire multiple second training samples from a second experience pool and set a second theoretical score for each second training sample; wherein the capacity of the first experience pool is greater than the capacity of the second experience pool.

[0113] The actual score determination module is used to input the current first training sample and the current second training sample into the discriminator to be trained for each first training sample and each second training sample to obtain the first actual score and the second actual score.

[0114] The loss processing module is used to process the first theoretical score and the first actual score according to the loss function corresponding to the discriminator to obtain a first loss value to be processed, and to process the second theoretical score and the second actual score according to the loss function to obtain a second loss value to be processed.

[0115] The parameter correction module is used to correct the parameters in the discriminator based on the first loss value to be processed and the second loss value to be processed, so as to obtain an inline discriminator.

[0116] Optionally, the device further includes: a state acquisition module, a state processing module, a state determination module, and a sample construction module.

[0117] The historical moment state acquisition module is used to acquire the state of the agent at the first historical moment in the target application scenario;

[0118] The state processing module is used to input the state of the first historical moment into the policy network to be trained, and obtain the decision action of the first historical moment, the reward of the first historical moment, and the cumulative reward of the first historical moment.

[0119] The state determination module is used to determine the state of the next historical moment based on the state of the first historical moment and the decision action of the first historical moment.

[0120] The sample construction module is used to construct training samples based on the state of the first historical moment, the decision action of the first historical moment, the reward of the first historical moment, the cumulative reward of the first historical moment, and the state of the next historical moment, and to store the training samples into the first experience pool and the second experience pool respectively.

[0121] Optionally, the device further includes: a current state acquisition module and a target decision action determination module.

[0122] The current state acquisition module is used to acquire the current state of the intelligent agent in the target application scenario.

[0123] The target decision action determination module is used to process the current state based on the target policy network to obtain the target decision action at the current time, and control the agent to execute the target decision action to obtain the state at the next time.

[0124] Optionally, the method can be applied to at least one of the following scenarios: robot control, game playing, computer vision, and autonomous driving.

[0125] The agent policy network training device provided in this embodiment of the invention can execute the agent policy network training method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0126] Example 4

[0127] Figure 4A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0128] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0129] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0130] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as agent policy network training methods.

[0131] In some embodiments, the agent policy network training method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the agent policy network training method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the agent policy network training method by any other suitable means (e.g., by means of firmware).

[0132] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0133] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0134] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on 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 fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0135] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0136] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0137] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0138] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0139] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for training an agent policy network, characterized in that, include: For each first training sample obtained from the first experience pool, the current first training sample is processed based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample; wherein, the first training sample is a tuple, the tuple includes an initial state, the state at a first historical moment, the decision action at the first historical moment, the state at the next historical moment, the reward at the first historical moment, and the cumulative reward at the first historical moment; wherein, the next historical moment is the next moment corresponding to the first historical moment as the current moment; The current first training sample is input into the state-action value network, the state value network, and the policy network respectively to obtain the first actual output corresponding to the state-action value network, the second actual output corresponding to the state value network, and the third actual output corresponding to the policy network. The first actual output and the reward at the first historical moment are processed based on the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network to obtain a first loss value. The parameters in the state-action value network are then corrected based on the first loss value. The second actual output and the reward at the first historical moment are processed according to the second loss function corresponding to the state value network to obtain a second loss value, and the parameters in the state value network are corrected according to the second loss value; and, The third actual output and the decision action at the first historical moment are processed according to the third loss function corresponding to the policy network to obtain the third loss value. The parameters in the policy network are then corrected according to the third loss value until the preset convergence condition corresponding to the policy network is reached, at which point the training ends and the target policy network is obtained. The third loss function is associated with the actual output of the state-action value network and the actual output of the state value network; the target policy network is used to judge the current state of the agent to obtain the target decision action at the current time. The agent policy network training method is applied to at least one of the following scenarios: robot control, game playing, computer vision, and autonomous driving.

2. The method according to claim 1, characterized in that, The first loss value is obtained by processing the first actual output and the cumulative reward at the first historical moment based on the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network. This includes: The first actual output and the reward at the first historical moment are processed according to the first loss function to obtain the initial loss value; The initial loss value is processed based on the second actual output, the cumulative reward at the first historical moment, the linear score, and the predetermined temperature coefficient to obtain the first loss value.

3. The method according to claim 2, characterized in that, The second actual output includes the actual value corresponding to the state at the next historical moment and the actual value corresponding to the initial state; correspondingly, the step of processing the initial loss value based on the second actual output, the cumulative reward at the first historical moment, the linear score, and a predetermined temperature coefficient to obtain the first loss value includes: The forward distribution weights are determined based on the actual value corresponding to the state at the next historical moment, the actual value corresponding to the initial state, and the cumulative reward at the first historical moment. The target weight is obtained by determining the product of the look-ahead distribution weight, the temperature coefficient, and the linear score. The first loss value is obtained by multiplying the target weight and the initial loss value.

4. The method according to claim 3, characterized in that, The step of determining the look-ahead distribution weights based on the actual value corresponding to the state at the next historical moment, the actual value corresponding to the initial state, and the cumulative reward at the first historical moment includes: The first value is obtained by adding the cumulative reward at the first historical moment and the actual value corresponding to the state at the next historical moment. The difference between the first value and the actual value corresponding to the initial state is determined to obtain the look-ahead distribution weight.

5. The method according to claim 1, characterized in that, Also includes: Multiple first training samples are obtained from a first experience pool, and a first theoretical score is set for each first training sample; and multiple second training samples are obtained from a second experience pool, and a second theoretical score is set for each second training sample; wherein the capacity of the first experience pool is greater than the capacity of the second experience pool. For each first training sample and each second training sample, the current first training sample and the current second training sample are input into the discriminator to be trained to obtain the first actual score and the second actual score. The first theoretical score and the first actual score are processed according to the loss function corresponding to the discriminator to obtain a first loss value to be processed, and the second theoretical score and the second actual score are processed according to the loss function to obtain a second loss value to be processed. The parameters in the discriminator are corrected based on the first and second unprocessed loss values ​​to obtain an inline discriminator.

6. The method according to claim 1 or 5, characterized in that, Also includes: Obtain the state of the intelligent agent at the first historical moment in the target application scenario; The state at the first historical moment is input into the policy network to be trained to obtain the decision action at the first historical moment, the reward at the first historical moment, and the cumulative reward at the first historical moment. Based on the state of the first historical moment and the decision action taken at the first historical moment, determine the state of the next historical moment; Based on the state of the first historical moment, the decision action of the first historical moment, the reward of the first historical moment, the cumulative reward of the first historical moment, and the state of the next historical moment, training samples are constructed and stored in the first experience pool and the second experience pool, respectively.

7. The method according to claim 1, characterized in that, Also includes: Obtain the current state of the intelligent agent in the target application scenario; The target policy network is used to process the current state to obtain the target decision action at the current moment, and the agent is controlled to execute the target decision action to obtain the state at the next moment.

8. A training device for an intelligent agent policy network, characterized in that, The device includes: The training sample acquisition module is used to process each first training sample acquired from the first experience pool based on a pre-trained linear discriminator to obtain a linear score corresponding to the current first training sample; wherein, the first training sample is a tuple, the tuple including an initial state, the state at a first historical moment, the decision action at the first historical moment, the state at the next historical moment, the reward at the first historical moment, and the cumulative reward at the first historical moment; wherein, the next historical moment is the next moment corresponding to the first historical moment as the current moment; The training sample processing module is used to input the current first training sample into the state-action value network, the state value network, and the policy network to be trained, respectively, to obtain a first actual output corresponding to the state-action value network, a second actual output corresponding to the state value network, and a third actual output corresponding to the policy network. The first loss value determination module is used to process the first actual output and the reward at the first historical moment based on the second actual output, the cumulative reward at the first historical moment, the linear score, and the first loss function corresponding to the state-action value network to obtain a first loss value, and to correct the parameters in the state-action value network based on the first loss value; and, The second loss value determination module is used to process the second actual output and the reward at the first historical moment according to the second loss function corresponding to the state value network to obtain a second loss value, and to correct the parameters in the state value network according to the second loss value; and, The third loss value determination module is used to process the third actual output and the decision action at the first historical moment according to the third loss function corresponding to the policy network to obtain the third loss value, and to correct the parameters in the policy network according to the third loss value until the preset convergence condition corresponding to the policy network is reached, and the training ends to obtain the target policy network. The third loss function is associated with the actual output of the state-action value network and the actual output of the state value network; the target policy network is used to judge the current state of the agent to obtain the target decision action at the current time. The intelligent agent policy network training device is applied to at least one of the following scenarios: robot control, game playing, computer vision, and autonomous driving.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the agent policy network training method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Network training and equipment control method and device, equipment and storage medium

    CN114219087A

  • Training method and device for information adjustment model of charging station and product

    CN115330556A