AgileRL HPO And Mutation
Use this sub-skill when the task is about AgileRL evolutionary hyperparameter optimization (HPO), TournamentSelection, Mutations, HyperparameterConfig, RLParameter, mutation probabilities, architecture mutation behavior, or diagnosing why a population did or did not mutate.
Read First
references/hpo-workflows.md for the standard tournament + mutation loop.
references/api-reference.md for key HPO classes and parameters.
references/troubleshooting.md for invalid mutable attributes, probability, and architecture mutation failures.
scripts/inspect_hpo_setup.py --help for a safe config-only HPO probe.
Boundaries
- Training-loop placement belongs in
../training-workflows/SKILL.md, ../multi-agent-and-wrappers/SKILL.md, ../offline-bandits-data/SKILL.md, or ../llm-fine-tuning/SKILL.md depending on the workflow.
- Architecture object construction belongs in
../evolvable-modules/SKILL.md.
- This sub-skill owns which hyperparameters are mutable, how mutation probabilities are selected, how tournament selection preserves elites, and why mutation may be a no-op.
Standard HPO Flow
- Create a population of AgileRL agents.
- Evaluate population fitness.
- Select elites and the next generation with
TournamentSelection.
- Mutate offspring with
Mutations.
- Continue training with the evolved population.
from agilerl.hpo.tournament import TournamentSelection
from agilerl.hpo.mutation import Mutations
from agilerl.algorithms.core.registry import HyperparameterConfig, RLParameter
hp_config = HyperparameterConfig(
lr=RLParameter(min=1e-4, max=1e-2),
batch_size=RLParameter(min=32, max=256),
learn_step=RLParameter(min=1, max=10, grow_factor=1.5, shrink_factor=0.75),
)
tournament = TournamentSelection(tournament_size=2, elitism=True, population_size=6, eval_loop=1)
mutations = Mutations(
no_mutation=0.4,
architecture=0.2,
new_layer_prob=0.2,
parameters=0.2,
activation=0.0,
rl_hp=0.2,
mutation_sd=0.1,
rand_seed=1,
device="cpu",
)
Decision Points
- Set
activation=0 when activation mutations are unsupported or not desired.
- Use
HyperparameterConfig fields that exactly match algorithm attributes.
- Keep
population_size, POP_SIZE, and tournament population size aligned.
- Use deterministic seeds when comparing HPO behavior.
- For LLM algorithms, do not assume architecture mutations are supported.
1---2name: hpo-and-mutation3description: "Use AgileRL evolutionary HPO, tournament selection, mutation4 probabilities, mutable hyperparameters, and population evolution safely."5disable-model-invocation: true6metadata:7 source: https://skillmd.com/skills/vectorspacelab/hpo-and-mutation8 disco-role: operating9license: Apache 2.010---1112# AgileRL HPO And Mutation1314Use this sub-skill when the task is about AgileRL evolutionary hyperparameter optimization (HPO), `TournamentSelection`, `Mutations`, `HyperparameterConfig`, `RLParameter`, mutation probabilities, architecture mutation behavior, or diagnosing why a population did or did not mutate.1516## Read First1718- `references/hpo-workflows.md` for the standard tournament + mutation loop.19- `references/api-reference.md` for key HPO classes and parameters.20- `references/troubleshooting.md` for invalid mutable attributes, probability, and architecture mutation failures.21- `scripts/inspect_hpo_setup.py --help` for a safe config-only HPO probe.2223## Boundaries2425- Training-loop placement belongs in `../training-workflows/SKILL.md`, `../multi-agent-and-wrappers/SKILL.md`, `../offline-bandits-data/SKILL.md`, or `../llm-fine-tuning/SKILL.md` depending on the workflow.26- Architecture object construction belongs in `../evolvable-modules/SKILL.md`.27- This sub-skill owns which hyperparameters are mutable, how mutation probabilities are selected, how tournament selection preserves elites, and why mutation may be a no-op.2829## Standard HPO Flow30311. Create a population of AgileRL agents.322. Evaluate population fitness.333. Select elites and the next generation with `TournamentSelection`.344. Mutate offspring with `Mutations`.355. Continue training with the evolved population.3637```python38from agilerl.hpo.tournament import TournamentSelection39from agilerl.hpo.mutation import Mutations40from agilerl.algorithms.core.registry import HyperparameterConfig, RLParameter4142hp_config = HyperparameterConfig(43 lr=RLParameter(min=1e-4, max=1e-2),44 batch_size=RLParameter(min=32, max=256),45 learn_step=RLParameter(min=1, max=10, grow_factor=1.5, shrink_factor=0.75),46)4748tournament = TournamentSelection(tournament_size=2, elitism=True, population_size=6, eval_loop=1)49mutations = Mutations(50 no_mutation=0.4,51 architecture=0.2,52 new_layer_prob=0.2,53 parameters=0.2,54 activation=0.0,55 rl_hp=0.2,56 mutation_sd=0.1,57 rand_seed=1,58 device="cpu",59)60```6162## Decision Points6364- Set `activation=0` when activation mutations are unsupported or not desired.65- Use `HyperparameterConfig` fields that exactly match algorithm attributes.66- Keep `population_size`, `POP_SIZE`, and tournament population size aligned.67- Use deterministic seeds when comparing HPO behavior.68- For LLM algorithms, do not assume architecture mutations are supported.