Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
235 changes: 13 additions & 222 deletions .gitignore

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/MILES_RL.md
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ identity keeps the normal in-phase recovery behavior instead.
## Engine selection

`--rl-engine {legacy,ports}` selects how an island drives Miles. It is accepted
by `yeto launch`, `python3 -m yeto.rl.learner`, the SSH harness (through the
by `yeto launch`, `python3 -m yeto.rl.adapters.miles.island_entry`, the SSH harness (through the
launch arguments), `scripts/benchmark_rl.py` and `yeto-rl-export`. The default
is `ports`; the choice is never inferred from the model, island count or other
flags, is fixed before startup, and does not change during a run.
Expand Down Expand Up @@ -851,15 +851,15 @@ it joins outer sync, and refuses to start if the hash differs.
Where the spec comes from:

1. `--rl-algorithm-spec PATH`, a v1 or v2 JSON file. `yeto launch` and
`python3 -m yeto.rl.learner` both accept it; it applies to `ports` only.
`python3 -m yeto.rl.adapters.miles.island_entry` both accept it; it applies to `ports` only.
2. Without that flag, the legacy CLI builds the spec exactly as in R0.
3. Mapped Miles flags found in the extra argv are absorbed into the spec.

A spec that only uses R0 fields keeps the R0 v1 canonical JSON, so its hash
is unchanged. Setting any new field switches the spec to
`yeto-rl-algorithm-spec-v2`.

**Absorb and reject.** `yeto/rl/engine/miles_adapter/algorithm_flags.py` maps
**Absorb and reject.** `yeto/rl/adapters/miles/algorithm_flags.py` maps
each Miles flag to a spec field. Every flag in that table is adapter-owned:

- A mapped flag in the extra argv is absorbed. It is recorded as
Expand Down Expand Up @@ -986,7 +986,7 @@ algorithm change declares it after its single-GPU smoke passes.
`--rl-allow-unverified-mechanism DIMENSION:NAME` (repeatable, for example
`features:clip_higher`) exempts only the named mechanisms from the "not
declared" check, and only on a single-island run **without outer sync**.
Every launched run and every `yeto.rl.learner` run joins a syncer, so today
Every launched run and every `yeto.rl.adapters.miles.island_entry` run joins a syncer, so today
the allowance is refused on those entry points; only the fake engine and the
dry run (which models a sync-less single island) accept it.
Every other check still applies. The allowance does not change the hash. It is
Expand Down Expand Up @@ -1714,7 +1714,7 @@ $M --dry-run --extra "--advantage-estimator ppo --gae-variant cross_segment_per_

### Port responsibilities

| port | responsibility | Miles adapter (`yeto/rl/engine/miles_adapter/`) |
| port | responsibility | Miles adapter (`yeto/rl/adapters/miles/`) |
| --- | --- | --- |
| `RolloutPool` | generate one rollout of complete groups from the published policy; members | `rollout.py` over `InferenceController` + `RolloutExecutor`; metadata from `rollout_meta_hook.py` inside the rollout process |
| `TrainerGroup` | one optimizer step on an opaque batch; onload/offload; grad norm for the per-round invariant | `trainer.py` over the single-cell actor group |
Expand Down Expand Up @@ -1933,7 +1933,7 @@ it is rejected as undeclared without the allowances and accepted with them.

## Algorithm status matrix

"Declared" means the Miles adapter (`yeto/rl/engine/miles_adapter/entry.py`,
"Declared" means the Miles adapter (`yeto/rl/adapters/miles/entry.py`,
`MILES_DECLARED`) accepts the mechanism without
`--rl-allow-unverified-mechanism`, which requires GPU evidence that it takes
effect. Declarations say nothing about training gains. G1 = single island on
Expand Down Expand Up @@ -2161,8 +2161,8 @@ The implementation is intentionally confined to the RL boundary:
| --- | --- |
| `yeto/rl/core.py` | canonical LoRA, deterministic RL fragments, policy snapshots |
| `yeto/rl/decoupled.py` | raw anchors, BCAST/PULL/PUSH state, final cut and benchmark consolidation |
| `yeto/rl/miles.py` | rollout-token validation, safe-boundary hook, island checkpoint |
| `yeto/rl/learner.py` | Miles argument mapping and runtime configuration |
| `yeto/rl/adapters/miles/legacy/engine.py` | rollout-token validation, safe-boundary hook, island checkpoint |
| `yeto/rl/adapters/miles/island_entry.py` | Miles argument mapping and runtime configuration |
| `yeto/rl/export.py` | authoritative checkpoint to standard PEFT |
| `yeto/rl/initial_adapter.py` | validated Decoupled PEFT policy warm start |
| `scripts/benchmark_rl.py` | equal-work native/strict/decoupled comparison |
Expand Down
2 changes: 1 addition & 1 deletion docs/WANDB.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ count — so a curve can be filtered by cloud, region, or GPU.

## RL islands

An RL island runs MILES behind `yeto.rl.learner`, so there is no inner
An RL island runs MILES behind `yeto.rl.adapters.miles.island_entry`, so there is no inner
loop here to instrument — but the island already keeps its own structured
event tape (`--event-tape`, written by `_append_rl_event`), carrying every
rollout round, fragment broadcast, fragment push, and strict-invariant
Expand Down
2 changes: 1 addition & 1 deletion docs/research/rl-algorithms/research.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- 但 `grpo` 和 `gspo` 的 advantage 只把 reward 广播到每个 token,KL 被丢弃(`LH/advantages.py:53-57`;`LH/math_utils.py:462-469` 的 `get_grpo_returns`)。
- KL 只有在 `--use-kl-loss` 时才进入 loss(`LH/losses.py` 的 `use_kl_loss` 分支)。
- 因此 `kl_coef>0` 加 GRPO 的效果是多占一份 ref 模型的显存和前向算力,梯度没有任何变化。
- legacy 的 `expert_full` 分支固定传 `--kl-coef 0.001`(`yeto/rl/learner.py:1068`)。legacy 用的是 agentenv fork,那边的 GRPO 是否同样忽略 KL **[未核实]**。
- legacy 的 `expert_full` 分支固定传 `--kl-coef 0.001`(`yeto/rl/adapters/miles/island_entry.py:1068`)。legacy 用的是 agentenv fork,那边的 GRPO 是否同样忽略 KL **[未核实]**。

5. **在 ports 的串行 driver 下,外层同步不会让 rollout 数据变旧** [源码]:
- 每轮的顺序是:用已发布策略生成,训练一次,在安全点 apply cut,再发布(`driver.py:1-10, 418-443`)。
Expand Down
4 changes: 2 additions & 2 deletions evidence-forkg1/s13-forkg1-modal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ cfg.validate()
keys = ("app_name", "function_name", "gpu_request", "num_nodes", "gpu_exact", "retries", "timeout_s",
"tape_volume_name", "tape_subdir", "cpu_request", "memory_request_mib", "image_ref")
print("modal cfg:", {k: getattr(cfg, k, "<absent in this code>") for k in keys})
learner = next(l for l in task.run.splitlines() if "-m yeto.rl.learner" in l)
print("learner flags:", learner.split("-m yeto.rl.learner", 1)[1].strip())
learner = next(l for l in task.run.splitlines() if "-m yeto.rl.adapters.miles.island_entry" in l)
print("learner flags:", learner.split("-m yeto.rl.adapters.miles.island_entry", 1)[1].strip())
print("algorithm sha:", args.rl_expected_algorithm_sha256)
print("overlay:", getattr(args, "rl_miles_overlay", None)); import re as _re
print("setup overlay lines:", [l.strip()[:160] for l in (task.setup or "").splitlines() if _re.search(r"REFUSING|sha256sum|git apply|overlay", l)][:12])
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_reward/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- 按名称:`import examples.custom_reward.reward` 后名称 `ends_with_label` 已注册。
- 按引用:`examples.custom_reward.reward:ends_with_label`。
- Miles 下取 `--custom-rm-path` 的值:`yeto.rl.engine.miles_adapter.rewards.miles_custom_rm_path(<名称或引用>)`;名称未注册时报错并列出已注册名称。
- Miles 下取 `--custom-rm-path` 的值:`yeto.rl.adapters.miles.rewards.miles_custom_rm_path(<名称或引用>)`;名称未注册时报错并列出已注册名称。
- 加载时记录插件身份(模块、函数名、源码文件 sha256,见 `yeto.rl.rewards.registry.load_reward`),改源码身份即变。

测试:`python -m pytest examples/custom_reward/test_reward.py`。
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Evidence moved out of the repository

Run logs that used to live under this directory were removed from git by change `rl-code-quality-cleanup` (2026-10-12).
Copies are kept outside the repository at:

/home/michael/work/infra-drafts/evidence/add-nebius-verda-modal-clouds/run-logs/

The relative path under that directory is the same as the old path under this directory.
Moved files:

- task-8.7-cleanup-verification.txt
- task-8.7-command.sh
- task-8.7-modal-island-metrics.txt
- task-8.7-syncer-tape.txt
- task-9.2-budget60-post-change.json
- task-9.2-budget60-post-change.stderr
- task-9.2-budget60-pre-change.json
- task-9.2-budget60-pre-change.stderr
- task-9.2-command.txt
- task-9.2-post-change.json
- task-9.2-post-change.stderr
- task-9.2-pre-change.json
- task-9.2-pre-change.stderr
- verify_cleanup.sh

This file was deleted.

This file was deleted.

Loading
Loading