A referential game with population dynamics and age-dependent plasticity. Agents learn to communicate while the population undergoes generational turnover.
# Single run
python -m egg.zoo.aging.train --n_agents=4 --n_epochs=100
# Grid search
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp1_baseline.json --n_workers=2git clone https://github.com/facebookresearch/EGG.git
cd EGGconda create -n egg-aging python=3.9 -y
conda activate egg-agingChoose the command for your CUDA version (see https://pytorch.org):
# CUDA 11.8
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
# CUDA 12.1
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
# CPU only
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpugit clone https://github.com/Jano04/EGG.git aging
cp -r aging/* EGG/egg/zoo/aging/cd EGG
pip install -r egg/zoo/aging/requirements.txt
pip install -e .python -c "import egg.zoo.aging.train; print('OK')"All experiments use EGG's grid search tool. See nest documentation.
Static populations (N=2-20) without turnover.
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp1_baseline.json --n_workers=22a. Rate study (N=10, varying k):
# Create warmup checkpoint
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp2_rate/warmup.json --n_workers=1
# Run turnover conditions
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp2_rate/k1_k20.json --n_workers=2
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp2_rate/k2_k5_k10.json --n_workers=22b. Population study (k=10, varying N):
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp2_population/n2.json \
--sweep egg/zoo/aging/grids/exp2_population/n4.json \
--sweep egg/zoo/aging/grids/exp2_population/n8.json \
--sweep egg/zoo/aging/grids/exp2_population/n16.json \
--n_workers=2# Create warmup checkpoint
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp3_plasticity/warmup.json --n_workers=1
# Run conditions
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp3_plasticity/baseline.json --n_workers=2
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp3_plasticity/adults.json --n_workers=2
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--sweep egg/zoo/aging/grids/exp3_plasticity/children.json --n_workers=2
python -m egg.nest.nest_local --game egg.zoo.aging.train \
--py_sweep=egg.zoo.aging.grids.exp3_plasticity.age_based --n_workers=2python -m egg.zoo.aging.visualizations_exp1
python -m egg.zoo.aging.visualizations_exp2
python -m egg.zoo.aging.visualizations_exp3python -m egg.zoo.aging.analysis experiments/exp2_turnover --recursive| Parameter | Default | Description |
|---|---|---|
--n_agents |
2 | Population size |
--kill_epoch |
0 | Epochs between deaths (0 = no turnover) |
--warmup_threshold |
0.0 | Accuracy threshold before turnover starts |
--enable_plasticity |
False | Enable age-based plasticity |
--temp_min/max |
0.1/1.0 | Gumbel-Softmax temperature range |
--lr_min/max |
1e-4/1e-3 | Learning rate range |
--plasticity_max_age |
100 | Age when plasticity reaches minimum |
Full parameter list: python -m egg.zoo.aging.train --help