Back to Agent Lightning

ScienceWorld

docs/10-example-science-world.md

1.0.02.0 KB
Original Source

ScienceWorld

GPUModelController ModeTrainer ModeCode
8× A100 40GBQwen/Qwen2.5-7B-InstructLocalAsync onlySource

ScienceWorld trains an agent with verl and Agent Lightning >=v1.0 to solve text-based science tasks from AllenAI's ScienceWorld.

This example uses the local controller in asynchronous trainer mode. Each rollout runs as a local process that interacts with a ScienceWorld environment, calls the model through the AGL Gateway, and reports the final reward. It does not require K8s, Docker, or Minikube.

Environment Preparation

Install Java and the example dependencies:

bash
sudo apt-get install -y default-jre
uv pip install scienceworld openai

ScienceWorld starts a JVM for each rollout, so Java 1.8 or later is required.

Training

Start local training from the repository root:

bash
examples/science_world/run_local.sh

run_local.sh starts agl-server, the local agl-controller, and the verl trainer. The controller launches each rollout as a local process, and the script cleans up the server, controller, and Ray processes when it exits.

The training dataset is generated automatically from ScienceWorld task names and variation indices. To train on selected tasks or change the number of variations per task:

bash
examples/science_world/run_local.sh \
    --task-names find-non-living-thing,find-living-thing \
    --variations-per-task 50

Available runtime settings include:

SettingDefaultDescription
--task-namesallComma-separated task names, or all ScienceWorld tasks
--variations-per-task50Maximum variations per task
--simplificationeasyScienceWorld simplification preset
SW_MAX_STEPS30Maximum model turns per rollout
SW_ENV_STEP_LIMIT100ScienceWorld environment step limit
AGL_MAX_TOKENS256Maximum tokens per model completion