In traditional imitation learning, we teach agents by showing them what to do. We provide a library of expert demonstrations—perfectly parked cars, smooth robotic grasps, or helpful assistant responses—and ask the model to "be like the expert."
However, a growing body of research suggests that learning only from success leaves agents fragile. When an agent trained only on "good" data encounters a slightly novel situation, it may drift into unsafe territory because it has never learned where the boundaries of safety actually lie. To build truly robust systems, researchers are now arguing that agents must also learn what not to do.
The Expert Only Trap
The fundamental problem with expert-only datasets is a lack of causal grounding. If a self-driving car only sees an expert staying in their lane, it doesn't necessarily understand why it shouldn't veer off—it just knows it hasn't seen the expert do it. As Inkyu Jang and Claire Tomlin point out in EigenSafe, without modeling failed trajectories, robots cannot effectively recognize the early signs of an impending failure.
This is particularly dangerous in "near-miss" scenarios. Shuyao Shang and colleagues in DriveDPO observe that imitation models often choose trajectories that look human-like but are secretly dangerous. By incorporating "hard negatives"—trajectories that are geometrically similar to expert paths but result in safety violations—models can learn the fine distinctions that separate a smooth turn from a collision.
Contrastive Learning for Safety
The most common mechanism for incorporating negative data is contrastive learning. Instead of a simple regression toward the expert's path, the training objective is modified to "pull" the agent toward success and "push" it away from failure.
In the TraC framework, Akshat Kumar and Pradeep Varakantham reframe offline reinforcement learning as a trajectory classification problem. By partitioning data into "desirable" and "undesirable" sets, the agent learns to identify specific behaviors to avoid. Similarly, Yuejiang Liu and Alexandre Alahi introduced Social NCE, which uses synthetic negative examples (like simulated collisions) to regularize motion representations, ensuring the model's internal "map" of the world has clear "no-go" zones.
This contrastive approach serves as an anchor. As Dylan Z Slack and Yinlam Chow demonstrate in SAFER, maximizing the likelihood of safe actions while simultaneously penalizing unsafe ones prevents the model from misidentifying dangerous behaviors as valid actions during the reinforcement learning process.
Counterfactual Reasoning and Self-Reflection
Beyond simple classification, some researchers are teaching agents to reason about the consequences of their actions through counterfactuals—asking "what if?"
Zhiding Yu and the team behind OmniDrive use counterfactual trajectory supervision to teach AI agents the consequences of alternative, unsafe actions. By evaluating these hypothetical paths against safety rules, the agent learns why a trajectory is unsafe. This is echoed in OpenREAD by Songyan Zhang and Chen Lv, where a Large Language Model (LLM) acts as a critic to grade open-ended reasoning, helping the system explain its decisions and reject unsafe trajectories.
This "self-reflection" capability is a key feature of the iFlyBot-VLM by Zhiyuan Cheng and colleagues. By training on negative examples of failed or irrational actions, the model learns to judge the safety of its own plans before executing them.
Dichotomous Modeling: Do vs. Avoid
A more structural approach to this problem is to split the agent's "brain" into two distinct parts. Ruiming Liang and Jianxiong Li propose this in DIPOLE, where they decompose the optimal policy into two models: one that learns what to do (reward maximization) and one that learns what to avoid (reward minimization).
This "dichotomous" approach is also seen in DualCOIL by Huy Hoang and Tien Anh Mai. By optimizing the difference between mimicking experts and repelling undesirable behaviors, they create a stable training objective that prevents the policy from drifting into low-reward or unsafe regions.
Safety is Not Unlearning
Perhaps the most provocative finding in this area comes from Pratyush Maini and Sachin Goyal in Safety Pretraining. They argue that excluding all harmful content from training data—a common practice in LLM alignment—can paradoxically make models less safe.
If a model never sees unsafe patterns during training, it fails to develop the internal mechanisms required to recognize and refuse them later. True safety, they argue, is not about "unlearning" or hiding bad data; it is about providing the model with enough exposure to unsafe patterns to define a clear, internal boundary of prohibited behavior.
Whether in autonomous driving, robotics, or language modeling, the consensus is shifting: to understand the light of expert behavior, an agent must first be shown the shadows of failure.