Parent Selection Strategies
Parent Selection Strategies
Parent selection is how HyperAgents balances exploration (trying new directions) with exploitation (refining what works). The choice of selection method significantly affects evolution dynamics.
Available Methods
random — Maximum Exploration
P(parent_i) = 1 / N for all valid parents
- Every valid parent has equal probability
- Maximum diversity in the search
- Good for early exploration when you don't know what works
- Risk: wastes compute on low-fitness branches
latest — Linear Chain
Always select the most recent valid generation
- Creates a simple chain: each generation builds on the last
- No branching, no backtracking
- Good for incremental refinement of a known approach
- Risk: can't escape local optima
best — Maximum Exploitation
Always select the highest-fitness generation
- Aggressively refines the best-known solution
- Fast convergence when near a good solution
- Risk: premature convergence, no exploration of alternatives
score_prop — Balanced (Recommended)
P(parent_i) = fitness_i / sum(all_fitness)
- Higher-scoring parents are more likely to be selected
- But any valid parent has a chance proportional to its score
- Natural balance of exploitation and exploration
- This is the default in HyperAgents
score_child_prop — Novelty-Aware
P(parent_i) = (fitness_i / (1 + children_i)) / Z
Where Z is the normalizing constant and children_i is the number of offspring already created from parent i.
- Favors high-fitness parents that haven't been explored much
- Encourages branching — explores different evolutionary paths
- Best for open-ended search where diversity matters
Selection Algorithm
def select_parent(archive, output_dir, domains, method):
# 1. Get candidates (valid parents only)
candidates = {}
for genid in archive:
if not is_valid_parent(output_dir, genid):
continue
# Average fitness across all domains
scores = [get_score(domain, output_dir, genid) for domain in domains]
if all(s is not None for s in scores):
candidates[genid] = mean(scores)
# 2. Apply selection method
if method == "random":
return random.choice(list(candidates.keys()))
elif method == "latest":
return max(candidates.keys())
elif method == "best":
return max(candidates, key=candidates.get)
elif method == "score_prop":
weights = list(candidates.values())
return random.choices(list(candidates.keys()), weights=weights, k=1)[0]
elif method == "score_child_prop":
child_counts = count_children(archive, output_dir)
weights = [
score / (1 + child_counts.get(gid, 0))
for gid, score in candidates.items()
]
return random.choices(list(candidates.keys()), weights=weights, k=1)[0]
Validity Check
A generation is a valid parent if:
valid_parent: truein its metadata- It has non-null fitness scores for all active domains
- It was not marked as failed by the meta-agent
When to Use Each Method
| Scenario | Recommended Method |
|---|---|
| Starting evolution, unknown domain | random |
| Refining a known-good approach | best |
| General purpose, most cases | score_prop |
| Open-ended exploration, diversity matters | score_child_prop |
| Ablation study, control condition | latest |
| Many generations complete, seeking novelty | score_child_prop |
Examples
These scenarios illustrate when this skill activates and what it does.
Scenario 1: Evolve loop needs a parent for the next generation
Trigger: The evolve command reaches the "Select Parent" phase of the generate loop and calls /hyperagents:select-parent --method score_prop.
Action: The skill loads archive.jsonl, filters to valid parents, computes fitness-weighted probabilities, and returns the selected parent genid. For example, with 4 valid parents scoring [0.60, 0.75, 0.82, 0.91], parent gen_4 (0.91) has a ~30% chance of selection while gen_1 (0.60) has a ~19% chance.
Scenario 2: User asks about exploration vs exploitation tradeoffs
Trigger: User asks "My evolution seems stuck, all offspring come from the same parent. How do I increase diversity?"
Action: The skill diagnoses the issue as over-exploitation and recommends switching from best to score_child_prop, which down-weights parents that already have many children. It explains the formula and shows how the adjusted probabilities would look for the current archive.
Scenario 3: Dry-run to inspect selection probabilities
Trigger: User runs /hyperagents:select-parent --method score_child_prop --dry-run.
Action: The skill computes and displays a table of all valid parents with their fitness scores, child counts, adjusted weights, and selection probabilities -- without actually selecting a parent. This lets the user verify the selection dynamics before committing to a strategy.
Diagnostics
Signs of poor parent selection:
- All offspring from one parent: Switch to
score_child_prop - No improvement for 5+ generations: Switch to
randomtemporarily - Fitness oscillating: Switch to
bestto stabilize - Archive diversity too low: Switch to
randomorscore_child_prop
More from zpankz/hyperagents
staged evaluation
Two-phase evaluation strategy from HyperAgents — run a quick staged check on small samples first, only proceed to full evaluation if the staged eval passes. Saves 90%+ compute on broken mutations. Triggers when evaluating generations, running benchmarks, or optimizing evaluation cost.
1fitness evaluation framework
Domain-agnostic fitness evaluation for evolved code generations. Defines evaluation harness interfaces, scoring contracts, and multi-domain aggregation. Triggers when evaluating code quality, running benchmarks, or scoring agent outputs.
1domain evaluation harness
Create and configure domain-specific evaluation harnesses for the HyperAgents evolution loop. Defines how tasks are loaded, agents are invoked, predictions are collected, and scores are computed. Triggers when setting up evaluation domains or creating custom fitness functions.
1self-referential self-improvement
Apply HyperAgents' self-referential improvement pattern to any code artifact. Triggers when Claude is asked to 'improve', 'optimize', 'evolve', or 'self-improve' code, agents, skills, or prompts. Also triggers on repeated failures as an automatic recovery strategy.
1evolutionary archive management
Manage the HyperAgents evolutionary archive — an append-only log of all code generations with fitness scores, lineage tracking, and diff storage. Triggers when working with .hyperagents/ directory, archive.jsonl files, or generation metadata.
1