Skip to content

build(cu12): support SGLang 0.5.21 and reusable training wheels - #503

Merged
Yangruipis merged 5 commits into
redai-studio:mainfrom
Yangruipis:build/cu129-hopper-wheel-cache
Nov 24, 2026
Merged

Yangruipis merged 5 commits into
redai-studio:mainfrom
Yangruipis:build/cu129-hopper-wheel-cache

Conversation

@Yangruipis

@Yangruipis Yangruipis commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

What

为 CUDA 12.9 / Hopper 镜像接入 SGLang 0.5.21,并支持通过 PREBUILD_CACHE_TAR_URL 复用训练扩展 wheel。新增导出脚本和完整的公开构建说明。本 PR 只包含 CUDA 12 相关实现,未修改 CUDA 13 Dockerfile。

Why

升级 SGLang 后,源码补丁、Rust tree binding 和运行时依赖必须使用同一版本及 Torch ABI。每次从源码重编 FA、TE、Apex 等扩展也使后续镜像构建和版本升级耗时较长。

How

  • CUDA 12 默认使用已发布的 ghcr.io/redai-studio/relaxrl:sglang-v0.5.21-cu129,支持匿名拉取,仍可通过 BASE_IMAGE 覆盖;docker/CUDA-129.md 保留从源码构建的完整流程。对齐 SGLang patch,重建 patched Rust tree binding,并复用现有 Router / HybridEP 构建阶段。
  • CUDA 12 的 cuDNN Frontend 1.31.0+cu12 和 CuTe DSL 4.6.2 复用仓库已有的 SM90 DSA 补丁。
  • 更新 cuDNN 和 NumPy 1.26 兼容依赖;在训练扩展之后固定 Pandas / PyArrow,并补齐活动 Python 环境的 Memory Saver preload 链接。
  • 有缓存 URL 时,先校验 Torch 完整版本、CUDA、NCCL、Python、CPU 架构、C++ ABI 和 wheel SHA256,再安装 11 个训练包。未提供 URL 时保留源码编译路径;下载或校验失败会中止。
  • docker/scripts/export_train_cache.sh IMAGE OUTPUT.tar 从临时容器导出、校验并打包 wheel,同时支持源码安装和 wheel 安装的 FA3 metadata。
  • 缓存说明集中在 docker/CUDA-129.md,附 16 份可提取的构建文件;docker/README.md 保留入口链接。公开 Relax 镜像示例统一为 ghcr.io/redai-studio/relaxrl。

默认 CUDA 12 构建从 SGLang 0.5.17 切换到上述公开的 SGLang 0.5.21 / CUDA 12.9 / Hopper 基镜像,无需提前在本地编译基镜像。

缓存必须来自相同 GPU 架构、扩展源码和编译选项;ABI 校验本身不覆盖这些条件。缓存不包含运行时 JIT、Router / HybridEP 或 SGLang Rust 的构建产物。

Testing

  • pre-commit run --all-files passes
  • Tests pass (pytest tests/)
  • New tests added (if applicable)
  • Documentation updated (if applicable)

复审修复 1d15ff98 使用现有镜像完成了以下验证,本轮未重新编译:

  • v0.5.21-cu129 基镜像验过原有 11 个 wheel 的 ABI 和 SHA256,pip 离线 dry-run 也选中相同的 11 个。额外 wheel、同时删除 wheel 与哈希、连同包记录一起删除、错误版本、重复分发包、错误哈希都被拒绝。
  • 从训练镜像实际导出 FA3 wheel,并检查归档中的配置、接口与原生扩展。逐一移走三个必需文件后,导出均在写入 wheel 前失败。旧实现缺少配置时仍能导出。
  • 连续运行两次 Dockerfile 中的 Memory Saver 链接步骤,确认活动 Python 环境里的兼容链接均指向 cu12 库。

同步主线 6fdc7878 后,复用已有镜像做了以下检查。本轮没有重新编译镜像或运行训练。

  • 从仓库根目录按文档提取 16 个附录文件,检查脚本语法和文档相对链接。
  • 在官方 v0.5.21 源码的 cu129 基镜像运行 pip check,实际应用当前 SGLang 补丁和 SM90 cuDNN 补丁,检查关闭 SGLang 功能补丁时的 Transformers 依赖声明。
  • 在基镜像上校验缓存 ABI 和全部 11 个 wheel 的 SHA256。安装缓存中的 Memory Saver 后,在 H800 上完成两轮暂停和恢复,每轮释放 32 MiB,恢复后数值完全一致。
  • 在已有 train 和 dev 镜像上运行 pip check。train 的 Pandas、PyArrow 和 Datasets 导入成功。dev 的 Rust TreeCore 绑定加载成功,H800 上 FlashAttention 的输出与预期值一致。
  • 运行 pytest -q tests/cpu/tools/test_cu12_runtime_dependencies.py tests/cpu/tools/test_docker_makefile.py,47 项通过。此次 PR 与主线的测试目录无差异。

以下是同步主线前在原镜像上完成的验证。

  • GHCR 基镜像匿名拉取成功;源码精确匹配官方 v0.5.21,pip check 和 Relax v0.5.21 patch 应用检查通过。重新运行基础 GPU 算子与 FA3 / FlashInfer 离线生成检查,全部通过。

  • 单机 Hopper、Torch 2.13 / CUDA 12.9 / NCCL 2.30.7 / Python 3.12:train、dev 各 25 项版本/算子检查。覆盖 FA2/FA3 的 FP16/BF16、causal、变长、GQA 和梯度数值对照;Hadamard、FlashMLA dense/sparse、TE BF16/FP8、Apex、INT4、ModelOpt 校准与反向传播。

  • 两种 Memory Saver hook 各完成两次暂停/恢复,每次释放 32 MiB,恢复后数据完全一致。

  • 基础镜像和 dev 的 FA3 / FlashInfer 离线生成均与 Transformers 参考 token 一致;DeepGEMM、Triton、RMSNorm 实际 GPU 运算通过。

  • 双卡 DeepEP 和 HybridEP dispatch/combine 的 top-k 1/2 往返数值检查通过;生产 Rust TreeCore 绑定的插入、匹配和 backup barrier 恢复等 3 项测试通过。

  • Qwen3-0.6B 两步 colocated GRPO 成功:真实 rollout、训练、权重同步、显存卸载/恢复、两次 checkpoint 保存;两个训练步骤均检测到权重变化。

  • 导出脚本实际生成约 1.30 GiB tar;11 个 wheel 的 SHA256 和 21 个原生 .so 与源镜像一致。文档中 16 个文件可提取,Python/Bash 语法检查通过。

  • 完整 PR diff、新增文件、提交信息和 PR 正文经过私有地址、个人路径、凭证检查;Gitleaks 通过。

验证范围为单机 Hopper,未覆盖跨节点 RDMA、所有模型或长时间稳定性。公开基础层配方的官方 Torch/NCCL metadata 调整已做独立检查,本次未从零重编整套公开基础层。

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • CI/CD or build changes

Screenshots / Logs

同步主线前的完整镜像验证记录:

train: 25/25 version and operator checks passed
dev:   25/25 version and operator checks passed
cache: 11 wheel checksums + 21 native binary checksums matched
GRPO:  2 training steps, weight updates and checkpoints verified
pre-commit / Gitleaks: passed

Build the patched Rust tree binding against the CUDA 12 Torch ABI, align
runtime dependencies, and allow train builds to reuse ABI-checked wheels.

Add a cache exporter and a self-contained public CUDA 12.9 build guide.
Keep CUDA 13 changes outside this contribution.
@Yangruipis
Yangruipis requested a review from a team October 28, 2026 16:36
@rai-studio-bot

rai-studio-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for contributing to Relax, @Yangruipis! 感谢你为 Relax 做出贡献!

📚 Contribution guide / 贡献指南

Describe the problem, your changes, and how you validated them. Keep each PR focused and run pre-commit run --all-files before submitting.

请说明问题、改动和验证方式,保持 PR 聚焦,并在提交前运行 pre-commit run --all-files。

English contribution guide · 中文贡献指南

🛠️ CI commands / CI 指令
Command / 指令 Usage / 用途
/rerun Retry failed CI / 重跑失败的 CI
/rerun <target> Rerun a workflow or check / 重跑指定 workflow 或检查
/cancel <workflow> Cancel an entire workflow / 取消整个 workflow
/help Show commands and targets / 查看指令和 target
/review Request a code review / 请求代码 review

Put one command on the first line of a new PR comment. Rerun/cancel require PR authorship or repository write access.

在新 PR 评论的首行写一条指令。PR 作者或有仓库写权限的贡献者可以重跑、取消 CI。

CI usage and targets · CI 用法与 target

🔎 Merge requirements / 合入条件

GitHub:✅ 满足合入条件

Requirement / 条件 Status / 状态
审批人数 ✅ 1/1 · 至少 1 位有仓库 write 或更高权限的人 Approve · 已审批:SigureMo
团队审批(relax-block-reviewers) ✅ 1/1 · 已审批:SigureMo
CI ✅ 已通过

@rai-studio-bot

rai-studio-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Nyanpasu 审查看板

审查状态: ✅ 已通过

审查版本: 1d15ff9

目标分支: main

已通过 1d15ff9 的复审。缓存校验、Memory Saver 链接和 FA3 导出三项问题均已修复。16 项 GitHub 检查通过。默认 CUDA 12.9 最终 relax 镜像按 Dockerfile 保守计最多 75 层,距传统 Docker 的 125 层上限还有 50 层。层数依据见 https://github.com/redai-studio/Relax/pull/503#discussion_r4677617919 。

审查阶段进度范围与结果
常规审查 ✅ 已完成 已核对缓存文件集合、预期分发包和哈希校验,确认移除了固定系统路径的 Memory Saver 链接命令,并确认 FA3 导出在创建 wheel 前检查必需文件。
深度审查 ✅ 已完成 已核对两个文件的增量及 Codenip 的四项静态规则,无新增发现。默认 linux/amd64 基镜像的 manifest 和配置均为 38 层,train 和 relax 的保守上限分别为 50 层和 75 层。作者报告在已有镜像上验证了缓存、FA3 导出和链接;本轮未重建成品 CUDA 12.9 镜像或执行多节点 GPU 验证。

审查发现

待处理
编号 严重性 问题状态规则来源
暂无待处理的记录。
已解决或已取代
编号 严重性 问题状态规则来源
F1 High severity 在 train 阶段完成 NumPy 1.x 依赖修复后再检查 ✅ 已解决 —
F2 Medium severity 同步更新仍要求旧基镜像的回归测试 ✅ 已解决 —
F4 High severity 确保校验后的 wheel 替换同版本的已安装包 ✅ 已解决 —
F5 Medium severity 校验实际安装的整组缓存 wheel ✅ 已解决 训练 wheel 缓存格式与校验约定
F6 Medium severity 只在活动 Python 环境创建 Memory Saver 链接
精简建议(非阻塞)
✅ 已解决 —
F7 Medium severity [experimental · ERR001] 缺少 FA3 必需文件时中止导出 ✅ 已解决 FA3 前向导入与源码构建检查

改进建议(非阻塞)

拆分

💡 1 个拆分方案

可先独立交付 CUDA 12 的 SGLang 0.5.21 升级,再加入依赖该基线的可选训练 wheel 缓存。拆分可分别验证运行时兼容性和缓存复用。

箭头表示前置部分 → 后续部分;目标分支为 main。

flowchart LR
    target["目标分支"]
A["PR A"]
target --> A
B["PR B"]
A --> B
Loading
部分PR 主题内容与范围验证
A CUDA 12 SGLang 0.5.21 将 Dockerfile 的默认基镜像、SGLang 0.5.21 patch 应用与 TreeCore 构建、运行时依赖和默认源码编译路径更新归入 A,并包含 latest SGLang 软链接与 cu12 runtime requirements。README 的公开镜像/版本说明及 CUDA-129.md 第 1–5 节和附录随之迁移,清除对可选缓存第 6 节的交叉引用。 Memory Saver 链接的路径修复也归入 A。 在 CUDA 12.9/Hopper 的 SGLang 0.5.21 基镜像上核对源码版本、patch 应用、TreeCore 绑定及运行时依赖。验证 train/dev 的 pip check 和关键导入,并按现有 PR 的运行时范围覆盖 H800 算子、rollout、权重同步及 checkpoint smoke。
B 训练 wheel 缓存复用 在 A 的 Dockerfile 中拆出 PREBUILD_CACHE_TAR_URL、11 个训练 wheel 的校验/安装和源码回退 hunks,并新增 export_train_cache.sh 与 export_train_wheels.py。README 缓存入口及 CUDA-129.md 第 6 节、以及第 4–5 节中缓存相关的交叉引用、适用边界和验证说明一并放入 B。 缓存文件集合和 FA3 导出完整性校验归入 B。 以 A 的 train 镜像完成源码构建、缓存导出和带缓存的 train/dev 构建,并另验无 URL 时保留源码编译路径、下载或校验失败会中止。比对 ABI 清单、11 个 wheel 的 SHA256、安装版本和关键扩展导入,运行 train/dev pip check、文档列出的关键 GPU 扩展与 Memory Saver 暂停/恢复,并做一次 rollout/训练同步/checkpoint smoke。
如何按依赖提交(stack)

已核对 PR 来源为 Yangruipis/Relax fork。当前审查账号无法直接确认作者在上游仓库的写权限。

先按表重组混合提交,每部分携带对应测试和文档;逐层验证,并核对顶层最终树与原 PR 一致。独立部分各自向目标分支开普通 PR;只将有依赖的线性链组成 stack,分叉或多前置依赖按图分别安排提交。

有上游写权限: 将各层分支放在上游仓库,在已按依赖拆好的一条分支链上注册并提交(替换目标分支与分支名):

gh stack init --base <target> <layer-1> <layer-2>
gh stack view
gh stack submit

下层更新后用 gh stack rebase 调整上层,或用 gh stack sync 同步整条链。上述命令管理已拆好的分支,不会自动拆开混合提交。参见 gh-stack 使用说明。

Fork 贡献者: 分支保留在 fork,先将底层向上游目标分支提交;上层暂留本地,或在 fork 内以其前置分支为 base 开 draft PR。底层合入后,只将上层独有提交 rebase 到更新后的上游目标分支,再提交下一层;若底层被 squash,注意排除其旧提交。

Fork 内 PR 只用于增量审阅;上游 PR 的 base 不能指向 fork 独有分支。多个累计 PR 同时指向上游目标分支会包含重复差异。GitHub 原生 stack 要求所有分支位于同一仓库。

Powered by Nyanpasu with gpt-6.2-sol high, please check the suggestions carefully.

Comment thread docker/Dockerfile Resolved

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要修改

已完成 da4d00d 的构建配方、训练 wheel 复用及相关调用链审查,仍有会阻断源码构建或 TMS 训练的缺陷,需要修改。已核对依赖契约并做定向 CPU 包装/安装复现;未构建完整镜像或运行 GPU、多节点训练。当前三个 GPU CI 检查均停在基镜像解析阶段,尚未执行测试。

详情见审查看板。

Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

Comment thread docker/Dockerfile Resolved
Comment thread docker/Dockerfile Resolved
Comment thread docker/Dockerfile Resolved
Resolve NumPy 1.x compatibility and TE wheel metadata before the train
stage dependency check. Force-install validated cached wheels without
reinstalling their dependency tree, then resolve runtime dependencies.

Update the published SGLang base assertion and add a real pip regression
for replacing an installed package with a same-version cached fork.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通过复审

已核对 f018362:三个原问题均已修复,新增同版本缓存包替换回归测试单独运行通过,本轮无新增发现。完整镜像及 GPU/多节点验证尚未确认。修复确认已回复原线程;当前账号无权将线程标记为已解决,需维护者处理线程状态。

详情见审查看板。

Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

@Yangruipis Yangruipis closed this Nov 20, 2026
@Yangruipis Yangruipis reopened this Nov 24, 2026
Align the SGLang and cuDNN patch steps with the 0.5.21 base. Keep the CUDA 12.9 build guide and wheel cache instructions under docker, and drop the PR-specific test.
@Yangruipis

Copy link
Copy Markdown
Collaborator Author

/review

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审意见

4ce8dac 已同步 main,合并冲突已解除。训练 wheel 缓存的校验范围需要与实际安装的文件集合对齐,详见行内评论。CUDA 12.9 完整镜像重建及多节点运行仍缺少本次提交的验证。

审查看板

Powered by Nyanpasu with gpt-6.2-sol high, please check the suggestions carefully.

Comment thread docker/scripts/export_train_wheels.py Resolved

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审完成

已完成 4ce8dac 的 CUDA 12.9 构建复审。补充意见涉及训练 wheel 的导出完整性和 Memory Saver 链接。当前仍缺少此版本的完整 CUDA 12.9 镜像重建及多节点验证。

审查看板

Powered by Nyanpasu with gpt-6.2-sol high, please check the suggestions carefully.

Comment thread docker/Dockerfile Resolved
Comment thread docker/scripts/export_train_wheels.py Resolved
Match the installable wheel set to the manifest and all expected distributions. Require the FA3 runtime files before writing its wheel, and create the Memory Saver compatibility link only in the active Python environment.
@Yangruipis

Copy link
Copy Markdown
Collaborator Author

/review

Comment thread docker/Dockerfile

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rai-studio-bot 帮看看这个镜像是否会超层数上限?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认 CUDA 12.9 构建的最终 relax 镜像保守上限是 75 层,距 Docker 传统镜像存储的 125 层上限还有 50 层。

  • GHCR 上默认 linux/amd64 基镜像的 manifest 和配置分别列出 38 个 layers 和 diff IDs。镜像 digest 为 sha256:24fe058f0b5aa87aead7cf35b58d6a3cae6b8fc238ba870015d6a8037c1b6402。
  • 按 1d15ff98 的 Dockerfile,每条 RUN、COPY 和 WORKDIR 都按一层计,base 最多增加 2 层,train 再加 10 层,最终 relax 再加 25 层。Router、HybridEP 和 TreeCore 构建阶段只向最终阶段提供产物,最终镜像不继承它们的层链。
  • 如果用自定义 TRAIN_IMAGE,在没有额外 ONBUILD 步骤的前提下,外部 train 镜像 100 层以内仍满足这个保守预算;下游封装增加的层数另计。

基镜像层数来自注册表,train 和 relax 是按 Dockerfile 得出的上界。本轮未重建成品镜像。 Dockerfile · Moby 传统层存储上限

Powered by Nyanpasu with gpt-6.2-sol high, please check the suggestions carefully.

@SigureMo SigureMo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通过复审

已复核 1d15ff98,缓存校验、Memory Saver 链接和 FA3 导出三项问题均已修复,增量复核无新增发现。当前 16 项 GitHub 检查通过。默认 CUDA 12.9 的最终 relax 镜像按 Dockerfile 保守计最多 75 层,低于传统存储的 125 层上限。本轮未重建成品镜像或执行多节点验证。

审查看板 · 层数计算依据

Powered by Nyanpasu with gpt-6.2-sol high, please check the suggestions carefully.

@Yangruipis
Yangruipis merged commit 93e2890 into redai-studio:main Nov 24, 2026
24 checks passed
@rai-studio-bot

Copy link
Copy Markdown
Contributor

✅ Cherry-pick successful! Created PR: #778

dirtyDan0 added a commit to dirtyDan0/Relax that referenced this pull request Nov 29, 2026
Remove the managed, immutable multi-version LoRA publication introduced by
redai-studio#475 and redai-studio#476, and connect Agentic generation to the existing fixed-name
single-adapter path. This removes the version control subsystem, its public
configuration APIs, its Session ownership protocol, and its custom SGLang
control endpoints. Keep the original LoRA training and weight-transfer
paths together with the independent correctness fixes carried by those PRs.

1. The capability Relax already had

Before redai-studio#475 and redai-studio#476, Relax could train LoRA with either merge mode or
adapter mode. Merge mode folds the learned delta into the base weights
before transferring them to inference. Adapter mode sends the frozen base
once and subsequently transfers the adapter under the fixed name
relax_policy_lora. Colocate uses the existing in-memory tensor loading
path. Fully asynchronous training uses the existing bucketed NCCL path.
Ordinary rollout generation selects that adapter by sending its name as
lora_path in the native SGLang request.

That single-adapter transport is useful on its own. It reduces the amount
of weight data sent at each synchronization point. It already existed
before the version-publication PRs and remains the serving contract after
this removal. The inference engine can use its existing pause, cache
flush, same-name replacement, and resume sequence when weights change.

2. The concurrency problem that motivated the original feature

The reference was Miles #3127. Its motivating example has adapters A, B,
and C sharing a frozen base. They represent separate training identities
with their own data and training progress. When A finishes an update and
publishes A@2, existing generation using B or C should be able to continue.
An engine-wide pause and cache flush interrupts those independent tasks.
Miles addresses this by staging a fresh adapter name, transferring its
complete weights, validating the update, and opening it for sampling after
commit. The weight-update session in that path is a begin/send/end
transfer transaction.

Relax also has a possible overlap window in fully asynchronous training.
A new snapshot of its single training policy can be transferred while
requests using an earlier snapshot are still generating. The distinction
between separate training identities and successive versions of one
policy matters when choosing which parts of the reference to adopt.
Relax's integration continued to train one adapter with one current
optimizer state. It did not introduce independent A/B/C training jobs.

3. How the Relax requirement became substantially stronger

Task 7 explicitly required an Agent Session to bind a version on its first
generation and keep it through later tool turns, retries, and abort/resume.
RFC redai-studio#418 made that requirement concrete through a central version owner,
Session registrations, capacity accounting, and periodic reconciliation.
redai-studio#475 supplied the immutable identity and state machine. redai-studio#476 connected
that state to training export, engine loading, and resident Agent Sessions.
The broader contract was already present in the task and RFC before the
implementation was integrated.

The important change in scope was the lifetime of the version reference.
An inference request needs its selected weights while it can still be
forwarded, retried, queued, or executing. Whole-Session binding also keeps
the weights alive while an Agent has no inference request and is waiting
on a tool. A slow tool can therefore keep an old version resident across
several training updates. At the configured version limit, publication
must wait or skip until those Sessions release their references.

Whole-Session consistency is an additional sampling policy that needs its
own algorithmic or workload justification. The existing full-weight path
can use updated weights after rollout interruption and resumption. LoRA
training also continues to optimize the current adapter, including when
its batch contains samples produced by older versions. Keeping a Session
on an old inference version does not select that old adapter for its
training forward pass or make the batch automatically on-policy.

The managed publication mode made this stronger policy inseparable from
its concurrent-update mechanism. As a result, ordinary Agent execution
became an owner of inference-weight retention and cleanup.

4. How subsequent upstream work inherited the LoRA contract

The compatibility history helps explain the selective removal. The later
commits generally carried the Session-binding rules through changes to
shared infrastructure. Their fixes have value independently of the
sampling policy that originally required the version manager. The
following observations come from the upstream history through eb0ec97.
They describe observable code and test changes. Benefit and cost still
require a separate workload evaluation.

- redai-studio#628, 043d7a2, reworked Agentic admission and resource reuse. It kept
  lora_key, lora_binding, and the existing Session version selection. It
  changed finalization so a logical result could be published before the
  physical cleanup completed. To make that work with managed LoRA,
  _release_lora_session recorded a pending release before waiting for a
  binding task. If cleanup timed out during the wait, heartbeat still had
  responsibility for retrying the release. Its revised test explicitly
  allowed a terminal Session result while the old version's session_count
  remained one, then expected zero after background cleanup completed.
  This is a compatibility repair around an existing Session reference.
  Retain independent Session progress, result publication, background
  cleanup, and unconfirmed-request ownership. Withdraw the additional
  version reference and its pending-release/heartbeat protocol.

- redai-studio#655, d0e00f3, developed ordinary Qwen3.8 LoRA training and repaired the
  fixed-name adapter update failure path. The pre-existing managed branch
  remained alongside it. The important correction was that one rank's
  adapter-push failure had to reach all training ranks before any of them
  resumed generation or marked the new weights loaded. Keep that failure
  agreement and the ordinary model/adapter support. It does not depend on
  storing immutable versions or binding an Agent Session.

- redai-studio#720, 0f6dac5, addressed ordinary policy-sample and weight-sync
  consistency, including the effective checkpoint and quantization used by
  inference receivers. Its new sender and quantization tests were added to
  test_actor_lora_publication.py, which already hosted the managed LoRA
  tests. This made a file created for version publication contain useful
  ordinary synchronization coverage. Retain those tests in the original
  file and retain the receiver/configuration checks. Remove cases whose
  contract requires the deleted publication service.

- redai-studio#761, 21b3662, introduced shared router and multimodal replay ownership.
  It kept both the managed direct-engine transport and the normal router
  transport, wrapping them with post_generation_request. It added
  _BackendAttempt with the actual wire RID, target set, and send_done state.
  An abort acknowledgement arriving before a delayed generate request
  settled could not release ownership. _pending_backend_cleanups kept a
  Session alive while backend cleanup was unconfirmed. Managed tests also
  held session_count until a failed abort or release was safely retried.
  These changes show how a Session-bound weight reference had to follow
  the newer request-ownership model. Keep wire-RID tracking, replay leases,
  abort ordering and pending backend cleanup. Remove the separate managed
  transport, Session version reference, and LoRA release RPCs.

- redai-studio#791, 7354e4f, moved post-training inference coordination out of training
  ranks into the Actor component and inference_sync.py. It preserved the
  managed bypass of ordinary rollout-update readiness and completion
  handshakes. To select that behavior, the component queried
  get_lora_training_config and passed _managed_lora_publication through the
  shared coordinator. A feature-specific assumption therefore moved into
  the component-level orchestration API. Retain the once-per-group
  coordination, evaluation and metric settlement. Delete the old
  configuration lookup, managed parameter, and handshake bypasses.

- redai-studio#705, 50eb517, added local inference recovery around that coordinator.
  rebind_rollout_manager refreshed the managed configuration when replacing
  an inference target, and RecoveryGate supplied settlement and retry
  boundaries around training and weight synchronization. This continued
  the compatibility contract at a new lifecycle entry point. Keep rebind,
  RecoveryGate, waiting for all participating ranks, and verification of
  the expected replacement receivers. Rebinding the normal manager can
  proceed through these mechanisms after the version configuration query
  is removed.

- redai-studio#804, 8c11399, hardened ordinary multimodal IPC and request cleanup. Its
  interaction with the managed-LoRA test file was an additional fixture
  binding for _finish_ipc_dispatch. Preserve the production IPC lifecycle
  corrections and their ordinary tests. The fixture-only increment
  disappears with the removed feature test file. While rebasing the
  retained SGLang patch, keep the required IPC method bindings and use one
  consistent fixture adaptation where the old and new patch sections
  address the same lifecycle fields. Verify the resulting patch by
  applying it to the actual pinned source.

- redai-studio#805, 198f9a6, replaced the router infrastructure while keeping the LoRA
  branches around it. redai-studio#828, 250eca5, converted fault-tolerance and health
  arguments to direct reads inside the managed configuration checks. Keep
  the native routing and ordinary argument handling. The configuration
  checks that belonged exclusively to the removed version service are
  removed together with that service.

The version manager, runtime, training publisher, and managed engine
client under relax/engine/lora_versions and lora_client.py have identical
contents at redai-studio#476 and upstream eb0ec97. The repository's managed
configuration calls still occur in definitions and tests, with no training
script or example adding an automatic activation path. This establishes
how the in-repository integration evolved. External callers and deployments
are outside this source inspection.

The resulting pattern is that shared scheduling, replay, synchronization,
and recovery improved while continuing to honor a strong existing
Session contract. Maintaining that contract required repeated work in
surrounding systems even as the version-control core remained fixed.
A compatibility test demonstrates that a refactor respected its existing
contract. The justification for keeping whole-Session version pinning also
needs evidence that its sampling semantics and retention cost fit Relax's
workloads.

This removal follows those responsibility boundaries. Preserve each
independent correction at its existing owner and preserve the ordinary
single-adapter update path. Withdraw the version owner, cross-Session
weight-retention policy, dedicated transport and control APIs that caused
those systems to depend on managed publication. Reversing the original
PRs mechanically would also discard later useful work, so each affected
path is reduced to its ordinary behavior and its independent protections.

5. The concrete initialization conflict exposed by first-step prelaunch

The integration assigned a SessionKey in start_group only when a LoRA
runtime had already been installed. set_lora_runtime rejected a Shard with
any existing Groups. RolloutManager first synchronized and published the
initial adapter, then injected the runtime into the Shard fleet.

First-step prelaunch deliberately constructs PREPARE Groups before engine
initialization is complete. Their first inference requests remain queued
behind Runtime admission. Those Groups are safe to prepare before weights
are available, but the separate empty-Group configuration invariant still
rejects them. Merely deleting that check would also be unsafe. A Session
created before configuration could lack its key, and the old dispatch
branch used the presence of that key to select managed generation.

The implementation actually bound weights at the first permitted
inference dispatch. Nevertheless, its earlier key-allocation and runtime
injection rules imposed a stricter construction order. This coupled Agent
startup to initial weight publication and prevented the intended overlap
between preparing Agents and initializing inference engines.

This affected runs that explicitly configured managed publication. The
ordinary training scripts did not automatically enable that API-only mode.

6. Why the managed subsystem is removed

The additional policy required a dedicated LoRAVersionRuntime Ray actor,
SessionKey allocation, per-Session binding tasks, Shard registration,
release retries, heartbeats, sequence watermarks, engine inventory,
publication attempts, capacity states, and shutdown calls back into Shards.
Generation also acquired a LoRA-specific route directly to a verified
engine. Those responsibilities crossed training, rollout orchestration,
Agent lifetime management, and inference transport.

The integration further introduced shared-file snapshot publication and
an extra training control path alongside the working IPC/NCCL adapter
updates. Its automatic publication required a fixed Agentic/Megatron
fully-async pool and disabled recovery and several engine configurations.
These restrictions and ownership rules made the feature expensive to
maintain and exposed the initialization conflict described above.

The existing Agentic rollout-step boundary still pauses and aborts active
requests according to its scheduling rules. Resuming a Session on its old
adapter preserves weight identity across that interruption. It does not
establish uninterrupted execution for the entire Agent. Concurrent adapter
publication has a valid narrower purpose, but retaining the complete
Session-bound subsystem requires evidence for its stronger contract and
its integration cost. The feature is withdrawn here with that boundary
made explicit.

7. What this commit removes and restores

- Delete relax/engine/lora_versions, including immutable snapshot identity,
  shared-file artifacts, the version state machine, publisher, training
  publication coordinator, and the dedicated Ray actor.
- Delete the managed SGLang LoRA client and the Relax-specific inventory,
  load, fencing, and reclamation control protocol from the 0.5.17, 0.5.20,
  and 0.5.21 dependency patches.
- Remove RolloutManager's managed configuration, publication and actor-handle
  APIs, the publication concurrency group, and feature-specific fixed-pool
  restrictions on normal lifecycle operations.
- Remove Agentic runtime injection, SessionKey and version state, binding
  tasks, heartbeats, release watermarks, version metadata overrides, and
  LoRA-specific direct-engine generation and endpoint tracking.
- Remove the training publication configuration, topology lease, publication
  result handling, and the managed bypasses of normal weight-update
  readiness and completion handshakes. Retain the shared inference-sync
  implementation and its later recovery integration.
- Delete tests whose product contract disappears with the version manager,
  managed configuration, immutable publication, or whole-Session binding.
  Adapt mixed tests to exercise ordinary router, replay and request cleanup.
  Keep their original file names and their independent assertions.

SGLang's native ability to load named adapters remains available. The
removed API is Relax's additional managed publication and Session-binding
layer. Manual users of configure_lora_training, configure_lora_versions,
or get_lora_version_runtime must move to the ordinary adapter-mode path.

8. What is kept, and why each part remains useful

The fixed name relax_policy_lora, existing adapter export and gather,
colocated tensor transport, fully asynchronous NCCL buckets, merge mode,
and ordinary rollout request construction all remain in place. Ordinary
LoRA updates retain the existing scheduling and synchronization contract.
The later PRs also contain independent changes that were integrated around
the publication code. Retain those changes through their ordinary paths.

- redai-studio#655 keeps Qwen3.8 LoRA training and adapter export support. In the normal
  DeviceDirectBackend update, all training ranks reduce the adapter-push
  failure flag. A failed push raises before continue_generation, and only
  a confirmed successful push sets adapter_loaded and base_sync_done. This
  prevents rollout from using a partially updated adapter.
- redai-studio#628 keeps independent progress of Sessions within a Group and publishes
  the logical Session result before scheduling process and backend cleanup.
  _pending_backend_cleanups retains ownership of unconfirmed requests so
  cleanup can finish safely after logical retirement. The empty
  actor_fwd/reference-group gate also remains, avoiding communication to
  recipients that do not exist. Remove the separate LoRA Session-release
  and heartbeat work from this cleanup path.
- redai-studio#640 keeps synchronization of same-checkpoint NEXTN draft weights. The
  normal model and draft synchronization path continues to determine which
  inference weights are transferred.
- redai-studio#720 keeps effective receiver-checkpoint and quantization configuration
  during weight conversion and transfer. Its ordinary quantization cases
  remain in test_actor_lora_publication.py under the original file name.
  The file name alone does not make these cases publication-specific.
- redai-studio#761 keeps router and multimodal replay, response manifests, and cleanup
  using the actual wire request ID. Mixed replay tests use the ordinary
  router transport after removal of the LoRA-specific direct-engine path.
  Their success, lost-response, and late-publication expectations remain.
- redai-studio#791 keeps post-training inference coordination in the Actor component
  and inference_sync.py. Readiness checks, weight synchronization,
  evaluation completion, and metric settlement still run through the shared
  coordinator. Remove the managed flag and its handshake bypasses.
- redai-studio#705 keeps local inference recovery, RolloutManager rebinding,
  RecoveryGate settlement, and checks that the expected replacement engine
  actors actually received their weights. Rebinding no longer queries the
  deleted managed LoRA configuration API.

Keep unrelated image and model support already integrated around the
SGLang patches, including the CUDA 12/0.5.21 image work from redai-studio#503 and the
0.5.17 DeepStack correction from redai-studio#788. The dependency version pins and
existing platform patch application paths remain the basis of validation.

The following fixes introduced with the version feature also remain
because their failure modes are reachable without multi-version serving.

- Keep Megatron Bridge wrapper forwarding of *args and **kwargs in
  _make_adapter_splice_wrapper. Upstream adapter export can pass additional
  arguments such as exclude_adapter_base_prefixes. Dropping those arguments
  breaks ordinary adapter export as well. Its existing regression remains.
- Keep max_staleness > 0 in Agentic _step_can_close. With zero staleness,
  training must consume the current partition before a later rollout can
  proceed. Closing the current partition with missing samples can leave
  training waiting for rows that a blocked next rollout would have to
  produce. The existing zero-staleness regression remains.
- Keep ordinary LoRARegistry acquire and cancellation handling. Hold the
  registry lock while looking up an adapter and incrementing its request
  count so unregister cannot pass between those operations. If acquisition
  is cancelled after incrementing part of a batch, roll those increments
  back. This protects ordinary single-adapter load/unload as well.
- Keep ordinary SGLang request cleanup fixes. Requests dispatched to the
  scheduler retain their adapter reference until terminal output or abort
  acknowledgement. Parallel-sampling children share the parent's lease and
  keep it alive until all owners finish. A retired logical parent can still
  cancel its running children. These rules protect a single adapter during
  replacement as well as any normal named-adapter request.
- Keep the request lifecycle identity checks in the 0.5.21 patch. A delayed
  abort waiter or failed handler must not delete a new request that reused
  its RID. Validate a complete batch for RID conflicts before adding states
  so a later duplicate cannot leave an earlier half-registered request.
  Preserve the associated ordinary tokenizer lifecycle tests. The other
  supported SGLang patches retain their version-appropriate cleanup fixes.
- Keep the global Bridge parameter-name initialization and its regression
  for the first synchronization. That test also exercises a non-LoRA
  configuration and protects the normal weight-transfer path.

These retained pieces have explicit behavior and failure cases independent
of the removed version manager. Their presence is intentional, so this is
a selective removal that preserves independently useful fixes.

9. The small Agentic single-adapter connection

Ordinary rollout already sent lora_path=relax_policy_lora before redai-studio#475/redai-studio#476.
The earlier Agentic native /generate request did not carry that field.
After removing managed binding, enabling the engine's LoRA support alone
would still let such a request select the base model.

Add the same mode check and fixed-name field directly where the Agentic
SGLang payload is built. The implementation adds four nonblank lines and
reuses LORA_ADAPTER_NAME. Adapter mode selects the already loaded policy
adapter. Merge mode and full-weight requests retain their existing payload.
The existing router, request ID, admission, pause/resume, abort, replay and
cleanup paths carry the request. This closes the separate single-adapter
integration gap with a local request-field change.

10. Validation and evidence limits

During this removal, the retained dependency patches were applied to fixed
SGLang 0.5.17 29481685, 0.5.20 94602c9c, and 0.5.21 e00930c5 sources. All
three normal combinations, the 0.5.21 CUDA 13 two-stage application, and
the ROCm exclusion/overlay sequence applied successfully. The retained
0.5.21 embedded ordinary request regressions passed 13 cases after adapting
their existing fixture to the preserved lifecycle registration contract.
Those checks validate source transformation and CPU request behavior.

Final targeted CPU verification passed 34 existing eager Agentic generation,
backend abort-target, checkpoint-resume and Bridge forwarding tests. Three
temporary payload checks exercise the actual Agentic request construction
with controlled HTTP for full-weight, merge and fixed-adapter requests.
Full pre-commit checks passed against the complete tree. Temporary payload
checks are removed after execution. No permanent test file is added by this commit.

CUDA devices are unavailable in the local environment. Real Megatron
training, GPU numerical equivalence, multi-node execution, and rebuilt
training images remain unverified. No throughput or latency improvement is
claimed. The removed publication GPU tests are retired with their removed
feature contract, and the ordinary LoRA training tests remain available for
hardware validation.

References

radixark/miles#3127
https://github.com/redai-studio/community/blob/main/contributor-program/2026-cohort-2/official-task.md#task-7
redai-studio#418
redai-studio#475
redai-studio#476

BREAKING CHANGE: Remove Relax's managed multi-version LoRA publication APIs
and whole-Session version-pinning behavior. Ordinary LoRA merge and
fixed-name adapter serving remain supported, with fixed-name selection
also connected to Agentic generation.
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.

3 participants