Skip to content

feat: add production GRPO objective inputs and reductions - #67

Merged
Flink-ddd merged 1 commit into
issue-18-overlap-pipelinefrom
issue-63-64-production-grpo
Jun 3, 2026
Merged

Flink-ddd merged 1 commit into
issue-18-overlap-pipelinefrom
issue-63-64-production-grpo

Conversation

@inaniloquentee

@inaniloquentee inaniloquentee commented Jun 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add a reusable production-facing GRPO objective module with group-relative reward normalization and clipped policy loss.
  • Extend the rollout/training contract to consume production GRPO inputs:
    old-policy logprobs, reference-policy logprobs, payload/provider rewards, and prompt group ids.
  • Make GRPO loss reduction semantics explicit:
    global_token_mean remains the default, and sequence_mean is available as an opt-in mode.
  • Wire Torch and DeepSpeed training workers through the shared GRPO objective instead of relying on synthetic/demo-only advantage paths.
  • Add focused tests and benchmarks covering grouped reward normalization, payload rewards, strict validation, loss reductions, and worker integration.

Issues Covered

Closes #16.
Closes #63.
Closes #64.

Why this PR is stacked

This PR is stacked on top of #61 (feat: add overlapping rollout training pipeline), which itself depends on #60 (feat: zero copy weight bridge).

The dependency chain is:

This keeps the review focused on the GRPO objective layer while reusing the already-built bridge and rollout/training pipeline.

Main changes

  • Add rl_engine/alignment/grpo.py
  • Export the public GRPO API from rl_engine/alignment/__init__.py
  • Integrate GRPO objective usage into:
    • rl_engine/executors/training_contract.py
    • rl_engine/executors/overlap_pipeline.py
    • rl_engine/executors/deepspeed_trainer.py
  • Add focused coverage in:
    • tests/test_grpo_objective.py
    • tests/test_overlap_pipeline.py
    • tests/test_deepspeed_training_worker.py
  • Add benchmarks/benchmark_grpo_objective.py

Validation

  • pre-commit run --files rl_engine/alignment/__init__.py rl_engine/alignment/grpo.py rl_engine/executors/training_contract.py rl_engine/executors/overlap_pipeline.py rl_engine/executors/deepspeed_trainer.py tests/test_grpo_objective.py tests/test_overlap_pipeline.py tests/test_deepspeed_training_worker.py benchmarks/benchmark_grpo_objective.py
  • py -3.13 -m mypy --ignore-missing-imports rl_engine
  • py -3.13 -m pytest tests -q
  • py -3.13 -m pytest rl_engine/tests/test_dispatch.py -v
  • py -3.13 -m mkdocs build --strict -f mkdocs.yaml

Results

  • Full test suite: 136 passed
  • Dispatch parity test: 3 passed
  • MyPy: passed
  • MkDocs strict build: passed

Notes

  • The review base should remain the overlap pipeline branch so the diff does not include the bridge or pipeline prerequisite work again.

@inaniloquentee inaniloquentee changed the title feat: add production GRPO inputs and reductions feat: add production GRPO objective inputs and reductions Jun 3, 2026
@Flink-ddd

Copy link
Copy Markdown
Collaborator

LGTM, Thanks.

@Flink-ddd
Flink-ddd merged commit fd9514e into issue-18-overlap-pipeline Jun 3, 2026
6 checks passed
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.

2 participants