Skip to content

Training's state walk is a declared TrainingPlace, and the in-engine trainer's lane is a LaneSource (card c42c4b3b, step 1 of removing Python) - #5262

Merged
joelteply merged 3 commits into
canaryfrom
c42c4b3b/python-leaves-the-live-core-engine-local
Oct 22, 2026
Merged

joelteply merged 3 commits into
canaryfrom
c42c4b3b/python-leaves-the-live-core-engine-local

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Joel 2026-10-21: "Python must be removed and deleted as long as it's properly adapted for
the other missing cases. Python takes down all performance and in place training in llama."
The cases the Python trainers cover are lanes the in-engine trainer can't reach today: a
base no lane on this node serves. The doc's state walk (ONE-RESIDENT-MODEL §S3) names the
order: the GPU here on the resident weights > a GPU on the grid > the CPU here at background
priority. This change gives that order one owner and gives the engine trainer the seam the
missing cases plug into. No behaviour changes: every trainer ranks where it ranked before.

  • adapter.rs: FineTuningCapabilities.trains_on_resident_weights (a bool) becomes
    place: TrainingPlace { ResidentHere, GridPeer, SeparateCopyHere, CpuHere, Cloud }, declared
    by each trainer. engine-local is ResidentHere; cuda-local, mlx-local and local-candle are
    SeparateCopyHere; openai is Cloud.
  • coordinator::rank orders by (place, host-native accelerator first). Within
    SeparateCopyHere, MLX still beats Candle on Apple Silicon, as before, until those copies
    are deleted. The locality tests' helpers derive the place from produces_local_artifact,
    as their tiers did.
  • engine_lora_adapter: LaneResolver (a sync Fn returning a URL) becomes Box
    { serves(base), async acquire(base) -> LaneLease { choice, hold } }. ResidentLane is
    today's live_lane_for. The run (EngineRun) keeps the lease's hold as _lane_hold for its
    whole life, so a lane stood up for one job (the CPU and grid sources next) lives exactly as
    long as that job. A reattached run trains in the lane that still holds it (None). Tests
    use FixedLane in place of the closure.

Next PRs: lift the single-purpose-lane memory gate out of cognition/eval into a shared owner;
engine-cpu (an EphemeralServingLane on the base, LanePlacement::Cpu, --train-dir with
--no-repack as measured on IntelMac 10-15); engine-grid; then delete cuda-local, mlx-local
and forge's Python paths. Not compiled here (serving node); CI compiles.

Co-Authored-By: Claude Opus 5.5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…trainer's lane is a LaneSource (card c42c4b3b, step 1 of removing Python)

Joel 2026-10-21: "Python must be removed and deleted as long as it's properly adapted for
the other missing cases. Python takes down all performance and in place training in llama."
The cases the Python trainers cover are lanes the in-engine trainer can't reach today: a
base no lane on this node serves. The doc's state walk (ONE-RESIDENT-MODEL §S3) names the
order: the GPU here on the resident weights > a GPU on the grid > the CPU here at background
priority. This change gives that order one owner and gives the engine trainer the seam the
missing cases plug into. No behaviour changes: every trainer ranks where it ranked before.

- adapter.rs: FineTuningCapabilities.trains_on_resident_weights (a bool) becomes
  `place: TrainingPlace { ResidentHere, GridPeer, SeparateCopyHere, CpuHere, Cloud }`, declared
  by each trainer. engine-local is ResidentHere; cuda-local, mlx-local and local-candle are
  SeparateCopyHere; openai is Cloud.
- coordinator::rank orders by (place, host-native accelerator first). Within
  SeparateCopyHere, MLX still beats Candle on Apple Silicon, as before, until those copies
  are deleted. The locality tests' helpers derive the place from produces_local_artifact,
  as their tiers did.
- engine_lora_adapter: LaneResolver (a sync Fn returning a URL) becomes Box<dyn LaneSource>
  { serves(base), async acquire(base) -> LaneLease { choice, hold } }. ResidentLane is
  today's live_lane_for. The run (EngineRun) keeps the lease's hold as `_lane_hold` for its
  whole life, so a lane stood up for one job (the CPU and grid sources next) lives exactly as
  long as that job. A reattached run trains in the lane that still holds it (None). Tests
  use FixedLane in place of the closure.

Next PRs: lift the single-purpose-lane memory gate out of cognition/eval into a shared owner;
engine-cpu (an EphemeralServingLane on the base, LanePlacement::Cpu, --train-dir with
--no-repack as measured on IntelMac 10-15); engine-grid; then delete cuda-local, mlx-local
and forge's Python paths. Not compiled here (serving node); CI compiles.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply and others added 2 commits October 21, 2026 18:46
…ce impl; EngineRun literal gets _lane_hold (CI on #5262)

#5262's lib build failed: the engine tests assign closures as the lane (tests/mod.rs:37,
536, 547, 567, 608, 636) and tests/part_2.rs builds an EngineRun literal. A cfg(test)
blanket impl of LaneSource for Fn(&str) -> Option<LaneChoice> keeps every existing test
unchanged (their closures now name the &str argument) and replaces FixedLane. The literal
gets _lane_hold: None.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

PASS — source review at 8f8e4d8; all hosted checks verified green.

This advances the shared training seam for resident learning: TrainingPlace replaces the resident boolean with an explicit ordering, while selection still applies hardware/base/capability gates, honors an explicit provider and retains the native-accelerator/alphabetical tie-break. Current production adapter declarations preserve their existing order. LaneSource consolidates availability/acquisition; the acquired hold moves into EngineRun through preparation and admission so it lives with the run. The resident implementation retains the existing live-lane lookup; this PR does not yet implement grid/CPU trainers or prove learning. Existing tests use the same trait through the test closure adapter. No local compilation or runtime mutation.

No blocking finding. Cormac retains integration ownership; verify the updated head if rebased.

@joelteply
joelteply merged commit 98157d2 into canary Oct 22, 2026
9 checks passed
@joelteply
joelteply deleted the c42c4b3b/python-leaves-the-live-core-engine-local branch October 22, 2026 01:14
joelteply added a commit that referenced this pull request Oct 22, 2026
…tity check (card 781885cb)

A run leased and fitted against Vram whatever lane it trained in, and re-read the node's
live lane to decide whether its chosen lane still held it. Both were the resident lane's
answers. A CPU-placed lane (IntelMac) keeps its bytes in Ram, and a lane stood up for the
run is never the live-lane record. Each lane source now answers for its own lane:

- LaneChoice.memory: the governed pool its bytes live in. The resident lane reads it from
  its placement; training_admission (request, wait, wait_bound, acquire) and
  governed_training_free take the kind instead of hard-coding Vram.
- LaneLease.still_bound: the source's check that the chosen lane (incarnation, endpoint,
  base) still answers, run inside the admission hold. Unbound::{Gone, Replaced} keeps the
  existing split: only a replaced lane returns her examples (card 0b8de4da).
- LanePlacement::pool_kind owns placement -> pool. modules::serving_daemon::pool_kind_for
  is deleted, serving_pool_kind delegates to it, and genome reads it without an upward
  import.
- Tests: eleven LaneChoice literals become LaneChoice::at(url, window).

Stacked on #5262 (LaneSource). The engine-lane source (A3b) builds on this. No local
compile (IntelMac serves); CI checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 22, 2026
…ames its own placement (Codex on #5264)

Codex's REQUEST CHANGES at ea215d0: recovery and the lane choice read the pool from the
current configuration (`main_lane_placement()`), so a placement change across a core
restart charged Ram for a run still using Vram, or the reverse.

- LaneRecord.placement: stamped at launch from the target. `LaneRecord::memory()` is the
  lane's own pool. A lane recorded before the field reads the configuration under the
  `training.lane.placement_unrecorded` probe until it relaunches. That is explicit and
  bounded to lanes an older build launched.
- ResidentWork.memory: the pool `reserved_bytes` was leased in, recorded at bind.
  `bound_memory()` reads it; a record without one was written by a build whose admission
  leased Vram unconditionally, so Vram is that record's own history.
- reclaim_resident_leases re-takes each lease via `work.bound_memory()`. Split into
  `reclaim_resident_leases_in(&daemon)` so the test hands in its own governor.
- The identity callback is `still_bound_to(rec, base, chosen, url)`, a pure function over the
  lane record, and the production closure calls it with `live_lane()`.

Tests:
- recovery_retakes_each_surviving_run_in_the_pool_it_was_bound_in: Vram-bound, Ram-bound and
  pre-field bindings, each re-taken in its own pool, with this node's configuration never
  read;
- a_lane_is_still_bound_only_at_its_incarnation_endpoint_and_base: the same lane passes; a
  moved endpoint, another base, another incarnation and no lane are refused.

Rebased on canary after #5262 merged. Not compiled here (IntelMac serves); CI checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 22, 2026
…tity check (card 781885cb) (#5264)

* Training admission follows the lane: its memory pool and its own identity check (card 781885cb)

A run leased and fitted against Vram whatever lane it trained in, and re-read the node's
live lane to decide whether its chosen lane still held it. Both were the resident lane's
answers. A CPU-placed lane (IntelMac) keeps its bytes in Ram, and a lane stood up for the
run is never the live-lane record. Each lane source now answers for its own lane:

- LaneChoice.memory: the governed pool its bytes live in. The resident lane reads it from
  its placement; training_admission (request, wait, wait_bound, acquire) and
  governed_training_free take the kind instead of hard-coding Vram.
- LaneLease.still_bound: the source's check that the chosen lane (incarnation, endpoint,
  base) still answers, run inside the admission hold. Unbound::{Gone, Replaced} keeps the
  existing split: only a replaced lane returns her examples (card 0b8de4da).
- LanePlacement::pool_kind owns placement -> pool. modules::serving_daemon::pool_kind_for
  is deleted, serving_pool_kind delegates to it, and genome reads it without an upward
  import.
- Tests: eleven LaneChoice literals become LaneChoice::at(url, window).

Stacked on #5262 (LaneSource). The engine-lane source (A3b) builds on this. No local
compile (IntelMac serves); CI checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* A surviving run is re-taken in the pool it was bound in, and a lane names its own placement (Codex on #5264)

Codex's REQUEST CHANGES at ea215d0: recovery and the lane choice read the pool from the
current configuration (`main_lane_placement()`), so a placement change across a core
restart charged Ram for a run still using Vram, or the reverse.

- LaneRecord.placement: stamped at launch from the target. `LaneRecord::memory()` is the
  lane's own pool. A lane recorded before the field reads the configuration under the
  `training.lane.placement_unrecorded` probe until it relaunches. That is explicit and
  bounded to lanes an older build launched.
- ResidentWork.memory: the pool `reserved_bytes` was leased in, recorded at bind.
  `bound_memory()` reads it; a record without one was written by a build whose admission
  leased Vram unconditionally, so Vram is that record's own history.
- reclaim_resident_leases re-takes each lease via `work.bound_memory()`. Split into
  `reclaim_resident_leases_in(&daemon)` so the test hands in its own governor.
- The identity callback is `still_bound_to(rec, base, chosen, url)`, a pure function over the
  lane record, and the production closure calls it with `live_lane()`.

Tests:
- recovery_retakes_each_surviving_run_in_the_pool_it_was_bound_in: Vram-bound, Ram-bound and
  pre-field bindings, each re-taken in its own pool, with this node's configuration never
  read;
- a_lane_is_still_bound_only_at_its_incarnation_endpoint_and_base: the same lane passes; a
  moved endpoint, another base, another incarnation and no lane are refused.

Rebased on canary after #5262 merged. Not compiled here (IntelMac serves); CI checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* reclaim_resident_leases_in takes the daemon's Arc, as acquire_guarded's receiver requires

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* A lane with no recorded placement is not offered for training, never priced from config (Codex on #5264)

Codex's remaining block at 1b2b04c: lane_memory read the current configuration for a lane
recorded before placements were. That configuration is the NEXT launch's truth, so a GPU
lane inherited across a change to cpu was priced in Ram.

lane_choice(rec, base) is now the one pure owner. A record without a placement gives no
choice (probe training.lane.placement_unrecorded), so the resident lane isn't offered until
its next launch records one. lane_memory and its fallback are deleted.

Test a_lane_is_priced_in_its_recorded_placement_and_an_unrecorded_one_is_not_offered: Gpu
gives Vram and Cpu gives Ram whatever the configuration; an unrecorded placement and another
base give no choice.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant