← Back to Pull requests

feat: Add lora_grpo implementation to training hub algorithms #111

Closed
unknown closed this pull request without merging on May 27, 2026 15:48 UTC
View on GitHub
unknown unknown commented on May 18, 2026 11:57 UTC
Author

RHOAIENG-62928
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, check our contributor guidelines: https://www.kubeflow.org/docs/about/contributing
2. To know more about Kubeflow SDK, check the developer guide:
https://github.com/kubeflow/sdk/blob/main/CONTRIBUTING.md
3. If you want faster PR reviews, check how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
-->

What this PR does / why we need it:

Add LORA_GRPO algorithm for RLVR/GRPO training
Adds support for Group Relative Policy Optimization (GRPO) via the ART backend as a new Training Hub algorithm.

Changes
Algorithm registration (algorithms.py)

- Register lora_grpo in the algorithm registry with DEFAULT_COMMAND entrypoint (not torchrun — ART is single-GPU and manages its own vLLM subprocess; torchrun env vars leak into it and cause NCCL timeouts)
- Metrics file pattern: training_metrics.jsonl (shared with lora_sft)
RHAI Training Hub integration (rhai/traininghub.py)

- Add LORA_GRPO to TrainingHubAlgorithms enum
- Add _read_lora_grpo_metrics() — reads ART's two-phase JSONL format (rollout + train lines per iteration), merges them into a single dict
- Add _transform_lora_grpo() — maps GRPO metrics to controller schema (progressPercentage, currentStep, loss, mean_reward, full_match_rate, entropy)
- Wrap instrumentation activation in if __name__ == '__main__': guard to prevent [Errno 98] Address already in use when ART's multiprocessing.spawn re-executes the script in child processes

Tests

- Algorithm registry: spec lookup, known algorithms set, shared metrics pattern allowlist, pod metadata, python entrypoint assertion
- RHAI: enum value, entrypoint validation, wrapper script __main__ guard, two-phase metrics reader, empty file handling, metrics transformer (with and without max_steps), cleanup on startup

Dependencies
- Training Hub 0.8.1 release

Which issue(s) this PR fixes _(optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged)_:

Fixes #

Verification steps _(required; provide valid, reproducible steps for reviewers to verify your changes, e.g. setup, commands, expected outcome, notebooks)_:

_Example: 1. Check out this branch. 2. Run make test-python. 3. Confirm that …_

Checklist:

  • Docs included if any changes are user facing
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Added LoRA GRPO training algorithm with integrated metrics reading and merging, mapping to controller-friendly training metrics (includes progress percentage and remaining-time estimates).
    Generated runtime wrappers now include a main-entry guard and use a Python entrypoint for improved runtime compatibility and stability.

    Tests
    * Extended test coverage for LoRA GRPO: metrics instrumentation, two-phase merged metrics handling, stale/empty metrics behavior, progress/remaining-time calculations, and runtime-wrapper behavior.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 414 lines (+310 / -104) across 5 files Reviewer: briangallagher Review duration: 13191m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 414 lines diff across 5 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.361
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #111"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.9% (MEDIUM) · Higher = larger blast radius
    49.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.7% · Safe to merge
    19.7%