Prioritized offline Goal-swapping Experience Replay

Wenyan Yang, Joni Pajarinen, Dinging Cai, Joni Kämäräinen

TL;DR

Prioritized Offline Goal-Swapping Experience Replay (PGSER) improves offline goal-conditioned reinforcement learning by intelligently augmenting limited datasets. By using a pre-trained Q-function to identify and prioritize "reachable" goal-swapped transitions, the method allows agents to learn complex skills across different trajectories without the noise of invalid data.

What Problem Does This Paper Address?

Goal-Conditioned Reinforcement Learning (GCRL) aims to train agents that can reach any arbitrary goal, rather than just mastering a single task. In the offline setting, this is particularly difficult because the agent cannot interact with the environment to explore; it must learn entirely from a static, pre-collected dataset.

The core challenge is the "limited state-goal-action space." If a dataset only contains a trajectory of a robot arm moving to point A and another moving to point B, the agent might never learn how to get to point B if it starts from a state halfway along the path to point A. This leads to overfitting, where the agent only knows how to reach goals it has seen from specific starting points.

Figure 2: The generalizability problem of of- fline GCRL: the agent needs to learn how to reach a goal from a state without a trajectory for this state-goal pair. Each color represents an individual goal-conditioned trajectory.

While "goal-swapping" (taking a state from one trajectory and relabeling its goal with a target from another) can theoretically create more data, it often generates "impossible" transitions—goals that are physically unreachable from the current state given the constraints of the offline data.

Methods

The authors propose PGSER, a two-stage framework designed to maximize data utility while filtering out "junk" augmentations.

  1. Pre-training a "Past-Life" Agent: The authors first train a Q-function on the original offline dataset using random goal-swapping. Because they use a sparse reward system (0 for reaching the goal, -1 otherwise), the Q-value effectively represents the negative expected number of steps to the goal.
  2. Reachable Transition Identification: The pre-trained Q-function acts as a filter. When new goal-swapped transitions ($\zeta_{aug}$) are generated, the Q-function estimates their value. A high Q-value suggests the goal is reachable; a very low value (below a certain horizon threshold) suggests it is unreachable.
  3. Prioritized Experience Replay ($\beta_{aug}$): Instead of treating all augmented data equally, PGSER stores these transitions in a prioritized buffer. Transitions with higher Q-values (more likely to be successful) are sampled more frequently during the final training phase.
Figure 1: An illustration of prioritized goal-swapping experience replay. During the offline training stage, we conduct random goal-swapping augmentation to create new goal-conditioned transitions ζaug. A pre-trained Q function estimates the priority w of corresponding ζaug in order to increase the priority of augmented transitions which are more likely to reach the goal. We store both ζaug and w into an additional prioritized experience replay buffer βaug. During training the final policy data will be sampled from both the original dataset buffer β and the prioritized goal-swapping buffer βaug for goal-conditioned skill learning.

Datasets

The method was evaluated on six benchmark tasks from the Plappert et al. (2018) suite, which are standard for GCRL:

  • Fetching Tasks: FetchReach, FetchPush, FetchPickAndPlace, and FetchSlide.
  • Dexterous In-Hand Manipulation: HandBlock-Z and HandEgg (rotating objects to specific poses).

The offline datasets were composed of a mixture of 500 expert trajectories and 2,000 random trajectories to simulate a realistic, sub-optimal data environment.

Key Insights and Ideas

  • Q-Values as Reachability Classifiers: The most elegant insight is that a pre-trained Q-function, even if not perfectly optimized, is remarkably good at distinguishing between reachable and unreachable goals. The authors proved this by using simple linear classifiers (like Logistic Regression and SVM) on the Q-values, achieving over 90% accuracy in identifying successful trajectories for most tasks.
  • Connecting the "Hubs": Goal-swapping allows the agent to treat overlapping states in different trajectories as "hubs." By swapping goals at these hubs, the agent learns to "stitch" together paths from different trajectories, effectively expanding its reachable workspace.
  • Filtering is Better than Pure Augmentation: Simply adding more data (random swapping) can actually hurt performance in complex tasks like HandEggRotate because the gradient updates become dominated by impossible transitions. Prioritization ensures the agent spends its "learning budget" on meaningful examples.
Figure 3: An example of goal-swapping data augmentation. (a) Original offline trajectories (denoted by four different colors). (b) Positive augmentation example where the goals are reachable in each generated trajectory. (c) shows the negative augmentation, where the goals are no longer reachable.

Key Results

PGSER consistently outperformed standard baselines (TD3 and TD3BC) across the board:

  • Dexterous Manipulation: In the HandBlockZ task, PGSER (TD3BC-mem) achieved a score of 28.43, nearly doubling the performance of the baseline TD3BC (16.35).
  • Robustness: The method showed significant gains in HandEggRotate, where random goal-swapping actually caused the standard TD3 agent's performance to crash, while PGSER maintained a strong lead.
  • Generalization: The prioritized buffer allowed the non-offline-specific TD3 algorithm to perform comparably to TD3BC (a specialized offline algorithm), suggesting that better data distribution can sometimes compensate for algorithmic limitations in offline RL.

Limitations and Future Work

The primary drawback noted is computational overhead. Training an additional Q-function just to assign sampling weights adds a significant pre-processing step.

Future research could focus on:

  • Developing more efficient ways to estimate reachability without a full pre-training phase.
  • Applying this prioritization logic to traditional (non-goal-conditioned) offline RL tasks.
  • Exploring how this method handles extremely noisy or multi-modal offline datasets where expert trajectories are scarce.

Summary updated

BibTeX
@misc{yang2023prioritized,
  author = {Wenyan Yang and Joni Pajarinen and Dinging Cai and Joni Kämäräinen},
  title = {{Prioritized offline Goal-swapping Experience Replay}},
  year = {2023},
  eprint = {2302.07741},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.07741},
}
Figure