Skip to content
Jgocunha edited this page Mar 31, 2026 · 2 revisions

XOR

Task description

The XOR task evaluates whether an evolved Dynamic Neural Field (DNF) architecture can implement exclusive-or, a classic benchmark requiring non-linear separability.

The desired behavior is:

  1. Two independent input fields encode binary values (0 or 1) as localized activation peaks.
  2. The output field should exhibit a self-stabilized peak if exactly one input is active.
  3. If both inputs are inactive (0,0) or both active (1,1), the output must remain at baseline.

This task tests whether neat-dnfs can evolve non-linear computational structure using continuous-time neural field dynamics.

Highest-fitness minimal phenotype

Unlike AND, XOR reliably requires additional structure to implement a non-linear mapping:

  • Fields: 4 (two inputs, one hidden, one output)

  • Hidden fields: typically 1–4 (mean indicates consistent use of internal structure)

  • Connections: dense multi-path coupling (including inhibitory / Mexican-hat interactions)

  • Dynamics:

    • Input fields encode the two bits as peaks
    • A hidden field constructs an internal intermediate representation
    • The output field combines direct and indirect pathways to realize exclusive-or
phenotype-xor@320x

The figure above highlights the core mechanism:

  • Multiple coupling routes from inputs to output
  • A hidden-field “pre-shape” that modulates the output
  • Inhibitory/excitatory interactions that suppress the (1,1) case while preserving (1,0) and (0,1)

Experiment-level statistics across runs

Analysed 100 runs; 100 reached the fitness threshold (100.0% success, threshold = 0.950)

Generations to threshold (successful runs)

  • Mean: 41.33
  • Median: 35.00
  • Std: 23.86

Convergence speed

  • Mean convergence rate (fitness gain/gen): 0.0234
  • Mean fitness improvement/gen: 0.0250

Architecture (successful solutions)

  • Hidden fields (mean ± std): 1.75 ± 0.65
  • Enabled connections (mean ± std): 7.04 ± 2.20

Time / performance

  • Average run duration: 0.40 h
  • Avg. time per generation: 29.39 s/gen

Notable runs

label run value
Highest max fitness 2026-02-11 11h49m16s 0.981327
Lowest max fitness 2026-02-10 05h03m46s 0.950413
Fastest to threshold 2026-02-10 01h43m26s 12.0
Slowest to threshold 2026-02-10 13h32m01s 164.0
Most hidden fields 2026-02-10 13h32m01s 4.0
Most enabled connections 2026-02-10 13h32m01s 14.0

Best-run evolutionary dynamics

This section reports detailed statistics from the evolutionary run that produced the highest-fitness solution for the XOR task.

Fitness statistics

Final generation: g = 42

  • Best fitness: 0.9731
  • Target fitness: 0.950
  • Average fitness: 0.3949

Overall run statistics

  • Max best fitness: 0.9731 (reached at generation 42)
  • Mean best fitness over run (AUC): 0.7430
  • Mean average fitness over run (AUC): 0.4228
  • Longest stagnation period: 4 generations
  • Target fitness first reached: generation 42 (best fitness ≈ 0.9731)

Species statistics

Final generation (g = 42)

  • Species: 308
  • Active species: 12

Across run

  • Total distinct species created: 304
  • Species extinct by final generation: 296
  • Average species per generation: 85.86
  • Average active species per generation: 41.49
  • Max active species in a generation: 195 (at g = 39)

Species lifetime & size

  • Average species lifespan: 11.13 generations
  • Longest-lived species: 0 (lifespan 42)
  • Average max members per species: 23.39
  • Average offspring per species: 134.87

Topology statistics

Final generation (g = 42)

  • Avg genome size: 9.00
  • Avg field genes: 4.00
  • Avg connection genes: 5.00

Growth over run

  • Genome size change: +6.00 (≈ +0.143 / gen)
  • Field genes change: +1.00 (≈ +0.024 / gen)
  • Connection genes change: +5.00 (≈ +0.119 / gen)

Ratios

  • Avg connections per field (final gen): 1.25

Population-level kernel usage

  • Field kernels:

    • Gaussian: 130 505 (79.2%)
    • Mexican-hat: 34 180 (20.8%)
  • Interaction kernels:

    • Gaussian: 89 503 (63.5%)
    • Mexican-hat: 51 403 (36.5%)

Genome of the highest-performing solution

Generation: 42 Fitness: 0.9731

Field genes

Field Role Kernel type Field parameters Kernel parameters
nf 1 Input Gaussian h = -11.08, τ = 24.33 A = 8.67, σ = 7.69, A_glob = -0.20
nf 2 Input Mexican-hat h = -14.00, τ = 5.00 A_exc = 22.02, σ_exc = 10.01, A_inh = 26.26, σ_inh = 12.33, A_glob = -0.01
nf 3 Output Gaussian h = -7.99, τ = 40.00 A = 9.55, σ = 6.69, A_glob = -0.10
nf 4 Hidden Gaussian h = -5.48, τ = 31.38 A = 13.76, σ = 5.52, A_glob = -0.20

Interaction genes

Interaction gene From → To Kernel parameters
mhk cg 1-3-3 nf 1 → nf 3 A_exc = -15.00, σ_exc = 30.00, A_inh = 7.16, σ_inh = 21.80, A_glob = 0.00
gk cg 1-4-4 nf 1 → nf 4 A = 7.91, σ = 4.39, A_glob = 0.00
mhk cg 4-3-5 nf 4 → nf 3 A_exc = 15.00, σ_exc = 5.00, A_inh = 1.69, σ_inh = 21.86, A_glob = -0.05
gk cg 2-3-11 nf 2 → nf 3 A = 16.98, σ = 5.85, A_glob = -0.05
mhk cg 2-4-37 nf 2 → nf 4 A_exc = -17.16, σ_exc = 14.30, A_inh = 28.46, σ_inh = 20.25, A_glob = 0.00

XOR.mp4

Takeaway

XOR is a strong contrast case to AND:

  • It requires non-minimal structure (a hidden field and multiple interaction pathways).
  • Evolution explores a very large architectural space (high species counts and extinctions).
  • Despite this, solutions remain interpretable: a hidden intermediate representation plus structured excitation/inhibition implements the exclusive-or constraint.

In the overall suite, XOR sits closer to DMTS/IOR than to AND in terms of evolutionary effort and architectural complexity, making it a useful bridge between symbolic and cognitive benchmarks.