> For the complete documentation index, see [llms.txt](https://docs.darwinslab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.darwinslab.ai/the-synthetic-darwin-protocol/core-architecture-the-evolutionary-loop.md).

# Core Architecture – The Evolutionary Loop

<figure><img src="https://2257896232-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk69P30R0x40ZoFiaF4UX%2Fuploads%2FzpDoHtwjzdlsKsLTuOAV%2F2025-07-05%2018.59.06.jpg?alt=media&amp;token=c9e674ea-a8f1-43a4-a003-d4726e820c05" alt="" width="563"><figcaption></figcaption></figure>

At the heart of Synthetic Darwin is a recursive loop:

```
Generation n
┌───────────────────────────────┐
│ Population  Pₙ  (|P| = N)      │
└──────────────┬────────────────┘
               │ evaluate fitness  ƒ(x)
               ▼
rank / roulette / tournament-selection → Parents
               │
        ┌────────┴─────────┐
        │ crossover  χ      │  (single-, two-, or uniform-point)
        │ mutation   μ       │  (param tweak, prompt splice, code diff)
        └────────┬─────────┘
               ▼
           Offspring  Ōₙ
               │   elitism ε% of Pₙ
               ▼
Pₙ₊₁  ←  ε · best(Pₙ)  ∪  (N-ε) · Ōₙ
               │
stop if  Δfitness < τ  or  n ≥ n_max
```

Each generation aims to create better successors.
