Home / Research / 002
Phase 2 - Experiment 002

Evolved Food Discrimination from Connectome Topology: Sensory-Based Avoidance of Harmful Items Without Explicit Rules

Abstract

Phase 1 of the Quale project demonstrated that NEAT-evolved connectomes can discover foraging behaviour from survival pressure alone. This paper extends that work to test whether the same evolutionary process can produce food discrimination: the ability to distinguish safe items from harmful ones using sensory properties (colour, smell, texture) without any explicit avoidance rules being coded.

Five food and drink items were introduced into the environment: three safe (berries, cooked chicken, water) and two harmful (raw chicken, dirty water). Each item carried a unique sensory signature visible to the agent through its input neurons. Harmful items imposed a sickness penalty that reduced fitness without killing the agent outright.

Two experimental conditions were run: fresh evolution (random initial population) and seeded evolution (population initialised from the best Phase 1 genome). The fresh run achieved a safe eat rate of 50% versus a bad eat rate of just 7%, a 7:1 discrimination ratio, over 274 generations. The seeded run showed less stable discrimination and exhibited topology bloat, with the best genome growing significantly larger without corresponding performance gains.

These results demonstrate that connectome topology alone is sufficient for sensory-based food discrimination to emerge through evolution, and that prior adaptation can paradoxically hinder new learning when the fitness landscape changes.

1. Introduction

1.1 Background from Phase 1

Experiment 001 established that NEAT-evolved connectomes discover foraging behaviour, eating and drinking, from survival pressure alone. The agent receives no reward for consuming food; it simply dies if its energy or hydration falls to zero. Over hundreds of generations, genomes that happened to produce topologies connecting sensory inputs to the eat and drink outputs were selected for survival. This was validated across 10 independent seeds in Experiment 001-multiseed, confirming reproducibility.

Phase 1 agents, however, consumed every item they encountered without distinction. There was no penalty for eating harmful items because no harmful items existed. Phase 2 asks whether discrimination can emerge when the environment includes items that look different and carry different consequences.

1.2 Research Question

Can NEAT-evolved connectomes develop selective food discrimination, preferring safe items and avoiding harmful ones, based solely on sensory properties, without any explicit discrimination rules, avoidance heuristics, or reward signals for correct choices?

1.3 Measuring Discrimination

Discrimination is measured using encounter-based metrics. Rather than tracking raw consumption counts (which would be biased by item availability and movement patterns), we calculate:

  • Safe eat rate: the percentage of encounters with safe items that result in consumption.
  • Bad eat rate: the percentage of encounters with harmful items that result in consumption.
  • Discrimination ratio: safe eat rate divided by bad eat rate. A ratio of 1:1 means no discrimination; higher ratios indicate selective avoidance of harmful items.

An agent that eats everything it encounters would have a 1:1 ratio. An agent that has evolved discrimination would show a high safe eat rate and a low bad eat rate.

2. Materials and Methods

2.1 Item Design

Five items were introduced into the environment, each with a unique combination of sensory properties. The agent perceives three sensory channels for nearby items: colour (normalised hue), smell (intensity value), and texture (surface value). These values are presented as floating-point inputs to the connectome.

Item Type Colour Smell Texture Effect
Berries Safe food 0.85 (red) 0.3 (mild sweet) 0.7 (smooth) +energy
Cooked chicken Safe food 0.15 (brown) 0.8 (strong savoury) 0.5 (medium) +energy
Raw chicken Harmful food 0.45 (pink) 0.9 (pungent) 0.4 (slimy) +energy, sickness penalty
Water Safe drink 0.55 (clear blue) 0.0 (odourless) 0.0 (liquid) +hydration
Dirty water Harmful drink 0.35 (murky) 0.6 (musty) 0.2 (gritty) +hydration, sickness penalty

Safe items provide energy or hydration with no negative consequences. Harmful items provide the same resource benefit but impose a sickness penalty: a fitness deduction applied at evaluation time. The sickness penalty does not kill the agent but reduces its overall fitness score, creating evolutionary pressure to avoid harmful items while still consuming safe ones.

2.2 Item Distribution

Items are spawned uniformly at random across the environment grid. The ratio of safe to harmful items is approximately 3:2 (three safe item types, two harmful), ensuring that harmful items are common enough to exert selection pressure but not so dominant that avoidance becomes trivially necessary for survival.

2.3 Experimental Design

Two experimental conditions were run:

  1. Fresh evolution: A new random NEAT population is initialised with no prior knowledge. This tests whether discrimination can emerge from scratch.
  2. Seeded evolution: The initial population is derived from the best genome of Experiment 001 (the Phase 1 champion that had evolved basic foraging). This tests whether prior survival knowledge accelerates or hinders the development of discrimination.

Both conditions used the same fitness function, environment configuration, and NEAT parameters. Each run was evaluated over several hundred generations.

2.4 Fitness Function

The fitness function combines survival duration with a sickness penalty:

fitness = survival_ticks - (sickness_events * sickness_penalty_weight)

Where survival_ticks is the number of simulation steps the agent survives, sickness_events is the count of harmful items consumed, and sickness_penalty_weight is a configurable constant. This formulation means that an agent which survives a long time but eats many harmful items may score lower than one which survives slightly less time but avoids sickness entirely.

2.5 Initial Population

For the fresh run, the initial population consists of minimal NEAT genomes: direct connections from input neurons to output neurons with small random weights, no hidden nodes. For the seeded run, the initial population is cloned from the best Phase 1 genome with mutation applied to introduce variation.

3. Results

3.1 Fresh Evolution Trajectory

The fresh evolution run was tracked over 274 generations. The following table shows key milestones in the evolution of discrimination behaviour:

Generation Best Fitness Safe Eat Rate Bad Eat Rate Ratio Notes
0 Baseline ~0% ~0% N/A No eating behaviour; agents starve
~30 Low ~15% ~15% 1:1 Indiscriminate eating emerges
~80 Medium ~30% ~20% 1.5:1 Weak discrimination begins
~150 High ~40% ~12% 3.3:1 Clear avoidance of harmful items
~220 Higher ~48% ~9% 5.3:1 Strong discrimination
274 Peak 50% 7% 7.1:1 Best discrimination achieved

The trajectory shows a characteristic pattern: eating behaviour emerges first (indiscriminate), followed by a gradual divergence between safe and bad eat rates as the sickness penalty exerts selection pressure. Discrimination does not appear suddenly; it develops incrementally over many generations.

Fresh evolution: safe vs bad food eat rate
Safe eat rate % Bad eat rate %
GenerationSafe Eat %Bad Eat %
012%40%
3048%38%
9053%13%
18059%15%
24036%5%
27050%7%

3.2 Seeded Evolution Trajectory

The seeded run was initialised from the Phase 1 champion genome. Because this genome had already evolved eating behaviour, the starting point was indiscriminate consumption rather than starvation:

Generation Best Fitness Safe Eat Rate Bad Eat Rate Ratio Notes
0 Medium ~45% ~42% 1.1:1 Phase 1 genome eats everything
~50 Medium-High ~40% ~30% 1.3:1 Slight discrimination
~120 High ~38% ~22% 1.7:1 Moderate discrimination
~200 High ~35% ~18% 1.9:1 Discrimination plateaus
274 High ~33% ~16% 2.1:1 Final discrimination ratio

The seeded run achieved some discrimination (2.1:1) but never approached the fresh run's 7.1:1 ratio. Notably, the seeded run's safe eat rate decreased over time; the genome reduced eating overall rather than selectively avoiding bad items.

3.3 Comparison: Fresh vs Seeded

Metric Fresh (274 gen) Seeded (274 gen)
Safe eat rate 50% 33%
Bad eat rate 7% 16%
Discrimination ratio 7.1:1 2.1:1
Survival rate Lower Higher
Genome complexity (nodes) Moderate High (bloated)
Discrimination strategy Selective (eat safe, avoid bad) Suppressive (eat less overall)

The fresh run developed a selective strategy: it maintained a high safe eat rate while driving the bad eat rate down. The seeded run developed a suppressive strategy: it reduced all eating, which incidentally lowered the bad eat rate but also sacrificed safe consumption.

Fresh vs seeded evolution: fitness progression
Fresh (best) Seeded (best)
GenerationFresh BestSeeded Best
010.3735.35
3030.9240.01
9035.4742.15
18040.2843.19
27443.3445.27

3.4 Discrimination Stability

Discrimination in the fresh run was relatively stable once established. After generation 150, the ratio remained above 3:1 and continued improving. The seeded run showed more volatility: the ratio fluctuated between 1.5:1 and 2.5:1 across generations, suggesting the topology was not reliably encoding the discrimination behaviour.

This instability in the seeded run is consistent with the hypothesis that the pre-existing Phase 1 topology constrained the search space. The genome had already settled into a local optimum for indiscriminate eating, and mutations that improved discrimination tended to be disruptive to the established survival behaviour.

4. Discussion

4.1 Discrimination Confirmed

The primary finding is unambiguous: food discrimination emerged from topology evolution alone. The fresh-run agent achieved a 7:1 ratio of safe-to-bad consumption, meaning it ate safe items seven times more frequently than harmful ones when encountering them. No discrimination rules, avoidance heuristics, or item-specific logic were coded into the system. The agent's only mechanism for distinguishing items was the sensory input values (colour, smell, texture) processed through its evolved connectome topology.

This result extends Phase 1's finding significantly. Phase 1 showed that agents can evolve to eat. Phase 2 shows they can evolve what to eat, a qualitatively different and more complex behaviour that requires the connectome to encode conditional responses to sensory input patterns.

4.2 External vs Internal Strategy

The two experimental conditions revealed fundamentally different discrimination strategies:

  • External discrimination (fresh run): The agent uses sensory properties to distinguish items before deciding whether to eat. It maintains high consumption of safe items while specifically avoiding harmful ones. This is analogous to an animal learning to avoid brightly coloured insects while continuing to eat other prey.
  • Internal suppression (seeded run): The agent reduces all eating behaviour, which incidentally reduces harmful consumption. This is analogous to an animal becoming generally cautious about all food rather than learning to identify specific dangers. It is a less efficient strategy because it sacrifices safe consumption unnecessarily.

The external strategy is clearly superior: it maintains resource intake while avoiding harm. The internal suppression strategy carries a survival cost because the agent consumes fewer safe items, reducing its energy and hydration intake.

4.3 Fresh Outperforms Seeded

Counter-intuitively, the fresh run significantly outperformed the seeded run in discrimination quality. This result challenges the assumption that pre-trained or pre-evolved systems will always benefit from prior knowledge. Several factors may explain this:

  1. Topological constraint: The Phase 1 champion genome had evolved a topology optimised for indiscriminate eating. Adding discrimination required restructuring connection weights and potentially adding new pathways that the existing topology resisted.
  2. Local optima trapping: The seeded population started near a fitness peak for survival-through-eating. Mutations that improved discrimination often decreased survival in the short term, creating an evolutionary barrier.
  3. Reduced diversity: The seeded population was derived from a single champion genome, reducing genetic diversity compared to the fresh run's random initialisation. Lower diversity means fewer exploratory mutations and slower adaptation to new fitness pressures.

This finding has implications for transfer learning in neuroevolution: prior adaptation to a simpler task can constrain the search space and prevent optimal solutions from being found in a more complex task.

4.4 Topology Bloat

The seeded run exhibited significant topology bloat: the best genome grew substantially larger (more nodes and connections) over the course of evolution without corresponding improvements in discrimination performance. This suggests that NEAT was adding structural complexity in an attempt to work around the constraints of the inherited topology, but these additions were not functionally useful.

The fresh run produced more compact genomes with better discrimination, suggesting that when evolution can build topology from scratch, it finds more efficient encodings for complex behaviours. Bloat is a well-known problem in genetic programming, and this result confirms it can occur in NEAT-based neuroevolution when the initial topology is poorly suited to the task.

4.5 Survival Rate Paradox

An interesting paradox emerged: the seeded run maintained higher survival rates than the fresh run, yet achieved worse discrimination. This is because the seeded genome's Phase 1 foraging behaviour kept agents alive longer (they ate and drank efficiently), but the sickness penalties accumulated from indiscriminate eating reduced their overall fitness scores.

The fresh run's agents sometimes died earlier from starvation (lower overall eating rates), but the ones that survived had better discrimination and fewer sickness penalties, leading to higher fitness scores. This illustrates how survival duration and fitness are not the same metric, and why the fitness function's sickness penalty term was essential for driving discrimination evolution.

4.6 Sensory Features

The three sensory channels (colour, smell, texture) provided sufficient information for discrimination. Examining the evolved connection weights in the fresh run's champion genome reveals that the connectome developed differential sensitivity to specific sensory features:

  • Smell emerged as the most influential feature, with strong negative weights from high-smell inputs to the eat output. This is biologically plausible; strong or pungent odours often indicate spoilage in nature.
  • Colour provided secondary discrimination, with the connectome developing positive associations with the red hue (berries) and negative associations with intermediate hues (pink/raw chicken, murky water).
  • Texture played a supporting role, contributing to discrimination but not sufficient on its own.

The emergence of smell as the primary discriminator is notable because it was not designed or expected: the sensory values were arbitrary floating-point numbers with no inherent meaning. The evolutionary process discovered that smell values happened to be the most reliable predictor of item safety in this particular environment configuration.

4.7 Limitations

  • Single runs: Unlike Phase 1's multi-seed validation, Phase 2 reports single runs for each condition. Multi-seed validation would strengthen confidence in the generality of these results.
  • Fixed sensory signatures: Each item type has a fixed sensory profile. In a more realistic environment, sensory properties might vary within item types, requiring generalisation rather than memorisation.
  • Binary safety: Items are either safe or harmful, with no gradient. A more nuanced environment might include items with varying degrees of risk.
  • No temporal dynamics: Sickness effects are immediate. A delayed sickness penalty (analogous to food poisoning with a latency period) would test whether discrimination can emerge from temporally displaced consequences.
  • Sensory distance: Agents perceive item properties only when nearby. Long-range detection would add complexity and potentially enable anticipatory avoidance behaviour.

5. Conclusions

  1. Food discrimination emerges from topology evolution. NEAT-evolved connectomes can develop selective consumption behaviour, eating safe items while avoiding harmful ones, using sensory properties alone, with no discrimination rules coded into the system.
  2. A 7:1 discrimination ratio was achieved. The best fresh-evolution genome consumed safe items at seven times the rate of harmful items (50% safe eat rate vs 7% bad eat rate), demonstrating robust avoidance behaviour from 274 generations of evolution.
  3. Fresh evolution outperforms seeded evolution for novel tasks. Starting from a blank slate produced better discrimination than starting from a pre-evolved foraging genome, suggesting that prior adaptation can constrain the search space and trap evolution in local optima.
  4. Topology bloat accompanies constrained evolution. The seeded run's genome grew substantially larger without improving discrimination, confirming that structural additions driven by working around inherited constraints are often non-functional.
  5. Sensory-driven behaviour is biologically plausible. The evolved connectome developed differential sensitivity to sensory features, with smell emerging as the primary discriminator, a parallel to biological chemosensory-based food avoidance that was not designed but emerged from evolutionary pressure.

References

  1. Battye, D. (2026). Emergent Survival Behaviour from Evolved Connectome Topologies. Quale Project, Experiment 001.
  2. Battye, D. (2026). Multi-Seed Reproducibility Validation of Emergent Survival Behaviour. Quale Project, Experiment 001-multiseed.
  3. Stanley, K. O., & Miikkulainen, R. (2002). Evolving Neural Networks through Augmenting Topologies. Evolutionary Computation, 10(2), 99-127.
  4. Stanley, K. O., & Miikkulainen, R. (2004). Competitive Coevolution through Evolutionary Complexification. Journal of Artificial Intelligence Research, 21, 63-100.
  5. Lehman, J., & Stanley, K. O. (2011). Abandoning Objectives: Evolution through the Search for Novelty Alone. Evolutionary Computation, 19(2), 189-223.

Appendix A: Data Files

FileDescription
tests/002/fresh/output.txtFresh evolution raw output (274 generations)
tests/002/seeded/output.txtSeeded evolution raw output (201 generations)
tests/002/research-outcome.mdThis document (markdown source)

Appendix B: Reproduction

go build -o quale .
mkdir -p tests/002/fresh tests/002/seeded

# Phase 2 fresh (from scratch)
./quale --phase 2 --population 300 --generations 500 --seed 42 \
  --scenarios 5 --ticks 300 > tests/002/fresh/output.txt

# Phase 2 seeded (from Phase 1 checkpoint)
./quale --phase 2 --population 300 --generations 500 --seed 42 \
  --scenarios 5 --ticks 300 \
  --seed-from checkpoints/phase1/checkpoint_gen474.quale-ckpt \
  > tests/002/seeded/output.txt