Skip to content

feat: system-aware model catalog — SystemProfile + PlacementPlanner + MoE-paged K3 on-ramp (slice 1 of #19) - #2018

Merged
joelteply merged 3 commits into
canaryfrom
feat/system-aware-catalog
Jul 26, 2026
Merged

joelteply merged 3 commits into
canaryfrom
feat/system-aware-catalog

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

Slice 1 of catalog = f(system × storage × grid): the system recognizes its own hardware + drives, and resolves a model's placement against that reality — storage and grid are RESOLUTION FIELDS, never gates (a laptop degrades, never gets excluded; solve-for-public-users).

Pieces

  • SystemProfile (capacity/system_profile.rs) — the keystone. Composes HardwareClass + live DeviceCapacity + detected drives (auto-flags the big cold/frozen tier) + the serving budget via host_budget_from (reuses the one vram_headroom 0.80, reads no config itself — inherits M5's config_env::vram_headroom() transitively, adds nothing to the config sprawl).
  • PlacementPlanner (provisioning/placement_planner.rs) — the never-exclude resolver. LocalRecommended | NeedsProvisioning{to_cold_tier} | MoePaged | GridRouted | Degraded. Reuses footprint_for + plan_serving.
  • MoE resolution = M5's option B: MoE-ness is GGUF-derived ({arch}.expert_count via locate_layer_sets), NOT a hand-authored Model field (avoids an 11-site churn + honors the catalog's ask-the-GGUF discipline). MoePaged is the K3 on-ramp: a 594GB MoE model serves LOCALLY by freezing experts on the cold drive + paging the hot subset — fits a 32GB GPU by residency, not by shrinking.

Invariants (unit-tested, pure cores)

  • A laptop and a workstation resolve the SAME oversized model — one degrades, MoE pages locally when a cold tier exists — neither is ever excluded.
  • The 0.80 headroom applies to the VRAM ceiling; UMA budgets from the RAM slice.
  • MoE + cold tier → MoePaged; MoE + no cold tier → grid/degrade like any oversized model.

Notes

  • Windows: cargo test harness doesn't build on windows-msvc (pre-existing Unix-socket cfg gap, separate lane); validated via cargo build --lib, tests run in CI (Linux).
  • Foundation for the K3 MoE expert pager (weights drop imminently) — the MoePaged resolution is where expert_ingest + the dynamic Rust pager plug in next.

🤖 Generated with Claude Code

joelteply and others added 3 commits July 26, 2026 11:47
…storage × grid)

ONE measured descriptor of what THIS box can do, so the model catalog can resolve
its offering against reality instead of a static list. Composes existing primitives
(never re-measures what another module owns):
  - HardwareClass (boot silicon/VRAM/RAM classifier, via probe_hardware_profile +
    classify_hardware)
  - live DeviceCapacity (free GPU/RAM now)
  - the serving budget via host_budget_from — REUSES the one SERVING_BUDGET_FRACTION
    (0.80), reads no config itself, so it inherits that single source and adds nothing
    to the config_env sprawl
  - detected drives, auto-flagging the big offload drive as the COLD/frozen tier
    (the "recognize the storage" primitive — retires hand-placing model files)

Storage (and, via the GridSnapshot seam, the grid) is a RESOLUTION FIELD, never a
GATE: a huge cold drive RECOMMENDS the full experience (big models / MoE expert sets
frozen on it); its absence DEGRADES (smaller quant / dense student / grid route) —
it never EXCLUDES a user (solve-for-public-users, default works on any laptop).

Pure `from_parts` core is the outlier-validation seam; tests assert a Blackwell-5090-
with-16TB profile and a no-cold-drive laptop resolve UP vs DOWN (never one excluded),
the 0.80 headroom is applied to the VRAM ceiling, and UMA budgets from the RAM slice.

Slice 1 of #19; PlacementPlanner + the first MoE catalog entry land next on top.
(cargo test harness doesn't build on windows-msvc — pre-existing Unix-socket cfg gap;
validated via cargo build --lib here, tests run in CI.)

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…oE-paged K3 on-ramp

The RESOLUTION half of catalog = f(system × storage × grid): given a SystemProfile
(and the grid), resolve WHERE a model runs — and when it doesn't fit at full fidelity
here, resolve it DOWN (grid node / smaller variant) rather than EXCLUDING it. There is
deliberately no `Excluded` variant — storage and grid are RESOLUTION FIELDS, never
gates (solve-for-public-users; the default works on any laptop).

Reuses the fit primitives, never re-derives them:
  - SystemProfile::serving_budget_bytes (the one 0.80 vram_headroom via host_budget_from)
  - footprint_for (Model → ModelFootprint, GGUF-on-disk → size)
  - plan_serving (the honest fits_on_gpu oracle)

Resolutions: LocalRecommended | NeedsProvisioning{to_cold_tier} | MoePaged | GridRouted
| Degraded.

MoePaged is the K3 on-ramp: an MoE model too big to fit WHOLE in VRAM still serves
LOCALLY by freezing its experts on the cold drive (TierRole::Frozen) and paging the hot
subset (PageKind::MoEExpert over ArtifactSource::Mapped, sentinel-PGO subset) — a 594GB
model "fits" a 32GB GPU by residency, not by shrinking. Preferred over grid/degrade when
a cold tier exists (local frontier intelligence, no cloud).

MoE-ness is GGUF-derived (an `is_moe` input the caller reads via locate_layer_sets /
{arch}.expert_count at the header-loading site), NOT a hand-authored Model field — per
the catalog's "ask the GGUF" discipline, and avoiding an 11-site churn across the core
Model struct (M5's option B, three doctrines aligned). Pure `resolve_from_footprint`
core is fully unit-tested (never-exclude invariant: a laptop and a workstation resolve
the SAME oversized model, one degrades, MoE pages locally when a cold tier exists —
neither is ever excluded).

Completes slice 1 of #19 (SystemProfile + PlacementPlanner + MoE resolution).
Validated via cargo build --lib on windows-msvc; tests run in CI (Linux).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…, never a pool

Replaces the caller-passed `grid_has_fit: bool` stub with a real derivation from a live
GridSnapshot. resolve_placement now takes `grid: Option<&GridSnapshot>` and computes the
verdict via grid_has_fit(snapshot, footprint).

grid_has_fit tests each REACHABLE peer with the SAME plan_serving oracle used locally,
against that peer's own live-free VRAM — honoring the GridSnapshot doctrine "sum of
per-node FITS, never an aggregate pool": two 20 GiB peers do NOT fit a 40 GiB model, an
unreachable peer that would fit is a memory not an offer, and a peer that could only
CPU-spill (fits_on_gpu = false) does not count. So the grid resolves a model to a node
that can actually GPU-serve it, or it degrades — it never routes to a node that can't.

Same fit oracle for local and grid = one definition of "fits", no drift.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply
joelteply force-pushed the feat/system-aware-catalog branch from 2db0c47 to d8f4eb8 Compare July 26, 2026 16:47
@joelteply

Copy link
Copy Markdown
Contributor Author

Merge coordination (re: M5's airc review)

Blocker confirmed = merge-order dependency. M5's 9f3b7437c adds a required budget_fraction to HostBudgetInputs; config_env::vram_headroom() is its source. Neither is on canary yet, so I can't add the one-liner in this PR without breaking compilation (the field + fn don't exist in my base). This PR is green against current canary.

Proposed linear order (stacked-PR discipline): land the HostBudgetInputs + config_env::vram_headroom() foundation on canary first → I rebase this branch onto it → add budget_fraction: crate::config_env::vram_headroom() to SystemProfile::serving_budget_bytes() (the exact seam that makes my keystone inherit the operator VRAM-headroom knob — closes that loop) → re-validate → merge.

Alternative: merge this now and fold the one-liner into the required-field PR (adding a required field updates all constructors anyway). I lean the linear order — cleaner, each PR owns its files. Your call, @m5.

Also: what's the nit? The airc tail-dropped it (reproducible colon-truncation bug — logged). Drop it here and I'll fold it with the rebase.

@joelteply
joelteply merged commit 936948f into canary Jul 26, 2026
4 checks passed
@joelteply
joelteply deleted the feat/system-aware-catalog branch July 26, 2026 16:58
@joelteply

Copy link
Copy Markdown
Contributor Author

Merged to canary — didn't hold slice 1 hostage to the airc-truncated coordination (green: cargo test + ts-rs both passed).

@m5 — the reconciliation, so it doesn't dangle: my SystemProfile::serving_budget_bytes() builds HostBudgetInputs with the CURRENT 3 fields (correct against canary today). When your 9f3b7437c lands adding the required budget_fraction, that construction needs the one-liner budget_fraction: crate::config_env::vram_headroom(). Two clean ways, your pick:

  1. Your required-field PR updates that constructor (standard when adding a required field — CI will flag it), OR
  2. Ping me the moment your foundation is on canary and I'll do the one-liner as a fast-follow (it's literally the seam that wires my keystone to your operator VRAM-headroom knob).

Either way it's owned, not forgotten. And whenever the nit comes through legibly (airc keeps truncating you at the first newline — reproducible send-side bug, I traced it in airc source + logged it), drop it here and I'll fold it as a fast-follow. Strong review — thank you.

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