Skip to content

[AAAI 2026] Code for the oral paper "Out-of-Distribution Generalization with a SPARC: Racing 100 Unseen Vehicles with a Single Policy"

License

Notifications You must be signed in to change notification settings

bramgrooten/sparc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPARC

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
Accepted as an oral at AAAI 2026.

Paper: https://arxiv.org/abs/2511.09737
Video: https://youtu.be/rrcj_oovzWE

Overview of SPARC

SPARC is a single-phase adaptation method for robust control. It works especially well in out-of-distribution (OOD) environments, where the agent adapts to new contextual conditions without access to privileged context information at test time. SPARC is able to infer the context through a history of the agent's own actions and observations.

The paper presents experiments on Gran Turismo 7 and MuJoCo environments. The code for Gran Turismo 7 (which runs exclusively on PlayStation) is proprietary and not included in this repository. The MuJoCo code is open source. We include the newly created benchmarks for MuJoCo environments with wind:

  • WindHalfCheetah-v5
  • WindHopper-v5
  • WindWalker2d-v5

These are all in the environments folder. See all methods in the algorithms directory.

Installation

Run the following commands to install:

conda create -n sparc python=3.10
conda activate sparc
pip install -r requirements.txt

Training

To train SPARC on a wind-perturbed MuJoCo environment, run:

python -m train --alg sparc --env WindHalfCheetah-v5 --wandb_mode disabled

Implemented algorithms are:

  • SPARC
  • RMA (note: this baseline must be trained in 2 separate phases, see both files)
  • SAC (only observations as input)
  • History Input (no context inference, history as input)
  • Oracle (privileged context information, even at test time)

Visualize

To view the wind-perturbed environments, run:

python -m utils.visualize_envs

Inside that script, you can adjust the environment and the wind strength.

The following table shows the wind ranges that we used in our experiments:

Environment Train x Train z Test x Test z
HalfCheetah [-2.5, 2.5] [-5, 5] [-5, 5] [-10, 10]
Hopper [-10, 10] [-2.5, 2.5] [-20, 20] [-5, 5]
Walker2d [-10, 10] [-2.5, 2.5] [-20, 20] [-5, 5]

Citation

If you find our work useful, please consider citing us:

@article{grooten2025sparc,
    title={{Out-of-Distribution Generalization with a SPARC: Racing 100 Unseen Vehicles with a Single Policy}}, 
    author={Bram Grooten and Patrick MacAlpine and Kaushik Subramanian and Peter Stone and Peter R. Wurman},
    year={2025},
    journal={Proceedings of the AAAI Conference on Artificial Intelligence}
}

About

[AAAI 2026] Code for the oral paper "Out-of-Distribution Generalization with a SPARC: Racing 100 Unseen Vehicles with a Single Policy"

Topics

Resources

License

Stars

Watchers

Forks

Languages