Pursuit IPPO Experiment Helper¶
src/experiments/pursuit_experiment.py retains
run_pursuit_ippo_experiment(...) as the single-algorithm IPPO entrypoint. The
four active Pursuit notebooks use run_pursuit_experiments(...) so they can
select any of the 15 supported variants; see
Pursuit Multi-Algorithm Notebooks for that suite
contract.
Shared notebook helper¶
Direct callers pass an explicit resolved config:
The helper is responsible for:
- constructing the wrapped
PursuitEvasionenvironment, - validating notebook config keys and applying CLI overrides that Marimo parsed,
- mapping those knobs onto an IPPO config,
- running all seeds,
- collecting wrapper histories for plotting,
- writing one checkpoint bundle per run,
- writing
runs.npy,nash.npy,nash_report.json, and related result artifacts as soon as the algorithm finishes, - returning
runs,nash_runs,nash_summary, and save metadata for notebook cells.
The suite notebooks themselves:
- define the experiment spec,
- define the full user-facing config in one place,
- show the resolved runtime config in the notebook output,
- render the NashConv summary,
- plot EWMA success,
- display the artifact paths returned by the helper.
IPPO config mapping¶
The direct helper accepts shared orchestration and flat IPPO knobs, including:
num_env_stepsnum_runsprogress_chunkscalculate_convcalculate_alpharankcalculate_satisfactioncalculate_conv_quickeval_episodesbr_train_itersbr_batch_stepssatisfaction_eval_episodessatisfaction_deltanashconv_deltanashconv_auto_resumenashconv_auto_resume_thresholdnashconv_auto_resume_step_fractionresume_partial_runssave_dirnum_envsnum_stepsnum_minibatchesupdate_epochslranneal_lrmax_grad_normactivationgammagae_lambdaclip_epsvf_coefent_coef
The helper resolves IPPO training config separately:
num_steps=min(256, target_chunk_size)when the notebook leavesnum_steps=None,total_timestepsis rounded up to a whole number of PPO updates,num_minibatchesis reduced automatically if the requested value does not divide the batch size.
progress_chunks controls how often the notebook progress bar redraws, not
the PPO rollout length itself. The trainer still emits metrics every update, but
the shared experiment helper only forwards progress to tqdm at milestone
boundaries. This keeps notebook memory use bounded while avoiding output spam.
Checkpoint bundle format¶
Each run writes a pickle bundle under the experiment checkpoints/ directory.
Bundle fields:
agent_idsrun_seedconfigtrain_states
train_states is serialized with flax.serialization.to_state_dict(...), so the bundle
is stable to pickle without storing live TrainState objects directly.
IPPO NashConv path¶
Notebook verification runs directly from saved IPPO train states.
approximate_nashconv_bernoulli_ippo(...):
- evaluates the baseline policy profile directly from saved IPPO train states,
- trains one best response at a time by warm-starting IPPO from the snapshot,
- freezes non-target agents with
trainable_agent_ids={target_agent}, - reuses the existing NashConv payload shape so
save_nashconv_report(...)stays unchanged.
BR defaults intentionally use:
NUM_ENVS=1NUM_MINIBATCHES=1TOTAL_TIMESTEPS = br_train_iters * br_batch_stepsNUM_STEPS = br_batch_steps
That keeps BR training easy to reason about and matches the notebook-facing
br_train_iters / br_batch_steps controls.