TL;DR
The Digital Red Queen (DRQ) framework combines Large Language Models (LLMs) with self-play and quality-diversity algorithms to open-endedly evolve assembly programs in the competitive game of Core War. By shifting from static optimization to a dynamic adversarial landscape, DRQ discovers robust, generalist strategies that mirror biological convergent evolution—converging on similar effective behaviors while maintaining diverse underlying code implementations.
What Problem Does This Paper Address?
Most current LLM-based evolution frameworks operate on static fitness landscapes, optimizing artifacts (like code or prompts) against a fixed set of unit tests or objectives. However, real-world computational challenges—such as cybersecurity exploits and defenses, market competition, or biological virus mutations—are inherently adversarial and dynamic.
To survive in these environments, an agent must continuously adapt to counter its competitors' adaptations, a phenomenon known in evolutionary biology as the Red Queen hypothesis (inspired by Lewis Carroll’s Red Queen, who notes that "it takes all the running you can do, to keep in the same place").
The authors address the challenge of studying these open-ended adversarial dynamics in a safe, controlled setting. They introduce Core War—a classic programming game where low-level assembly programs ("warriors") compete for control of a shared virtual machine—as a Turing-complete sandbox for LLM self-play.
Methods
The authors introduce Digital Red Queen (DRQ), a self-play algorithm driven by an LLM loop:
- Adversarial Self-Play Loop: DRQ proceeds through a sequence of rounds. In each round $t$, a new warrior $w_t$ is evolved with the explicit objective to defeat all previous round champions $\{w_0, \dots, w_{t-1}\}$. This creates a continually shifting, escalating fitness landscape.
- LLM as an Intelligent Mutation Operator: Instead of relying on random bit-flips or token swaps, DRQ uses an LLM (GPT-4.1 mini) provided with a concise manual of the Redcode assembly language. The LLM acts as a domain-aware mutation operator, modifying existing code to improve performance based on structural priors.
- Intra-round Optimization via MAP-Elites: To prevent the LLM from getting stuck in local minima within a single round, the authors employ MAP-Elites, a quality-diversity algorithm. It maintains an archive of diverse solutions partitioned by two behavioral descriptors: total spawned threads and total memory coverage.
Datasets
The authors evaluated their method using human-designed warriors scraped from public repositories:
- Static Baseline Dataset: 294 human-designed warriors used to benchmark single-round optimization performance.
- DRQ Evaluation Dataset: A subset of 96 diverse human warriors used as initial seeds across independent multi-round DRQ runs.
- Generality Test Suite: A held-out dataset of 317 human warriors used exclusively to evaluate how robustly an evolved warrior performs against completely unseen strategies in a zero-shot manner.
Key Insights and Ideas
- Convergent Evolution in Code: Over multiple rounds of DRQ, independent evolutionary runs statistically converge toward a single general-purpose behavior (phenotype) while maintaining highly diverse underlying code implementations (genotype). Much like how birds and bats independently evolved wings to solve the same functional demand, different DRQ runs independently discovered similar high-level strategies using entirely different code structures.
- History Prevents Strategic Cycling: Optimizing against a history of past champions ($K > 1$) significantly dampens cyclic "rock-paper-scissors" dynamics. Increasing the history length to $K=10$ resulted in a 77% reduction in strategic cycles compared to only training against the immediate predecessor ($K=1$).
- Chaotic Code is Predictable: Core War simulations are notoriously chaotic; a single instruction change can completely flip a battle outcome. Remarkably, a simple linear probe trained on LLM text embeddings of the raw Redcode source code was able to moderately predict a warrior's overall generality score ($R^2 = 0.461$), suggesting that LLMs capture latent structural features relevant to program robustness.
Key Results
- Specialists vs. Generalists: Single-round static optimization successfully engineered specialized warriors that collectively defeated or tied 96.3% of human warriors. However, these individuals were brittle, defeating or tying only 27.9% of human-designed warriors on average.
- DRQ Drives Generality: Full multi-round DRQ consistently increased the average generality of warriors over successive rounds, forcing the emergence of robust generalist strategies capable of handling diverse threats.
- Diversity is Essential: Ablating MAP-Elites (replacing it with a single-cell variant) drastically degraded the fitness of the evolved champions, proving that maintaining behavioral diversity within each round is crucial for escaping local minima in deceptive search spaces.
Limitations and Future Work
- Linear Lineage: DRQ currently optimizes along a single line of descent (one new champion per round). Real-world ecosystems feature large populations co-evolving in parallel, which the authors suggest as a promising direction for future work.
- Simulation Bottleneck: Evaluating generality requires expensive multi-step simulations against hundreds of opponents. However, the predictability of code embeddings opens the door to using LLMs as surrogate fitness models to bypass simulation entirely.
- Application Domains: While Core War is a safe sandbox, the core principles of DRQ could be extended to practical adversarial domains like automated red-teaming in cybersecurity or modeling drug resistance in biology.
Summary updated