Hindsight Relabeling is All You Need for Reach-Avoid Learning

Kevin Li, Marinka ZitnikNeurIPS 2026

TL;DR

Teaching an AI agent to reach a target while dodging obstacles usually requires brittle reward engineering and retraining from scratch every time a new hazard appears. This paper introduces RADT (Reach-Avoid Decision Transformer), a model that learns entirely from clumsy, random offline data without any reward or cost functions. By treating goals and hazards as simple prompt tokens, RADT lets you dynamically drop in new, resizing, or multiplying obstacles at test time—achieving zero-shot safety across both robotics and cellular biology.

What Problem Does This Paper Address?

Imagine a home robot navigating a living room where furniture is constantly rearranged, or a medical algorithm steering a cell’s genetic state toward a healthy target without accidentally triggering a cancerous intermediate state. Both are reach-avoid problems: get to Point B, and stay out of trouble along the way. Because making mistakes in the real world is dangerous, agents often have to learn offline from pre-collected datasets rather than through live trial-and-error.

Existing offline reinforcement learning (RL) methods struggle to do this flexibly. Typically, they hardcode obstacle locations directly into the agent's state vector and bake obstacle sizes into a handcrafted cost function.

Prior models append avoid-regions directly to the state vector, locking the model into a fixed number of obstacles.

This creates a rigid bottleneck: if you add a second coffee table to the room, the state vector changes length, and you have to retrain the whole network. Furthermore, balancing "reach the goal" rewards against "avoid the hazard" penalties requires finicky math that often breaks when an obstacle is genuinely unavoidable.

Figure 1: (a) An ideal reach-avoid model should learn to avoid arbitrarily specified regions of varying number and size at evaluation time, using only suboptimal, random-policy training data. (b) RADT is the only model that satisfies all criteria for an ideal reach-avoid learner (Section 2).

Methods

The authors build RADT on top of a Decision Transformer—a standard architecture that treats RL like language modeling, predicting the next best action given a history of states and actions. What’s new is how RADT is prompted and trained:

  • Prompt-Based Conditioning: Instead of stuffing obstacle data into the state vector, RADT prepends a structured prompt to the trajectory. This prompt contains a binary avoid success indicator ($z \in \{0, 1\}$), an arbitrary number of avoid-region tokens (vectors defining obstacle centers and sizes), and a goal token. Because transformers naturally handle variable-length sequences, you can feed RADT one obstacle during training and ten at test time.
  • Hindsight Avoid-Region Relabeling (HAR): Standard hindsight goal relabeling takes a random, wandering trajectory and pretends its final state was the intended goal all along. The authors invent an analogous trick for obstacles. For every random trajectory in the dataset, they create a twin pair: one prompted with a synthetic obstacle the agent happened to miss (labeled $z=1$), and an identical trajectory prompted with an obstacle the agent blundered right through (labeled $z=0$).

Because the states and actions in the pair are identical, the model is forced to link the $z$ token to obstacle violations. At test time, you simply prompt the model with $z=1$, and your desired goals and hazards. No reward or cost functions required.

Datasets

RADT is trained strictly on suboptimal trajectories generated by purely random policies ($2 \times 10^6$ timesteps for robotics; $6 \times 10^4$ for biology). The authors evaluate across newly adapted benchmarks:

  • FetchReachObstacle & MazeObstacle: Adapted from standard Gymnasium Robotics tasks (a 3D robotic arm and 2D maze navigation, including variants with dead ends and image-based observations). Crucially, unlike prior safe-RL datasets where obstacles are solid walls, the authors make obstacles passable during data collection so random agents can actually violate them, testing true suboptimality tolerance.
  • Cardiogenesis: A newly introduced RL environment based on an established Boolean network model of mouse heart cell development, featuring discrete, combinatorial states and stochastic transitions.

Key Insights and Ideas

  • Showing what not to do matters: Pairing identical trajectories with $z=1$ and $z=0$ is the secret sauce for credit assignment. Ablating this pairing drops performance, proving the model needs explicit contrast to isolate what constitutes a violation.
  • Graceful degradation under impossible odds: Constrained optimization RL tends to break when constraints are impossible to satisfy. In the Cardiogenesis task, when the authors placed an avoid-token on a biological bottleneck state that must be crossed to reach the goal, RADT didn't freeze up—it automatically found a path that minimized the number of timesteps spent inside that undesirable state (cutting dwell time from 5 steps to 3).
  • Representation agnostic: Because tokens are projected into a shared latent space, RADT doesn't care how you define an obstacle—boxes, spheres, discrete gene states, or even raw images encoded via ResNet-18 all work seamlessly.

Key Results

Across 17 tasks, zero-shot RADT consistently matches or beats baselines (like AM-Lag, RbSL, and WGCSL) even when those baselines are retrained from scratch for every new obstacle configuration:

  • Scaling Obstacle Sizes (FetchReachObstacle): Trained on a max box width of 0.16 and tested zero-shot up to 0.24 ($1.5\times$ larger), RADT cuts mean normalized cost (MNC—average steps spent inside an obstacle) by 35.7% at width 0.20 and 36.2% at width 0.22 compared to retrained AM-Lag, while maintaining a ~98–100% goal-reaching success rate (SR).
  • Scaling Obstacle Counts (MazeObstacle): Trained on 3 obstacles and tested zero-shot on up to 20, RADT beats retrained baselines in both MNC and SR up to 10 obstacles ($>300\%$ out-of-distribution), and maintains a higher SR all the way to 20 obstacles.
  • Cell Reprogramming (Cardiogenesis): Achieve 100% goal-reaching while completely bypassing avoidable hazardous intermediates (dropping visitation from 100% to 0%) via longer, safer genetic pathways.

Limitations and Future Work

The authors note that the model's specific limitations are detailed in Appendix G, which is not included in the provided main text. (One interesting nuance observed in the main text's stress tests is that mixing conservative expert demonstrations into the random training data actually hurts goal-reaching success on out-of-distribution obstacle sizes, suggesting RADT can inherit overly cautious biases from non-random data.)

Summary updated

Abstract

Offline goal-conditioned reinforcement learning methods have shown promise for reach-avoid tasks, where an agent must reach a target state while avoiding undesirable regions of the state space. Existing approaches typically encode avoid-region information into an augmented state space and cost function, which prevents flexible, dynamic specification of novel avoid-region information at evaluation time. They also rely heavily on meticulously designed reward and cost functions, limiting transferability to novel environments and specifications. We introduce RADT, a decision transformer approach for offline, reward-free, goal-conditioned, avoid-region-conditioned RL. RADT encodes goals and avoid-regions directly as prompt tokens, allowing any number of avoid-regions of arbitrary size to be specified at evaluation time. Using only suboptimal offline trajectories from a random policy, RADT can learn reach-avoid behavior in a completely data-driven manner using our novel avoid-region hindsight relabeling approach, without the need for reward/cost supervision. We benchmark RADT against existing offline goal-conditioned RL models across 17 tasks, environments, and experimental settings. RADT generalizes in a zero-shot manner to out-of-distribution avoid-region sizes and counts, outperforming baselines that require retraining. In one such zero-shot setting, RADT achieves 35.7% improvement in normalized cost over the best retrained baseline while maintaining high goal-reaching success. We also apply RADT to cell reprogramming in biology, demonstrating its versatility.
BibTeX
@inproceedings{li2026hindsight,
  author = {Kevin Li and Marinka Zitnik},
  title = {{Hindsight Relabeling is All You Need for Reach-Avoid Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=NUNqj0j1C6},
}
Figure