Skip to content

【No.7 2/2】feat(lora): publish immutable adapters for resident sessions - #476

Merged
SigureMo merged 14 commits into
redai-studio:mainfrom
overloadedHenry:feat/lora-engine-publication
Nov 16, 2026
Merged

SigureMo merged 14 commits into
redai-studio:mainfrom
overloadedHenry:feat/lora-engine-publication

Conversation

@overloadedHenry

@overloadedHenry overloadedHenry commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Publish immutable adapters for resident sessions

关联 issue #418,作为 PR1 #475 的后续 PR。

What

将不可变 LoRA(低秩适配)版本接入 SGLang、常驻会话和异步训练,连接训练快照导出、引擎加载、会话绑定和旧版本回收。发布期间,旧会话继续使用绑定的版本;只有全部目标引擎验证新版本后,才切换新会话的默认版本。旧版本在会话结束、引擎请求排空后回收。

本 PR 依赖 feat/immutable-lora-publication 提供的状态核心,合入顺序为 PR1 → PR2。以下描述 PR2 相对 PR1 的增量。

Why

原地更新固定名字的 adapter,会让多轮会话在不同轮次使用不同权重。全局暂停生成和清空缓存又会影响仍在运行的会话,因此需要让旧会话继续使用原版本,同时为新会话发布新版本。

这要求训练导出、引擎加载和会话生命周期共同遵守版本状态机的约束。发布失败时,系统仍需保留默认版本和待清理副本的状态;HTTP 超时既不能证明加载失败,也不能证明副本已经消失,清理必须核对引擎的实际状态。

How

不可变产物与发布

  • 产物与传输。 自动训练发布使用共享目录中的不可变文件产物(FILE),包含 adapter tensor、配置和 manifest。同机共享内存传输(SHM)保留为另一条发布接口。
  • 验证与提交。 每个目标引擎校验实际接收的内容,再加载独立命名的 adapter。发布器核对回执,并使用指定版本执行 1 token greedy 探针;全部目标验证通过后,状态机才提交默认版本。该探针验证版本可用性,数值一致性仍需单独验收。
  • 状态核对与失败清理。 Ray runtime 持有发布状态,并定期核对引擎实际状态。失败发布先隔离对应尝试,再关闭接收入口、排空请求并卸载;即使缺少加载回执,runtime 仍会查询并清理实际副本。

引擎与会话

SGLang 补丁提供 inventory、load、fence 和 unload 控制接口。受管 adapter 禁止隐式重载,也不能经旧接口绕过控制;请求引用保留至调度器报告终态,避免因请求取消而提前卸载。

会话在首次允许派发请求时绑定版本,工具等待、abort/resume 和后续轮次均保留该绑定。生成请求携带明确的 lora_path,直接路由到已验证的引擎。会话终结后释放版本引用,样本记录实际绑定的版本号。

补丁覆盖 SGLang 0.5.17 和 0.5.20。由于 0.5.20 的并行采样会扩展自动生成的请求 ID,本 PR 仅为逻辑 prompt 建立父状态和引用。前缀请求与采样子请求共享引用,直到全部请求终结。

训练接入与启用条件

训练先完成底座同步,再发布初始 adapter;后续更新导出新快照,通过独立发布并发组调用 runtime。训练进程共享发布结果,避免某个进程提前退出集合通信。

容量不足时保留当前版本并跳过本次发布。发布失败或结果未确认时,训练保留 pending 版本及原产物,并抛出错误;本 PR 不提供训练作业的自动故障恢复。

该模式通过 RolloutManager.configure_lora_training(...) 显式启用,配置须早于训练 actor 的 set_rollout_manager。该 API 接收共享产物目录、底座指纹和有效的探针 token;共享目录须对全部目标引擎可见,并按训练作业隔离。现有训练命令不会自动启用此模式,当前没有专用 CLI 开关。

自动发布须满足以下条件:

  • Megatron、fully-async、Agentic rollout 和 LoRA adapter 模式。
  • 冻结底座,训练与推理使用独立 GPU,固定单模型引擎池。
  • 关闭 colocate/hybrid、rollout offload 和自动恢复;配置检查会拒绝启用 use_fault_tolerance 或 use_health_check。
  • 引擎的数据并行、流水线并行度均为 1,使用单 tokenizer worker;暂不支持 prefill/decode 分离、推测解码或 HiCache 外部存储层。

保留 K 个版本时,max_loras_per_batch 至少为 K+1,max_loaded_loras 不小于 max_loras_per_batch。例如,K=2 时可将两者均配置为 3。

Testing

CPU 测试使用生产共享内存序列化器和实际补丁定义,HTTP 与 GPU worker 执行边界使用测试替身。并行采样回归使用完整的请求归一化和请求处理方法,覆盖默认、字符串、列表形式的请求 ID(RID),以及混合 LoRA 请求。

已有 GPU 验收:SGLang 0.5.17

以下结果使用 SGLang 0.5.17。验收环境为单机 Qwen3-0.6B / GSM8K,1 张训练卡和 2 个推理引擎,张量并行、流水线并行度均为 1。训练验收使用独立脚本,脚本未随本 PR 提交。

场景 已验证结果
真实训练发布 完成 2 次 optimizer 更新,双引擎提交 v0/v1/v2
跨更新训练会话 8 条旧会话按实际 abort 前缀恢复 v0,与 24 条新 v1 样本共同进入下一训练批次和实际 loss
工具与会话恢复 独立探针覆盖外部工具、非空 abort 和跨发布恢复;探针不进入 optimizer batch
持续负载 288 个请求全部完成;发布期间未观察到全局 pause/flush/abort_all 调用
容量不足 跳过发布后继续训练;旧版本释放并回收后可发布新快照
发布失败与超时 覆盖接收端拒绝、提交后控制回执超时,以及加载成功后的 HTTP ACK 超时;失败作业按预期抛错退出

Add detached adapter snapshots with canonical content digests and
position-weighted transport checksums. Introduce a synchronous version
manager with atomic publication, idempotent retries, session references,
capacity limits, and fenced cleanup decisions.

Keep engine I/O and runtime integration separate from the state core.
Cover failure ordering, engine and shard replacement, and late replies
with CPU scenarios and reproducible seeded event replay.

Validation: 34 CPU tests pass, including 100,000 seeds and 6.4 million
replayed event steps. Tests also pass after the lora_versions rename.
All pre-commit checks pass. Real engine and GPU integration follow in
subsequent changes.
Reject regressive cleanup snapshots as a whole, preserving fencing and
admission state without combining fields from different observations.
Allow request counts to grow until both loading and admission are closed.

Move the backend-independent version core and tests to engine/lora_versions.
Extend seeded replay to two concurrently active shards and verify that
closing one shard preserves the other shard's version references.

Validation: 41 CPU tests pass, including 100,000 seeds and 6.4 million
replayed event steps. Focused reproductions confirm that the previous
implementation accepts all three cleanup regressions and this change
rejects them. All pre-commit checks pass.
Load and verify full adapter snapshots on every target engine before
committing a new default. Retain shared-memory storage and version capacity
until fenced cleanup confirms physical absence.

Add instance-aware engine inventory and controls, receiver checksums, TP
acknowledgement aggregation, and idempotent partial-load cleanup. Keep LoRA
request references until scheduler completion, including cancellation and
parallel sampling, and prevent implicit reloads of retired managed names.

Reuse the existing adapter export and add CPU protocol regressions plus an
opt-in two-engine GPU test. Pre-commit checks and 66 CPU cases passed across
separate runs; real GPU integration remains unverified.
Read the TP size from Scheduler.ps when collecting managed LoRA update
results, preventing worker crashes. Cover the actual ParallelState layout
and successful single- and multi-rank responses in CPU regressions.

Make opt-in GPU acceptance prepare reproducible local model fixtures and
own its two engine processes. Cover publication rollback, draining, stale
unload rejection, cache isolation and adapter slot reuse. Compare numerical
results against isolated references with matching cache histories.

Validated targeted CPU regressions and all three GPU acceptance cases
across two runs, plus SGLang patch applicability and pre-commit checks.
Persist complete engine-format snapshots with content validation and
idempotent publication. Load and verify file tensors on each SGLang worker
while retaining existing fencing, replica verification and commit semantics.

Add artifact and managed file-loading regressions, and extend opt-in GPU
numerical isolation coverage to file transport. Combined CPU validation:
93 tests passed; GPU acceptance remains unrun.
Coordinate replacement with publication and reconciliation, and swap clients
under the same locks after the instance CAS. Preserve recovery retries and
reject stale replacements even when no snapshots remain.

Continue recovering the default when a retired version loses its last session
during verification, while preserving real load and probe errors.

Add concurrency, cancellation, stale-client and same-endpoint retry regressions.
Validation: 103 CPU tests and 4 GPU acceptance cases passed; full pre-commit passed.
Add a runtime owner for immutable adapter publication, reconciliation,
Session references, and verified engine replacement. Keep each Session on
its first bound version across tool calls, pauses, and retries, and route
managed generation directly without ambiguous transport replay.

Expose explicit RolloutManager configuration for a fixed single-model
engine pool. Publish before injecting Session owners and finish Sessions
before closing the runtime and engines.

Validate lifecycle races, recovery, routing, and cleanup with CPU
regressions and four GPU acceptance cases; all 365 related cases pass.
Add explicit training configuration for immutable adapter publication on
fully async Megatron Agentic runs with a frozen base and fixed engine pool.
Synchronize the base once, then export and publish adapters without
pausing rollout. Preserve pending artifacts for idempotent caller retries
and keep the current version when capacity is exhausted.

Share control-plane failures across training ranks before leaving a
collective stage. Serialize publication and disposal separately from the
generation event loop, and retain actor-forward synchronization.

Validation: 462 related cases pass, including real SHM and GPU acceptance
and a two-rank Gloo to Ray runtime to GPU publication case. One existing
LoRAMerge API compatibility case remains skipped. The live case uses
synthetic adapters and does not cover optimizer steps or NCCL base sync.
Forward upstream adapter-export arguments through the Bridge splice wrapper.
Keep zero-staleness rollouts open until their training partition is complete,
so training does not wait for rows that only a blocked next rollout can fill.

Set positive staleness explicitly in the existing close-eligibility fixture.

Validation: 157 targeted tests passed, one unavailable LoRAMerge test skipped;
all pre-commit hooks passed. A single-node GSM8K run completed two optimizer
steps and published three adapter versions to two inference engines.
Merge main at 11a1de8 into the immutable LoRA publication branch.
The five publication core and test files remain byte-for-byte unchanged.

Validation: 41 CPU tests passed; all pre-commit hooks passed.
Merge the updated publication core branch, including main at 11a1de8.
Preserve the CUDA 12 SGLang 0.5.17 patch and port managed FILE/SHM
publication, fencing, cleanup, and request leases to SGLang 0.5.20.

Track only logical parents when parallel sampling expands request IDs,
and retain leases until every dispatched child terminates. Reject global
health-check recovery through both managed configuration entry points.

Validation: 360 CPU regression tests, 60 SGLang 0.5.17 compatibility tests,
and four additional Agentic interaction checks passed. Both patches apply
to their exact pinned sources; Python syntax and all pre-commit hooks pass.
New runtime image builds and GPU validation were not performed.
@rai-studio-bot

rai-studio-bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for contributing to Relax, @overloadedHenry! 感谢你为 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 · 已审批:GUOGUOPOT
团队审批(relax-block-reviewers) ⏳ 0/1 · 可联系:Aurelius84, Yangruipis, RexFlux, yuanlehome, SigureMo, NINGBENZHE, Lemon-412
CI ✅ 已通过

@SigureMo SigureMo changed the title feat(lora): publish immutable adapters for resident sessions (PR2) 【No.7 2/5】feat(lora): publish immutable adapters for resident sessions (PR2) Oct 23, 2026
@SigureMo SigureMo changed the title 【No.7 2/5】feat(lora): publish immutable adapters for resident sessions (PR2) 【No.7 2/5】feat(lora): publish immutable adapters for resident sessions Oct 23, 2026
@overloadedHenry
overloadedHenry marked this pull request as ready for review October 25, 2026 19:37
@overloadedHenry
overloadedHenry requested a review from a team October 25, 2026 19:37
@SigureMo

Copy link
Copy Markdown
Member

【No.7 2/5】

确认一下一共是 5 个 PR 么?可以根据实际情况调整

@rai-studio-bot

rai-studio-bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Nyanpasu 审查看板

审查状态: 💬 已完成 · 有补充意见

审查版本: 4d54d60

目标分支: main

已完成合入 main/#475 后的兼容性复审,未确认新增代码缺陷。作者已补充 SGLang 0.5.21 单机验收结果表,但所测提交、CUDA 13 镜像标识、命令与日志仍待补齐;多节点保持未验证。新增报告:https://github.com/redai-studio/Relax/pull/476#issuecomment-6848945809

审查阶段进度范围与结果
常规审查 ✅ 已完成 当前31个文件均接收;30个文件与上次审查内容一致,沿用相应引擎、会话和训练源码证据。#475 已合入,原核心及测试退出本 PR 范围。此次未重复本地测试;上轮4个定向 CPU 用例结果对应 eb9b5f1,并非当前提交的运行结果。
深度审查 ✅ 已完成 检查新版状态核心的历史压缩、回执撤销与发布/回收/替换调用;终态守卫和 engine_instance() 接口保留,未确认兼容性缺陷。已评估新增单机报告的覆盖范围;当前没有可独立核验的运行记录,本次未运行 GPU/多节点作业,缺少相应硬件与服务环境。

本次没有需要列入看板的问题。

改进建议(非阻塞)

拆分

💡 1 个拆分方案

#475 已合入,当前剩余31个文件可选拆为引擎发布→resident 接入→自动训练三层;继续维持现有2/2结构也合理,本建议不阻塞合入。

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

flowchart LR
    target["目标分支"]
A["PR A"]
target --> A
B["PR B"]
A --> B
C["PR C"]
B --> C
Loading
部分PR 主题内容与范围验证
A 引擎发布与回收 三版 SGLang 补丁(含补丁内回归)、lora_client.py、artifact.py、publisher.py、engine_instance() 与引擎 runtime 的非训练接口。携带 test_artifact、test_managed_lora、test_managed_request_lifecycle、test_lora_runtime_backend、GPU 发布测试及 test_runtime 前五个非训练用例和公共辅助函数;#475 已合入的核心不再拆分。 对应版本 CPU 回归及双引擎 GPU 数值/KV 隔离、请求排空和槽位复用。作者已报告 0.5.21 单机结果;精确环境和运行记录待补,本次未重跑。
B resident 会话接入 Session/pipeline 绑定增量、agentic.rollout.bind_agentic_lora_runtime 及 Ray RolloutManager 手工 configure_lora_versions、生命周期和固定池守卫。携带 test_agentic_rollout 的 managed 会话/直连/关闭增量,以及 test_lora_runtime_wiring 前六个手工配置用例和 wiring fixture;训练字段及条件、finish_eligibility 参数化归 C。 对应会话与手工 wiring 回归;验证首次允许派发绑定、工具等待/abort-resume 固定版本、丢回执重试、收尾及关闭。以手工发布验证旧新会话共存。
C 自动训练发布 training.py、Megatron actor/export、DCS device_direct/client.engine、Bridge 参数转发、runtime.publish_for_training(含 VersionState import)、Ray 训练配置/发布方法及 _lora_training_config 与相关守卫条件、零 staleness 修正。携带训练/actor/DCS 专属用例、weights_getter 新例及 sys import、actor_http_timeout 改动、test_runtime 末两例、wiring 从 prepare_training 起的训练用例和 fixture 字段、finish_eligibility 参数化;保留显式启用和共享目录说明。 训练、actor、DCS 定向回归及实际镜像下底座先同步、后续连续发布、容量跳过、pending 重试和 rank 结果一致。作者已报告单机 0.5.21 训练/失败/取消场景;多节点未验收,当前报告未标明所测提交、CUDA 镜像及命令。
如何按依赖提交(stack)

已确认 head 来自 overloadedHenry/Relax fork;作者的上游写权限未能独立核实。

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

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

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

相关 PR

💡 实现与合入建议

#475 前置依赖已满足,撤销原先等待其合入的建议;#476 与 #629 仍是互补能力,没有新增硬性顺序。

https://github.com/redai-studio/Relax/pull/475 · b60bc67b12a48afcc6e5607fc6665709e36144cb · 目标分支 main

https://github.com/redai-studio/Relax/pull/629 · 155497c223da5f3aa48e51aa1d8be449859ae2f2 · 目标分支 main

实现取舍: 保留已合入的 #475 状态核心与本 PR 独有的 engine_instance(),无需重复引入核心。#476 提供稳定 adapter 绑定、发布与回收,#629 提供片段来源和消费年龄审计;两者不能完整替代。

当前 PR 调整: 当前已保留回执撤销、历史压缩及 getter。今后与 #629 合并 service.py、actor.py 和 client/engine.py 时保留各自职责:绑定版本标注先进入片段审计;LoRA version_id 与 dense DCS 发布 ordinal 分开。adapter 未登记到相应策略映射时,年龄保持 unknown/null,不用相同数字推断同一身份;无需为本次协调扩大实现范围。

合入顺序: #475 已于 498167c 合入。#476/#629 可按各自准备程度独立合入,后合者适配共享消费接口;仅扩展 LoRA 数值年龄审计时才需要带策略/来源命名空间的成功 commit→ordinal 映射。

依据与验证范围: 只读对照,未测试组合实现。前序合入确认:https://github.com/redai-studio/Relax/pull/476#issuecomment-6846585734 。当前 getter:https://github.com/redai-studio/Relax/blob/4d54d60019572dce8b40afaa6ce9372bf3377301/relax/engine/lora_versions/manager.py#L161 ;审计范围:https://github.com/redai-studio/Relax/blob/155497c223da5f3aa48e51aa1d8be449859ae2f2/relax/agentic/policy_audit.py#L55 。作者新增 GPU 表为自报结果,多节点未验收;不得据此宣称组合路径已验证。

提交范围 · 接收 31 · 建议移出 0 · 待确认 0

接收 31 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。

文件结论仓库维护必要性依据替代去向或方案
docker/patch/sglang/v0.5.17.patch
docker/patch/sglang/v0.5.20.patch
docker/patch/sglang/v0.5.21.patch
接收 为当前 SGLang 0.5.21 镜像和保留版本提供不可变 LoRA 控制与请求生命周期补丁。 issue #418、PR #476 的既有范围,以及 GUOGUOPOT 关于 SGLang 0.5.21 + CUDA13 适配验证的请求。 当前生产与对应测试位置合理;一次性硬件实验记录保留为 PR 证据。
relax/agentic/pipeline/runtime.py
relax/agentic/rollout.py
relax/agentic/session/service.py
relax/backends/megatron/actor.py
relax/backends/megatron/weight_update/lora_adapter_sync.py
relax/backends/sglang/lora_client.py
relax/distributed/checkpoint_service/backends/device_direct.py
relax/distributed/checkpoint_service/client/engine.py
relax/distributed/ray/rollout.py
relax/engine/lora_versions/artifact.py
relax/engine/lora_versions/manager.py
relax/engine/lora_versions/publisher.py
relax/engine/lora_versions/runtime.py
relax/engine/lora_versions/training.py
relax/utils/megatron_bridge_utils.py
接收 不可变发布、会话绑定、训练接入及合并当前 main 后的兼容修正。 issue #418、PR #476 的既有范围,以及 GUOGUOPOT 关于 SGLang 0.5.21 + CUDA13 适配验证的请求。 当前生产与对应测试位置合理;一次性硬件实验记录保留为 PR 证据。
tests/cpu/backends/megatron/test_actor_http_timeout.py
tests/cpu/backends/megatron/test_actor_lora_publication.py
tests/cpu/backends/sglang/test_lora_runtime_backend.py
tests/cpu/backends/sglang/test_managed_lora.py
tests/cpu/backends/sglang/test_managed_request_lifecycle.py
tests/cpu/distributed/checkpoint_service/test_lora_training_publication.py
tests/cpu/distributed/checkpoint_service/test_weights_getter.py
tests/cpu/distributed/ray/test_lora_runtime_wiring.py
tests/cpu/engine/lora_versions/test_artifact.py
tests/cpu/engine/lora_versions/test_runtime.py
tests/cpu/engine/lora_versions/test_training.py
tests/cpu/test_agentic_rollout.py
tests/gpux4/backends/sglang/test_managed_lora_gpu.py
接收 保护生产发布/训练/会话边界;按现有 CPU 与多卡测试目录放置,新增生命周期回归对应当前补丁。 issue #418、PR #476 的既有范围,以及 GUOGUOPOT 关于 SGLang 0.5.21 + CUDA13 适配验证的请求。 当前生产与对应测试位置合理;一次性硬件实验记录保留为 PR 证据。
Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.

@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.

审查通过

已核查不可变发布、会话绑定、安全回收及异步训练接入,未确认需要修改的缺陷。固定 head 的相关 CI 已通过;四个专用 GPU 验收用例被跳过,本次未独立执行多节点/GPU 集成,不能据此确认 SGLang 0.5.20 的真实 GPU 行为。拆分及 #475 合入顺序建议见审查看板,均为非阻塞意见。

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

@overloadedHenry

Copy link
Copy Markdown
Contributor Author

【No.7 2/5】

确认一下一共是 5 个 PR 么?可以根据实际情况调整

不一定,先看一下第一轮 review 意见吧。目前从开发流程是分功能按顺序去实现的,拆分起来不会麻烦。

@overloadedHenry overloadedHenry changed the title 【No.7 2/5】feat(lora): publish immutable adapters for resident sessions 【No.7 2/2】feat(lora): publish immutable adapters for resident sessions Oct 26, 2026
@overloadedHenry

Copy link
Copy Markdown
Contributor Author

@SigureMo 任务已完成,请求 review。

@GUOGUOPOT

Copy link
Copy Markdown
Contributor

感谢这次贡献,这里想请你补充一下当前运行环境的适配和验证。

我们目前已经在使用 SGLang 0.5.21,这个 PR 的补丁仍落在 0.5.17 和 0.5.20 上。建议先将补丁适配到当前版本,并重点在 SGLang 0.5.21 + CUDA 13 的实际训练镜像上完成 GPU 验证。

Merge main at 931726a while preserving managed LoRA session binding,
publication cleanup, and initial base synchronization. Combine the updated
rollout handshake, observability, and topology broadcast with managed safety
checks, and restore snapshot name-map initialization to the constructor.

Port managed LoRA control, payload verification, and shared request leases
to SGLang 0.5.21 while retaining the main branch cancellation behavior.
Preserve both sides of the SGLang 0.5.17 patch and the Agentic regression suite.

Validation: 422 core CPU regressions, 63 SGLang 0.5.17 compatibility cases,
13 tokenizer lease tests, and 4 snapshot tests passed. Both full SGLang
patches apply to their pinned source revisions. Real GPU integration was not
run; the pre-existing 0.5.21 parallel-sampling parent-RID cancellation gap
remains outside this merge resolution.
Track logical and child request IDs so parent cancellation reaches active
parallel samples. Retain shared LoRA leases until scheduler completion.
Validate batch IDs atomically and guard delayed cleanup and adapter
acquisition against request ID reuse.

Add eight CPU regressions using real tokenizer classes. Move ten CPU test
files into tests/cpu and the two-GPU acceptance suite into tests/gpux4,
updating shared test imports.

Validation: 274 CPU tests passed with GPUs hidden, and four GPU acceptance
cases collected. The full patch applies to the pinned SGLang source and
matches the validated environment.

@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.

源码复审完成,GPU 验证待补充

已核查 0.5.21 适配及当前会话/训练接入,未确认新增代码缺陷;4 个定向 CPU 用例通过。当前镜像 GPU 验证请求仍缺可核验结果,旧 0.5.17 报告和 CPU 用例不能证明 0.5.21 + CUDA13 的实际运行。请补充对应 head、镜像标识、GPU 验证命令与结果,本轮暂不新增通过结论。范围、验证限制及非阻塞协调建议见审查看板。

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

SigureMo pushed a commit that referenced this pull request Nov 13, 2026
# feat(lora): add immutable adapter version state machine

关联 issue #418,作为 PR2 #476 的前序PR。

## What

新增 `relax/engine/lora_versions`,提供不可变
LoRA(低秩适配)快照和版本状态机,用于协调版本发布、会话绑定和旧版本回收。会话绑定版本后,后续发布不会改变该绑定;旧版本只有在会话引用释放、引擎请求排空并确认物理副本消失后,才能完成回收。

本 PR 提供状态核心,引擎通信和训练接入由后续 PR 提供。状态机根据调用方提交的验证回执和清理观测返回操作,由调用方执行网络调用和引擎卸载。

## Why

原地更新同名
adapter,会让持续运行的会话在执行过程中使用不同权重。版本发布需要与会话绑定分开:新版本可以成为新会话的默认版本,已有会话仍须使用绑定时的权重。

例如,已有会话绑定 v0 后,即使开始发布 v1,也继续使用 v0。只有全部目标引擎验证 v1 并完成 commit 后,默认版本才切换到
v1,供新会话绑定;已有会话结束后再释放 v0 的引用。


异步发布中的重复调用、迟到回执和引擎重启,还可能让过期事件影响当前状态。因此,状态机统一管理版本身份、发布尝试和引擎实例,并依据会话引用与引擎清理结果决定何时回收。

## How

- **冻结权重并确定版本身份。** 快照将 tensor 复制到独立的 CPU 存储,隔离后续训练写入。规范化的 manifest
覆盖底座指纹、adapter 配置和 tensor 内容,SHA-256 摘要与版本号共同构成 adapter 名称。
- **以 commit 作为默认版本的唯一切换点。** 发布按 reserve → verify → commit
推进。同版本、同内容的发布可以幂等重试,内容冲突则被拒绝。
- **隔离过期回执。** 回执携带 `attempt_id`、引擎实例身份和
`lora_id`,旧发布尝试或旧引擎实例的回执不能更新当前状态。
- **保持会话绑定稳定。** 同一会话重复 bind
时仍返回原版本。release、分片关闭和会话水位用于清理引用,水位不能越过仍存活的会话。
- **根据清理证据回收资源。**
会话引用归零后,先关闭引擎接收入口,再等待请求排空,之后才允许卸载。只有全部目标确认物理副本消失且发布尝试已被隔离,才释放容量。超时不等于卸载成功,状态机也会拒绝表示清理进度倒退的观测。

## Testing


定向测试覆盖快照隔离、摘要稳定性、重复发布、容量约束,以及取消竞态、迟到回执、引擎实例替换和分片关闭。随机事件回放用于检查默认版本、容量和引用计数的不变量。
@SigureMo

Copy link
Copy Markdown
Member

#475 已合,辛苦解决下冲突,并基于 sglang 0.5.21 补一下验证报告~

Merge main's LoRA state-machine hardening, wholepack recipe decoupling,
and Qwen3.5 VPP tuning.

Keep receipt revocation and compact completed-version records while
retaining engine_instance() for engine replacement and retry. Preserve
the expanded state-machine regressions.
@overloadedHenry

Copy link
Copy Markdown
Contributor Author
验收内容 SGLang 0.5.17:历史结果 SGLang 0.5.21:最新结果
部署拓扑 单机,1 张训练卡+2 个单卡推理引擎 相同
模型覆盖 Qwen3-0.6B;另有 Qwen3.5-0.8B 引擎测试 Qwen3-0.6B
真实训练与自动发布 通过:2 次更新,发布 V0/V1/V2 通过:2 次更新,发布 V0/V1/V2
Session 跨更新固定版本 通过 通过:旧会话保持 V0,新会话使用 V1
引用释放与旧版本回收 通过 通过
旧请求运行期间加载新版本 通过 通过
过期卸载、退役版本请求拒绝 通过 通过
接收端拒绝与部分发布回滚 通过 补充通过:失败副本回收,默认版本保持 V0
容量不足后的训练继续与发布恢复 通过 补充通过:V2 跳过,回收后发布 V3
提交后的发布回执超时 通过 补充通过:重复确认不新增加载或提交
加载成功后的 HTTP ACK 超时 通过 补充通过:清理有效,迟到 ACK 未恢复副本
发布等待者取消专项 通过 新增通过:两次真实 RPC 取消;关闭等待在途发布完成
工具调用、生成中断与跨更新恢复 通过独立探针验证 补充通过:真实工具调用,恢复前缀和预算一致
旧样本进入下一训练批次 通过:8 条旧 V0+24 条新 V1 进入实际 loss 补充通过:相同覆盖
SHM/FILE、KV 隔离、槽位复用 通过 通过:指定比较最大误差为 0

这是目前的测试范围,还有需要我补充的吗?对于多节点的验收目前只能麻烦内部测一下了。

@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.

合并兼容性复审完成

已核查 #475 合入后的发布、回收与实例替换路径,未确认新增代码缺陷。新增 0.5.21 验收表已覆盖本轮关注的主要单机路径,暂不需要扩大测试矩阵;请补充这些运行对应的 commit、CUDA 13 镜像标识、启动/测试命令及关键日志链接,便于核验实际镜像验证要求。多节点保留为未验证范围,待具备硬件时验收。范围和证据限制见审查看板。

Powered by Nyanpasu with gpt-6.1-sol xhigh, 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 🐾

@SigureMo
SigureMo merged commit 3816c3e into redai-studio:main Nov 16, 2026
16 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants