Skip to content

task: Add staged evaluation to service-reuse campaigns #704

Backlog

Description

@lirx-pd

task: Add staged evaluation to service-reuse campaigns

Current state: 提案,未定案。现有 service_reuse 冻结一套评测协议。refresh-references 可变更测试条件并重测参照性能,但不能切换整套性能和精度协议,也不重测独立比较父版本的精度。#467 的条件变更决定已明确要求新条件下重新验收候选。#513 的后续决定保留这一要求,并将 profiling 改为补充证据。#480 中的历史待决说明不再是本提案的阻塞项。

Decision needed: 请拟议负责人和验收人确认分阶段范围、RunSpec 接口、全链路轮次预留以及与 #697 续跑的组合验收。以下字段和 CPU 样例数值供定案,不是仓库默认值或模型验收门槛。

Next action: 确认负责人、验收人和范围后,按本 Issue 冻结配置、切换记录和证据绑定,再认领实现及回归验证。

Goal and acceptance

  • Problem / desired outcome: Day 0 新模型的初始服务可能比目标慢数十倍。为 service_reuse 提供默认关闭的分阶段评测,先用低负载、少量性能指标和小样本精度加快迭代,再切换到正式协议。末期可以追加正式协议未覆盖的负载和保护约束,减少优化只对原负载有效的风险。
  • Completion criteria:
    • 阶段协议显式启用。 未启用时维持原命令、配置、结果及 refresh-references 行为。每阶段恰好使用一套现有格式的性能和精度协议,允许不同阶段换数据集、评分器、样本数与门槛,不支持同一阶段并行拼接多套精度评分。快速迭代阶段可以减少场景、指标、请求量与精度样本,也可以使用更宽松的阶段门槛。它仍执行功能、就绪检查和本阶段声明的全部必测项,PASS 只在本阶段有效。它不是可选的 screening 命令。screening 仍只是诊断,不替代或截断本阶段的正式测量。
    • 在 start 保证必经阶段的轮次可达性。 按全局累计已结算逻辑轮触发切换,PASS 和 FAIL 各计一轮,未决的 INCONCLUSIVE 不触发切换,同一逻辑轮的重试不分配第二个名额。预配置触发轮数必须是严格递增的正整数,最后一个触发轮数必须小于总轮数上限。相邻触发点之间和最后一个触发点之后,各必经阶段都须至少有一个独立候选轮。达到边界后自动进入待切换状态,不再分配旧阶段的新轮。追加阶段在冻结前用同一规则检查当前轮次边界和剩余候选轮,不得透支后续必经阶段的名额。轮次可达只保证有机会跑候选,不保证候选通过。预算不足时拒绝配置或追加,不自动扩容。
    • 切换前同时核对时间和轮次。 切换与后续候选测试在轮次边界分开执行。用 RunSpec 声明的切换与首轮时限,在启动切换服务前检查剩余搜索时间至少覆盖两者之和,且另保留既有 final 预留。末期追加要在冻结为必达目标前通过这项检查。切换只占评测时间,不占候选轮。switch_timeout_seconds 覆盖两份参照的评测总时长,first_round_timeout_seconds 限制新阶段首个逻辑轮的每次评测尝试,显式重试重新核对剩余预算。沿用既有独立清理时限和 task: Complete formal performance testing and decouple profiling in service-reuse campaigns #513 的 profiling 时间核算。不能以缩减样本量或挪用 final 预留来达成准入。
    • 在新协议下固定两份参照。 在切换开始前锁定原始基线和上一阶段已确认的比较父版本,分别用新阶段全量性能与精度协议采证,不使用未验收的工作区修改。源码身份、有效配置和执行条件一致时可合并为一次运行。两者的性能向量、精度结果与判定分别留存。可信的父版本精度低于新门槛时,可保留其性能作单步比较参照,但不得把它当作新阶段合格候选。精度未测、超时、无效或绑定不匹配属于参照不完整。对绝对门槛,基线有有效低分也可作为性能参照,候选仍须过绝对精度门槛。对 baseline_comparison,使用新协议下原始基线的已验证精度分数,不用父版本或旧阶段分数替代。
    • 参照齐备后原子提交。 复用 campaign 锁和服务生命周期。先留存切换请求、触发轮次或原因、原阶段和目标协议、两份参照版本及预算。两份参照的数据、实际服务绑定和清理证明均验证通过后,原子更新活动阶段、reference_epoch、协议及参照指针。任一参照缺失或清理未验证时,切换为 INCONCLUSIVE,保留旧活动状态并阻止继续计轮和启动 final。恢复只核对和结算既有证据,不启动服务。显式重试只复用同一切换下完整、清理已确认且绑定不变的子运行。重复恢复不重复推进纪元或计费。清理确认后可取消未提交的执行,但不能借此撤销已冻结的必经阶段。
    • 按新纪元重新诊断、排名和计停滞。 比较父版本用于单步收益和回退限制,原始基线用于累计回退限制。切换时的两份参照留作阶段锚点,只有选中新阶段的合格候选才按原规则更新后续比较父版本。此前的排序、诊断和 profile 留档,不充作新纪元证据。保持现有行为,PASS 即使未被选中也清零停滞计数,基础设施或证据失败不计为无收益。新阶段成功提交时清零 streak 和已通知标记,保留旧事件。若旧阶段已出现 action: pause,先按原流程记录分析并解除暂停,再继续切换。增加跨阶段的 action: pause 回归,验证新阶段只按本纪元连续拒绝计数和暂停,重复恢复不重复发事件。
    • 区分正式验收和末期追加验收。 正式阶段获得新通过后才可显式追加阶段。追加前冻结新增场景、指标及门槛,完整保留既有正式验收项和口径。追加阶段若被用于继续调优,只能表述为「在追加约束下通过」,不得作为未见样本的泛化证据。本 Issue 不实现独立盲测。若另行验收泛化,需要在搜索前冻结独立输入和判据,这批输入只用于独立 final,不得参与候选调优。
    • 没有当前阶段新通过,不启动 final。 完成所有必经切换后,须有候选在当前验收阶段通过性能和精度门禁并被选中,final 才能独立复测。使用该尝试绑定的协议、原始基线和它获选时的比较父版本,不与自己比较。参照重测、此前版本的 PASS 或旧 profile 均不满足准入。profiling 继续按 task: Complete formal performance testing and decouple profiling in service-reuse campaigns #513 处理,缺失、失败或未配置不改变合格评测的结论或 final 资格。预算尚可继续时,没有新通过属于可恢复的 INCONCLUSIVE,可验证清理后再提交候选。预算耗尽或经授权明确结束仍无新通过,记录终态 INCONCLUSIVE 和原因,不回退到旧阶段报通过。已冻结的阶段如需撤销或放宽,须由验收负责人记录正式范围变更,不能由执行代理或超时逻辑跳过。
    • 与 task: Allow managed campaigns to continue after a failed final evaluation #697 的显式续跑组合。 正式阶段的独立 final 得到有效 FAIL 后,按 task: Allow managed campaigns to continue after a failed final evaluation #697 已接受的 service 路径显式续跑。沿用会话锁,绑定前次 final 的尝试 ID 与续跑理由,同阶段仍使用原冻结协议,不变更总轮数上限、截止时间和 final 预留。final 和续跑请求本身不占候选轮。续跑候选首次准入最多分配一个逻辑轮。重放同一请求不重复启动候选或扣减预留。若实际执行中断,按现有清理和恢复规则显式重试,仍用原逻辑轮。只有新候选逻辑轮结算为 PASS 或 FAIL 后,阶段的已结算轮数才增加一次。续跑不绕过必经切换和新阶段验收。这是对运行期计数与结果归属的验收,独立于 start 的阶段可达性检查。
    • 报告可核对。 status、CLI 结果和看板显示活动阶段、待切换阶段、原因、协议版本、参照和剩余轮数/时间、final 阻塞原因。原始样本、聚合、精度结果、源码 Git revision、有效配置、服务和运行 ID、清理凭据都绑定到阶段和比较纪元。status、summary.json、看板和导出逐项保留每次 final 的尝试 ID、候选、判定、证据、原阶段、比较纪元和冻结协议,不按活动阶段重标或重算。会话最近一次确定结论仍按 task: Allow managed campaigns to continue after a failed final evaluation #697 保留。如果截止时间不允许重新评测,或必经阶段仍待切换,单独展示当前阶段尚无有效 final 及阻塞原因,不能把前次留存的 PASS 或 FAIL 报为本阶段结论。

RunSpec 与切换接口提案

RunSpec 通过现有 --evaluation-config 引用首阶段协议。以下是该 JSON 增加的可选字段,不是完整配置。默认不声明 staged_evaluation。启用时,首阶段用原顶层协议,transitions 按顺序引用各自完整的协议,路径相对于声明的协议目录,协议及其输入随计划只读留存。各阶段 ID 唯一,预配置的最后一步是 formal_stage_id。

{
  "staged_evaluation": {
    "initial_stage_id": "quick",
    "formal_stage_id": "formal",
    "transitions": [
      {
        "stage_id": "formal",
        "after_completed_rounds": 3,
        "evaluation_config": "formal.json",
        "switch_timeout_seconds": 120,
        "first_round_timeout_seconds": 60
      }
    ]
  }
}

达到计划轮次时,status 显示待切换。提议沿用 campaign refresh-references --next-stage --reason <原因> 执行计划切换,成功后按新纪元诊断并提交候选。末期追加使用 campaign refresh-references --stage-config <json> --reason <原因>,追加描述沿用 stage_id、evaluation_config 和两个时间字段,不传 after_completed_rounds。这两种入口与现有 --conditions 互斥,阶段协议不同不靠修改原配置文件生效。

下表仅为 CPU 合成 fixture 示例。性能 gain 以比较父版本为准,回退分别约束父版本/原始基线,至少一个收益指标达到阈值才通过性能门禁。请求数为每场景每次测量,样例要求全部成功。

阶段 性能协议样例 精度协议样例
快速迭代 quick C1,4 请求,1 次预热、1 次测量。只测 TTFT p50,收益 ≥2%,回退 ≤3%/5% 8 条确定性检查,至少 7 条正确
正式评测 formal C1、C4,各 32 请求,1 次预热、3 次测量。TTFT p50、TPOT p50,收益 ≥3%,回退 ≤2%/3% 正式评分器,100 条用例,至少 95 条正确
末期追加 extra 保留 formal 全量配置,新增 C8(32 请求)和 TTFT p95 回退约束 ≤2%/3%,新增指标不单独作为收益指标 保留 formal 的精度配置与门槛

最小回归矩阵

  • 轮次刚好够与少一轮。 触发点为 3 时,总上限 4 可启动且第 4 轮归正式阶段,上限 3 在 start 拒绝,即使墙钟余量充足。再测多阶段边界按顺序严格递增,重复或倒序触发点拒绝。第 4 轮通过后,总上限 5 可追加,第 5 轮属于追加阶段,总上限 4 则在冻结追加目标、启动参照服务前拒绝。修复重试复用原逻辑轮的名额。
  • 参照与恢复。 分别覆盖两版本和同版本合并、父版本有效低分和缺失精度、第一份参照完成后中断、未核实清理、预算不足、重复恢复,以及成功提交后参照和阶段只变更一次。
  • 判定与停滞。 旧阶段 PASS 加两份有效新参照仍不能 final,新阶段性能与精度通过后可独立复测。验证未配置或失败的 profiling 不阻塞、追加阶段无通过时不得回退,以及切换保留历史、重置 streak 并按新阶段触发 action: pause。
  • 分阶段 × task: Allow managed campaigns to continue after a failed final evaluation #697 组合回归。 使用总上限 5 轮的 up_to 计划显式启用阶段。快评后进入正式阶段,第 4 轮候选通过,但独立 final 为 FAIL。验证这次 final 不分配第 5 轮。显式续跑一次,在续跑候选准入后、启动前注入中断,恢复并重放同一请求。验证只保留一个第 5 轮名额,候选不重复启动,已结算轮数仍为 4。覆盖同轮执行中断后的显式重试,已结算轮数只在新逻辑轮结算时从 4 变为 5,重复恢复不再加计。再验证后续独立 final 不覆盖原 FAIL,status 和导出中每次 final 的阶段与冻结协议可核对。另测「截止时间禁止重新评测」和「必经阶段待切换」两种分支,均保留前次 final 的原始归属,不把它当成被阻塞阶段的结论。
  • 兼容性。 未启用阶段的旧配置、既有 refresh-references --conditions、AB/BA 和题包行为不变。

Scope and constraints

  • In scope / out of scope: 仅扩展普通项目的 service_reuse,包括阶段配置、轮次与时间准入、参照重测、恢复、判定及展示。首版不通过阶段切换改变模型、量化规格或部署拓扑,不实现阶段内多评分器编排、独立盲测、默认 CI 新通道或自动扩轮。不在本 Task Issue 中规定实际模型门槛。
  • Relevant dependencies, shared interfaces or limits (if any): 共用 Harness 的 campaign 锁、执行器、参照证据和 final,不另建调度器。主分支的现有刷新已经拒绝轮数耗尽,并在变更条件时清零停滞。已通过但未选中的候选也清零停滞。分阶段路径需在成功提交时保持对应语义,并覆盖整个计划的轮次可达性,不能只依赖刷新时的单点检查。阶段复测的完整正式成本仍需预留。续跑只组合 #697 已接受的服务路径,不扩展到 Top-K、按名复测候选或预算延期。

Ownership and authorization

  • Proposed by / actual requester: lirx-pd.
  • Status: Proposed.
  • Accountable parent (Issue-level owner, if assigned): lirx-pd.
  • Slice implementer(s) / acting contributor (if assigned): lirx-pd.
  • Goal-acceptance owner: Dong1017.
  • Accepted decision or scoped delegation: None

Inputs and deliverables

Completion and closure

  • Who accepts completion and may close: 经确认的验收负责人根据完成条件和回归证据验收,由获授权的 Issue 负责人发布 closure summary 后关闭。功能验收不等于模型性能、精度或泛化通过。
  • Remaining uncertainty / next decision: 确认拟议负责人、验收人、接口命名和首版范围。保留新阶段新候选通过的要求。若未来需要仅重新验证未改动的父版本,或做仅在 final 使用的盲测,另行冻结准入与判据。

Activity

  1. added
    kind:task
    on Nov 26, 2026
  2. Dong1017 commented on Nov 26, 2026

    @Dong1017
    Collaborator

    Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

    Not ready to build yet. The switch, final-gate and late-stage rules fit together with the merged #480 base, but the numbers, RunSpec fields, owners and the open #467 rules they depend on are still missing, so the decision the body asks for can't be accepted yet.

    What it asks: a default-off staged service_reuse evaluation. It has ordered stages, a switch after N settled logical rounds, re-measured baseline and comparison-parent references, an optional late stage with extra scenarios, and final only after a new candidate passes the current stage. The body asks the Issue owner to confirm three points before design or code: the switch boundary, the late-append rule, and the new-pass rule for final.

    Top gaps:

    1. Depends on task: Support service-reuse and multi-scenario optimization in managed campaigns #467. Add service-reuse evaluation for project campaigns #480 says the profile-failure and changed-condition final rules are still waiting for an owner decision. A stage switch is a changed condition, so the design should wait for those rules.
    2. No numbers or schema. Switch round count, switch and first-round time caps, stage thresholds, sample counts and RunSpec field names are all unset.
    3. Scope conflict. The scope line says "不新增多套独立精度评分编排", but each stage also declares its own accuracy dataset and scorer.
    4. No owners. Accountable parent, goal-acceptance owner and implementer are all blank, and status is Proposed.
    Details

    Clarifying questions

    1. Which values and field names define the switch boundary and the time caps?
    2. Is a per-stage scorer allowed, given the scope line?
    3. Can early stages use reduced performance and accuracy gates? The body says both "cheap feedback" and "该阶段规定的完整性能与精度门禁", which read differently.
    4. Is screening in the completion criteria the same stage as 快速迭代 in the table? Use one name.
    5. If the late stage never gets a pass, is INCONCLUSIVE terminal? Who decides to retire that stage?

    Carry-over from #480 review. An earlier review comment on #480 (head 6c468262, 2026-11-17) flagged two problems: accepted-but-unselected rounds were counted toward stagnation, and refresh-references did not reset the streak. Confirm both are fixed before reusing that code. The switch must reset the streak and add a regression for the action: pause case.

    What I checked

    Next steps

    1. Name the accountable owner and goal-acceptance owner on the issue.
    2. The owner decides the task: Support service-reuse and multi-scenario optimization in managed campaigns #467 final-rule questions, then answers the three decision points above with concrete values.
    3. Once the owners accept the spec, write the stage config, switch-record and evidence-binding spec, then implement. Implementation is unassigned. lirx-pd built the Add service-reuse evaluation for project campaigns #480 base and is the natural candidate if they claim it. Dong-bot cannot write code or run tests.
  3. zengchuang-hw commented on Nov 26, 2026

    @zengchuang-hw
    Contributor

    NO PASS

    支持默认关闭的分阶段评测,尤其是先凑齐新协议下的两份参照,再原子提交阶段;旧阶段的 PASS 不得替代新阶段的独立 final。定案前请补一条全链路轮次可达性验收。 现稿只在「切换时」检查下一阶段仍有候选轮,没约束前一阶段不能先把后面必经阶段所需的名额用完。

    例如总上限 3 轮、快评在完成第 3 轮后才触发正式阶段:即使所有快评都成功、墙钟和 final 时间充足,正式阶段也已无法产生必需的新候选。类似地,选配末期阶段若只预留两份参照的时间、却没有独立候选轮,不应先冻结为必达目标。现有 刷新入口会在轮次用尽时拒绝,final 也要求当前纪元的新验收。请在 start 校验触发阈值严格递增且给各后续必经阶段至少保留一轮,追加阶段时在冻结前使用同一校验;补「刚好够 / 少一轮」和「同一逻辑轮重试不消耗第二个名额」的回归,不自动延长预算。

    另外,追加阶段的负载若在冻结后仍可继续参与调优,最终可称为「追加约束下通过」,不能把这批输入当作未见泛化证据。若要保留泛化结论,另留一批只在独立 final 使用的输入,并在搜索前锁定它的判据。

    本轮静态对照了现有轮次上限、参照刷新、当前纪元 final 闸门及 #467/#480 的关系;未执行服务或未来的分阶段代码。建议先由负责人确认范围与验收归属,不代作接受决定。

  4. david6666666 commented on Nov 26, 2026

    @david6666666
    Collaborator

    Dot, acting for @david6666666 under delegated Issue review.

    Please include a composition test with the accepted #697 continuation slice. Start an opted-in campaign, get a formal-stage independent FAIL, continue once, and check that neither that final nor an interrupted retry spends a staged candidate-round slot; only settlement of the new logical candidate round should count. If the deadline prevents re-evaluation, or a mandatory stage is still pending, do not report the predecessor's retained verdict as a result for that stage. Pin each retained final to its original stage/protocol in status and export. This is separate from the existing start-time round-reachability gate.

  5. added
    area:harness
    on Nov 26, 2026
  6. lirx-pd commented on Nov 26, 2026

    @lirx-pd
    ContributorAuthor

    感谢三位审阅。已更新 [#704 正文](https://github.com/InferMatrixLab/InferRSI/issues/704),主要补齐了三点。

    1. 阶段切换与验收。 RunSpec 已补齐触发轮数、切换与首轮时限,以及样例门槛。每个阶段可以使用不同的数据集、评分器和门槛,但阶段内只使用一套精度协议。快评不是 screening。切换时先按新协议重测并固定原始基线和比较父版本,再原子提交。参照刷新不算候选通过,新阶段仍须有候选通过性能和精度才能进入 final,profiling 只作补充证据。回归清单也补了停滞计数重置和 action: pause。 [#513 决定](task: Complete formal performance testing and decouple profiling in service-reuse campaigns #513 (comment))
    2. 轮次可达性与结果边界。 start 和冻结追加阶段前都校验后续必经阶段至少有一个候选轮。例如第 3 轮后切换,总上限 4 轮刚好够,3 轮则在启动时拒绝。同轮重试不另占名额。参与调优的追加负载只能证明「在追加约束下通过」。如果预算耗尽仍无新通过,记录 INCONCLUSIVE,不回退到旧阶段报通过。
    3. 与 task: Allow managed campaigns to continue after a failed final evaluation #697 的组合回归。 新增正式阶段 final 失败后显式续跑的用例。final 和中断重试不额外占轮,只有新逻辑轮结算才增加已完成轮数。每次 final 在状态和导出中保留原阶段及冻结协议。截止时间已到或必经阶段待切换时,不把历史结论当作当前阶段结果。 [#697 续跑范围](task: Allow managed campaigns to continue after a failed final evaluation #697 (comment))

    Ownership 已明确,由 lirx-pd 负责并实施,Dong1017 验收。当前仍为 Proposed,尚未实施或运行回归。请 @Dong1017 确认上述范围和验收条件。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:harnesskind:task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions