README.md

July 31, 2026 · View on GitHub

Animated GRSD flow for agentic reinforcement learning

Group-Reflective Self-Distillation for Agentic Reinforcement Learning

Policy-native reflection and turn-level credit assignment from verified on-policy experience

arXiv: 2607.28076 License: Apache 2.0 Last commit

Reflect on verified rollouts. Contrast success with failure. Distill the difference into turn-level credit.

News  ·  Quickstart  ·  Overview  ·  Method  ·  Results  ·  Layout  ·  Reproduce  ·  Launchers  ·  Checkpoints  ·  Verification

🔥 News

  • 2026.07.30 — We have open-sourced the official GRSD implementation, and the paper is now available on arXiv.

⚡ Quickstart

# 1. environment
conda create -n grsd python=3.10 -y && conda activate grsd
pip install vllm==0.11.0 && pip install -e .

# 2. one task (ALFWorld)
pip install gymnasium==0.29.1 stable-baselines3==2.6.0 alfworld
export ALFWORLD_DATA="$PWD/data/alfworld" && alfworld-download -f
bash examples/data_preprocess/prepare_alfworld.sh

# 3. train
bash examples/run_grsd_alfworld_qwen3_local.sh
Shortest path from a clean machine to an ALFWorld GRSD run. Full instructions in Reproduce.

🔎 Overview

GRSD lets an agent learn fine-grained credit from its own verified experience. For each prompt, the policy reflects on every rollout, contrasts successful and failed reflections into compact group-level DO / AVOID guidance, and uses that guidance as privileged context for turn-level self-distillation.

Terminal rewards tell an agent whether a trajectory succeeded, but not which of its many decisions deserve credit. GRSD keeps the stable GRPO objective and adds a policy-native signal for that missing credit assignment.

Policy-native
The policy writes its own reflections
Group-reflective
Success and failure are contrasted
Turn-level
Credit follows interaction structure
Inference-free
No privileged context at deployment

Important

Official GRSD is policy-native. The external model is only an optional scalar reflection judge; it never writes the reflection or group-level guidance. The external-reflection implementation is retained solely as an ablation.

ChallengeGRSD design
Sparse, trajectory-level rewardA self-teacher converts the trajectory advantage into a bounded, turn-level modulation.
Skills generated by a stronger external modelThe policy reflects on its own verified trajectories, keeping guidance within its capability boundary.
A single rollout mixes useful and incidental behaviorA stop-gradient snapshot contrasts successful and failed rollouts for the same prompt.
Privileged training context can leak into deploymentThe guidance is used only to construct training signals; the deployed agent receives only the original task prompt.

🧠 Method

GRSD pipeline: policy-native reflection, group-level guidance construction, and turn-level self-distillation
GRSD pipeline. Privileged guidance is used during training only; inference uses the plain task prompt.

  1. Policy-native self-reflection. For every verified rollout, the rollout policy identifies outcome-critical decisions and extracts a trajectory-level reflection skill. An optional OpenAI-compatible endpoint supplies only a scalar rubric score for the reflection objective; it never generates or revises reflection content.
  2. Group-level guidance construction. A stop-gradient policy snapshot contrasts reflection-derived skills from successful and failed rollouts of the same prompt and synthesizes concise, outcome-discriminative DO / AVOID guidance.
  3. Turn-level self-distillation. The same sampled actions are evaluated under plain and guidance-augmented contexts. Their aligned likelihood difference refines the trajectory-level GRPO advantage into turn-specific credit without changing its verifier-determined sign.

The policy-native implementation is the official GRSD variant and is selected by default. The legacy verl.trainer.main_grsd entry point is retained as the external-reflection ablation (GRSD_VARIANT=external) for comparisons and backward compatibility.

📊 Results

The paper evaluates three long-horizon environments and three instruction-tuned backbones. Values below are the reported per-environment averages; ALFWorld and SearchQA are percentages, while WebShop reports normalized score / success rate.

Performance overview of GRSD across agentic environments and model backbones
Performance overview. GRSD delivers strong aggregate results across environments and model scales.

+5.5%
ALFWorld vs. GRPO
+2.7%
SearchQA vs. GRPO
+4.8%
WebShop score vs. GRPO
+7.2%
WebShop success vs. GRPO
Average absolute improvement across the three evaluated backbones.
BackboneALFWorld successSearchQA accuracyWebShop score / success
Qwen3-1.7B92.243.884.5 / 66.4
Qwen2.5-3B-Instruct86.746.286.9 / 76.5
Qwen2.5-7B-Instruct92.250.591.6 / 82.8

📈 Training dynamics

On ALFWorld with Qwen3-1.7B, GRSD continues to improve after the baselines begin to plateau and reaches the highest validation success rate. It also maintains a smaller absolute mean teacher-student gap than Skill-SD and SDAR, consistent with more compatible guidance and smoother late-stage optimization.

Training dynamics on ALFWorld with Qwen3-1.7B

🪞 Reflection strategy

Policy-native reflections are compared with external-model reflection generation. The official GRSD pipeline achieves higher late-stage success while maintaining a smaller-magnitude teacher-student gap, indicating guidance that better matches the policy's capability boundary.

Reflection strategy ablation: success rate
Overall success rate
Reflection strategy ablation: teacher-student gap
Mean teacher-student gap

🎛️ Hyperparameter sensitivity

The default settings use a moderate reflection-loss weight and self-distillation strength. The paper sweeps both to expose the stability / credit-shaping trade-off.

Reflection loss weight ablation
Reflection-loss weight alpha
Self-distillation strength ablation
Self-distillation strength lambda

🌐 Cross-domain generalization

GRSD transfers beyond the in-domain ALFWorld training distribution and improves the Unseen task types, with particularly clear gains on Cool and Pick2.

Cross-domain generalization on ALFWorld Unseen

🗂️ Repository layout

GRSD/
├── agent_system/                # ALFWorld, SearchQA, and WebShop environments
├── examples/
│   ├── data_preprocess/         # task download and Parquet preparation
│   ├── search/retriever/        # local SearchQA retrieval service
│   └── run_grsd_*_local.sh      # complete 3 task x 3 backbone matrix
├── verl/trainer/ppo/            # GRSD trainers, reflection, and advantage logic
├── skills/                      # task skill prompts and mappings
├── docs/grsd/                   # figures used in the paper and this README
├── scripts/                     # checkpoint conversion and merging utilities
└── tests/                       # focused GRSD regression tests

🛠️ Reproduce

The public launchers use repository-relative defaults. Set MODEL_ROOT, DATA_ROOT, MODEL_PATH, DATA_DIR, CHECKPOINT_DIR, and PYTHON_BIN to adapt them to your machine; no absolute path from the development environment is required.

1. Install

Python 3.10 is recommended. Install a CUDA-compatible PyTorch build first, then the rollout engine and this repository:

conda create -n grsd python=3.10 -y
conda activate grsd

pip install vllm==0.11.0
pip install flash-attn==2.7.4.post1 --no-build-isolation --no-cache-dir
pip install -e .

The full dependency list is in requirements.txt. The task environments add their own requirements as described below.

2. Prepare data and environments

All preparation scripts are kept in this repository and write to data/ by default.

ALFWorld

pip install gymnasium==0.29.1 stable-baselines3==2.6.0 alfworld
export ALFWORLD_DATA="$PWD/data/alfworld"
alfworld-download -f
bash examples/data_preprocess/prepare_alfworld.sh

Search-based QA

pip install -e agent_system/environments/env_package/search/third_party
pip install gym==0.26.2
bash examples/data_preprocess/prepare_search.sh

Run the retriever in a separate Python 3.10 environment with transformers, datasets, pyserini, faiss-gpu, fastapi, and uvicorn:

bash examples/search/retriever/retrieval_launch.sh

Set DOWNLOAD_RETRIEVER_ASSETS=false when the Parquet files are already present. Use SEARCH_ASSET_ROOT, INDEX_FILE, and CORPUS_FILE for a non-default asset location.

WebShop

WebShop requires Python 3.10, JDK 11+, product JSON files, and a Pyserini/Lucene index:

cd agent_system/environments/env_package/webshop/webshop
./setup.sh -d all
cd ../../../../../
bash examples/data_preprocess/prepare_webshop.sh

The launcher expects the setup output under data/webshop/ by default. Override WEBSHOP_DATA_DIR, WEBSHOP_INDEX_DIR, or WEBSHOP_JAVA_HOME when assets are stored elsewhere.

3. Configure the optional reflection judge

Official GRSD uses an OpenAI-compatible endpoint only to assign a scalar rubric score to policy-generated reflections during training:

export JUDGE_API_KEY=your_key
export JUDGE_API_BASE=https://your-openai-compatible-endpoint/v1
export JUDGE_MODEL=your_judge_model

Set JUDGE_ENABLED=false to remove the auxiliary reflection reward and loss while retaining policy-native reflection, group-level guidance construction, and turn-level self-distillation. Keep WANDB_MODE=offline (the default) for local runs.

🚀 Launchers

There is one official GRSD launcher for every combination of the three tasks and three backbones. Each defaults to GRSD_VARIANT=grsd and can be overridden without editing the script.

TaskQwen2.5-3B-InstructQwen2.5-7B-InstructQwen3-1.7B
ALFWorldrun_grsd_alfworld_qwen2.5_3b_local.shrun_grsd_alfworld_qwen2.5_7b_local.shrun_grsd_alfworld_qwen3_local.sh
SearchQArun_grsd_search_qwen2.5_3b_local.shrun_grsd_search_qwen2.5_7b_local.shrun_grsd_search_qwen3_local.sh
WebShoprun_grsd_webshop_qwen2.5_3b_local.shrun_grsd_webshop_qwen2.5_7b_local.shrun_grsd_webshop_qwen3_local.sh

Run from the repository root, for example:

bash examples/run_grsd_alfworld_qwen3_local.sh
bash examples/run_grsd_search_qwen2.5_3b_local.sh
bash examples/run_grsd_webshop_qwen2.5_7b_local.sh

The paper defaults are summarized below; every setting can be overridden with an environment variable or appended Hydra arguments.

SettingDefaultMeaning
Group size8Rollouts per prompt used for group-level contrast
GRSD_LAMBDA0.5Self-distillation strength
GRSD_G_HAT_MAX0.2Bound on the turn-level modulation
GRSD_ETA0Dead-zone threshold below which the turn-level gate is inactive
REFLECT_LOSS_COEF0.01Reflection-loss weight alpha
Policy updates600 / 240ALFWorld Qwen3-1.7B / all other launchers

To reproduce the external-reflection ablation:

GRSD_VARIANT=external bash examples/run_grsd_alfworld_qwen3_local.sh

GRSD_VARIANT=reflect and GRSD_VARIANT=original remain accepted as legacy aliases for grsd and external.

💾 Checkpoints and evaluation

Training outputs default to checkpoints/. Use scripts/model_merger.py to merge FSDP or Megatron shards into a Hugging Face model directory. Evaluation uses the task-specific environment wrappers and the same plain prompt format used by training.

✅ Verification

Run the focused GRSD regression suite before a long GPU job:

python -m unittest tests.trainer.ppo.test_grsd_advantage
python -m compileall -q verl agent_system examples/data_preprocess
for script in examples/run_grsd_*local.sh examples/run_grsd_reflect_*local*.sh; do bash -n "$script"; done

The launchers also validate required data/model paths, CUDA visibility, and (when enabled) the judge or SearchQA retriever endpoint before starting Ray.

When a run fails for environment reasons, scripts/diagnose.py reports the OS, hardware, Python, pip, and network state in one pass:

python scripts/diagnose.py

🙏 Acknowledgements

GRSD builds on veRL, verl-agent, ALFWorld, WebShop, and Search-R1. We also acknowledge the public SDAR repository, which provided an important implementation reference for agentic self-distillation. We thank the authors and contributors of these projects.

📝 Citation

@misc{zheng2026groupreflectiveselfdistillationagenticreinforcement,
      title={Group-Reflective Self-Distillation for Agentic Reinforcement Learning},
      author={Binbin Zheng and Zijun Xie and Guanqun Zhao and Enlei Gong and Xing Ma and Xiaoliang Fu and Zeyu Chen},
      year={2026},
      eprint={2607.28076},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2607.28076},
}
Apache-2.0 | Research code | Training-time privileged context, inference-time plain prompts