Skip to content

team josh (tollbit.com)

i set out to find out if a multi agent gpt5 system can learn their own language when optimizing a context free grammar constrained output.

Core trick

Evolves context-free grammars that constrain agent messages in a signaling game, favoring shorter formats that keep guessing accuracy high.

Tags

Description

i set out to find out if a multi agent gpt5 system can learn their own language when optimizing a context free grammar constrained output. tldr: YES!
JoshMayerr/cfg-neuralese★ 10 forksPythonCreated Aug 9, 2025 · last push Aug 11, 2025

README excerpt

# create "neuralese" with gpt5 and context free grammars (CFG)

### project goal

this is a multi agent system running a loop that evolves context-free grammars to optimize communication between GPT-5 agents. The system automatically discovers shorter, more efficient message formats while maintaining high accuracy

### why its interesting

this is a constrained example on a mini game. but this experiment seems to be standard in other research. according to them, if this mini game works, it can extend to a real grammar for an entire language. this shows that if you wanted to build / learn a cfg to do neuralese you probably can. you just need to run a bigger experiment for longer

### how it works

![Example Round](example.png)
the agents play a guessing game (Lewis Signaling Games) over many rounds. in each round, there are 4 options the speaker must encode in their language and send to the guesser such that the guesser will correctly decode it and select the correct option. the speaker can only send messages that follow the current CFG. after every round, the CFG is updated and optimized based on metrics below.

### commands for demo

```bash
uv run python main.py --rounds 3 --batch-size 5 # run main loop to optimize
```

```bash
uv run test_step3.py # show an example guessing round
```

```bash
uv run scripts/qa.py # play a guessing game based on final CFG
```

### Full Evolution

```bash
# Run evolutionary optimization (10 rounds, batch size 10)
uv run python main.py --roun

Team