Patent Description:
Machine learning models receive an input and generate an output, e.g., a predicted output, based on the received input. Some machine learning models are parametric models and generate the output based on the received input and on values of the parameters of the model.

Some machine learning models are deep models that employ multiple layers of models to generate an output for a received input. For example, a deep neural network is a deep machine learning model that includes an output layer and one or more hidden layers that each apply a non-linear transformation to a received input to generate an output.

<CIT> discloses methods, systems, and apparatus, including computer programs encoded on computer storage media, for implementing an interactive autonomous vehicle agent. One of the methods includes receiving a request to generate an experience tuple for a vehicle in a particular driving context. A predicted environment observation representing a predicted environment of the autonomous vehicle after the candidate action is taken by the autonomous vehicle in an initial environment is generated, including providing an initial environment observation and the candidate action as input to a vehicle behavior model neural network trained to generate predicted environment observations. An immediate quality value is generated from a context-specific quality model that generates immediate quality values that are specific to the particular driving context. An experience tuple comprising the initial environment observation, the candidate action, and the immediate quality value is generated and used as input to a reinforcement learning system for the autonomous vehicle.

This specification describes a simulation system implemented as computer programs on one or more computers in one or more locations that can learn to control a set of agents interacting with a simulated environment to cause their behavior to realistically simulate the behavior of real-world agents.

According to a first aspect there is provided a method performed by one or more data processing apparatus for generating a simulation of an environment that is being interacted with by a set of agents over a sequence of time steps. The simulation includes a respective simulation state for each time step that specifies a respective state of each agent at the time step. The method includes, for each time step, obtaining a current simulation state for the current time step. A set of candidate next simulation states for a next time step are generated based on the current simulation state. Generating each candidate next simulation state includes sampling, for each agent, a respective action from a set of possible actions that can be performed by the agent. For each agent, a respective next state of the agent at the next time step if the agent performs the corresponding sampled action at the current time step is determined. For each candidate next simulation state, a discriminative score characterizing a likelihood that the candidate next simulation state is a realistic simulation state is determined. A candidate next simulation state is selected as the simulation state for the next time step based on the discriminative scores for the candidate next simulation states.

In some implementations, the agents are vehicles in the environment.

In some implementations, the set of possible actions that can be performed by an agent include actions that adjust a steering angle of the agent.

In some implementations, the set of possible actions that can be performed by an agent include actions that adjust an acceleration of the agent.

In some implementations, the state of an agent at a time step includes: (i) a position of the agent at the time step, and (ii) a motion of the agent at the time step.

In some implementations, the position of the agent includes: (i) a spatial location of the agent in the environment, and (ii) a heading of the agent in the environment.

In some implementations, the motion of the agent includes: (i) a speed of the agent, and (ii) an acceleration of the agent.

In some implementations, the method further includes, for each agent, obtaining a representation of the current state of the agent in the environment, and processing the representation of the current state of the agent in the environment using a policy neural network to generate a corresponding probability distribution over the set of possible actions for the agent. Sampling, for each agent, a respective action from the set of possible actions may include, for each agent, sampling an action from the set of possible actions in accordance with the probability distribution over the set of possible actions for the agent.

In some implementations, determining, for each agent, a respective next state of the agent at the next time step if the agent performs the corresponding sampled action at the current time step includes, for each agent, processing data characterizing: (i) a current state of the agent, and (ii) the sampled action for the agent, using a motion model to generate the next state of the agent at the next time step.

In some implementations, determining a discriminative score characterizing a likelihood that a candidate next simulation state is a realistic simulation state includes obtaining a representation of the candidate next simulation state. The representation of the candidate next simulation state may be processed using a discriminator neural network to generate the discriminative score characterizing the likelihood that the candidate next simulation state is a realistic simulation state.

In some implementations, obtaining a representation of the candidate next simulation state includes obtaining, for each agent, a representation of the next state of the agent at the next time step corresponding to the candidate next simulation state. Processing the representation of the candidate next simulation state using a discriminator neural network may include, for each agent, processing the representation of the next state of the agent at the next time step corresponding to the candidate next simulation state using the discriminator neural network to generate an agent-specific discriminative score characterizing a likelihood that the next state of the agent is a realistic agent state. The discriminative score characterizing the likelihood that the candidate next simulation state is a realistic simulation state may be generated based on the agent-specific discriminative scores.

In some implementations, generating the discriminative score characterizing the likelihood that the candidate next simulation state is a realistic simulation state based on the agent-specific discriminative scores includes computing a minimum of the agent-specific discriminative scores.

In some implementations, the discriminator neural network is trained to generate discriminative scores that characterize an environment state as being realistic if the environment state is a real-world environment state.

In some implementations, selecting a candidate next simulation state as the simulation state for the next time step based on the discriminative scores for the candidate next simulation states includes selecting the candidate next simulation state with the highest discriminative score as the simulation state for the next time step.

According to a second aspect there is provided a system including one or more computers and one or more storage devices communicatively coupled to the one or more computers, where the one or more storage devices store instructions that, when executed by the one or more computers, cause the one or more computers to perform the operations of the method of the first aspect.

According to a third aspect there are provided one or more non-transitory computer storage media storing instructions that when executed by one or more computers cause the one or more computers to perform the operations of the method of the first aspect.

This specification describes a simulation system that can control a set of multiple simulated agents (e.g., vehicles) interacting with an environment to cause their behavior to realistically simulate the behavior of real-world agents (e.g., vehicles controlled by human drivers). The simulation system can be used to improve the operation of a planning system that selects actions to be performed by a partly- or fully- autonomous vehicle. For example, the simulation system can be used to generate a large number of simulations where the planning system controls one vehicle while the remaining vehicles are controlled by the simulation system. These simulations can be used to identify and resolve potential "bugs" in the planning system (e.g., where the planning system selects actions that cause the vehicle to operate unsafely) before the planning system is used to control a vehicle in a real-world environment. As another example, a planning system of a vehicle can use the simulation system to predict the possible future behavior of other vehicles in an environment, and thereafter use these behavior predictions to control the operation of the vehicle more safely and effectively. As another example, the simulation system can be used to train a planning system to select actions that enable a vehicle to operate safely, efficiently, and comfortably, in environments that are simultaneously occupied by other vehicles.

Previously, to test the performance of a planning system, a simulation could be generated where the planning system would control one vehicle and the remaining vehicles would simply replay logged behavior of real-world vehicles. Such simulations may be unrealistic, since the vehicles following predetermined trajectories are unable to adjust their behavior to account for the behavior of the vehicle controlled by the planning system. In contrast, the simulation system described in this specification can dynamically select the actions to be performed by each vehicle under its control at each time step while accounting for the behavior of each other vehicle, i.e., including the vehicle controlled by the planning system. Therefore, the simulation system described in this specification can generate more realistic simulations that can be used to improve the operation of a planning system.

The simulation system described in this specification can "sample" (i.e., stochastically generate) a large number of possible simulations of an environment starting from a given initial condition of the environment. Sampling different possible simulations enables the simulation system to simulate many different scenarios, e.g., where a vehicle controlled by the simulation system merges behind a vehicle controlled by the planning system, and where the vehicle controlled by the simulation system merges ahead of the vehicle controlled by the planning system. In contrast, an alternative simulation system where vehicles replay logged behavior of real-world vehicles would be unable to simulate multiple scenarios starting from a given initial condition. The ability to sample different possible simulation scenarios enables the simulation system described in this specification to be used, e.g., for testing a planning system under a more comprehensive set of realistic scenarios than would be possible using some alternative simulation systems.

This specification describes a simulation system that can learn to control a set of agents (e.g., vehicles) interacting with a simulated environment to cause their behavior (e.g., acceleration and steering) to simulate the behavior of real-world agents (e.g., cars controlled by human drivers). The simulation system jointly controls the agents to cause each agent to behave realistically, both individually and with respect to each of the other agents in the environment. Take, as an example, the simulated multi-agent environment <NUM> illustrated by <FIG>, where five agents (<NUM>-A-E) are jointly navigating a roadway. The simulation system may cause agent <NUM>-C to stop at the intersection, and to refrain from entering the lane occupied by agent <NUM>-E until after agent <NUM>-E (which is also controlled by the simulation system) has passed the intersection. When agent <NUM>-C does enter the intersection, the simulation system can control its steering and acceleration to cause it to follow a realistic trajectory, e.g., such that it stays on the roadway and does not collide with any of the other agents.

Throughout this document, the behavior of an agent is said to be "realistic" if it simulates (i.e., has similar properties to) the behavior of real-world agents. For example, an agent may be considered to behave realistically based on whether it collides with other objects in the environment, how it handles traffic control lights and signs (e.g., all-way stop precedence), and how it handles interactions with other agents (e.g., during lane changes and merging). Similarly, the state of an environment (or an agent) is said to be realistic if it simulates the states of real-world environments (or agents). Put another way, a simulation is said to be realistic if it specifies simulation states that have similar characteristics to real-world environment states derived from logged data, such that an observer (e.g., a discriminator neural network or a person) may have difficulty distinguishing the simulation states from the real-world environment states.

The simulation system controls the agents by selecting a respective action to be performed by each agent at each of multiple time steps. In particular, for each agent, the system can use a "policy" neural network to generate a probability distribution over a set of possible actions, and then select the action to be performed by the agent using the probability distribution. The actions that can be performed by an agent may include actions that control the motion of the agent, e.g., steering and acceleration actions, and actions that otherwise affect the state of the agent, e.g., by activating or deactivating turns signals. The actions performed by the agents at a given time step determine the state of the simulation (in particular, the respective state of each agent) at the next time step. As used throughout this document, a "simulation state" at a time step refers to data that characterizes the state of each agent at the time step.

Starting from a given initial simulation state at a first time step, the simulation system generates a set of multiple "candidate" next simulation states for the next time step. Each candidate next simulation state is the result of the agents performing respective actions that are sampled from the per-agent action probability distributions generated by the policy neural network at the first time step. The simulation system evaluates whether each candidate next simulation state is realistic by generating a respective "discriminative score" for the candidate next simulation state using a "discriminator" neural network. The simulation system can use the discriminative scores to filter (i.e., remove from further consideration) one or more candidate next simulation states, e.g., by only maintaining the candidate next simulation state with the highest discriminative score, or the candidate next simulation states with discriminative scores satisfying a threshold.

The simulation system "rolls out" the simulation over multiple time steps by, at each time step, generating candidate next simulation states for the next time step based on the simulation state(s) for the current time step, and filtering unrealistic candidate next simulation states based on the discriminative scores. Maintaining multiple candidate next simulation states (i.e., which are each identified as being realistic) can enable the simulation system to roll out multiple simulations in parallel.

<FIG> illustrates an example of a simulation <NUM> that has been rolled out over <NUM> time steps (T = <NUM>, <NUM>, <NUM>, <NUM>) starting from an initial time step (T = <NUM>). Each of the circles <NUM>-A-I represent a respective simulation state generated by the simulation system. At T = <NUM>, the simulation system generates two candidate next simulation states <NUM>-B and <NUM>-C from the initial simulation system <NUM>-A. The simulation system generates discriminative scores for the candidate simulation states <NUM>-B and <NUM>-C, and in this example, filters the candidate simulation state <NUM>-B. In <FIG>, unfilled circles (e.g., <NUM>-B) represent simulation states that have been filtered, while filled-in circles (e.g., <NUM>-C) represent simulation states that have been maintained by the simulation system. The simulation system proceeds to generate candidate simulation states <NUM>-D and <NUM>-E from candidate simulation state <NUM>-C, filter candidate simulation state <NUM>-D, generate candidate simulation states <NUM>-F and <NUM>-G, filter candidate simulation state <NUM>-G, and generate candidate simulation states <NUM>-H and <NUM>-I (filtering neither). In this example, the simulation system generates two possible simulations of the agents in the environment, corresponding to the sequences of simulation states: [A, C, D, F, H] and [A, C, D, F, I].

The simulation system described in this specification can be used for any of a variety of purposes. In one example, the simulation system can be used to assess whether a planning system of a vehicle (i.e., that is configured to make driving decisions that control the operation of the vehicle) is able to safely and effectively control the vehicle, e.g., during lane changes and merging interactions. In another example, the simulation system can be used by a planning system of a vehicle during operation of the vehicle, e.g., to predict the behavior of other agents in the vicinity of the vehicle.

These features and other features are described in more detail below.

<FIG> is a block diagram of an example simulation system <NUM>. The simulation system <NUM> is an example of a system implemented as computer programs on one or more computers in one or more locations in which the systems, components, and techniques described below are implemented.

The simulation system <NUM> is configured to generate one or more simulations of an environment (e.g., a roadway) that is being interacted with by one or more agents (e.g., vehicles) over multiple time steps. Each simulation of the environment specifies a sequence of simulation states, where each simulation state corresponds to a respective time step, and the simulation state for a time step characterizes the state of each agent at the time step. The state of an agent at a time step may specify, e.g., the position and the motion of the agent at the time step. The position of an agent may specify the spatial location of the agent in the environment (e.g., represented by a set of x-y coordinates) and the heading (direction of travel) of the agent (e.g., represented by an angle in the range [<NUM>,<NUM>π] radians). The motion of an agent may specify the speed of the agent (e.g., in miles-per-hour) and the acceleration of the agent (e.g., in feet-per-second-squared). The state of an agent at a time step may also characterize other aspects of the agent, e.g., the turn signal status of the agent at the time step. Each simulation may specify further information characterizing the environment being interacted with by the agents, e.g., road graph data indicating the positions of various static features of the environment (e.g., lanes), and data indicating the states of objects in the environment (e.g., traffic lights) at different time points.

At each of multiple time steps, the simulation system <NUM> processes one or more current simulation states <NUM> for the current time step to generate one or more next simulation states <NUM> for the next time step, where each next simulation state extends a current simulation state. A next simulation state is said to "extend" a current simulation state if it results from each agent performing a respective action in the current simulation state. In the example illustrated in <FIG>, the simulation states <NUM>-B and <NUM>-C extend the simulation state <NUM>-A. After the final time step, the simulation system <NUM> identifies one or more simulations of the environment from the generated simulation states. Each simulation specifies a sequence of generated simulation states having the property that each simulation state in the sequence extends the preceding simulation state in the sequence.

The simulation system <NUM> can process a current simulation state <NUM> for a current time step to generate one or more next simulation states <NUM> for the next time step using: an observation embedding system <NUM>, a policy neural network <NUM>, a motion model <NUM>, a discriminator neural network <NUM>, and a filtering engine <NUM>, as will be described in more detail next.

The observation embedding system <NUM> generates a respective current observation embedding <NUM> for each agent. The current observation embedding <NUM> for an agent is an ordered collection of numerical values (e.g., a vector or matrix of numerical values) that characterizes the current state of the agent and the current state of the environment. For example, the current observation embedding for a given agent may characterize the current state of the environment (including the current states of the other agents) from the perspective of the given agent, as will be described in more detail with reference to <FIG>. The observation embedding system <NUM> may generate observation embeddings <NUM> for the agents having a fixed (predetermined) dimensionality, e.g., the observation embedding <NUM> for each agent may be a <NUM>-dimensional vector.

The observation embedding system <NUM> can generate the current observation embeddings <NUM> for the agents by processing the current simulation state <NUM> and a set of environment data <NUM> characterizing the current state of the environment. The environment data <NUM> may include, e.g., a road-graph indicating the structure of the roadway being travelled by the agents (e.g., the positions and types of lanes, road signs, crosswalks, and the like), the states of objects in the environment (e.g., traffic lights), the trajectories of the agents up to the current time point, and the predicted future trajectories of the agents (as will be described in more detail below). An example observation embedding system <NUM> is described in more detail with reference to <FIG>.

For each agent, the policy neural network <NUM> processes the observation embedding <NUM> for the agent to generate a probability distribution <NUM> over a set of possible actions that can be performed by the agent. The set of possible actions may include actions that control the motion of the agent and actions that otherwise affect the state of the agent. In one example, the set of possible actions may be given by: <MAT> where each Ai represents an action that adjusts the acceleration of the agent and each Sj represents an action that adjusts the steering angle of the agent. The policy neural network can have any appropriate neural network architecture that enables it to perform its described function. In one example, the policy neural network may include an input layer, followed by a sequence of multiple fully-connected layers, followed by a soft-max output layer, where each neuron of the soft-max output layer corresponds to a respective action in the set of possible actions.

The simulation system <NUM> uses the action probability distributions <NUM> to generate one or more candidate next simulation states <NUM> that extend the current simulation state <NUM>. To generate a candidate next simulation state <NUM>, the simulation system <NUM> samples a respective action for each agent from the corresponding action probability distribution <NUM> for the agent. The simulation system <NUM> then uses the motion model <NUM> to compute the state of the agent at the next time step if the agent performs the corresponding sampled action at the current time step. The computed next agent states collectively specify the candidate next simulation state <NUM>. The motion model <NUM>, which may also be referred to as a "dynamics model", a "transition model", or a "physics model", may compute the next state of an agent based on the current state of the agent and the action performed by the agent using the appropriate kinematic and geometric relationships.

The simulation system <NUM> uses the discriminator neural network <NUM> to generate a respective discriminative score <NUM> for each candidate next simulation state <NUM>. The discriminative score <NUM> for a candidate next simulation state <NUM> characterizes the likelihood that the candidate next simulation <NUM> state is realistic. The discriminative score <NUM> for a candidate next simulation state can be represented as a numerical value, e.g., a numerical value in the range [<NUM>,<NUM>], e.g., where higher values of the discriminative score (i.e., closer to one) indicate that the candidate next simulation state is more realistic.

Generally, the simulation system <NUM> can generate the discriminative score <NUM> for a candidate next simulation state <NUM> by using the discriminator neural network <NUM> to process a representation of the candidate next simulation state <NUM>. In one example, the simulation system <NUM> may generate the representation of the candidate next simulation state by using the observation embedding system <NUM> to generate a respective observation embedding for each agent corresponding to the candidate next simulation state <NUM>. In this example, the agent observation embeddings corresponding to the candidate next simulation state <NUM> collectively specify the representation of the candidate next simulation state. The simulation system <NUM> may use the discriminator neural network <NUM> to process each agent observation embedding to generate a respective agent-specific discriminative score for each agent which characterizes the likelihood that the state of the agent is realistic. The simulation system <NUM> may then combine the agent-specific discriminative scores to generate the overall discriminative score for the candidate next simulation state. For example, the simulation system may generate the discriminative score D for the candidate next simulation state as: <MAT> <MAT> where N is the number of agents, Di is the agent-specific discriminative score for agent i, Oi is the observation embedding for agent i corresponding to the candidate next simulation state, and fθ(·) represents the operations performed by the discriminator neural network. Determining the discriminative score for the simulation state as the minimum of the agent-specific discriminative scores (i.e., as in equation (<NUM>)) reflects the intuition that the behavior of any agent being unrealistic results in the entire simulation state being unrealistic.

Optionally, the discriminator neural network <NUM> may process other inputs in addition to the representation of the candidate next simulation state <NUM>. For example, the discriminator may process a representation of the current simulation state <NUM> (and possibly representations of one or more preceding simulation states) in addition to the representation of the candidate next simulation state <NUM>. Processing these additional inputs may enable the discriminator neural network to more accurately characterize whether the candidate next simulation state is realistic.

Generally, the discriminator neural network <NUM> can have any appropriate neural network architecture that enables it to perform its described function. For example, the discriminator neural network architecture may include a sequence of fully-connected layers followed by an output layer with a single neuron, i.e., where the activation of the output layer neuron specifies the discriminative score. The output layer may use, e.g., a sigmoid activation function, to cause the discriminative scores to fall into the range [<NUM>,<NUM>],.

The simulation system <NUM> uses the filtering engine <NUM> to select one or more next simulation states <NUM> from among the candidate next simulation states <NUM> based on the discriminative scores <NUM> for the candidate next simulation states <NUM>. Generally, the filtering engine <NUM> is more likely to filter (i.e., remove from further consideration) a candidate next simulation state <NUM> if the discriminative score <NUM> for the candidate next simulation state indicates that it is not a realistic state, i.e., is a state that is unlikely to occur in a real-world environment. In one example, the filtering engine <NUM> may filter each candidate next simulation state <NUM> having a discriminative score <NUM> that does not satisfy a predetermined threshold. In another example, the filtering engine <NUM> may filter every candidate next simulation state <NUM> except for a predefined number of candidate next simulation states <NUM> having the highest discriminative scores.

In some cases, particularly during training of the simulation system <NUM> (i.e., when the simulation system <NUM> has not yet learned to effectively select actions to be performed by the agents), many of the candidate next simulation states may meet the criteria for being filtered by the filtering engine <NUM>. In order to continue rolling out the simulations at the next time step, the simulation system <NUM> must select at least one next simulation state for the next time step. Therefore, the simulation system <NUM> may continually generate candidate next simulation states <NUM> (i.e., that extend the current simulation states <NUM>) until at least a predefined number have been selected by the filtering engine <NUM> as acceptable next simulation states <NUM> for the next time step.

After identifying the simulation states <NUM> for the next time step, the simulation system <NUM> may proceed to the next time step. If the current time step is the final time step, the simulation system <NUM> may identify one or more simulations of the environment from the simulation states generated for each time step. The simulation system <NUM> may determine that the current time step is the final time step if the simulations have been rolled-out for a predefined maximum number of time steps.

Generally, in order to select actions that cause the agents to behave realistically, the simulation system <NUM> (in particular, the policy neural network <NUM>) may account for the predicted future behavior of the agents. The simulation system <NUM> may account for the predicted future behavior of the agents in a manner that is purely implicit, e.g., that is implicitly learned and encoded in the parameter values of the policy neural network <NUM>. However, in order to improve the performance of the simulation system <NUM> and to facilitate the training of the policy neural network <NUM>, the simulation system <NUM> may also select the actions to be performed by the agents based on explicit predictions for the future behavior of the agents. The explicit predictions for the future behavior of the agents may be provided by one or more previously generated simulations of the environment. For example, the simulation system <NUM> may iteratively generate simulations of the environment, where at each iteration, the simulation system <NUM> generates one or more simulations of the environment that take into account the simulations generated at the previous iteration. That is, to generate the simulations at a given iteration, the simulation system can observe the predicted agent behaviors represented by the simulations generated at the previous iteration.

The simulation system <NUM> can use simulations generated at a previous iteration in generating the simulations for the current iteration in any of a variety of ways. For example, for each time point, the simulation system <NUM> can generate a respective "occupancy map" that indicates whether each spatial position in the environment was occupied by an agent at the time point in any of the simulations of the previous iteration. More specifically, the occupancy map for a time point can be represented as a two-dimensional (2D) array of numerical values, where each component of the array corresponds to a respective spatial location in the environment. The value of each component of the array indicates whether the corresponding spatial position in the environment was occupied by an agent at the time point in any of the simulations of the previous iteration. At each iteration, the simulation system <NUM> can provide the occupancy maps corresponding to the previous iteration as an additional input to the observation embedding system <NUM> as part of generating the current observation embeddings <NUM>. At the first iteration (for which there are no previous iterations), the simulation system <NUM> can use default occupancy maps, i.e., having predefined default values. <FIG> provides an illustration of a set of occupancy maps <NUM> for time points T = <NUM>, <NUM>, <NUM>, where components of the occupancy maps are shaded to indicate that the corresponding spatial location in the environment was occupied by an agent in one or more of the simulations of the previous iteration.

The simulation system <NUM> can jointly train the policy neural network <NUM> and the discriminator neural network <NUM> based on logged environment data that characterizes the behavior of real-world agents interacting with a real-world environment. Parts of the logged environment data may be derived from sensor data generated by sensors (e.g., camera sensors, lidar sensors, radar sensors, and the like) of vehicles navigating real-world environments. In some cases, the logged environment data may be derived from sensor data of multiple vehicles navigating the same environment at the same time. Using sensor data derived from the sensors of multiple vehicles may enable the logged sensor data to characterize the environment more comprehensively and accurately, e.g., in situations where part of the environment is occluded from the perspective of one of the vehicles but not another. The simulation system <NUM> processes the logged environment data to generate representations of "real-world" environment states.

The logged environment data may be stored, e.g., in a geolocation-specific snapshot database or a geolocation-specific trajectory database. The geolocation-specific snapshot database may group log data per specific geolocation in the real world, so that log data collected in the same geolocation by different vehicles at different times is in the same geolocation-specific grouping. The geolocation-specific snapshot database can be queried for a given geolocation and provide all log data generated in the given geolocation. The geolocation-specific trajectory database may similarly group logged trajectory data (i.e., that characterizes agent trajectories), such that the database can be queried for a given geolocation and provide all trajectories that include the given geolocation. Geolocation-specific snapshot and trajectory databases are described further with reference to <CIT>. Storing the logged data in the geolocation-specific snapshot database and the geolocation-specific trajectory database can facilitate efficient retrieval of logged environment data for use in training the policy neural network and the discriminator neural network. For example, the geolocation-specific databases may enable efficient retrieval of logged data generated by multiple vehicles that were in the same vicinity at the same time. As described above, such data can be combined to characterize the environment more comprehensively and accurately, e.g., in situations where part of the environment is occluded from the perspective of one vehicle but not another.

The simulation system <NUM> trains the discriminator neural network to classify whether representations of environment states are: (i) simulation states generated by the simulation system in accordance with the current values of the policy network parameters, or (ii) real-world environment states derived from the logged environment data. For example, the simulation system <NUM> may train the discriminator neural network to generate the discriminative score value "<NUM>" for real-world environment states derived from the logged environment data, and the discriminative score value "<NUM>" for simulation states generated by the simulation system.

The simulation system <NUM> trains the policy neural network <NUM> to generate action probability distributions <NUM> that result in simulation states which are classified by the discriminator neural network <NUM> as being realistic, i.e., real-world environment states. For example, the simulation system <NUM> may use the policy neural network <NUM> to generate one or more candidate next simulation states that extend a current simulation state, and process representations of the generated candidate next simulation states using the discriminator neural network to generate corresponding discriminative scores. The simulation system <NUM> can then adjust the current values of the policy neural network parameters based on an objective function that depends on the discriminative scores.

The simulation system <NUM> can alternate between: (i) training the discriminator neural network using simulation states generated based on the latest values of the policy network parameters, and (ii) training the policy neural network using discriminative scores generated based on the latest values of the discriminator network parameters. Doing so encourages the policy neural network to become progressively better at selecting actions that result in realistic simulation states and encourages the discriminator neural network to continually adapt to identify unrealistic aspects of the simulation states being generated using the policy neural network. An example method for jointly training the policy neural network and the discriminator neural network is described with reference to: <NPL>. Another example method for jointly training the policy neural network and the discriminator neural network is described with reference to:<NPL>.

In some cases, the set of possible actions that can be performed by real-world agents differs from the set of possible actions that can be performed by simulated agents (i.e., that are controlled by the simulation system). For example, real-world agents can make steering angle adjustments drawn from a continuous range (e.g., the range [<NUM>,<NUM>π] radians), while simulated agents may be restricted to making steering angle adjustments drawn from a finite set (e.g., a discretization of the range [<NUM>,<NUM>π] radians into a finite number of bins). Differences between the respective sets of possible actions that can be performed by real-world agents and by simulated agents may compromise the training of the discriminator neural network. For example, a discriminator neural network may learn to discriminate between simulated states and real-world environment states by implicitly identifying whether the actions performed by the agents are drawn from continuous or finite sets. To avoid this outcome, the simulation may preprocess the logged environment data to map each of the actions performed by the real-world agents to the closest actions from set of possible actions that can be performed by the simulated agents.

<FIG> is a block diagram of an example observation embedding system <NUM>. The observation embedding system <NUM> is an example of a system implemented as computer programs on one or more computers in one or more locations in which the systems, components, and techniques described below are implemented.

The observation embedding system <NUM> is configured to process a set of environment data <NUM> characterizing an environment and a current simulation state <NUM> characterizing the current state of each of multiple agents interacting with the environment to generate a respective observation embedding <NUM> for each agent.

The observation embedding system <NUM> processes the environment data <NUM> using an embedding neural network <NUM> to generate an environment embedding <NUM>, i.e., an alternative representation of the environment data <NUM>. The environment data <NUM> may include a road graph indicating the structure of the roadway being traveled by the agents, the states of objects in the environment (e.g., traffic light states), the trajectories of the agents up to the current time point, the current states of the agents, and the predicted future trajectories of the agents. The environment embedding <NUM> can be represented as a collection of point embeddings, where each point embedding is an ordered collection of numerical values corresponding to a respective spatial location in the environment. For example, the environment embedding <NUM> may be represented as an array of embeddings (e.g., <NUM>-dimensional embeddings), where each embedding corresponds to a respective 2D or 3D spatial location in the environment (e.g., represented by (x, y) or (x, y, z) coordinates respectively). The embedding neural network can have any appropriate neural network architecture (e.g., a convolutional neural network architecture) that enables it to perform its described function.

The embedding neural network <NUM> may be jointly trained with the policy neural network and the discriminator neural network of the simulation system (described with reference to <FIG>), e.g., by backpropagating gradients through the policy and discriminator neural networks into the embedding neural network <NUM>. The embedding neural network <NUM> can also be trained using an objective function that directly depends on the environment embedding <NUM>, e.g., that measures how accurately the environment data <NUM> can be reconstructed by processing the environment embedding <NUM>.

For each agent, the observation embedding system <NUM> uses a coordinate transformation engine <NUM> to transform the coordinates of the respective spatial location associated with each point embedding of the environment embedding <NUM> from a predefined "global" coordinate system to an "agent-centric" coordinate system. The agent-centric coordinate system is defined relative to the state of the agent. For example, the coordinate transformation engine <NUM> may apply a translation operation to the spatial coordinates of the point embeddings to cause them to be centered on the spatial location of the agent. As another example, the coordinate transformation engine <NUM> may apply a rotation operation to map the heading of the agent to a predefined direction in the agent-centric coordinate system. The set of point embeddings and their associated spatial locations in the agent-centric coordinate system are referred as the "agent-centric embedding" <NUM>. Generating the observation embedding <NUM> for the agent based on the agent-centric embedding <NUM>, rather than the environment embedding <NUM>, facilitates the training of the policy neural network and the discriminator neural network of the simulation system.

The observation embedding system <NUM> generates the respective observation embedding <NUM> for each agent based on the agent-centric embedding <NUM> corresponding to the agent. For example, to generate the observation embedding <NUM> for an agent, the observation embedding system <NUM> may apply a spatial pooling operation to the corresponding agent-centric embedding <NUM>, and then process the pooled agent-centric embedding using one or more neural network layers to generate the observation embedding <NUM>.

In some cases, certain regions of the environment may not be visible to an agent. For example, a region of the environment may not be visible to the agent as a result of the region being occluded by another agent or a static object in the environment (e.g., a safety barrier or a tree). Optionally, the observation embedding system <NUM> may prune point embeddings from the agent-centric embedding <NUM> for the agent that correspond to regions of the environment that are not visible to the agent, e.g., by replacing the point embeddings with default (predefined) embeddings. The observation embedding system <NUM> may determine that a region of the environment is not visible to an agent, e.g., if the line of sight of the agent to the region of the environment is blocked (e.g., by another agent or by a static object in the environment). Generating observation embeddings <NUM> based only on data from regions of the environment that are visible to the agent can enable the policy neural network of the simulation system to simulate the behavior of real-world agents more realistically.

In some implementations, rather than using an embedding neural network <NUM> to generate the environment embedding <NUM>, the observation embedding system <NUM> may generate the environment embedding data <NUM> from the environment data <NUM> using a set of manually defined rules.

<FIG> is a block diagram of an example on-board system <NUM> of a vehicle <NUM>. The on-board system <NUM> is composed of hardware and software components, some or all of which are physically located on-board the vehicle <NUM>. The on-board system <NUM> uses a planning system <NUM> to plan the future trajectory of the vehicle and to select actions to be performed by the vehicle. The simulation system described in this specification can be used to train and test the planning system <NUM>, as will be described in more detail below.

The on-board system <NUM> includes a sensor system <NUM> that generates sensor data <NUM> which enables the on-board system <NUM> to "see" the environment in the vicinity of the vehicle <NUM>. More specifically, the sensor system <NUM> includes one or more sensors, some of which are configured to receive reflections of electromagnetic radiation from the environment in the vicinity of the vehicle <NUM>. For example, the sensor system <NUM> can include one or more laser sensors (e.g., lidar laser sensors) that are configured to detect reflections of laser light. As another example, the sensor system <NUM> can include one or more radar sensors that are configured to detect reflections of radio waves. As another example, the sensor system <NUM> can include one or more camera sensors that are configured to detect reflections of visible light.

The sensor system <NUM> continually (i.e., at each of multiple time points) captures sensor data which can indicate the directions, intensities, and distances travelled by reflected radiation. For example, a sensor in the sensor system <NUM> can transmit one or more pulses of electromagnetic radiation in a particular direction and can measure the intensity of any reflections as well as the time that the reflection was received.

The planning system <NUM> is configured to use the sensor data <NUM> (in addition to other data, e.g., road-graph data) to generate planning decisions which plan the future trajectory of the vehicle, and in particular, to select actions to be performed by the vehicle. The actions <NUM> selected by the planning system <NUM> can be provided to a control system <NUM> of the vehicle <NUM>. The control system <NUM> of the vehicle can control some or all of the operations of the vehicle by implementing the actions <NUM> selected by the planning system. For example, in response to the planning system <NUM> selecting an action specifying that the speed of the vehicle should be reduced, the control system <NUM> may transmit an electronic signal to a braking control unit of the vehicle. In response to receiving the electronic signal, the braking control unit can mechanically apply the brakes of the vehicle.

After being trained, the simulation system <NUM> can be used to safely and efficiently test the effectiveness of the planning system <NUM>. For example, the planning system <NUM> can be used to control an agent in a simulated environment while one or more other agents in the simulated environment are controlled by simulation system <NUM> (using the policy and discriminator neural networks, as described earlier). Potential bugs in the planning system (e.g., where the planning system selects actions that cause the simulated agent to operate unsafely) can be identified by rolling out large numbers simulations and identifying where the planning system fails.

The planning system <NUM> may be jointly trained with the simulation system <NUM> using machine learning techniques. For example, the planning system <NUM> and the simulation system <NUM> can be jointly trained by rolling out a large number of simulations where the planning system <NUM> controls one agent in the simulated environment, and the simulation system <NUM> controls the remaining agents (as described earlier). The planning system <NUM> may be trained to optimize an objective function that characterizes whether vehicle controlled by the planning system <NUM> efficiently achieves its objectives (e.g., navigating from point A to point B) while operating safely. The simulation system <NUM> (in particular, the policy and discriminator neural networks) may be trained to realistically simulate the behavior of the other agents based on a set of logged real-world data, as described earlier. Jointly training the planning system <NUM> along with the simulation system <NUM> may enable the planning system <NUM> to learn to control the vehicle <NUM> more safely and efficiently.

The simulation system <NUM> may also be implemented by the on-board system <NUM> of the vehicle and used by the planning system <NUM> of the vehicle to perform behavior prediction for other agents in the vicinity of the vehicle. For example, prior to selecting an action to be performed by the vehicle at a time point, the planning system <NUM> may use the simulation system <NUM> to roll out simulations that predict the future behavior of the other agents in the vicinity of the vehicle over a duration of time (e.g., <NUM> seconds). The planning system <NUM> may take the predicted future behavior of the other agents into account when selecting the action to be performed by the vehicle.

<FIG> is a flow diagram of an example process <NUM> for generating a simulation of an environment being interacted with by multiple agents. For convenience, the process <NUM> will be described as being performed by a system of one or more computers located in one or more locations. For example, a simulation system, e.g., the simulation system <NUM> of <FIG>, appropriately programmed in accordance with this specification, can perform the process <NUM>.

The system obtains one or more current simulations state for the current time step (<NUM>). If the current time step is the first time step, the system may obtain the current simulation state from a set of logged environment data characterizing the state of a real-world environment. If the current time step is after the first time step, the system may obtain the simulation states generated for the current time step at the previous time step. Generally, a simulation state for a time step specifies a respective state of each agent at the time step. In one example, the agents are vehicles, and the state of an agent at a time step specifies the position (e.g., spatial location and heading) of the agent and the motion (e.g., speed and acceleration) of the agent at the time step.

The system generates a set of candidate next simulation states for the next time step based on the current simulation states (<NUM>). To generate a candidate next simulation state that extends a current simulation state, the system generates a respective probability distribution over a set of possible actions for each agent. The system may generate the action probability distribution for an agent by processing a representation of the current state of the agent in the environment (sometimes referred to as an "observation embedding") using a policy neural network. The system then samples a respective action for each agent using the probability distribution corresponding to the agent, and determines the next state of the agent at the next time step if the agent performs the sampled action at the current time step using a motion model. The set of possible actions may include, e.g., actions that adjust the steering angle of the agent and actions that adjust the acceleration of the agent.

The system generates a respective discriminative score for each candidate next simulation state (<NUM>). The discriminative score for a candidate next simulation state characterizes the likelihood that the candidate next simulation state is a realistic simulation state. The system can generate the discriminative score for a candidate next simulation state by processing a representation of the candidate next simulation state using a discriminator neural network. The discriminator neural network is trained to generate discriminative scores that characterize an environment state as being realistic if the environment state is a real-world environment state. The system may generate the representation of a candidate next simulation state by obtaining, for each agent, a representation of the next state of the agent at the next time step corresponding to the candidate next simulation state. To generate the discriminative score for the candidate next simulation state, the system may generate an agent-specific discriminative score for each agent by processing the representation of the next state of the agent corresponding to the candidate next simulation state using the discriminator neural network. The agent-specific discriminative score for an agent characterizes the likelihood that the next stage of the agent is a realistic agent state. The system may then generate the overall discriminative score for the candidate next simulation state based on the agent-specific discriminative scores for the candidate next simulation state, e.g., based on the minimum of the agent-specific discriminative scores.

The system selects one or more of the candidate next simulation states as simulation states for the next time step based on the discriminative scores (<NUM>). For example, the system may select a predefined number of candidate next simulation states having the highest discriminative scores as the simulation states for the next time step. If the current time step is not the final time step, the system can advance to the next time step and return to step <NUM>. If the current time step is the final time step, the system can output one or more simulations of the environment based on the simulation states generated for each time step.

A program can be stored in a portion of a file that holds other programs or data, e.g., one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple coordinated files, e.g., files that store one or more modules, subprograms, or portions of code.

Claim 1:
A method (<NUM>) performed by one or more data processing apparatus for generating a simulation of an environment (<NUM>) that is being interacted with by a plurality of agents (102A-E) over a plurality of time steps, wherein the simulation comprises a respective simulation state for each time step that specifies a respective state of each agent at the time step, the method comprising, for each time step:
obtaining (<NUM>) a current simulation state (<NUM>) for the current time step;
generating (<NUM>) a plurality of candidate next simulation states (<NUM>) for a next time step based on the current simulation state, wherein generating each candidate next simulation state comprises:
sampling (<NUM>), for each agent, a respective action from a set of possible actions that can be performed by the agent; and
determining (<NUM>), for each agent, a respective next state of the agent at the next time step if the agent performs the corresponding sampled action at the current time step;
determining, for each candidate next simulation state, a discriminative score (<NUM>) characterizing a likelihood that the candidate next simulation state is a realistic simulation state;
selecting a candidate next simulation state as the simulation state for the next time step based on the discriminative scores for the candidate next simulation state; and
using the simulation of the environment to test a planning system for an autonomous vehicle.