Can In-Context Reinforcement Learning Recover From Reward Poisoning Attacks?

Paulius Sasnauskas, Yiğit Yalın, Goran RadanovicOpenReview 2026 · Submission to ICLR 2026 · Rejected

TL;DR

This paper introduces AT-DPT (Adversarially Trained Decision-Pretrained Transformer), a framework that makes in-context reinforcement learning agents robust against reward poisoning. By training the agent alongside a learned attacker, the model develops the ability to "see through" corrupted rewards at test time, significantly outperforming traditional robust bandit and RL algorithms in adversarial environments.

What Problem Does This Paper Address?

In-context Reinforcement Learning (ICRL) allows agents to adapt to new tasks simply by observing a "context" of recent interactions (states, actions, and rewards) without updating their neural network weights. While powerful, this reliance on context creates a massive security vulnerability: test-time reward poisoning.

Traditional RL research focuses on training-time attacks, where an adversary corrupts the data used to build a static policy. However, for an ICRL agent, the "learning" happens during deployment. If an attacker can subtly manipulate the rewards the agent perceives in its current session, they can trick the agent into adopting a sub-optimal policy. The authors set out to answer: Can we train a transformer-based agent to ignore these "lies" in its context and still find the optimal path?

Methods

The authors build upon the Decision-Pretrained Transformer (DPT). Their core contribution is a novel adversarial training protocol:

  1. The Adversarial Game: They frame training as a two-player game. An attacker ($\phi$) is trained to minimize the agent's true environment reward by perturbing the observed rewards within a specific "budget." Simultaneously, the agent ($\theta$) is trained to predict the true optimal action despite the poisoned history in its context.
  2. Simultaneous Optimization:
    • The attacker is updated using the REINFORCE algorithm to get better at tricking the agent.
  3. The agent is updated via Supervised Learning to match the actions of an "oracle" (an expert that knows the true, unpoisoned environment).
  4. Adaptive vs. Non-Adaptive: They test the agent against both simple attackers (fixed reward offsets) and adaptive attackers (transformers that change their poisoning strategy based on the agent's past behavior).

Datasets and Environments

The researchers evaluated their method across several increasingly complex settings:

  • Multi-armed Bandits (MAB): A 5-armed bandit where rewards follow a normal distribution.
  • Linear Bandits: A more complex bandit setting where rewards are a linear function of arm features ($d=2$, 10 arms).
  • Darkroom2: A 2D gridworld MDP with two goals. One goal provides a reward of 1, the other a reward of 2. The agent must identify and reach the +2 goal even if the attacker makes the +1 goal look more attractive.
  • Miniworld: A 3D visual navigation environment where the agent must find a specific colored box based on 25x25 pixel image observations.

Key Insights and Ideas

  • Context as Training Data: The fundamental insight is that for ICRL agents, the context is the training set. Therefore, test-time poisoning is effectively a real-time data poisoning attack on the agent's internal "learning algorithm."
  • Robustness via Exposure: By seeing thousands of poisoned trajectories during pre-training, the Transformer learns to identify patterns of corruption. For example, in the Darkroom2 environment, an attacker might boost a reward to a value (like "3") that the agent never saw during clean pre-training. AT-DPT learns to recognize these out-of-distribution rewards as "fake" and ignores them.
  • Generalization to Unseen Attacks: Remarkably, an AT-DPT agent trained against its own attacker generalizes well to attacks designed to fool other algorithms (like Thompson Sampling). This suggests the agent learns a general principle of "reward skepticism" rather than just memorizing one specific adversary.
  • The Robustness Trade-off: There is a slight "robustness tax." AT-DPT performs slightly worse than a standard DPT in perfectly clean environments, but the gap is small compared to the massive performance gain under attack.

Key Results

  • Bandit Dominance: In the 5-armed bandit setting with 40% of steps poisoned ($\epsilon=0.4$), AT-DPT achieved a cumulative regret of 24.2, while standard robust baselines like crUCB and RTS lagged behind with regrets of 82.5 and 92.5, respectively.
  • MDP Success: In the Darkroom2 environment, the standard DPT's performance collapsed under attack (reward dropped from ~306 to ~143). AT-DPT maintained a high reward of ~242, nearly matching the performance of specialized RL algorithms like Natural Policy Gradient (NPG).
  • Visual Robustness: The method successfully scaled to the 3D Miniworld environment, proving that the adversarial training benefits carry over to high-dimensional, vision-based tasks.

Limitations and Future Work

  • Oracle Requirement: Like the original DPT, this method requires an "oracle" to provide optimal actions during training. In many real-world scenarios, such an oracle might not exist.
  • Clean Training Assumptions: The current protocol assumes the agent has access to clean environments during the adversarial training phase to calculate the "true" reward.
  • Single Attack Specification: The authors only trained against one attack budget at a time. They suggest that mixing different contamination levels ($\epsilon$) and attack types (adaptive vs. non-adaptive) during training could lead to even more "bulletproof" agents.

Summary updated

BibTeX
@misc{sasnauskas2026can,
  author = {Paulius Sasnauskas and Yiğit Yalın and Goran Radanovic},
  title = {{Can In-Context Reinforcement Learning Recover From Reward Poisoning Attacks?}},
  year = {2026},
  url = {https://openreview.net/forum?id=MtsmJZXIu5},
  howpublished = {OpenReview},
  note = {Submitted to ICLR 2026},
}
Figure