LOCAL REINFORCEMENT LEARNING LAB

Arena SARSA

A practical workbench for collecting driving demonstrations, training a transparent policy, and reviewing its progress.

Local session127.0.0.1
01 / Input and playback

Drive and play

Locally, these actions open native PyGame windows. On Render, SARSA playback runs as headless evaluation and is saved as a run; human keyboard recording remains local-only.

Human demonstration

Drive with arrow keys. Saved episodes become warm-start data for SARSA.

SARSA playback

Locally, watch PyGame playback. On Render, run a headless evaluation with reward and survival results.

No native window launched from this page.

Loading demonstration summary…

02 / Experiment setup

New SARSA training run

Tune a bounded experiment, then compare its recorded results below.

Ready

03 / Evidence

Training analytics

Start a run or choose saved evidence below.

SARSA (S)

Total reward

Survival steps

Exploration epsilon

Average TD error

Saved runs

Each browser-started run has its own history and metadata under artifacts/runs/<run-id>/. Earlier history in artifacts/ remains available too.

Loading saved runs…
04 / Improvement plan

Seven-day training plan

A complete path from baseline measurement to stress testing and publishing.

Reliability target, not guaranteed accuracy

A 100% score cannot be guaranteed in random traffic. A model can score perfectly on a small fixed test and still fail on unseen layouts. Compare collision-free rate, survival, reward, and stability across new seeds.

DAY 1Establish a baseline

Back up the current checkpoint, continue the existing model for a controlled run, and record its starting performance.

Copy-Item artifacts\checkpoints\sarsa_q_table.npy `
  artifacts\checkpoints\sarsa_q_table.day1.backup.npy
python scripts/train.py --episodes 100 --resume --seed 1000
python scripts/evaluate_model.py --episodes 20 --steps 300 --seed 1000

Record average reward, survival steps, and collision-free rate in accuracy.md.

DAY 2Collect better demonstrations

Drive 20–50 careful human episodes. Save smooth, collision-free episodes and discard poor demonstrations.

python scripts/play_human.py
python scripts/train.py --episodes 200 --resume --warm-start --seed 2000

Demonstrations are saved as JSONL in data/human_demonstrations/. Warm-start gives the table a human-guided starting bias.

DAY 3Increase state coverage

Expose the policy to different lane, speed, gap, and rear-traffic states without changing the state representation.

python scripts/train.py --episodes 300 --resume --vehicles-count 20 `
  --vehicles-density 1.2 --duration 400 --seed 3000

Use different seeds, traffic counts, densities, and longer episodes so the table sees more situations.

DAY 4Compare SARSA settings

Compare learning rates around 0.05–0.10, gamma around 0.95–0.99, and exploration ending around 0.02–0.05.

$env:ARENA_STORAGE_DIR = "D:\arena-experiment-day4"
python scripts/train.py --episodes 300 --seed 4000
python scripts/evaluate_model.py --episodes 20 --steps 300 --seed 4000
Remove-Item Env:ARENA_STORAGE_DIR

Keep the configuration with the best consistent collision-free rate and survival, not just the highest single reward.

DAY 5Reduce risky behavior

Use moderate target speeds, retain the lane-change penalty, and keep the collision penalty strong.

python scripts/train.py --episodes 300 --resume --duration 400 --seed 5000
python scripts/evaluate_model.py --episodes 30 --steps 400 --seed 5000

Do not select a model only because it drives faster. Stable survival matters more than raw speed.

DAY 6Stress test unseen conditions

Test conditions that were not used for the main training run:

  • Different random seeds
  • More vehicles and higher density
  • Different starting lanes
  • Longer episodes
  • Different target speeds

Reject models that perform well only on familiar seeds or light traffic.

DAY 7Evaluate and publish

Run a larger greedy evaluation, compare it with Day 1, and publish only a checkpoint that improves consistently.

python scripts/evaluate_model.py --episodes 100 --steps 300 --seed 7000
python scripts/publish_model.py
git add published accuracy.md
git commit -m "Publish improved SARSA baseline"
git push

Publishing is explicit. Review the evaluation before sharing the checkpoint.

Practical success criteria

  • Collision-free rate close to 100% across unseen seeds
  • Longer average survival
  • No major collapse in denser traffic
  • Stable real-time playback
  • Higher comparable reward than the baseline

Keep episode count, seed, duration, and environment settings recorded when comparing results.

05 / Reference

Project documentation

Architecture, SARSA, workflow, security, and backend notes are available here.

Loading documentation…