Distributed Red Queen (DRQ) optimization with peer-to-peer gossip networking. Each node runs DRQ autonomously, and at the end of every round broadcasts its champion to the network via GossipSub over axl. Peers receive champions from the network and can use them as seeds for future rounds.
┌─────────────────────────────────────────┐
│ Node │
│ │
│ ┌───────────┐ ┌────────────────┐ │
│ │ axl │◄───►│ gossipsub │ │
│ │ node │ │ (embedded in │ │
│ │ :9002 │ │ drq.py) │ │
│ └───────────┘ └───────┬────────┘ │
│ │ │
│ ┌───────▼────────┐ │
│ │ DRQ │ │
│ │ optimization │ │
│ └───────┬────────┘ │
│ │ │
│ ┌───────▼────────┐ │
│ │ LLM inference │ │
│ │ (vLLM / MLX │ │
│ │ or remote) │ │
│ └────────────────┘ │
└─────────────────────────────────────────┘
Each node:
- Runs axl for encrypted P2P transport
- Runs DRQ with embedded GossipSub for round champion broadcast/receive
- Runs an LLM (local vLLM/MLX, or remote API) for warrior generation/mutation
- Clone axl:
git clone git@github.com:gensyn-ai/axl.git axl - Generate private key:
openssl genpkey -algorithm ed25519 -out axl/private.pem - Edit
axl/node-config.jsonwith the public nodes you want to peer with
docker build -f runtime/docker/Dockerfile -t drq-gossip .docker run \
-p 9001:9001 \
-e MODEL="claude-opus-4-6" \
-e MODEL_URL="https://api.anthropic.com" \
-e OPENAI_API_KEY=<api-key> \
-e DRQ_SAVE_DIR=/outputs \
-v $(pwd)/outputs:/outputs \
-v $(pwd)/axl/node-config.json:/opt/axl/node-config.json:ro \
-v $(pwd)/axl/private.pem:/opt/axl/private.pem:ro \
drq-gossipdocker run --gpus all \
-p 9001:9001 \
-e DRQ_SAVE_DIR=/outputs \
-v $(pwd)/outputs:/outputs \
-v $(pwd)/inference/vllm/config.yaml:/config/vllm_config.yaml:ro \
-v $(pwd)/axl/node-config.json:/opt/axl/node-config.json:ro \
-v $(pwd)/axl/private.pem:/opt/axl/private.pem:ro \
-v ~/.cache/huggingface:/root/.cache/huggingface \
drq-gossipThe HuggingFace cache mount persists downloaded models across container restarts.
docker run -e DRQ_ARGS="--n_rounds=20 --n_iters=250 --seed=42" ...brew install go supervisor uvMODEL="claude-opus-4-6" \
MODEL_URL="https://api.anthropic.com" \
OPENAI_API_KEY=<api-key> \
./runtime/macos/start.shEdit inference/mlx/config.yaml to set your model, then:
./runtime/macos/start.shDRQ_ARGS="--n_rounds=20 --n_iters=250 --seed=42" ./runtime/macos/start.shGossipSub is a publish/subscribe mesh protocol. Each node maintains a small mesh of peers (D=3) and uses a combination of eager push and lazy pull to propagate messages efficiently:
- On publish: eagerly send to all mesh peers
- On forward: eagerly send to 1 mesh peer, IHAVE (lazy announce) to the rest
- IWANT deduplication: each message is only requested from one peer, preventing redundant fetches
- Heartbeat: periodic mesh maintenance (graft/prune) and IHAVE gossip to non-mesh peers
This achieves ~1.05x redundancy (near theoretical minimum) with 100% delivery reliability.
Round N completes
→ write round_N_champion.red to save_dir/
→ gossip.publish(champion_code) to network
Round N+1 starts
→ gossip.tick() drains incoming messages
→ received champions written to save_dir/received_champions/
peer_<node_id>_round_<R>.red
Gossip is enabled with --gossip_enabled (on by default in both runtimes). If axl is not running, gossip disables itself gracefully and DRQ continues in local-only mode.
# Docker
docker run -e DRQ_ARGS="--gossip_enabled=False" ...
# macOS
DRQ_ARGS="--gossip_enabled=False" ./runtime/macos/start.shgossipsub.py GossipSub protocol implementation
drq/
src/drq.py DRQ optimization driver (with embedded gossip)
src/llm_corewar.py LLM warrior generation and mutation
src/corewar_util.py Core War simulation utilities
corewar/ Core War engine
human_warriors/ Seed warriors
runtime/
docker/ Linux container (vLLM + axl + DRQ)
macos/ macOS supervisord (MLX + axl + DRQ)
inference/
vllm/ vLLM config (Linux/GPU)
mlx/ MLX config (macOS/Apple Silicon)
axl/ P2P transport layer (Go binary)