← Back to Pull requests

fix(lora_grpo): support openpipe-art >= 0.5.20 and always pass the LoRA rank #162

Merged
Maxusmusti merged 3 files (186 lines) on Nov 12, 2026 17:25 UTC
View on GitHub
Maxusmusti Maxusmusti commented on Nov 09, 2026 21:22 UTC
Author

Problem

1. lora_grpo(backend="art") fails before training on openpipe-art ≥ 0.5.20. ART 0.5.20 moved LoRA settings from _internal_config.peft_args to a top-level TrainableModel(lora_config=...), and art.dev.PeftArgs now raises:

ValueError: `peft_args` has been replaced by top-level `TrainableModel(lora_config=...)`. Rename keys: r->rank, lora_alpha->alpha, ...

The same release also made run_name a required keyword-only argument of TrainableModel, so removing peft_args alone would just fail with a TypeError. pyproject.toml floors openpipe-art>=0.5.17 with no cap, so a fresh install resolves 0.5.24. Every release after 0.5.18 on PyPI is affected (0.5.19 has no wheel).

2. The default LoRA rank was silently ignored. The old code only passed r when lora_r != 16, assuming ART defaults to 16. ART defaults to 8 (0.5.18 get_model_config: r=8; 0.5.24 _peft_args_from_lora_config: r=8), so default lora_grpo(backend="art") runs have been training rank-8 adapters.

Change

  • New _build_art_model_kwargs() picks the API from the TrainableModel signature instead of a version string:

  • - new ART: lora_config={"rank", "alpha", "target_modules"} plus run_name. run_name reuses the model name, so the checkpoint layout is unchanged.
    - old ART: _internal_config.peft_args, as before.
  • The rank is always passed explicitly.

  • Unit tests (tests/test_lora_grpo_art_config.py) cover fake old/new ART APIs and whichever openpipe-art is installed. AGENTS.md documents the API change.
  • The openpipe-art>=0.5.17 floor is unchanged, since both sides of the API change work.

    Validation

    1× H100, Qwen2.5-1.5B-Instruct, generic-mode arithmetic reward, num_iterations=2, group_size=4, prompt_batch_size=8, lora_r=16, lora_alpha=8, torch 2.14.0, vllm 0.33.0:

    | Code | openpipe-art | Result | Saved adapter rank |
    |---|---|---|---|
    | main | 0.5.24 | ❌ ValueError (peft_args replaced) | — |
    | main | 0.5.18 | ✅ reward 0.156 → 0.375 | r=8 (requested 16) |
    | this PR | 0.5.18 | ✅ reward 0.125 → 0.375 | r=16 |
    | this PR | 0.5.24 | model + initial adapter built correctly (r=16); then fails inside ART's managed vLLM runtime (see below) | r=16 (checkpoint 0000) |

  • tests/test_lora_grpo_art_config.py + tests/test_lora_grpo_wandb_stub.py: 13 passed with ART 0.5.24 and with ART 0.5.18.

  • Full CPU test suite: 293 passed. The 2 failures (test_embedding_sft.py::TestLossFnValidation) also fail on unmodified main; that environment lacks the optional sentence_transformers package.
  • Known limitation: ART ≥ 0.5.20 end-to-end (not addressed here)

    From 0.5.20, ART no longer uses the vLLM installed in the environment. At training time it builds its own managed vLLM runtime: it downloads a pinned torch 2.11.0 + vLLM 0.25.1 (partly from GitHub release URLs) into $XDG_CACHE_HOME/vllm_runtime (override: ART_VLLM_RUNTIME_CACHE_DIR) and serves rollouts from there. In my test it failed to start with ImportError: tilelang is required for mhc but is not installed, raised inside that ART-managed venv, which training_hub doesn't control. This PR gets ART ≥ 0.5.20 past model construction, but full runs on those versions also depend on ART's runtime. For offline / AIPCC deployments it also means rollouts don't use the image's vLLM and need network access at training time. Whether to cap openpipe-art<0.5.20 (the AIPCC indexes still carry 0.5.17/0.5.18) or adopt ART's external runtime mode should be a separate decision.

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    Improved LoRA training compatibility across supported versions of openpipe-art.
    * LoRA training now consistently applies the configured rank and alpha, includes target modules when specified, and uses the model name for run identification when supported.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 186 lines (+169 / -17) across 3 files Reviewer: xingliu-netizen Review duration: 4082m
    All Vouch review confidence checks passed
    Residual risk 0.12 = Change Risk (0.37) × (1 − Review Confidence (0.68)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 186 lines diff across 3 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.35 · 1 substantive comment(s)
    0.35
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    67%
    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.313
    Real PR Conversation Timeline
    1 comments
    "Review active on #162"
    general weight: 0.35
    Assignees
    Maxusmusti Maxusmusti
    Labels
    risk: low confidence: 67.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: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    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: 67.5% · Lower = rushed or shallow review
    67.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: 12.1% · Safe to merge
    12.1%