Skip to content

Add the GRPO-on-Substrate example: a real RL loop with actors as the reward executor - #101

Closed
Vicente Ferrara (vicentefb) wants to merge 4 commits into
agent-substrate:mainfrom
vicentefb:examples/grpo-harness
Closed

Vicente Ferrara (vicentefb) wants to merge 4 commits into
agent-substrate:mainfrom
vicentefb:examples/grpo-harness

Conversation

@vicentefb

Copy link
Copy Markdown
Collaborator

TRL's GRPOTrainer trains Qwen2.5-0.5B on MBPP on a CPU host, every completion runs inside a gVisor actor, and the reward is the share of the task's asserts that pass. Only the sandbox calls changed; the module docstring maps each one to its agent-sandbox counterpart.

What the example adds: a smoke mode that checks the wiring without loading the model; a JSONL record of every create, boot, eval, suspend, wake and heal with wall time, plus report.py for p50/p95/max per event and per step; a first-request retry on wake, since Substrate wakes on the first request rather than on an explicit resume; a working-set knob (random-byte ballast per actor) for suspend and wake cost by size; and a multi-endpoint router that splits the reward fleet across clusters.

examples/grpo/README.md has the prerequisites, the run ladder, what to record, and the measured results: ten-step runs on a 4-node cluster and on a 139-node cluster with ac5c5ee0 Substrate, 560 evaluations with no state lost, and the parking cost per step by working set, with a four-worker rerun that separates the placement effect from the build effect.



"""
Real RL loop on CPU: GRPO (TRL) + Substrate actors as the reward executor.

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 recommend clarifying that this is an RL Loop where all the pieces are in one python process on a CPU machine.

Usually when I hear Real RL Loop, I do expect disaggrated and accelerator usage. Timing & load from a single python process on CPU machine probably does not look like what a classic RL loop would produce.

@rakyll

Copy link
Copy Markdown
Collaborator

This example doesn't belong to this repo, see #109.

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