Evolution Dynamics and Troubleshooting

Evolution Dynamics and Troubleshooting

Back to Home

Overview {#overview}

This document explains the dynamics of digital evolution in ByteBiota and provides troubleshooting guidance for common evolution stagnation problems.

Evolution Success Case Study {#success-case}

Problem: Population Stagnation

  • Initial growth to 648 organisms
  • Sudden crash to 5-25 organisms
  • Zero birth rate after crash
  • No genetic evolution

Root Causes Identified

  1. Energy Economy Imbalance: Memory rent drained energy faster than harvest replenished
  2. No Selection Pressure: Reaper disabled, no natural selection
  3. Mutation Catastrophe: 14% insertion/deletion rate created mostly broken offspring
  4. Resource Starvation: Organisms couldn't sustain reproduction

Solution Applied

  • Reduced MEMORY_RENT_PER_BYTE from 0.001 to 0.0001
  • Increased ENV_HARVEST_YIELD from 30 to 50
  • Enabled reaper with REAP_CHANCE=0.01
  • Reduced INSERTION_DELETION_RATE from 0.14 to 0.001
  • Lowered threshold multipliers for age/error-based death

Results Achieved

  • Population stable at 24 organisms
  • 2.48M steps completed continuously
  • 24 unique genomes (100% diversity)
  • 8,934 total mutations with viable offspring
  • Memory occupancy only 1.38%

Energy Economy Principles {#energy-economy}

The Energy Death Spiral

When organisms consume energy faster than they can harvest it, the population enters a death spiral:
1. Organisms exhaust energy reserves
2. Cannot execute harvest instructions
3. Cannot reproduce
4. Population crashes
5. No evolution occurs

Sustainable Energy Balance

Organisms need positive energy balance:
- Energy In: Harvest operations, task rewards
- Energy Out: CPU costs, memory rent, reproduction
- Net Result: Must be positive for survival

Configuration Guidelines

  • Memory rent should be < 10% of harvest yield
  • Initial energy should allow 20+ harvest cycles
  • CPU costs should be minimal compared to harvest gains

Natural Selection Requirements {#natural-selection}

Why Selection is Essential

Without death, there's no selection pressure:
- Bad mutations accumulate
- No evolution of better strategies
- Population stagnates genetically
- No adaptation to environment

Reaper Configuration

  • Growth Phase: REAP_CHANCE=0.0 for initial population growth
  • Selection Phase: REAP_CHANCE=0.01 for natural selection
  • Thresholds: Age and error multipliers create selective pressure

Selection Mechanisms

  1. Age-based: Old organisms die (prevents immortal stagnation)
  2. Error-based: High-error organisms die (selects for robustness)
  3. Random: Stochastic death (maintains genetic diversity)
  4. Energy-based: Starved organisms die (selects for efficiency)

Mutation Rate Balance {#mutation-balance}

The Mutation Catastrophe

High mutation rates (>5%) create mostly non-viable offspring:
- Most mutations break functionality
- Population cannot maintain viable lineages
- Evolution stalls due to lack of working organisms

Optimal Mutation Rates

Based on Tierra research:
- Copy-time mutations: 0.5% (reasonable for gradual evolution)
- Structural mutations: 0.1% (prevents catastrophic breaks)
- Background mutations: Minimal (reduces noise)

Mutation Types

  1. Copy-time: Bit flips during replication (gradual changes)
  2. Structural: Insertions/deletions (major changes)
  3. Background: Random memory corruption (environmental pressure)

Diagnostic Metrics {#diagnostics}

Healthy Evolution Indicators

  • Population: 20-500 organisms (stable range)
  • Birth/death rate: Balanced turnover
  • Genetic diversity: >50% unique genomes
  • Mutation rate: 0.1-1.0% (viable range)
  • Memory usage: <10% occupancy
  • Energy levels: Non-zero average energy

Stagnation Warning Signs

  • Population crashes >50% in single cycle
  • Birth rate near zero
  • All organisms at zero energy
  • Genetic diversity = 100% (no evolution)
  • High mutation rates with low viability

Monitoring Commands

# Check simulation status
curl http://localhost:8080/api/simulation/status

# Get detailed metrics
curl http://localhost:8080/api/simulation/metrics

# Monitor population trends
curl http://localhost:8080/api/simulation/metrics | jq '.series.population[-10:]'

Troubleshooting Guide {#troubleshooting}

Problem: Population Crashes

Symptoms: Sudden drop from peak to <50 organisms
Causes: Energy starvation, mutation catastrophe
Solutions:
1. Reduce MEMORY_RENT_PER_BYTE to 0.0001
2. Increase ENV_HARVEST_YIELD to 50+
3. Reduce INSERTION_DELETION_RATE to 0.001

Problem: No Births

Symptoms: Zero or very low birth rate
Causes: Energy starvation, reproduction costs too high
Solutions:
1. Check energy balance (harvest vs. costs)
2. Reduce CHILD_ENERGY_REQUIREMENT
3. Increase ENV_HARVEST_YIELD

Problem: No Evolution

Symptoms: Genetic diversity = 100%, no new lineages
Causes: No selection pressure, mutation rates too low
Solutions:
1. Enable reaper with REAP_CHANCE=0.01
2. Lower AGE_THRESHOLD_MULTIPLIER to 3.0
3. Increase COPY_BIT_FLIP_RATE to 0.005

Problem: High Mutation Rates

Symptoms: >5% mutation rate, low viability
Causes: Mutation rates too high
Solutions:
1. Reduce INSERTION_DELETION_RATE to 0.001
2. Increase BACKGROUND_FLIP_INTERVAL to 1000000
3. Keep COPY_BIT_FLIP_RATE at 0.005

Evolution Phases {#evolution-phases}

Phase 1: Population Growth (0-2 minutes)

  • Population grows from 5 to 100-500 organisms
  • Birth rate high, death rate low
  • Energy economy establishes

Phase 2: Selection Pressure (2-5 minutes)

  • Birth/death rates balance
  • Genetic diversity emerges
  • Natural selection begins

Phase 3: Stable Evolution (5+ minutes)

  • Continuous turnover
  • Multiple lineages
  • Adaptive mutations spread

Best Practices {#best-practices}

Configuration Strategy

  1. Start Conservative: Begin with low mutation rates
  2. Enable Selection: Always have some reaper pressure
  3. Monitor Energy: Ensure positive energy balance
  4. Gradual Tuning: Adjust parameters incrementally

Monitoring Strategy

  1. Track Population: Watch for crashes or stagnation
  2. Monitor Diversity: Ensure genetic evolution
  3. Check Energy: Verify sustainable energy economy
  4. Log Metrics: Record successful configurations

Testing Strategy

  1. Run 10+ Minutes: Evolution takes time to establish
  2. Multiple Runs: Test configuration stability
  3. Document Results: Record what works
  4. Iterate: Refine based on observations