# tinker_cookbook.rl.compute_advantages ### [**tinker_cookbook.rl.compute_advantages**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/data_processing.py#L23)(*trajectory_groups_P*) Compute advantages for each trajectory, centered within groups. **Parameters:** - [**trajectory_groups_P**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/data_processing.py#L23) (*list\[[TrajectoryGroup](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/trajectorygroup/index.md)\]*) – Groups of trajectories, where each group's rewards are centered independently. **Returns:** *list[torch.Tensor]* – Per-group advantage tensors of shape `(G,)`, where `G` is the number of trajectories in each group. ## Referenced by - [tinker_cookbook.rl.assemble_training_data](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/assemble_training_data/index.md)