Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Light 科研主线 stage 6:把冻结的 question/estimand、experiment matrix、pre-registration 与 data lineage 落成最小可运行、测试先行、无泄漏、可复现且能交给 result-analysis 的实验代码。用于实现或复现训练/预处理/评测, 设计 gold/property/metamorphic 测试,控制 Python/NumPy/框架/CUDA/DataLoader 随机性,审查 train/test 或 CV fit 穿越,记录 config/code/environment/input hashes、stdout/stderr、raw metrics、patient/entity predictions 与 failure artifacts,以及运行 stage-6 checkpoint。数据泄漏或不可复现是 critical;静态扫描和同 seed 两次一致都不证明跨硬件 绝对复现。
.claude/skills/light0305-light-experiment-coding/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 258% | 0% |
| case-21 | ✗→✓ | ▲ Improved | 143% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 165% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 78% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 138% | 0% |
任务不是“写出能跑的 notebook”,而是把上游冻结计划逐行实现成可证伪、可复跑、可审计的实验。优先级:
先完整阅读 references/experiment-coding-resource-map.md。工具机制见 references/tools.md,TDD/调试红旗见 references/tdd_redflags.md 与 references/debug_protocol.md。
开始写码前读取并 hash:
split_leakage evidence;primary outcome、comparison family、exclusion、stopping 已冻结。若实现证明计划不可行,带最小复现和影响返回 research-plan,停下让人决策;不得改 config 默认值静默漂移。
优先复制 assets/project-scaffold/:
uv.lock + pyproject.toml:uv sync --locked --extra dev;configs/experiment.schema.json:每个 matrix row 的机读配置;experiment_contracts.py:data/model/metric/preprocessing 最小接口;reproducibility.py:运行期 seed helper;遵循现有仓库框架和配置格式;不要为一个实验引入付费 IDE、云追踪或私有 key。MLflow/DVC 可选,普通本地文件必须能完成 核心闭环。不可用资源明确写 UNAVAILABLE:原因,不假装通过。
在实现 preprocessing/train/eval 前:
浮点断言用 pytest.approx / assert_allclose(rtol, atol)。先声明 device、dtype、mixed precision 和容差;NaN/Inf 默认 fail。不要测“随机训练一定达到某个漂亮数”,测确定性边界和可重算事实。
fit/fit_transform,test 只 transform;Pipeline,每折只 fit training fold;split_leakage,不重造。review_gate 只识别静态形态,会漏/误报;领域语义仍要人工核对。指标异常好,先查 leakage。
分开两个目的:
fixed_repro:固定一个 seed,在同代码/data/config/environment 下做两次独立运行;randomness_estimation:按预注册 seed 列表做多次运行,估计算法随机性。多 seeds 不是患者/实体样本量,绝不拿 seed 数替代功效分析 n。
按实际使用覆盖 PYTHONHASHSEED(当前进程须启动前设)、random、NumPy、框架 RNG、CUDA、cuDNN、 deterministic algorithms、DataLoader generator/worker。记录 device/dtype/AMP、线程数、worker 数、排序键和已知 非确定算子。换 seed 应可变但可追溯;同 seed 一致也只支持同环境契约,不外推跨 release/platform/hardware bitwise 保证。
从 templates/run_manifest.template.json 生成 light.run_manifest.v3;说明见 templates/run_manifest.md。 termination 只说明进程为何停止,completion 才记录矩阵行 oracle 是否真的通过; timeout / max iterations / cancel 一律不得冒充完成。
每个 matrix row × config × seed × attempt 独立目录,至少保存:
失败 run 不删除,不覆盖成成功。禁止只交 summary CSV;result-analysis 必须能从 raw evidence 重算。
按此顺序真跑并记录 exit code:
bashpython scripts/experiment_execution_contract.py --spec experiment_execution_contract.json \ --report execution_contract_findings.json --json-out execution_contract_report.json python scripts/review_gate.py src/ --json python scripts/seed_audit.py src/train.py src/reproducibility.py python scripts/repro_gate.py --spec repro_spec.json --report repro_findings.json python scripts/run_artifact_check.py --manifest runs/EXP-01/run-a/manifest.json python scripts/run_artifact_check.py --compare \ runs/EXP-01/run-a/manifest.json runs/EXP-01/run-b/manifest.json python ../light-orchestrator/scripts/run_checkpoint.py \ --file .light/passport.yaml --stage 6 --findings repro_findings.json --write --ts <ISO-8601>
experiment_execution_contract.py 消费 light.experiment_execution_contract.v1(模板见 templates/experiment-execution-contract.example.json,故意 fail-closed):核 as_of、frozen scope/evaluator/budget、failure-tree handoff、matrix/DAG、run status/termination/failure class、partial checkpoint/resume command、环境与 cache provenance、repro level 分层、远程/付费执行授权。timeout/OOM/preempted/max-iterations 不得写 completed;frozen_at 与远程授权 approved_at 不得来自未来;decision=NOT_READY/UNKNOWN 本身阻断推进;run 必须绑定冻结 matrix_rows 中的 row,且每个 row 必须绑定 failure_tree_refs(hypothesis_ids、branch_action_ids、适用的 guardrail_ids);新增实验行要先回 research-plan 修订;completed run 若上游要求 guardrail,completion 必须留下 guardrail_evidence_artifacts,否则不得交 result-analysis;实际 walltime/cost/compute_units 与远程预计成本不得静默超过冻结预算,超限必须有预算覆盖授权;PARTIAL/RESUMABLE 必须有 checkpoint SHA 和 resume command;请求 CLEAN_ENV_RERUN/CROSS_PLATFORM/INDEPENDENT_REIMPLEMENTATION 必须有对应证据;远程/付费/HPC 运行在 user_authorization=APPROVED 前不得 RUN_READY。
stage 6 的 canonical critical 只有:
leakage;reproducible。float/security 在研究 checkpoint 按 spec 为 warn;review_gate 可作为独立交付阻断门,不得借此扩大 checkpoint critical 面。 stage-6 门失败就在本阶段修,不伪造 ROUTES[6] 出边。
同固定 seed 两次必须是独立 run dir;run_artifact_check.py 先核 matrix/config/env/code/input 身份和 started_at/ended_at 时间轴(带时区、不倒序、不来自未来),再比较 predictions/raw_metrics hashes。 静态 seed/leakage 门 + 同 seed pair 都通过,仍只是一组有边界的证据。
交付全部 completed/failed runs、coverage、manifests、predictions、raw metrics、logs、test evidence 和 canonical findings。 不要在 stage 6 替 result-analysis 选择性丢 run 或先写结论。
只有 result-analysis 产出真实实现 bug 或不可复现 root cause时,orchestrator 才可:
bashpython ../light-orchestrator/scripts/reroute.py \ --findings result_findings.json --stage 7 --passport .light/passport.yaml
reroute 只给建议。落 7→6 back-edge 前停下,让用户拍板;用户确认后才调用 passport add-back-edge,并带回失败命令、 期望 vs 实得、artifact pointers 修根因。统计不显著、效果小、计划不可行不自动等于实现 bug。
== 断言,不静默吞 NaN/Inf。experiment_execution_contract.py 吗?scope/evaluator/budget、DAG、run status、failure class、resume、资源成本、repro level 和远程授权都闭合了吗?.light/failure_tree_report.json 的 locator/hash/status?每个 matrix row 是否有 failure_tree_refs?completed run 是否留了 guardrail evidence?as_of、frozen_at、远程 approved_at、run started_at/ended_at 都是真实已发生时间吗?没有未来预填或结束早于开始吧?matrix_row_id 是否来自冻结 experiment matrix?实际 walltime/cost/compute_units 或远程预计成本超预算时,有预算覆盖授权吗?TDD、seed、安全扫描、复现实验都不是 Light 独有。R1 真同类已普遍具备 config-first、smoke、immutable run、 lineage 与 keep/discard。这里的实际增量是:
split_leakage;Round 3 再补 run→冻结 matrix row 身份绑定与实际/预计资源成本预算超限门,防止新实验行或付费扩跑绕过上游批准; Round 3 续补 failure-tree handoff 与 guardrail evidence,让 research-plan 的失败/无结论/kill criterion 不在执行端丢失;
诚实落后项:没有 MLflow 式查询 UI、DVC remote、GPU scheduler、仓库语义索引或自主 experiment search;静态门仍有边界。
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 26,271 | 6,642 | -75% | 1 | 1 | 0% | 5,189 | 3,632 | -30% | 0 | 0 | — |
case-02 | fail→fail | 24,839 | 4,537 | -82% | 1 | 1 | 0% | 4,140 | 3,314 | -20% | 0 | 0 | — |
case-03 | fail→fail | 29,264 | 4,799 | -84% | 1 | 1 | 0% | 5,662 | 3,490 | -38% | 0 | 0 | — |
case-04 | fail→pass | 9,199 | 11,261 | +22% | 1 | 1 | 0% | 1,402 | 5,024 | +258% | 0 | 0 | — |
case-05 | pass→fail | 5,654 | 8,197 | +45% | 1 | 1 | 0% | 805 | 3,849 | +378% | 0 | 0 | — |
case-06 | fail→fail | 13,015 | 28,644 | +120% | 1 | 1 | 0% | 2,187 | 8,005 | +266% | 0 | 0 | — |
case-07 | pass→pass | 12,881 | 13,543 | +5% | 1 | 1 | 0% | 2,125 | 5,398 | +154% | 0 | 0 | — |
case-08 | pass→pass | 10,966 | 13,025 | +19% | 1 | 1 | 0% | 1,822 | 5,309 | +191% | 0 | 0 | — |
case-21 | fail→pass | 11,429 | 6,513 | -43% | 1 | 1 | 0% | 1,714 | 4,162 | +143% | 0 | 0 | — |
case-09 | pass→pass | 11,951 | 8,003 | -33% | 1 | 1 | 0% | 1,739 | 4,357 | +151% | 0 | 0 | — |
case-10 | fail→pass | 12,345 | 13,836 | +12% | 1 | 1 | 0% | 1,924 | 5,089 | +165% | 0 | 0 | — |
case-11 | pass→pass | 72,199 | 9,756 | -86% | 1 | 1 | 0% | 1,723 | 4,663 | +171% | 0 | 0 | — |
case-12 | pass→pass | 10,816 | 11,367 | +5% | 1 | 1 | 0% | 1,841 | 4,876 | +165% | 0 | 0 | — |
case-13 | fail→pass | 13,866 | 7,562 | -45% | 1 | 1 | 0% | 2,438 | 4,343 | +78% | 0 | 0 | — |
case-14 | pass→pass | 16,648 | 17,507 | +5% | 1 | 1 | 0% | 2,721 | 5,882 | +116% | 0 | 0 | — |
case-15 | fail→fail | 12,473 | 8,579 | -31% | 1 | 1 | 0% | 1,780 | 4,394 | +147% | 0 | 0 | — |
case-16 | pass→pass | 13,612 | 13,289 | -2% | 1 | 1 | 0% | 2,156 | 5,287 | +145% | 0 | 0 | — |
case-17 | fail→pass | 15,262 | 14,617 | -4% | 1 | 1 | 0% | 2,236 | 5,311 | +138% | 0 | 0 | — |
case-18 | fail→pass | 8,160 | 5,022 | -38% | 1 | 1 | 0% | 1,257 | 3,865 | +207% | 0 | 0 | — |
case-19 | fail→pass | 17,783 | 8,704 | -51% | 1 | 1 | 0% | 2,974 | 4,677 | +57% | 0 | 0 | — |
case-20 | pass→pass | 13,297 | 10,228 | -23% | 1 | 1 | 0% | 1,840 | 4,751 | +158% | 0 | 0 | — |
case-22 | fail→pass | 12,342 | 7,170 | -42% | 1 | 1 | 0% | 1,871 | 4,120 | +120% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 18 counted toward the lift figure. The other 4 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +32 percentage points is the difference between those two pass rates over the 18 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.