Large-scale retrieval augmented reinforcement learning
Methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for controlling a reinforcement learning agent in an environment to perform a task. In one aspect, a method comprises: maintaining a retrieval dataset that stores a plurality of history observations and, for each history observation, a respective associated context; receiving a current observation characterizing a current state of the environment; selecting one or more history observations from the plurality of history observations; processing, using an encoder neural network and in accordance with current values of encoder network parameters, an encoder network input comprising (i) the current observation and (ii) the one or more selected history observations and their respective associated context to generate a latent state representation for the current state of the environment; and using the latent state representation to determine an action to be performed by the agent in response to the current observation.
1 . A method for controlling an agent in an environment to perform a task, the method comprising:
maintaining a retrieval dataset that stores a plurality of history observations and, for each history observation, a respective associated context, wherein each history observation characterizes a respective history state of the environment and the respective associated context for each history observation characterizes one or more actions that were performed in response to the history observation;
receiving a current observation characterizing a current state of the environment;
selecting one or more history observations from the plurality of history observations, comprising:
generating a query vector for the current observation, comprising:
processing the current observation using an embedding neural network to generate an embedding and processing the embedding to generate the query vector, and
selecting the one or more history observations from the plurality of history observations using the query vector; and
processing, using an encoder neural network and in accordance with current values of encoder network parameters, an encoder network input comprising (i) the current observation and (ii) the one or more selected history observations and their respective associated context to generate a latent state representation for the current state of the environment;
processing, by a policy neural network, an input that comprises the latent state representation generated by the encoder neural network to generate a policy network output; and
determining an action to be performed by the agent in response to the current observation based on the policy network output.
2 . The method of claim 1 , wherein the associated context of each history observation comprises one or both of: a history action performed in response to the history observation, or a history reward received in response to the history action being performed.
3 . The method of claim 1 , wherein the associated context of each history observation further comprises one or both of: a history final observation characterizing a terminal state in a trajectory that includes the history observation, a history final reward received by the agent in the trajectory that includes the history observation.
4 . The method of claim 1 , wherein processing the embedding to generate the query vector comprises:
processing the embedding by using principal component analysis.
5 . The method of claim 1 , wherein each history observation stored in the retrieval dataset is associated with a corresponding key vector that is generated by using the embedding neural network.
6 . The method of claim 5 , wherein selecting the one or more history observations from the plurality of history observations comprises:
selecting, from among the key vectors associated with the plurality of history observations, one or more key vectors based on their respective distances from the query vector for the current observation; and
selecting, as the one or more selected history observations, corresponding history observations from the plurality of history observations that are associated with the one or more selected key vectors.
7 . The method of claim 6 , wherein selecting the one or more key vectors comprises:
selecting one or more key vectors having smallest Euclidean distances from the query vector for the current observation.
8 . The method of claim 1 , wherein selecting the one or more history observations from the plurality of history observations using the query vector comprises using an approximate nearest neighbor matching technique.
9 . The method of claim 1 , wherein selecting the one or more history observations from the plurality of history observations using the query vector comprises using a vector similarity search technique.
10 . The method of claim 9 , wherein the vector similarity search technique comprises a maximum inner product search technique.
11 . The method of claim 9 , wherein the maximum inner product search technique comprises an anisotropic quantization-based maximum inner product search technique.
12 . The method of claim 1 , wherein some or all of the plurality of history observations stored in the retrieval dataset are generated as a result of the agent performing one or more different tasks when interacting with the environment.
13 . The method of claim 1 , wherein some or all of the plurality of history observations stored in the retrieval dataset each have a different dimension, a different modality, or both than the current observation.
14 . The method of claim 1 , wherein determining the action to be performed by the agent in response to the current observation comprises:
performing a look-ahead search that begins from the current state and searches through a latent state representation space guided by the policy network output and additional policy network outputs of the policy neural network, wherein the policy neural network is configured to, at each of multiple time steps, process a respective latent state representation for the time step to generate a corresponding additional policy network output for the time step.
15 . The method of claim 14 , wherein the look ahead search comprises a Monte-Carlo Tree Search (MCTS) technique.
16 . The method of claim 1 , wherein the policy network output comprises one or both of:
a predicted policy output that defines a score distribution over a set of possible actions; or
a predicted value output that defines a value representing a predicted long-term reward received by the agent as a result of the environment being in the current state.
17 . The method of claim 1 , wherein determining the action to be performed by the agent in response to the current observation comprises:
selecting, from the set of possible actions, the action to be performed by the agent by using the policy network output of the policy neural network.
18 . The method of claim 1 , wherein the task comprises one of: an object manipulation task or an environment navigation task.
19 . The method of claim 1 , wherein the agent is a mechanical agent, the environment is a real-world environment, and the observation comprises data from one or more sensors configured to sense the real-world environment.
20 . The method of claim 1 , wherein the encoder neural network comprises:
a first sub network configured to process the current observation to generate a first encoded representation;
a second sub network configured to process each of the one or more selected history observations and its respective associated context to generate a respective second encoded representation; and
a third sub network configured to process the first encoded representation and the respective second encoded representations to generate the latent state representation.
21 . The method of claim 1 , wherein the encoder neural network has been trained through reinforcement learning on a training dataset that stores a plurality of trajectories generated as a result of the reinforcement learning agent interacting with the environment.
22 . The method of claim 21 , wherein the retrieval dataset is the same as the training dataset.
23 . The method of claim 21 , wherein the retrieval dataset is different from the training dataset and is larger than the training dataset.
24 . The method of claim 21 , wherein the encoder neural network has been trained through model-based reinforcement learning.
25 . One or more non-transitory computer storage media storing instructions that when executed by one or more computer cause the one or more computers to perform operations for controlling an agent in an environment to perform a task, the operations comprising:
maintaining a retrieval dataset that stores a plurality of history observations and, for each history observation, a respective associated context, wherein each history observation characterizes a respective history state of the environment and the respective associated context for each history observation characterizes one or more actions that were performed in response to the history observation;
receiving a current observation characterizing a current state of the environment;
selecting one or more history observations from the plurality of history observations, comprising:
generating a query vector for the current observation, comprising:
processing the current observation using an embedding neural network to generate an embedding and processing the embedding to generate the query vector, and
selecting the one or more history observations from the plurality of history observations using the query vector; and
processing, using an encoder neural network and in accordance with current values of encoder network parameters, an encoder network input comprising (i) the current observation and (ii) the one or more selected history observations and their respective associated context to generate a latent state representation for the current state of the environment;
processing, by a policy neural network, an input that comprises the latent state representation generated by the encoder neural network to generate a policy network output; and
determining an action to be performed by the agent in response to the current observation based on the policy network output.
26 . A system comprising one or more computers and one or more storage devices storing instructions that when executed by the one or more computers cause the one or more computers to perform operations for controlling an agent in an environment to perform a task, the operations comprising:
maintaining a retrieval dataset that stores a plurality of history observations and, for each history observation, a respective associated context, wherein each history observation characterizes a respective history state of the environment and the respective associated context for each history observation characterizes one or more actions that were performed in response to the history observation;
receiving a current observation characterizing a current state of the environment;
selecting one or more history observations from the plurality of history observations, comprising:
generating a query vector for the current observation, comprising:
processing the current observation using an embedding neural network to generate an embedding and processing the embedding to generate the query vector, and
selecting the one or more history observations from the plurality of history observations using the query vector; and
processing, using an encoder neural network and in accordance with current values of encoder network parameters, an encoder network input comprising (i) the current observation and (ii) the one or more selected history observations and their respective associated context to generate a latent state representation for the current state of the environment;
processing, by a policy neural network, an input that comprises the latent state representation generated by the encoder neural network to generate a policy network output; and
determining an action to be performed by the agent in response to the current observation based on the policy network output.