Adding workers to a reinforcement learning job does not guarantee a faster or better result. This project measures where parallelism helps and where its overhead takes over.
The experiments train a PPO agent on LunarLander-v3 with Ray RLlib. The same workload runs locally and on an NRP Nautilus Kubernetes cluster with 1, 2, 4, 8, and 16 workers. This repository contains the training scripts, KubeRay configuration, recorded benchmarks, and analysis.
More workers helped, but the gains flattened early.
| Environment | Worker change | Training time | Result |
|---|---|---|---|
| Local machine | 1 to 4 | 10.4 to 5.0 minutes | 2.1x speedup |
| Nautilus cluster | 1 to 8 | 13.89 to 10.36 minutes | About 25% faster |
| Nautilus cluster | 8 to 16 | 10.36 to 10.37 minutes | No further speedup |
LunarLander is inexpensive to simulate, so experience collection stops being the bottleneck after a few workers. At that point, PPO's centralized update and cluster communication dominate the iteration time.
Hyperparameter tuning also behaved differently at different scales. Across three matched repeats, tuned configurations performed worse at 1 and 2 workers but better at 4, 8, and 16 workers. At 16 workers, the tuned configuration reached a mean best reward of 198.28, compared with 99.53 for the baseline. The variance in the smaller runs is high, so the reports include the full per-worker statistics rather than presenting one run as conclusive.
The detailed results are in the distributed scaling report and HPO comparison.
LunarLander environments
|
v
Ray RLlib environment workers
|
v
PPO learner on the Ray head node
|
v
JSON metrics -> analysis scripts -> reports and charts
For cluster runs, KubeRay creates one Ray head pod and up to 16 worker pods. cluster/run.sh handles deployment, copies the training code to the head pod, runs each worker configuration, and downloads the JSON results.
.
|-- src/
| |-- train.py PPO training entry point
| |-- tune_hpo.py Optuna hyperparameter search
| |-- demo.py LunarLander environment demo
| `-- analysis/ Comparison and plotting utilities
|-- cluster/
| |-- run.sh Nautilus experiment pipeline
| |-- values.yaml KubeRay resource configuration
| |-- Dockerfile Ray image with project dependencies
| `-- SETUP.md Cluster setup instructions
|-- results/
| `-- benchmarks/ Curated JSON used by the reports
|-- docs/
| |-- experiments/ Baseline, scaling, and HPO reports
| `-- assets/ Report figures
`-- requirements.txt
Generated runs belong in results/runs/. That directory is ignored by Git so a local experiment does not add hundreds of output files to the repository.
Python 3.12 is recommended.
python -m venv venvActivate the environment:
# Windows
.\venv\Scripts\activate
# macOS or Linux
source venv/bin/activateInstall the dependencies:
pip install -r requirements.txtThe --name value groups output files from the same experiment.
python src/train.py --workers 1 --name local-baseline
python src/train.py --workers 4 --name local-baselineResults are written to results/runs/<name>/.
To inspect the LunarLander environment without training:
python src/demo.pyNautilus runs require cluster access, kubectl, Helm, and the OIDC login plugin. Follow the cluster setup guide before using the runner.
./cluster/run.shAvailable flags:
./cluster/run.sh --skip-deploy # reuse an existing Ray cluster
./cluster/run.sh --tune # run Optuna HPO
./cluster/run.sh --compare # compare baseline and tuned parameters
./cluster/run.sh --cleanup # remove the Ray clusterThe comparison script reads both curated benchmarks and new local runs:
python src/analysis/compare_results.pyPlot one or more result files:
python src/analysis/plot_reward_curve.py results/benchmarks/scaling/workers-04.jsonThe repository keeps representative benchmark data rather than every intermediate run. Older experiments remain available in Git history.

