Skip to content

New agent environment: an genetic search/elo rating system - #321

Open
Somasundaram-Rahul wants to merge 24 commits into
mainfrom
agent_elo
Open

New agent environment: an genetic search/elo rating system#321
Somasundaram-Rahul wants to merge 24 commits into
mainfrom
agent_elo

Conversation

@Somasundaram-Rahul

Copy link
Copy Markdown
Collaborator

Very much work in progress but would appreciate feedback on this. The idea is to introduce an environment where multiple agents compete with each other in match-ups. Winners get to improve their elo scores. After one iteration, winner(s) with highest elo scores get to reproduce (clones of them are made) and looser(s) with lowest elo scores are removed from the population.

Some things work well, at least when running the test examples/environment/run_elo.py. But quite a few features are missing: the strategy for pairing up agents against each other, improve the way judging is done, etc. Also this currently does not work with the dashboard.

@mikegros

Copy link
Copy Markdown
Collaborator

This looks awesome and I look forward to testing it out soon!

@Somasundaram-Rahul
Somasundaram-Rahul marked this pull request as ready for review September 9, 2026 16:36
@Somasundaram-Rahul

Copy link
Copy Markdown
Collaborator Author

I've fixed the issues I raised in my previous message. This environment seems to work well on my end. The simplest way to get started with this would be the dashboard. Setting up a new 'elo' environment can be done the same way as you would set up a new symposium or teams.

I'd love to hear if you have feedback on this.

@awadell1 awadell1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the code:

  1. A worked example that could land on https://lanl.github.io/ursa/latest/examples/ would be great. Details are here: https://lanl.github.io/ursa/latest/examples/#adding-an-example
  2. This seems be introducing a lot of primitives that should be on BaseEnvironment
  3. This really should be creating an invoking a langgraph graph, not doing lots of async calls. The current implementation is going to kill observability
  4. The config story and integration with the dashboard (or TUI) isn't great (somewhat out of scope. Adding a new thing requires a whole lot of modification to the dashboard code, which won't scale (See the old HITL)
  5. there are a lot of race-conditions here plus potential for unexpected mutation
  6. This runs in serial, it really should be using a map-reduce structure so that things can happen in parallel

On the environment:

The procedure seems like a stochastic sort with lots of re-evaluations. It's not clear to me why children or re-evaluations are even needed.

  • Why not a deterministic evaluator (or the privatives for one)
  • Anything to back the prompt structure?
  • There's not a lot of configurability around the judge
  • There's not really any thing preventing the judge from mutating a players config

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be:

  1. moved to it's own folder (or subfolder)
  2. Get an example.yaml file, so it shows up on the examples page
  3. Be more of a walkthrough and use --<8-- to import code instead of inlining it. See examples/environments/README.md

More details on adding examples are in the examples/README.md

Comment on lines +57 to +84
```yaml
name: numerical_integration_elo
group: default
workspace: ./elo_workspace

generations: 2
initial_rating: 1500
k_factor: 32
deaths_per_round: 1
seed: 12345

judge_prompt: >
Prefer correct, executed, reproducible numerical work. Evaluate accuracy,
convergence checks, and evidence supporting the conclusions. In later
generations, reward useful improvements and stronger validation.

members:
- name: researcher_1
role: Develops and validates numerical integration methods
agent: ExecutionAgent
config:
use_web: false

- name: researcher_2
role: Explores alternative methods and checks numerical accuracy
agent: ExecutionAgent
config:
use_web: false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example this could be:

```yaml
--8<-- "examples/environments/agent_elo.yaml"
```

use_web: false
```

The repository also includes `examples/environments/agent_elo.yaml` and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be links

The repository also includes [agent_elo.yaml](agent_elo.yaml)...

Paths are relative to the markdown file

## Run Elo from Python

```python
from langchain.chat_models import init_chat_model

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto on the this being an --8<--

reproduction. Cancellation may leave an already-running blocking subprocess
active until it exits or reaches its own timeout.

## Workspaces, persistence, and lineage

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this stuff belongs more on the docs for agent_elo, than in a worked example.

So basically, it belongs here. And the worked example (the stuff above) should go elsewhere

else symposium_cache_dir(self.group, name) / "symposium.yaml"
)

if launch.environment_type == "agent_team":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a BaseEnvironment method?

"""


ELO_STARTER_YAML = """name: research_elo

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This defo doesn't go here
  2. Probably better to use importlib.resources.files



@pytest.mark.parametrize("backup_fails", [False, True])
def test_persistence_backup_releases_database_handles(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing anything creating these tables so idk what's being tested here

Comment thread pyproject.toml
"langchain-openai>=1.0.1",
"langgraph-checkpoint-sqlite>=3.0.3",
"aiosqlite>=0.20.0",
"aiosqlite>=0.20.0,<0.22",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the restriction?

llm=self.llm,
workspace=self.workspace,
group=self.group,
use_web=False,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No web?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants