Out-of-Distribution Generalization with a SPARC: Racing 100 Unseen Vehicles with a Single Policy

Bram Grooten, Patrick MacAlpine, Kaushik Subramanian, Peter Stone, Peter R. Wurman

TL;DR

The paper introduces SPARC (Single-Phase Adaptation for Robust Control), a reinforcement learning framework that unifies context encoding and history-based adaptation into a single training loop. By eliminating the multi-stage training pipeline typical of modern adaptive controllers, SPARC achieves state-of-the-art out-of-distribution generalization, enabling a single policy to successfully race 100 entirely unseen vehicle models in Gran Turismo 7.

What Problem Does This Paper Address?

Deep reinforcement learning (RL) excels in static environments but frequently fails when deployed in the real world, where environmental dynamics—like friction, wind, or vehicle mass—change unpredictably. To tackle this, researchers use contextual RL, where an agent learns to adapt to varying environmental factors.

A leading framework for this is Rapid Motor Adaptation (RMA). RMA operates in two distinct phases: first, it trains an "expert" policy using privileged simulation data (like exact friction coefficients); second, it freezes the expert and trains a "history adapter" via supervised learning to guess those latent factors from a short history of recent states and actions.

While effective, this two-phase approach is cumbersome. It requires researchers to meticulously select the best intermediate expert checkpoint, complicates distributed cloud training, and completely prevents on-device continual learning. The authors of this paper ask a compelling question: Can we collapse this entire pipeline into a single, streamlined training phase without sacrificing performance?

Methods

The authors introduce SPARC (Single-Phase Adaptation for Robust Control), which trains the expert policy ($\pi^{ex}$) and the adapter policy ($\pi^{ad}$) simultaneously.

Overview of the SPARC architecture and its deployment setting in Gran Turismo 7.

Here is how the single-phase training loop operates:

  1. The Expert Policy ($\pi^{ex}$) receives the current observation ($o$) and privileged context ($c$) to generate an action. It is optimized using Quantile Regression Soft Actor-Critic (QR-SAC).
  2. The Adapter Policy ($\pi^{ad}$) receives the same observation ($o$) but replaces the privileged context with a latent representation ($\hat{z}$) generated by a History Adapter ($\phi$) from a sequence of recent observation-action pairs ($h$).
  3. Simultaneous Optimization: The history adapter is trained via supervised regression to match the output of the expert's context encoder ($z$). Crucially, because both networks learn at the same time, the target $z$ is a moving target.

Another critical design choice in SPARC is the rollout policy. Instead of using the expert policy to collect training data, SPARC uses the adapter policy to interact with the environment. This ensures that the data distribution matches what the agent will actually experience during deployment.

Datasets and Benchmarks

The authors evaluated SPARC across two highly demanding domains:

  1. Gran Turismo 7 (GT7): A high-fidelity racing simulator.
  2. Car Models Setting: The authors used an isolation forest algorithm to sort ~500 cars by their physical features (mass, drivetrain, power, etc.). The agent trained on the 80% most "normal" cars (In-Distribution, or IND) and was tested on the 20% most extreme outliers (Out-of-Distribution, or OOD), such as lightweight racing karts and massive pickup trucks.
  3. Power & Mass Setting: A controlled experiment where a single car's engine power and mass were randomized during training and pushed to extreme limits during testing.
  4. MuJoCo Continuous Control: Standard benchmarks (HalfCheetah, Hopper, Walker2d) modified to include multi-dimensional wind perturbations acting as the dynamic context.

Key Insights and Ideas

  • The "Moving Target" is Stable: Intuitively, training an adapter to regress to a context encoder that is itself constantly changing sounds unstable. However, SPARC proves that joint optimization converges reliably and avoids the brittle checkpoint-selection process required by RMA.
  • Adapter Rollouts Prevent Compounding Errors: Forcing the adapter policy to collect its own experience acts like an on-policy correction mechanism. It trains the history adapter to be robust to its own past mistakes.
  • History Beats the Oracle: In some OOD settings, SPARC actually outperformed an "Oracle" policy that had direct access to the true context parameters. This is because a history of states and actions helps mitigate partial observability—providing the agent with a richer understanding of the system's immediate physical state than raw context parameters alone.

Key Results

SPARC demonstrated exceptional robustness across both simulation environments:

  • Unseen Car Generalization: On the grueling Grand Valley track in GT7, SPARC achieved the highest completion rate (98.06%) and the fastest lap times among all methods that lacked access to privileged context at test time.
OOD performance comparison on Grand Valley, showing SPARC achieving the best trade-off between lap time and completion rate.
  • Resilience to Physics Patches: Mid-way through the study, the developers of Gran Turismo 7 released an official game update that altered the simulator's underlying vehicle-dynamics model. Tested zero-shot on this new physics engine, SPARC maintained a 97.09% completion rate on OOD vehicles, while alternative methods saw their performance degrade drastically.
  • MuJoCo Wind Perturbations: SPARC consistently outperformed RMA across a wide grid of OOD wind speeds, securing higher average rewards and fewer falls in the HalfCheetah and Walker2d environments.

Limitations and Future Work

While SPARC simplifies the training pipeline and improves OOD generalization, the authors note a few areas for improvement:

  • Physical Deployment: The algorithm has currently only been validated in high-fidelity simulations (GT7 and MuJoCo). Testing SPARC on physical robotic platforms is a necessary next step to prove its real-world utility.
  • Training Efficiency: Although SPARC eliminates a training phase, optimizing two complex policies simultaneously still demands significant computational resources. Further work is needed to optimize its sample efficiency.

Summary updated

BibTeX
@inproceedings{grooten2026out,
  author = {Bram Grooten and Patrick MacAlpine and Kaushik Subramanian and Peter Stone and Peter R. Wurman},
  title = {{Out-of-Distribution Generalization with a SPARC: Racing 100 Unseen Vehicles with a Single Policy}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  doi = {10.1609/aaai.v40i26.39281},
}
Figure