From f07575ff6d34349c560a2c502cd8bedfe18263b0 Mon Sep 17 00:00:00 2001 From: dongxinwen Date: Fri, 27 Nov 2026 08:21:57 +0800 Subject: [PATCH] Preserve training resource budgets, source rights and deep install paths Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (implementation) Signed-off-by: dongxinwen --- src/inferrsi/knowledge/atomic_build.py | 17 +- src/inferrsi/knowledge/atomic_generation.py | 16 +- .../playbooks/training-resource-budget.md | 177 ++++++++++++++++++ .../references/mindspeed-historical.md | 112 +++++++++++ .../references/mindspeed-source-readset.md | 55 ++++++ .../papers-20261015/INTEGRATION_NOTES.md | 60 ++++++ .../cases/paper-grounded-cases.md | 51 +++++ .../knowledge/offload-delta.md | 15 ++ .../notes/training-memory-scheduling.md | 115 ++++++++++++ .../references/source-readset.md | 98 ++++++++++ .../references/sources.md | 61 ++++++ .../references/stas-decision-notes.md | 41 ++++ ...ing-resource-budget.integration-notes.json | 75 ++++++++ ...-resource-budget.mindspeed-historical.json | 75 ++++++++ ...ource-budget.mindspeed-source-readset.json | 75 ++++++++ ...raining-resource-budget.offload-delta.json | 75 ++++++++ .../training-resource-budget.original.json | 104 ++++++++++ ...-resource-budget.paper-grounded-cases.json | 75 ++++++++ ...aining-resource-budget.source-readset.json | 75 ++++++++ .../training-resource-budget.sources.json | 75 ++++++++ ...g-resource-budget.stas-decision-notes.json | 94 ++++++++++ ...rce-budget.training-memory-scheduling.json | 75 ++++++++ .../training-resource-budget.json | 176 +++++++++++++++++ .../knowledge/test_atomic_training_budget.py | 118 ++++++++++++ 24 files changed, 1905 insertions(+), 5 deletions(-) create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/mindspeed-historical.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/mindspeed-source-readset.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/references/source-readset.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/sources.md create mode 100644 src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/stas-decision-notes.md create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.integration-notes.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.mindspeed-historical.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.mindspeed-source-readset.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.offload-delta.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.original.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.paper-grounded-cases.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.source-readset.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.sources.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.stas-decision-notes.json create mode 100644 src/inferrsi/knowledge/atoms/training-resource-budget.training-memory-scheduling.json create mode 100644 src/inferrsi/knowledge/compositions/training-resource-budget.json create mode 100644 tests/knowledge/test_atomic_training_budget.py diff --git a/src/inferrsi/knowledge/atomic_build.py b/src/inferrsi/knowledge/atomic_build.py index 5b5e8be97..243da9298 100644 --- a/src/inferrsi/knowledge/atomic_build.py +++ b/src/inferrsi/knowledge/atomic_build.py @@ -9,7 +9,15 @@ from tempfile import TemporaryDirectory from .atomic_composition import AtomPin, applies, select_routes -from .atomic_generation import FORMAT, PUBLIC_TASKS, SEAL, InstalledGeneration, digest, owned_path +from .atomic_generation import ( + FORMAT, + PUBLIC_TASKS, + SEAL, + InstalledGeneration, + digest, + filesystem_root, + owned_path, +) from .atomic_json import matches_span, member_spans from .atomic_reader import atom_material, permits_operations from .atomic_skill_directory import directory_content, export_directory_skill, skill_spans @@ -378,13 +386,14 @@ def _prepare(source: Path, permits: Callable[[AtomPin, str], bool], roots: Mappi def build_generation(source: Path, target: Path, *, permits: Callable[[AtomPin, str], bool], source_roots: Mapping[str, Path] | None = None) -> str: """Stage and verify a complete new generation; repeat installs must have identical bytes.""" - source = Path(source).resolve(strict=True) - target = Path(target).absolute() + source = filesystem_root(source).resolve(strict=True) + target = filesystem_root(target) if target.is_symlink() or target.resolve() != target: raise ValueError("Generation target must be a physical directory") if target.is_relative_to(source) or source.is_relative_to(target): raise ValueError("Separate the authored and installed generation roots") - roots = {key: Path(path).resolve(strict=True) for key, path in (source_roots or {}).items()} + roots = {key: filesystem_root(path).resolve(strict=True) + for key, path in (source_roots or {}).items()} generation, files = _prepare(source, permits, roots) if target.exists(): return InstalledGeneration(target, expected=generation).generation diff --git a/src/inferrsi/knowledge/atomic_generation.py b/src/inferrsi/knowledge/atomic_generation.py index d840b6b4e..0bd08f20c 100644 --- a/src/inferrsi/knowledge/atomic_generation.py +++ b/src/inferrsi/knowledge/atomic_generation.py @@ -4,6 +4,7 @@ import hashlib import json +import os from pathlib import Path, PurePosixPath from .atomic_composition import AtomPin @@ -21,6 +22,19 @@ def digest(data: bytes) -> str: return hashlib.sha256(data).hexdigest() +def filesystem_root(root: Path) -> Path: + """Use absolute filesystem paths that accommodate deep installed resources on Windows.""" + absolute = Path(root).absolute() + if os.name != "nt": + return absolute + name = str(absolute) + if name.startswith(("\\\\?\\", "\\\\.\\")): + return absolute + if name.startswith("\\\\"): + return Path("\\\\?\\UNC\\" + name[2:]) + return Path("\\\\?\\" + name) + + def directory_skill_path(metadata: dict, name: str) -> str: entry = PurePosixPath(safe_path(metadata["entrypoint"])) relative = PurePosixPath(safe_path(name)).relative_to(entry.parent) @@ -55,7 +69,7 @@ class InstalledGeneration: """An internally consistent snapshot, optionally pinned by its caller's release record.""" def __init__(self, root: Path, *, expected: str | None = None): - root = Path(root).resolve(strict=True) + root = filesystem_root(root).resolve(strict=True) seal = json.loads(owned_path(root, SEAL).read_bytes()) generation = seal.pop("generation") if seal.get("format") != FORMAT or generation != "sha256:" + digest(_json(seal)): diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget.md new file mode 100644 index 000000000..b31c7ee1c --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget.md @@ -0,0 +1,177 @@ +--- +name: training-resource-budget +description: 'Choose training offload and resource-budget changes using pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case. Balance accelerator capacity, CPU work, pinned RAM and local storage; keep host/device transfer exposure distinct from collective network bottlenecks. + + ' +metadata: + inferrsi: | + { + "tags": [ + "training", + "offload", + "resource-budget", + "memory", + "cpu", + "numa" + ], + "status": "candidate", + "profile": "local-skill-v1", + "schema_version": 1, + "kind": "skill", + "origin": [ + "external" + ], + "empirical_validation": "not_run", + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "recommendations": [ + "Attribute the state and separate a capacity failure from a throughput bottleneck before choosing an offload surface.", + "Verify the consumer of buffer_size before calculating bytes or tuning it, and measure the executing path before claiming a knob ran.", + "Compare the whole step's critical path, not host capacity alone.", + "Use plan-activation-residency, choose-parallel-training-plan and assess-split-backward-schedule for live-range, parallel-plan and backward-ordering questions." + ], + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets." + ], + "provenance_readsets": [ + "references/mindspeed-historical.md", + "references/mindspeed-source-readset.md", + "references/papers-20261015/cases/paper-grounded-cases.md", + "references/papers-20261015/INTEGRATION_NOTES.md", + "references/papers-20261015/knowledge/offload-delta.md", + "references/papers-20261015/notes/training-memory-scheduling.md", + "references/papers-20261015/references/source-readset.md", + "references/sources.md", + "references/stas-decision-notes.md" + ], + "consumption_mode": "packaged" + } +--- + +# Training Cross-Resource Budget Decisions + +Status: candidate. No hardware validation, measured gain or current NPU +compatibility claim. [Source boundaries](references/sources.md) identify exactly +what was inspected; no checkpoint implementations are mined by this skill. + +## Start with ownership and one bottleneck + +Attribute state to parameters, optimizer state, gradients or activations; +record its current memory tier, lifetime and next consumer. Distinguish an +allocation-capacity failure from a throughput bottleneck. A change that enables +a model to fit can still slow each training step. + +Keep a per-host budget for input buffers, checkpoint snapshots, offloaded state, +OS cache and CPU workers. Count the actual ranks sharing that host. Record the +host/device link separately from inter-device/inter-node collective traffic. +A tensor copied to CPU does not establish an InfiniBand/RoCE bottleneck. + +SearchSpace: Accelerator and RAM / Host → Diagnose, Configure, Optimize; +SSD / Storage → Configure, Optimize (DeepSpeed NVMe state); OS / System → +Diagnose, Configure (CPU share/locality/garbage-collection attribution). +Network → Observe, Diagnose, Verify only through the scoped expert collective +measurement principles, not through CPU/NVMe offload itself. + +## CR1 — DeepSpeed offload decision surfaces + +| Surface | Inspected contract | Decision consequence | +|---|---|---| +| Parameter offload `device=cpu/nvme` | ZeRO stage 3 only | Establish parameter state residency before spending buffers or CPU RAM | +| Optimizer offload `device=cpu/nvme` | Stages 1/2/3; computation remains on CPU for either target | NVMe placement does not remove CPU optimizer demand | +| Parameter `max_in_cpu` | Parameter **elements** retained in CPU when NVMe is enabled | Convert using actual dtype/storage; this is not a byte or total-host-memory cap | +| Parameter `buffer_count`, `buffer_size` | NVMe buffer-pool count and size | The approved config/doc excerpt does not explicitly define `buffer_size` units; verify its consumer before calculating bytes or tuning it | +| Optimizer `buffer_count` | At least the number of optimizer states per parameter; source illustrates Adam's four | Do not transplant the parameter-pool count or assume all optimizers have identical states | +| `pin_memory` | Defaults True at this pin; page-locked CPU memory supports async transfers/overlap | Budget resident memory and existing memlock allowance; no privileged limit change authorized | +| `pipeline_read` / `pipeline_write` | Next-tile read / previous-tile write overlap with current optimizer tile compute | Applicable to tiled ZeRO-Infinity execution; configuration presence does not prove actual overlap | +| `ratio` | Fraction in [0,1] for CPU Adam, stage 3 only | Not a general placement ratio for parameters or activations | +| `super_offload`, `cpuadam_cores_perc` | Superchip CPU offload; core fraction valid with stage 3 plus `super_offload=True` | Not a universal CPU throttle or generic recommendation on every host | +| `fast_init` | NVMe optimizer initialization | Startup cost and steady-state step time have different denominators | + +A justified overlap proposal needs evidence that compute can hide the relevant +read/write segment, sufficient CPU/pinned-RAM/storage capacity and unchanged +state semantics. Measure the executing path before claiming a knob ran. The +config schema and live documentation are not dispatch/performance evidence. + +## CR6 — Attributed expert diagnosis + +Read [the scoped Stas Bekman note](references/stas-decision-notes.md) for +MFU/HFU denominator checks, transient-versus-sustained compute, collective +measurement semantics, NUMA locality and garbage-collection stragglers. This +note explicitly retains CC BY-SA 4.0 attribution and share-alike conditions; +no upstream runbook commands or automatic-update instructions are adopted. + +Use these principles to form a hypothesis, not to import a platform tuning +constant. Garbage-collection or affinity changes require separate task +approval and memory/correctness evidence; this extraction changes neither. + +## CR5 — Historical NPU case + +[MindSpeed adaptive memory](references/mindspeed-historical.md) illustrates +spending spare NPU memory versus CPU swapping/recomputation. Preserve the +`core_r0.8.0` exclusions and distinguish its validation assertions from the +separate feature-selection guard. The [pinned source readset](references/mindspeed-source-readset.md) +recovers the historical full revision and license, allocator-to-swap callback +and 910A/910B affinity branch. Check compatible allocator symbols, tracked +swappable storage, host capacity and actual device/NUMA/CPU mapping before +separately authorized reuse; `npu-smi` and `lspci` presence alone is insufficient. +One reported comparison changes layer count; its headline gain is not reused. +Current-stack compatibility, whole-model correctness and measured benefit remain +unverified. These historical source observations do not establish current Ascend +support. + +## Paper-derived training decisions + +[ZeRO-Offload ownership and semantics](references/papers-20261015/knowledge/offload-delta.md) +extends the configuration evidence above with CPU optimizer state/compute +colocation, shard ownership and tiled update/return costs. Compare the whole +step's critical path, not host capacity alone. Delayed parameter updates change +training semantics and require explicit approval and quality evidence; ordinary +overlap does not imply permission for staleness. + +Use [activation residency](../plan-activation-residency/SKILL.md) for live-range, +address-packing and rematerialization choices; +[parallel training plans](../choose-parallel-training-plan/SKILL.md) for stage, +mesh and sharding choices; and +[split backward](../assess-split-backward-schedule/SKILL.md) for input-gradient +versus weight-gradient ordering and optimizer post-validation. These are distinct +contracts: activation checkpoints are not restart snapshots, Alpa's conditional +plans are not unrestricted global optima, and Zero Bubble's rollback preserves +semantics rather than authorizing ZeRO-Offload's stale updates. + +The [mechanism comparison](references/papers-20261015/notes/training-memory-scheduling.md), +[readset](references/papers-20261015/references/source-readset.md) and +[hypothetical cases](references/papers-20261015/cases/paper-grounded-cases.md) +retain resource costs, counter-signals and unresolved table discrepancies. +Paper versions are separate from the DeepSpeed implementation pin. No current +runtime, NPU support or measured application outcome follows from these notes. + +## Candidate decision record + +For each proposal, retain: + +1. The observed limiting interval and owning state/resource. +2. The exact source version and enabled execution mode. +3. Capacity released and resources consumed, with units and uncertainty. +4. Overlap readiness/mutation boundaries and expected contention with input, + checkpoint and network activity. +5. Fixed-workload training step/throughput and correctness evidence required + for later validation; initialization and auxiliary metrics separately. + +No broad source expansion, newest-wheel installation, scheduler-priority +changes, benchmarks or failure injection follow from this skill. Source +support and extracted coverage remain separate from measured improvement. diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/mindspeed-historical.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/mindspeed-historical.md new file mode 100644 index 000000000..70bc0da5f --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/mindspeed-historical.md @@ -0,0 +1,112 @@ +# Historical MindSpeed adaptive-memory case + +Reference entry CR5. Initial documentation inspection: 2026-10-15. Historical +source follow-up: 2026-10-30. This remains a source-derived candidate with no +current runtime or compatibility qualification. + +## Provenance and permitted reuse + +[Original document](https://gitcode.com/Ascend/MindSpeed/blob/core_r0.8.0/docs/features/adaptive-memory.md), +branch `core_r0.8.0`; the 2026-10-15 inspection recorded page history +`53193db8`, 2025-06-04. Full revision, license and implementation were unresolved +at that inspection. Retrieved HTML SHA-256: +`773d702b932534f96d037c07156604d7dd9e4c3b82f4a0a6e6e8ff70e5365eef`. +The document body was readable then; its named implementation was not retrieved. + +The 2026-10-30 follow-up resolved the original page's commit link to +[`53193db8bf5def407c4041a9beb3f4c9e9773daf`](https://gitcode.com/Ascend/MindSpeed/commit/53193db8bf5def407c4041a9beb3f4c9e9773daf). +The official Ascend/MindSpeed [GitHub commit](https://github.com/Ascend/MindSpeed/commit/53193db8bf5def407c4041a9beb3f4c9e9773daf) +has the same identity, the `!2378` README-update message and commit timestamp +`2025-06-04T04:43:14Z`. The pinned document and bounded implementation were read +at that revision; the [source readset](mindspeed-source-readset.md) distinguishes +those new observations from the original HTML snapshot. The snapshot hash is +retained as historical evidence, not claimed to hash the fetched Markdown. + +Historical license evidence is the same pin's [root LICENSE](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/LICENSE): +BSD-3-Clause terms apply by default unless otherwise noted, with separate +third-party terms for identified files. The adaptive-memory document has no +separate license notice; `docs/LICENSE` is absent at this pin. The README's MIT +badge does not replace the root terms, and a later branch's documentation license +does not resolve historical rights. Attribution remains Ascend/MindSpeed, with +Bytedance, Huawei and NVIDIA copyright notices retained in the linked license. +This note independently paraphrases mechanisms; no upstream code or prose is +copied or adapted into an executable helper. + +## Incremental decision + +The documented trigger is **unused NPU memory under full recomputation**. +The document describes lossless tensor swapping, strategy generation/search, +SwapManager and allocator integration to choose how much state to retain versus +move to CPU. The document describes intercepting out-of-memory conditions via +PTA's `NPUPluggableAllocator`, allowing SwapManager to intervene. This is a +source design claim. The bounded source observations below confirm the allocator +callback path, not the complete search algorithm or whole-model losslessness. + +Derived decision: assess retained activation capacity, recomputation work and +NPU↔CPU transfer exposure together. Less recomputation can spend host RAM and +host/device bandwidth. This does not demonstrate a network optimization, nor +a guarantee that OOM interception makes arbitrary workloads safe. + +## Historical configuration boundary + +| Surface documented at this branch | Constraint | +|---|---| +| `--adaptive-memory-optimization` | Historical opt-in flag, not a recommendation for current releases | +| Full recomputation; adaptive selective recomputation; `swap-attention`; `recompute-in-bubble` | Documented incompatible combinations; do not combine policies merely because their memory objectives overlap | +| Memory-fragmentation optimization | Both modify PyTorch memory management; document says an assertion rejects simultaneous enablement | +| CPU affinity | Document names `npu-smi` and `lspci`; the source has additional topology/tool and SoC conditions below | +| Custom `torch.autograd.Function` integration | The document names `adapt_mem_func_wrapper`; its pinned implementation accepts a `torch.autograd.Function` subclass and selects profiling, recomputation, swap or the original `.apply` by phase/action | + +## Pinned implementation decisions + +Use the [exact paths and line ranges](mindspeed-source-readset.md) for these +observations, all inspected 2026-10-30 at the historical revision above. + +1. **Check effective selection before allocator assumptions.** `arguments.py` + rejects adaptive recomputation, configured `recompute_granularity` or + `recompute_method`, `recompute_activation_function`, `swap_attention`, + `recompute_in_bubble`, memory fragmentation and `ampipe_degree > 1`. + Separately, `megatron_adaptor.py` only installs the adaptive-memory wrappers + and allocator when the flag is true and adaptive recomputation, fragmentation, + swap-attention and `smart_swap` are false. The `smart_swap` exclusion is a + dispatch guard, not the same validation assertion. A present flag alone does + not establish that this policy was selected. +2. **Treat the allocator as a process runtime dependency.** That dispatch branch + invokes `change_allocator()`, whose builder loads the historical C++ extension. + It supplies `my_malloc`/`my_free` to TorchNPU's `NPUPluggableAllocator`, changes + the current allocator and installs init/reset/stat callbacks. The builder + depends on PyTorch/TorchNPU headers and links `torch_npu`; API names alone do + not establish compatibility with another wheel or CANN stack. +3. **Bound OOM rescue to its captured state.** After ordinary allocation/cache + attempts fail, the C++ allocator calls `common.swap_out_by_size(size)` and + retries. `common.py` routes to the adaptive-memory manager under this flag. + Its saved-tensor hooks track eligible tensors; rescue moves shared storage + through pinned CPU memory and restores it for unpack. The manager returns + false when no tracked tensor is eligible, and the allocator retains an OOM + error path. This mechanism does not promise recovery for arbitrary allocations + or unlimited host capacity. Charge shared storage once and account for its + return before the backward consumer, rather than counting tensor views as + independent savings. +4. **Check the historical affinity branch and topology.** Setup calls `bind_cpus` + only when `acl.get_soc_name()` contains `910A` or `910B`. The helper queries + `npu-smi`, `lspci` and `lscpu`, then sets process affinity through `psutil`. + It derives NUMA CPU ranges from `lscpu`, uses a contiguous device-ID range, + and assigns CPUs per device from a historical `ratio=0.5` default or + `CPU_BINDING_NUM`. These are source assumptions, not a recommended CPU share. + Before separate authorized reuse, reconcile visible device numbering, parsed + topology and granted CPU affinity; command presence alone is insufficient. + Reading this case authorizes no package installation or affinity change. + +## Evidence quality + +The document reports cropped GPT-175B experiments on eight NPUs. One comparison +uses `NL=8` for adaptive memory and `NL=3` for full recomputation. Its headline +percentage is not a controlled fixed-workload gain and is deliberately not +carried into coverage or performance claims. Other tables remain author reports; +no raw traces, correctness outputs or matched reruns were inspected. + +Still open: current torch/TorchNPU/CANN/MindSpeed compatibility, complete strategy +search and cache behavior, actual transfer exposure, whole-model correctness and +measured end-to-end benefit. The historical full revision and default license +terms are now recoverable; the selected allocator, wrapper and affinity paths +are source observations only. No hardware run or failure injection was performed. diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/mindspeed-source-readset.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/mindspeed-source-readset.md new file mode 100644 index 000000000..4ddf367ab --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/mindspeed-source-readset.md @@ -0,0 +1,55 @@ +# MindSpeed historical source readset + +Source: [Ascend/MindSpeed](https://github.com/Ascend/MindSpeed), historical +`core_r0.8.0` document commit +`53193db8bf5def407c4041a9beb3f4c9e9773daf`. Inspected 2026-10-30. +The [historical case](mindspeed-historical.md) retains the separate 2026-10-15 +documentation inspection and original HTML hash. + +## Identity and rights + +- The [original GitCode page](https://gitcode.com/Ascend/MindSpeed/blob/core_r0.8.0/docs/features/adaptive-memory.md) + links its abbreviated history entry to the [full commit](https://gitcode.com/Ascend/MindSpeed/commit/53193db8bf5def407c4041a9beb3f4c9e9773daf). + The official [GitHub commit API](https://api.github.com/repos/Ascend/MindSpeed/commits/53193db8bf5def407c4041a9beb3f4c9e9773daf) + reports that SHA, `!2378` README-update message and timestamp + `2025-06-04T04:43:14Z`. The branch name remains a moving reference; every source + link below uses the recovered full revision. +- [Root LICENSE, lines 1–34](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/LICENSE#L1-L34): + default BSD-3-Clause terms unless otherwise noted, including Bytedance, Huawei + and NVIDIA attribution. The rest of the file supplies identified third-party + exceptions; do not relabel the entire repository with a single guessed license. + No separate license notice appears in the selected adaptive-memory document. + The [historical `docs/LICENSE` path](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/docs/LICENSE) + returned 404. No later license is substituted for this pin. +- [README](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/README.md#L901-L917), + version table only: historical Core/PyTorch and in-development stack entries, + not a complete frozen runtime stack. Its MIT badge near the beginning is not + the inspected root license text. [Package version](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/setup.py#L11-L16) + is `0.8.0`; `setup.py` was read, not executed. + +## Bounded implementation reads + +Paths are relative to that repository. Listed sections support the stated +decision only; surrounding framework internals and the full solver are not +audited. + +| Pinned source | Inspected section | Observation used by the owner | +|---|---|---| +| [docs/features/adaptive-memory.md](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/docs/features/adaptive-memory.md) | Whole short document | Trigger, mechanism attribution, exclusions, wrapper requirement, affinity prerequisites and mismatched-layer performance table | +| [mindspeed/arguments.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/arguments.py#L353-L354) | Flag 353–354; [validation 839–849](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/arguments.py#L839-L849) | Default-off flag; explicit rejection of conflicting configurations, including ampipe and activation recomputation | +| [mindspeed/megatron_adaptor.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/megatron_adaptor.py#L639-L656) | 639–656; adaptation call 1077 | Effective selection guard, including `smart_swap`; allowed layer and setup-wrapper registration; allocator replacement | +| [mindspeed/core/memory/adaptive_recomputing/pluggable_allocator_adpator.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/core/memory/adaptive_recomputing/pluggable_allocator_adpator.py) | Whole 24-line adapter | Shared historical allocator builder, allocation/free symbols and current-allocator/stat callback setup | +| [mindspeed/op_builder/adaptive_recomputing_builder.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/op_builder/adaptive_recomputing_builder.py) | Whole short builder; `op_builder/__init__.py` import mapping | Extension source, PyTorch/TorchNPU includes and `torch_npu` link dependency | +| [mindspeed/ops/csrc/pluggable_allocator/adaptive_recomputing/NpuCachingCustomAllocator.cpp](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/ops/csrc/pluggable_allocator/adaptive_recomputing/NpuCachingCustomAllocator.cpp#L44-L53) | Allocation forwarding 44–53 | Exported allocator reaches the device allocator defined in the header | +| [mindspeed/ops/csrc/pluggable_allocator/adaptive_recomputing/NpuCachingCustomAllocator.h](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/ops/csrc/pluggable_allocator/adaptive_recomputing/NpuCachingCustomAllocator.h#L548-L678) | Allocation/retry/callback/OOM 548–678; exports 1572–1592 | Failed cache/allocation attempts reach Python `common.swap_out_by_size`; false ends rescue; OOM remains possible | +| [mindspeed/core/memory/common.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/core/memory/common.py) | Whole 11-line router | Adaptive flag selects adaptive-memory rather than adaptive-recomputation SwapManager | +| [mindspeed/core/memory/adaptive_memory/adaptive_memory_swap_manager.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/core/memory/adaptive_memory/adaptive_memory_swap_manager.py#L231-L378) | Copy state 25–84; eligibility 120–141; rescue pack/unpack, shared storage and selection 231–378; layer hooks 375–415 | Rescue concerns tracked eligible saved tensors; shared-storage CPU move/restore, pinned allocation and false result when none is eligible | +| [mindspeed/core/memory/adaptive_memory/adaptive_memory_opt.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/core/memory/adaptive_memory/adaptive_memory_opt.py#L189-L213) | Setup 189–213 | Optimizer/profiling hooks; CPU binding conditional on 910A/910B SoC; cache loader identified only | +| [mindspeed/core/memory/adaptive_memory/cpu_binder.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/core/memory/adaptive_memory/cpu_binder.py) | Whole 110-line helper | `npu-smi` → PCIe → `lspci` NUMA → `lscpu` CPU ranges; contiguous-device assumption, historical ratio/env selection and process-affinity mutation | +| [mindspeed/core/memory/adaptive_memory/adaptive_memory_function.py](https://github.com/Ascend/MindSpeed/blob/53193db8bf5def407c4041a9beb3f4c9e9773daf/mindspeed/core/memory/adaptive_memory/adaptive_memory_function.py#L99-L136) | Saved-tensor wrapper and action dispatch 99–136 | Explicit autograd-subclass integration; phase/action-specific profiling, swap, checkpoint or original `.apply` | + +The solver, policy cache, complete prefetch schedule, framework allocator ABI, +device kernels and model training results remain outside this bounded extraction. +The builder and binder are referenced for their prerequisites; neither is copied, +imported or executed by this skill. No current-stack or numerical qualification +follows from source inspection. diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md new file mode 100644 index 000000000..69b17c8ba --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md @@ -0,0 +1,60 @@ +> Supplier integration proposal, preserved as historical source context (2026-10-15). The local owner review and current two matrices govern acceptance; suggested follow-ups and permission statements below do not authorize work or describe the current inventory. + +# Pack C integration proposals + +Status: candidate; empirical_validation: not_run. Independent five-paper, fulltext-derived expansion. F = source facts/models/results; P = proposed operational rules. No empirical validation, install, reproduction, framework run, hardware work, InferRSI modification, matrix edit or PR has occurred. Source PDFs/text/render caches are outside this deliverable tree and are not redistributed. + +## Deliverable routes + +- [Compact mechanism notes](notes/training-memory-scheduling.md): twelve mechanism cards with objective, assumptions, variables/constraints, action, benefit/cost, evidence, limits/counter-signals and candidate rule. +- [Exact readset and metric audit](references/source-readset.md): all five version pins, actual sections/equations/figures/tables read, rendered-page checks, author-reported workload/baseline/hardware/denominator and missing evidence. +- [Offload extension](knowledge/offload-delta.md): incremental ZO1–ZO3 knowledge for the existing skill. +- [Review cases](cases/paper-grounded-cases.md): hypothetical failure/decision cases, not executed evaluations. +- [plan-activation-residency](../../../plan-activation-residency/SKILL.md), [choose-parallel-training-plan](../../../choose-parallel-training-plan/SKILL.md), [assess-split-backward-schedule](../../../assess-split-backward-schedule/SKILL.md): three candidate skills, selected by distinct decision boundaries rather than one skill per paper. + +P, grouping rationale: Checkmate and OLLA jointly inform retain/recompute/order/address choices and need one shared feasibility check. Alpa changes partition/mapping/resharding choices, so it remains separate from fixed-pipeline scheduling. Zero Bubble introduces an independent backward-order and optimizer-validation gate. ZeRO-Offload belongs in the earlier training-offload skill instead of duplicating its tensor-tier accounting. None is promoted or empirically validated. + +## Existing artifacts inspected first + +- Offload synthesis (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `notes/offload.md`) +- Offload source audit (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `notes/references/offload-source-notes.md`) +- Training-offload skill (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `diagnose-training-offload/SKILL.md`) +- Training-offload references (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `diagnose-training-offload/references/source-notes.md`) +- Previous integration notes (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `INTEGRATION_NOTES.md`) + +These are semantic paths in the identified prior archive, not local hyperlinks or files bundled again. Resolve them to the approved repository inventory during integration. Existing ZeRO-Infinity coverage is retained: phase/class/tier budgets, prefetch/buffer pipelines, tiling, initialization and tied/external parameters. New evidence concerns CPU optimizer ownership/staleness, legal lifetime shortening, event-level rematerialization, static address packing, heterogeneous parallel plans and split-backward scheduling. + +## P: Only the two official matrix destinations + +The following are repository-relative link proposals, not local matrix edits or invented row IDs. Official paths are docs/reference-matrix.md and docs/searchspace-matrix.md. Any older matrix-path suggestion is superseded by these two official destinations. Live rows/anchors were not inspected. There is no third matrix. + +For docs/reference-matrix.md: +- Add ZeRO-Offload 2101.06840v1 → ZO1–ZO3 → offload extension and readset; mark the old next-gate lead as read only when integration is approved. +- Add Checkmate 1910.02653v3 → CM1–CM2 and OLLA 2210.12924v2 → OL1–OL2 → activation-residency skill/readset. OLLA likewise advances from the earlier unread lead after approved integration. +- Add Alpa 2201.12023v3 → AL1–AL2 → parallel-plan skill/readset. +- Add Zero Bubble 2401.10241v1 → ZB1–ZB3 → split-backward skill/readset. + +For docs/searchspace-matrix.md, propose semantic cross-links using existing taxonomy/row IDs after local reconciliation: +- Accelerator × Observe/Diagnose/Optimize/Verify: live ranges, per-event capacity, rematerialization, reserved-address packing, shard/mesh feasibility, pipeline passes and total device memory. +- RAM/host-compute evidence × Observe/Diagnose/Optimize/Verify: optimizer residency/update/copy and host-resource ownership, extending the existing offload entry. This is not an additional SSD technique. +- Communication/Network × Observe/Diagnose/Optimize/Verify only for actual inter-node reduce-scatter/allgather, cross-mesh resharding or pipeline transfers. Local GPU collectives remain Accelerator topology. H2D/D2H and same-host IPC do not become Network entries. +- Configure, where the existing matrix uses it, must point to a later separately authorized current-implementation gate. These paper plans do not prove current framework/NPU support. No generic OS/VM-tuning or persistent recovery-checkpoint rule follows from this pack. + +## Evidence boundaries that must survive integration + +- Checkmate's headline batch-capacity increase is constrained model evidence; OLLA's runtime saving is estimated over an assumed million iterations. Neither should become a measured end-to-end speed claim. +- Alpa is hierarchical and approximate in important respects: zero compute-cost simplification inside intra-op search, omitted inter-stage transfer, external microbatch count, static shapes/schedules. Do not advertise globally optimal mixed-parallel execution. +- Zero Bubble's calculated bubble rates, ideal formulas and measured throughput are distinct. Similar activation caps do not mean identical total memory. Table 6's fixed-global-batch comparison is preferable to Table 11's ambiguous/changing-batch rows. +- ZeRO-Offload DPU changes update semantics; Zero Bubble post-validation intends to preserve them through validation/rollback. Keep separate gates. +- Source inconsistencies are flagged rather than repaired: ZeRO-Offload Table 1; Alpa Wide-ResNet size rounding; Zero Bubble Table 11 microbatch labels and missing Table 9 time units. + +## Unread next-gate leads + +These are leads named in the five papers' references, not additional reviewed evidence. Stop the current batch at five papers. + +- AutoTM (ZeRO-Offload reference 8): joint tensor movement with heterogeneous memory could address transfer decisions absent from Checkmate/OLLA; no mechanism imported here. +- Capuchin (ZeRO-Offload reference 17): a possible recomputation-plus-movement comparison; not read. +- Reducing Activation Recomputation in Large Transformer Models (Zero Bubble reference list): a possible check on Transformer-specific saved-tensor assumptions; not read. +- Piper (Alpa related work): an alternate mixed-parallel search boundary; not read. + +A later gate may also review author-linked implementation at an explicit revision for compatibility. No such source inspection or validation is implied by this delivery. diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md new file mode 100644 index 000000000..15449ba32 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md @@ -0,0 +1,51 @@ +# Paper-grounded review cases + +Status: candidate; empirical_validation: not_run. All scenarios and proposed decisions below are P, hypothetical review cases. Their F evidence is historical and linked. These were not executed as tests and are not claims about an actual user workload. + +## C1. OOM with low live-byte demand but high reserved memory + +Signal: a stable graph's phase-aligned live tensor total is well below the allocator peak, and the requested large allocation cannot fit an available range. + +Decision: distinguish reserved-byte fragmentation from unavoidable live data. Consider legal address reuse after lifetime proof before buying transfer/recomputation overhead. Keep size/alignment/workspace and asynchronous overlap in the accounting. Do not assume a reserved/live difference alone proves external fragmentation; cached free blocks and unaccounted workspaces must be resolved. + +F basis: OLLA §§3.3–3.5, §5.4/Fig. 8. Its fragmentation percentage is (reserved−resident)/reserved at the reserved-memory peak, not a universal multiplier. Acceptance idea: later evidence shows the same graph's peak reserved memory falls without illegal overlapping aliases or a latency regression. Stop if shapes/lifetimes are unstable. [OL2](../notes/training-memory-scheduling.md) + +## C2. Large forward activations remain live across a nearly linear graph + +Signal: activations dominate at large batch, few independent operators can be reordered, and CPU offload would expose transfer waits. + +Decision: propose selective retain/recompute alternatives with event-level peak memory, adding recompute cost to the same critical-path ledger. Do not expect OLLA's small-batch gradient-order savings to carry over. Do not change global batch merely because more input could fit. + +F basis: OLLA §5.3 limits; Checkmate §4/Eqs. 1–9 and Fig. 5. Acceptance idea: same-model/batch/precision proposal preserves dependencies, fits worst-case memory including output-before-release, and has a justified step-time benefit versus supplied offload costs. Missing transfer/operator timing leaves the performance choice unresolved. [CM1/OL1](../notes/training-memory-scheduling.md) + +## C3. Approximate rematerialization has low objective cost but exceeds memory + +Signal: rounded retention plan has dependency-valid recomputations and a favorable FLOP estimate, yet its replayed lifetime ledger exceeds the actual budget. + +Decision: reject feasibility, regardless of closeness to an LP/ILP objective. Record dependency validity and capacity violation separately. A different margin, policy or exact incumbent may be considered on paper; a solver timeout does not establish no feasible plan exists. + +F basis: Checkmate §5.3 explicitly does not preserve capacity under rounding; Table 2 averages ratios only across feasible budgets. Acceptance idea: an actual feasible schedule/capacity proof under the chosen accounting, not a 1.06 mean-cost claim. [CM2](../notes/training-memory-scheduling.md) + +## C4. One pipeline stage is weight-heavy while earlier stages are activation-heavy + +Signal: uniform layer counts create per-rank OOM or a bottleneck despite spare memory elsewhere; the cluster has fast local links and slower inter-node links. + +Decision: compare uneven stages/mesh sizes and varying operator shard axes. Include layout conversion and in-flight activations; prefer a simple uniform fallback if the model is homogeneous or planning cannot amortize. Do not substitute weak-scaling PFLOP/s for fixed-work speed. + +F basis: Alpa §5/Eqs. 2–5, §8.3, §8.6/Fig. 12; 16-GPU Wide-ResNet uses 4/4/8-GPU stages. Acceptance idea: same global batch and total hardware, actual cross-node transfer included, all rank peaks feasible, and useful whole-step improvement. [AL1/AL2](../notes/training-memory-scheduling.md) + +## C5. Lower modeled pipeline bubbles require smaller microbatches + +Signal: a larger activation cap allows ZB-2p-like scheduling only by reducing microbatch size; small kernels lose utilization. + +Decision: compare 1F1B, capped split backward, V placement and b/2 plus 2m at fixed global batch and similar total memory. Choose useful throughput, not zero-idle theory. Do not splice Table 4's different memory budgets with Table 11's changing global batches. + +F basis: Zero Bubble §6.1/Table 6; 6.2B favors ZB-2p* over V while 28.3B's listed base b2,m96 favors V slightly. Table 7 demonstrates microbatch sensitivity but changes global batch. Acceptance idea: matched-workload latency/throughput, per-pass timing and actual peaks; computed bubble rate is supporting model evidence only. [ZB1/ZB2](../notes/training-memory-scheduling.md) + +## C6. "Overlap the optimizer" hides two different semantic choices + +Signal: a plan proposes overlapping next-step forward work with optimizer processing and labels the change a harmless schedule optimization. + +Decision: ask which mechanism is intended. ZeRO-Offload DPU deliberately accepts one-step stale updates; Zero Bubble post-validation intends synchronous semantics with complete global validation and rollback/redo. Neither permits dropping clipping/NaN decisions. Keep ordinary synchronized execution as the fallback until the selected mechanism's semantics and implementation evidence are explicit. + +F basis: ZeRO-Offload §5.2/§6.2.4 versus Zero Bubble §4/Appendix C and Table 10. Acceptance idea: DPU requires separately approved training-semantics/quality criteria; post-validation requires numerical rollback, validation and dependent-work coverage. Historical BERT F1 or fixed-seed loss matching is insufficient for universal approval. [ZO3/ZB3](../notes/training-memory-scheduling.md) diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md new file mode 100644 index 000000000..76ad3fb1a --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md @@ -0,0 +1,15 @@ +# Incremental extension to training-offload knowledge + +Status: candidate; empirical_validation: not_run. F = source fact; P = proposal. Local ownership is training-resource-budget. The supplier's earlier diagnose-training-offload archive is unavailable in this integration; its prior coverage is a carried supplier claim, not a locally imported capability. [Exact ZeRO-Offload v1 evidence](../references/source-readset.md), [ZO1–ZO3 cards](../notes/training-memory-scheduling.md). + +## Retain existing coverage + +The previous offload notes (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `notes/offload.md`) and source audit (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `notes/references/offload-source-notes.md`) already explain phase memory, slow-tier pipelines, collective reconstruction, tiling, initialization and external/tied parameters. Do not duplicate these as new discoveries. + +## P: Proposed additions + +- Before choosing tensor offload alone, inspect whether moving the optimizer computation with its FP32 state reduces required traffic. Record CPU/update ownership and avoid redundant per-rank host work. F source: ZO §§3–4. +- Distinguish optimizing CPU update from enabling delayed updates. CPU-Adam vectorization/threading/tile-copy is a system optimization; DPU changes training semantics. F source: ZO §§5.1–5.2 and §6.2.4. +- Include an offload-free fallback when all ranks can fit adequate microbatches. F counterexample: ZeRO-2 surpasses ZeRO-Offload at 64/128 GPUs in the 10B experiment (§6.2.3/Fig. 11). +- Do not carry the Table 1 printed memory figure into a universal byte ledger: its final 4M/8× row conflicts with a 16M baseline. Re-derive actual optimizer/precision/buffer accounting as the existing skill already requires. +- If exact execution is required, leave one-step DPU out. If a user separately accepts changed semantics, propose representative convergence/quality checks; the historical GPT-2/BERT tests do not authorize it. diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md new file mode 100644 index 000000000..dd485bd4d --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md @@ -0,0 +1,115 @@ +# Training memory and scheduling: incremental mechanisms + +Status: candidate; empirical_validation: not_run. F = pinned-source fact/model/measurement; P = proposed procedure. This is paper-derived planning, not a tested recipe. [Pins, exact readset, metrics and caveats](../references/source-readset.md). The labels ZO/CM/OL/AL/ZB refer to the five source entries there. + +## P: Joint decision boundary + +Start with the existing ZeRO-Infinity offload notes (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `notes/offload.md`) and training-offload procedure (prior archive `omnirsi-paper-intelligence-2026-10-15.zip`, semantic path `diagnose-training-offload/SKILL.md`). They already cover tensor-class/tier accounting, retrieval pipelines, tiling, initialization and nonlocal ownership. This pack adds a decision among changing optimizer residency, tensor lifetimes, recomputation, operator partitions and fine-grained execution order. None of these papers supplies one globally optimal solver for all five choices together. + +Use one phase-aware capacity/critical-path record: model states; live activations and gradients; operator/workspace peaks; simultaneous transfer buffers; host/device capacity; shape/batch/precision; dependency graph; CPU, accelerator, transfer and collective time. Distinguish useful synchronous-step completion from modeled FLOPs or reduced idle fraction. A memory-saving candidate is valuable only if the remaining compute/transfer schedule remains feasible. Do not add separately reported speedups or memory-saving percentages. + +Activation checkpointing is rematerialization within training, not persistent restart/recovery checkpointing. H2D/D2H and same-host IPC are not Network; inter-node transfers and collectives may be. No NPU kernel, collective, compiler or asynchronous-execution compatibility has been established. + +## ZO1. Move the optimizer computation with its state + +- F, objective/assumptions: ZO §§3.1–3.5 seek maximal model-state relief at minimal host/device traffic while excluding compute-heavy CPU forward/backward work. Model: mixed-precision Adam, known parameter count, relatively slow CPU and PCIe; activation offload excluded. +- F, variables/constraints/mechanism: choose placement of data/compute graph nodes; colocate FP32 master weights/moments and update/cast on CPU, keep FP16 weights and F/B on GPU, stream gradients to CPU. Whole-state graph-cut minimum is 4M bytes/iteration in the restricted model. §4.2 first shards gradients/optimizer ownership, then offloads; CPU work and traffic are not duplicated by every data-parallel rank. +- F, benefit/cost/evidence: Table 4's CPU-Adam reduces CPU update latency; Fig. 8 reports 14% average TFLOP/s gain over L2L with matched batch and no DPU. CPU memory bandwidth, thread contention, transfer and updated-weight collective remain costs. +- F, limits/counter-signals: Table 1 has inconsistent memory accounting; the optimality claim excludes activations, different optimizers and partial heterogeneous plans. Fig. 11 shows ZeRO-2 overtaking offload at 64/128 GPUs once capacity no longer forces smaller batches. +- P, rule: extend the existing offload diagnosis with an ownership-and-compute ledger. Compare CPU-update-plus-return against GPU-update-plus-state-transfer under the actual optimizer. Prefer an offload-free candidate when both fit and exposed transfer dominates; never infer benefit from CPU capacity alone. + +## ZO2. Optimize CPU update and copy as one pipeline + +- F, objective/assumptions: ZO §5.1 accelerates O(M) updates where CPU work or weight return delays GPU progress; assumes vectorizable Adam and usable host memory bandwidth. +- F, variables/constraints/mechanism: SIMD width, loop unroll, threads, tile size; fuse vector arithmetic and pipeline tile updates with prior-tile H2D parameter copy. Historical AVX512 and unroll 8 are implementation choices, not portable constants. +- F, benefit/cost/evidence: Table 4 gives 0.22 vs 1.39 s at 1B parameters and 2.57 vs 14.76 s at 10B for CPU-Adam vs PyTorch CPU; GPU Adam is still faster. Tiling/threads/copies can compete for memory bandwidth; isolated component ablations are unreported. +- F, limits/counter-signals: host saturation and small GPU compute windows; adding threads does not create bandwidth. Historical CPU improvements do not establish present optimizer speed. +- P, rule: use supplied per-stage CPU/transfer evidence to identify whether optimizing update, return copy, or neither could affect the step critical path. Keep bounded buffers and pinned-memory accounting from the existing skill; do not prescribe ISA/thread counts from the paper. + +## ZO3. Delayed update is a separate training-semantics branch + +- F, objective/assumptions: ZO §5.2 hides CPU optimizer work at small batch by allowing one-step staleness after a stable warmup. +- F, variables/constraints/mechanism: DPU start iteration and delayed-gradient schedule; one iteration skips update, then CPU updates overlap next GPU F/B using older parameters. +- F, benefit/cost/evidence: §6.2.4/Fig. 9 reports 1.12–1.59× throughput at microbatch 8. Figs. 12–13 check GPT-2 loss and BERT-large/SQuAD F1 92.8, with DPU after 40 iterations. +- F, limits/counter-signals: training dynamics change; the GPT loss initially lags. Two workloads do not bound behavior for other optimizers/models, nor prove a universal warmup length. +- P, rule: do not silently include DPU in an exact-execution offload plan. Mark it a separate consequential proposal requiring explicit acceptance of changed training semantics and representative quality/convergence evidence. Prefer ordinary overlap if exact updates are required. + +## CM1. Pay recomputation cost selectively under event-level memory limits + +- F, objective/assumptions: CM §§4.1–4.10 minimize summed operator-evaluation cost for a static known-size DAG with deterministic/replayable operations and supplied cost estimates. +- F, variables/constraints/mechanism: binary compute R and retention S, FREE and U memory variables; ensure every dependency exists, compute each frontier, and count newly allocated output before freeing consumed inputs. Retain valuable values and rematerialize others. Inputs/parameters and a gradient reserve remain resident. A fixed frontier order bounds the search. +- F, benefit/cost/evidence: §6.3/Fig. 5's U-Net/16-GB profile model improves modeled time 1.20× over linearized greedy; recomputation spends extra compute to avoid memory/transfer pressure. §6.4's 5.1× MobileNet batch-capacity ratio is model-based with a one-extra-forward FLOP constraint. +- F, limits/counter-signals: no joint transfer/parallelism objective; additive layer cost can miss kernel fusion, concurrency and workspace behavior. Stateful/random operations and changed batches need correctness review. A timeout is not infeasibility proof. +- P, rule: compare a selective-rematerialization candidate to retention/offload using supplied costs and lifetime peaks; favor discarding values with low recomputation cost relative to sustained resident burden, while preserving all dependencies. Validate candidate peak memory and equivalent numerical semantics before claiming feasibility. + +## CM2. Approximation quality and memory feasibility are different checks + +- F, objective/assumptions: CM §5 seeks practical schedules when the exact MILP is costly. +- F, variables/constraints/mechanism: relax integrality, round only retention S, reconstruct minimally necessary R to repair dependency constraints, then derive releases. Their 10% budget allowance is empirical; rounding itself does not enforce the capacity cap. +- F, benefit/cost/evidence: §6.5/Table 2's geometric-mean FLOP-cost ratios are 1.00–1.06 across mutually feasible budgets, not a worst-case guarantee. Appendix D shows the allowance can waste capacity. DenseNet161 lacked a feasible ILP result within one day (§5). +- F, limits/counter-signals: computational validity can coexist with OOM; input-specific rounding margin and planning overhead matter. +- P, rule: treat an approximate schedule as a proposal until both dependency replay and exact peak-accounting pass. Record solver status, feasible incumbent, bound/gap and amortization separately; do not report near-optimal compute as memory-safe execution. + +## OL1. Shorten live ranges before buying more capacity + +- F, objective/assumptions: OL §§2–3 minimize memory of a static DAG without deleting/recomputing values. Tensor sizes and all dependencies must be represented. +- F, variables/constraints/mechanism: creation/preservation times select a legal topological order; exactly one tensor creation, shared-consumer lifetimes and multi-output creation are explicit. Reorder eligible work, including safe early weight updates, so large gradients need not remain live unnecessarily. §4.3 adds precedence controls to limit the search. +- F, benefit/cost/evidence: §5.3 measures requested-memory reduction excluding fragmentation: mean 22.5% at batch 1 and 10.1% at batch 32 versus PyTorch 1.11 ordering. No extra recomputation or offload traffic is introduced by the mechanism, but planning and changed execution concurrency can cost time. +- F, limits/counter-signals: activations retained for backward give little forward-pass leverage; large batches reduce gradient-relative savings. Distributed accumulation, global clipping, tied state and shared weights can restrict early updates; the paper does not establish those integrations. +- P, rule: investigate excessive live gradients/outputs before offload. Propose only reorderings proven legal by the full graph, including update/collective barriers. If activations dominate a largely linear order, route to selective rematerialization rather than promise OLLA's average saving. + +## OL2. Pack nonoverlapping lifetimes into reusable addresses + +- F, objective/assumptions: OL §§3.3–3.5 minimize reserved address extent given predictable tensor lifetimes; location means addresses in one memory space. +- F, variables/constraints/mechanism: integer base addresses and pairwise nonoverlap for simultaneously live tensors; reuse addresses across disjoint lifetimes. §4 bounds lifetimes, removes provably unnecessary pair constraints, splits ordering/packing, and preplaces nested activations. A preallocated buffer makes deallocation a no-op. +- F, benefit/cost/evidence: §5.4 removes measured fragmentation in evaluated cases; baseline ratios average 7.9%/26.1% at batch 1/32. §5.7 combined peak reduction is 30.4%/36.1% with two five-minute search caps. The estimated runtime saving is not direct end-to-end timing. +- F, limits/counter-signals: empirical fragmentation elimination does not prove all orderings can pack without loss. Dynamic shapes, overlapping executions, alignment/workspace and aliasing can invalidate fixed addresses. Low fragmentation means less scope. +- P, rule: separate live-byte excess from reserved-byte fragmentation, using the same phase/denominator. Propose address planning only when allocation/lifetime evidence is stable; do not misroute this mechanism as CPU/SSD placement or kernel-VM tuning. + +## AL1. Choose operator shards and pipeline stages together, within a declared search space + +- F, objective/assumptions: AL §§4–5 minimize pipeline latency for static shapes, homogeneous devices inside each logical mesh, a supplied operator order and synchronous 1F1B-style timing. +- F, variables/constraints/mechanism: select operator shardings/resharding edges; then stage boundaries and physical/logical meshes, using stage cost and memory feasibility. Eq. 5 retains multiple in-flight activation sets. Objective includes first-microbatch latency and bottleneck-stage repetition. Operator clustering/pruning reduce planning cost. +- F, benefit/cost/evidence: §8.3/Fig. 9: Wide-ResNet/32-GPU plan outperforms equal-operator/equal-layer restrictions 2.6×/1.6× in PFLOP/s. Fig. 12 uses unequal 4/4/8-GPU stages. Planning costs are material (Table 5: 2393.26 s for one GPT-39B search). +- F, limits/counter-signals: intra-op compute costs are simplified to zero; stage costs include a profiling/modeling path. Inter-stage transfer and overlap are omitted from the optimizer; microbatch count is external; no global optimum over all plans. Equal-layer is already as good on the tested homogeneous GPT case. +- P, rule: consider changing parallel plans when memory/work differs markedly by stage or collective cost dominates. Compare the proposed heterogeneous plan to a simple equal-stage baseline under fixed global batch, actual topology and explicit cross-stage-transfer cost. Report omitted costs and plan-generation amortization rather than adopting solver output uncritically. + +## AL2. Avoid repeated slow-link copies during resharding + +- F, objective/assumptions: AL §6 reduces communication between unequal meshes when receivers need replicated tiles and local bandwidth is better than cross-mesh bandwidth. +- F, variables/constraints/mechanism: tile source/destination correspondence, unique cross-mesh sends, local allgather; ensure all target shardings receive correct elements. Static per-mesh instructions coordinate execution. +- F, benefit/cost/evidence: §8.5/Fig. 11 reports 2.0× PFLOP/s throughput over send/recv-only for 32-GPU Wide-ResNet. Local collectives/staging replace duplicate slow-link traffic; they are not free. +- F, limits/counter-signals: topology may not provide the assumed asymmetry; optimal many-to-many mapping is not solved. One-byte signal baseline is only an upper-bound control. +- P, rule: derive actual required tensor intersections and replication before proposing multicast-like staging. Classify local allgather under Accelerator topology and only the cross-node segment under Network. Reject byte savings that overload local links or increase peak buffers beyond the common ledger. + +## ZB1. Split critical input-gradient work from deferrable weight-gradient work + +- F, objective/assumptions: ZB §§1–3 reduce synchronous pipeline idle time while respecting activation limits, dependencies and measured F/B/W/communication times. +- F, variables/constraints/mechanism: execution order/end times for F, B and W; prioritize B needed by the previous stage, schedule W in gaps or to reclaim memory. Delaying W extends retention of its inputs. The heuristic searches under memory caps; limited-scale ILP provides another route. +- F, benefit/cost/evidence: Table 4's 28.3B/32-GPU/m96 row gives 0.87 versus 0.76 samples/s/GPU for ZB-1p vs 1F1B at 44 vs 43 GB. ZB-2p reaches 0.99 at 74 GB. Table 5's lower bubble rates are calculated from timing inputs; Fig. 6 shows extra real gaps. +- F, limits/counter-signals: equal F/B/W theory does not match actual kernels; fused backward splitting may add overhead; memory is not free. Appendix A's tail parameter grouping for DP overlap has no isolated measured ablation. +- P, rule: require a trace or supplied equivalent showing B blocked behind deferrable W. Propose split schedules only with measured pass costs, retained-byte lifetimes and collective ordering. A smaller bubble fraction alone is not higher useful-step throughput. + +## ZB2. Compare memory-equivalent schedule/microbatch choices + +- F, objective/assumptions: ZB §§5.4–6 trade bubble reduction against activation memory and microbatch kernel efficiency. +- F, variables/constraints/mechanism: activation cap, microbatch size/count, two-chunk V placement. ZB-V starts F/B locally sooner and balances memory; its ideal zero-bubble claim assumes equal pass times. ZB-2p* trades half-size microbatches for twice their count at fixed global batch. +- F, benefit/cost/evidence: Table 6's 28.3B/32-GPU/base b2,m96: V 1.01 at 71 GB, 2p* 1.00 at 72, 1F1B 0.82 at 69 samples/s/GPU. At 6.2B, 2p* instead beats V. Extra boundaries/communication and smaller kernels can offset reduced idle time. +- F, limits/counter-signals: theoretical pMB is activation memory, not total HBM. Tables 7 and 11 change global batch, and Table 11 has ambiguous m labels; do not use them as matched-global-batch proof. Performance can plateau before exact zero bubbles. +- P, rule: compare a small set at the same global batch, precision, model and total-device-memory margin. Include simpler 1F1B, memory-capped split backward, and V/2p* only when legal. Choose useful throughput over the lowest modeled idle fraction. + +## ZB3. Preserve optimizer validation when removing its global barrier + +- F, objective/assumptions: ZB §4 removes an optimizer synchronization bubble assuming numerical exceptions/clipping are uncommon and updates can be validated and repaired. +- F, variables/constraints/mechanism: partial global-state reduction, tentative update, later complete validation, rollback/re-update where required. Appendix C supplies an in-place AdamW inverse to avoid state copies; no stale-gradient semantics are intended. +- F, benefit/cost/evidence: Appendix E/Table 10: 28.3B/32 GPUs/m96 post-validation 0.99 versus synchronized 0.91 samples/s/GPU. Author per-iteration fixed-seed loss checks are bit-identical for tested schedules, not a broad rollback-stress or convergence study. Rollbacks cost work and can perturb scheduling. +- F, limits/counter-signals: frequent clipping/NaNs, noninvertible updates, finite-precision reversibility, stateful side effects, or unverified rollback coverage undermine the benefit/correctness. Failure-rate sensitivity and broad optimizer support are unreported. +- P, rule: treat barrier removal as a separate correctness gate. Retain global clipping/NaN semantics and require evidence of rollback, redo and dependent-work handling on the actual optimizer before proposing enablement. When absent, keep the synchronized fallback. Do not confuse this post-validation with ZeRO-Offload DPU. + +## Candidate destinations + +- [Activation-residency skill](../../../../plan-activation-residency/SKILL.md): CM1–CM2 and OL1–OL2 share one live-range/retain/recompute decision, with separate capacity and correctness checks. +- [Parallel-plan skill](../../../../choose-parallel-training-plan/SKILL.md): AL1–AL2 share one partition, mapping and resharding decision. +- [Split-backward skill](../../../../assess-split-backward-schedule/SKILL.md): ZB1–ZB3 share a pipeline schedule, memory and optimizer-semantics decision. +- ZO1–ZO3 are an [incremental knowledge extension](../knowledge/offload-delta.md) to the existing offload skill, avoiding a duplicate skill. +- [Cases](../cases/paper-grounded-cases.md) are review examples, not executed tests. [Integration proposals](../INTEGRATION_NOTES.md) target only docs/reference-matrix.md and docs/searchspace-matrix.md. diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/references/source-readset.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/references/source-readset.md new file mode 100644 index 000000000..4fdf21fec --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/papers-20261015/references/source-readset.md @@ -0,0 +1,98 @@ +# Pack C: pinned sources and actual readset + +Status: candidate; empirical_validation: not_run. F = source-reported design, analysis, or observation. P = proposed application. Research date: 2026-10-15 UTC. These are historical designs, not current implementation or NPU-compatibility claims. Only five assigned papers and their original arXiv records were researched. No implementation source was needed. No installation, benchmark, reproduction, hardware task, framework change, matrix edit, InferRSI change, or PR was performed. PDF extraction/rendering and artifact checks are document operations, not empirical validation. + +Activation checkpoints here retain intermediate tensors for recomputation inside training. They are not persistent recovery checkpoints or durability mechanisms. + +## ZO: ZeRO-Offload + +- Full title: ZeRO-Offload: Democratizing Billion-Scale Model Training. Jie Ren, Samyam Rajbhandari, Reza Yazdani Aminabadi, Olatunji Ruwase, Shuangyan Yang, Minjia Zhang, Dong Li, Yuxiong He. +- [Original metadata](https://arxiv.org/abs/2101.06840), [pinned v1 PDF](https://arxiv.org/pdf/2101.06840v1). Only v1 listed: 2021-01-18 02:11:25 UTC. 14 PDF pages. +- Actual relevant readset: §§2–3.5, including §3 footnotes 1–2 and Fig. 2/Table 1; §§4.1–4.2/Figs. 3–4 and associated schedule discussion; §§5.1–5.2 including displayed CPU-Adam algorithm and Fig. 6; §§6.1–6.2.4, Tables 2–4, Figs. 7–13 and associated prose. Visually checked PDF pp. 5 and 11, especially Table 1, Table 4 and Figs. 11–13. Figure 5's code screenshot was not independently transcribed or implementation-audited. +- SHA256 of downloaded pinned PDF: 361dd58aadd744a79b17268b985034de00b9cf7423c000f9aa1549bfa382146c. + +F, setup: GPT-2-like Transformer models; mixed FP16/FP32 Adam. Single-node capacity/throughput tests use DGX-2 with 16 V100 32-GB GPUs, two Xeon Platinum 8168 CPUs, 1.5-TB DDR4, reported bidirectional PCIe 32 GB/s. Scaling uses eight DGX-2 nodes and an InfiniBand switch. Table 3 changes depth, width, microbatch and model parallelism by model size. Fig. 8 uses total batch 512, matched microbatches and gradient accumulation, with delayed parameter update (DPU) disabled. Fig. 10 uses total batch 512 but the largest feasible microbatch for each system. These are different comparison controls. + +F, evidence ledger: +- §§3.1–3.5: graph cuts minimize host/device bytes after fixing O(MB) forward/backward compute and FP16 weights on GPU; O(M) optimizer operations and FP32 master weights/moments move to CPU, as do FP16 gradients. The stated minimum is 4M bytes per iteration for whole model-state offloads in this model. The analysis excludes activation offload and residual-state costs; it is not an arbitrary-hardware global optimum. +- Table 1 prints the final row as 4M device memory and 8× reduction versus 16M. These entries are mutually inconsistent; the surrounding placement prose leaves FP16 parameters plus transient gradient buffers on GPU. Do not silently replace the printed number or treat the table as a reliable total-peak formula. +- §4.2: reduce-scatter gradients before offloading each owned partition; parallel CPU updates; return updated parameter partitions and allgather. Partitioning prevents duplicated host updates/traffic across data-parallel replicas. Claims about increasing CPU resources apply across compute nodes, not indefinitely across more GPUs sharing a fixed host. +- §5.1/Table 4: CPU-Adam versus PyTorch CPU Adam latency in seconds for 1B/2B/4B/8B/10B parameters: 0.22/0.51/1.03/2.41/2.57 versus 1.39/2.75/5.71/11.93/14.76. PyTorch GPU (L2L) comparator: 0.10/0.26/0.64/0.87/1.00. SIMD/loop-unrolling/OpenMP and tiled copy are combined; isolated attribution for each is unreported. +- §6.2.1/Fig. 7: 13B fits one V100 versus 1.4B PyTorch; L2L fits 17B. Capacity leadership therefore does not imply throughput leadership. §6.2.2/Fig. 8: ZeRO-Offload is 14% faster on average, up to 22%, than L2L in reported TFLOP/s under the matched batch comparison. The paper models L2L traffic as 28M versus 4M bytes; this is historical baseline accounting. +- §6.2.2/Fig. 10: up to 70B on 16 GPUs with model parallelism, over 30 TFLOP/s/GPU; not a same-size speed ratio against a baseline that OOMs. §6.2.3/Fig. 11: 10B model aggregate throughput approximately scales through 128 GPUs, but ZeRO-2 becomes faster at 64/128 GPUs once both can use similar microbatches and offload retains a transfer cost. Do not label this fixed-total-work strong scaling without the missing batch/scaling controls. +- §5.2/§6.2.4/Figs. 9,12,13: one-step DPU intentionally uses stale updates after an initial ordinary-training period. At microbatch 8, throughput ratio with/without DPU is reported 1.12–1.59×. Convergence examples enable DPU after 40 iterations: GPT-2 pretraining for 100K iterations shows initially slower loss then catching up; BERT-large SQuAD fine-tuning reaches F1 92.8 in both variants. These two workloads do not establish universal convergence safety. + +## CM: Checkmate + +- Full title: Checkmate: Breaking the Memory Wall with Optimal Tensor Rematerialization. Paras Jain, Ajay Jain, Aniruddha Nrusimha, Amir Gholami, Pieter Abbeel, Kurt Keutzer, Ion Stoica, Joseph E. Gonzalez. +- [Original metadata](https://arxiv.org/abs/1910.02653), [pinned v3 PDF](https://arxiv.org/pdf/1910.02653v3). v1 2019-10-07; v2 2020-03-12; read v3 2020-05-14 17:46:43 UTC. 15 PDF pages. No revision mixing. +- Actual relevant readset: §§4.1–4.10, Eqs. 1–9, Theorem 4.1 and Lemmas 4.1–4.2; §§5.1–5.3 and Algorithms 1–2; §§6.1–6.5, Eq. 10, Tables 1–2, Figs. 5–6; Appendices A–D, Figs. 7–8. Visually checked PDF pp. 9–10 for Figs. 5–6/Table 2. PDF p. 2 contains a figure with embedded manuscript text; its obsolete equation/section snippets were not used in place of the body formulation. +- SHA256: 8355cc2ecac072863fde2542585f8da0be30924e6181d9b05a36a63b22a1f694. + +F, model and evidence: +- §§4.1–4.10: static DAG; each value has memory Mv and per-evaluation cost Cv. Binary R[t,i] selects evaluation, S[t,i] retention. U[t,k] accounts for memory just after an output exists and before dependencies are freed. Inputs/parameters and parameter-gradient reserve remain resident (Eq. 2). FREE variables require no later user and no retained checkpoint. Objective minimizes summed evaluation costs under per-event memory budget, not transfer time. +- §4.6/Eq. 8 restricts to a supplied topological order and frontier-advancing stages. This narrows the feasible set; optimality is within this formulation, not all possible reordered/parallel executions. Example: an eight-layer linear graph with unit costs and memory budget 4 solves in 0.23 seconds versus 9.4 hours unpartitioned, to the same objective. Appendix A's corresponding integrality-gap example is 1.18 versus 21.56. These are optimization examples, not training throughput. +- §4.10: additive timings from layer profiling on target hardware, shapes and batch; dense tensors use four-byte floats in the evaluated model. §6 implementation is TensorFlow 2.0/Keras/Gurobi. Most ordinary solves use 3600-second limit on at least 24 CPU cores. §5 reports no feasible solution for a DenseNet161 instance within one day; solver timeouts do not prove infeasibility. +- §6.3/Fig. 5: overhead is profile-model time relative to no-rematerialization ideal, using one NVIDIA V100. U-Net batch 32, 416×608 images, 16-GB budget: reported 1.20× speedup over linearized greedy and 1.38× over linearized sqrt(n). This is not directly measured whole-training speedup. VGG16 batch 256 and MobileNet batch 512 use 224×224. +- §6.4/Eq. 10/Fig. 6: maximize feasible batch subject to 16 GB and at most one extra forward pass in statically computed FLOPs. The nonlinear formulation gets a one-day limit; returned batch is a lower bound if optimality is unproved. MobileNet 224×224: 1105 versus 215 checkpoint-all and 640 linearized-greedy; author reports 5.1× and 1.73× respectively. U-Net 416×608: 61 versus 16 checkpoint-all and 35 best plotted heuristic. These are theoretical feasible-batch results, not observed time-to-quality or a guarantee that enlarged batch preserves training behavior. +- §§5.1–5.3/Algorithm 2: round S, then restore minimal necessary R to satisfy computation dependencies. Capacity is not guaranteed by this procedure. The authors empirically use 10% memory allowance; Appendix D says that allowance is overly conservative for MobileNet. +- §6.5/Table 2: two-phase approximation COSTapprox/COSTopt, geometric mean across mutually feasible budgets, in FLOPs: MobileNet 1.06, VGG16 1.01, VGG19 1.00, U-Net 1.03, ResNet50 1.05. It is neither a worst-case 1.06 approximation guarantee nor a whole-job speed ratio. Appendix D/Fig. 8 compares randomized versus deterministic two-phase rounding with profile-cost milliseconds. + +## OL: OLLA + +- Full title: OLLA: Optimizing the Lifetime and Location of Arrays to Reduce the Memory Usage of Neural Networks. Benoit Steiner, Mostafa Elhoushi, Jacob Kahn, James Hegarty. +- [Original metadata](https://arxiv.org/abs/2210.12924), [pinned v2 PDF](https://arxiv.org/pdf/2210.12924v2). v1 2022-10-24; read v2 2022-11-02 19:22:24 UTC. 14 PDF pages. +- Actual relevant readset: §§2.1–2.3/Figs. 3–4; §§3.1–3.5, Eqs. 1–9/Function 1; §§4.1–4.5, Eqs. 10–15/Functions 2–5/Figs. 5–6; §§5.1–5.7/Figs. 7–14; §6's placement/lifetime comparison. Visually checked PDF p. 10 (Figs. 11–14 and §5.7). Individual bar values were not digitized. +- SHA256: 69aebb2c874871e363ccec93e2ea15891e91c793153cde37004d17ea12ddef0b. + +F, model and evidence: +- §3: DAG tensors are edges (possibly multiple consumers), with known sizes. Binary creation C[e,t] and preservation P[e,t] enforce exactly one creation, availability of all inputs, contiguous retention and simultaneous sibling outputs. Integer A[e] is a base address in one preallocated buffer, not GPU/CPU/SSD tier placement. Concurrent live tensors cannot overlap addresses. Objective minimizes maximum A[e]+size[e]. It neither offloads nor recomputes tensors. +- §§4.1–4.5: bound variable ranges using earliest/latest schedules and useful lifetimes; drop pairwise constraints for proven nonoverlapping tensors; add control edges to force safe early weight updates; split lifetime optimization (Eq. 14) from address optimization (Eq. 15); preplace nested activation lifetimes. The split relies on their empirical ability to remove fragmentation, not a universal proof that independently optimized lifetimes always admit ideal packing. +- §§5.1–5.2: PyTorch 1.11, torchtext/torchvision 0.12, torch.FX and Gurobi 9.1.1; Xeon Gold 6138 at 2.0 GHz plus A100 40 GB. Eleven families: AlexNet, EfficientNet, GoogleNet, MNASNet, MobileNet, ResNet, ResNet3D, Transformer, VGG, ViT, XLM-R, at batches 1/32. Graph size ranges from AlexNet 118 to XLM-R 2007 operators. +- §5.3/Fig. 7: node-reordering comparison excludes fragmentation, measuring peak requested operator memory/resident demand rather than allocator-reserved bytes. Maximum reduction 38%; mean 22.5% at batch 1, 10.1% at batch 32. Less leverage at large batch is attributed to forward activations dominating gradients. +- §5.4/Fig. 8: fragmentation defined (MR−RS)/MR at peak reserved memory MR. PyTorch mean fragmentation 7.9% at batch 1, 26.1% at batch 32; OLLA fully removes it in evaluated scenarios. Do not add these percentages to lifetime percentages: denominators differ. +- §§5.5–5.6/Figs. 9–12: median ordering solve 1.4±0.2 s, address generation 5.7±0.6 s; difficult EfficientNet ordering takes 2 min for batch-1 optimum, 5 min to within 1% at batch 32. GoogleNet/EfficientNet packing reaches <1% fragmentation within 5 min. The text's uncertainty notation is retained; no unreported confidence interpretation is added. +- §5.7/Fig. 13: cap each of the two optimizations at five minutes; overall memory reduction averages 30.4% at batch 1 and 36.1% at batch 32 versus PyTorch. §5.7/Fig. 14 estimates about five minutes runtime saved over one million batch-32 iterations by comparing allocator costs with upfront optimization. Total training time under the two schemes was explicitly not directly measured; batch-1 runtime estimate is unreported. +- Isolated ablations of every pruning/early-update/preplacement optimization and distributed-training interactions are unreported. No conclusion about current PyTorch allocator behavior follows from the 1.11 comparison. + +## AL: Alpa + +- Full title: Alpa: Automating Inter- and Intra-Operator Parallelism for Distributed Deep Learning. Lianmin Zheng, Zhuohan Li, Hao Zhang, Yonghao Zhuang, Zhifeng Chen, Yanping Huang, Yida Wang, Yuanzhong Xu, Danyang Zhuo, Eric P. Xing, Joseph E. Gonzalez, Ion Stoica. +- [Original metadata](https://arxiv.org/abs/2201.12023), [pinned v3 PDF](https://arxiv.org/pdf/2201.12023v3). v1 2022-01-28; v2 2022-06-03; read v3 2022-06-28 19:36:44 UTC. 20 PDF pages. A v1 PDF was fetched before metadata resolution but not used as evidence. +- Actual relevant readset: §§2–8.6 including every method, limitation and evaluation subsection; Eqs. 1–6, Algorithm 1, Tables 1–5, Figs. 1–12 and associated prose; Appendix A/Theorem 1/Eq. 7, Appendix B/Tables 6–8, Appendix C/Fig. 13. Visually checked PDF p. 13/Table 5/Figs. 10–11. +- SHA256: cd1dea70769571a5e9298ba0610e04cc514a06ab12018dd7f19a457fd00cd474. + +F, model and evidence: +- §4/Eq. 1: choose one sharding algorithm per operator on a homogeneous 2-D logical device mesh, accounting for operator communication and edge resharding. The evaluated ILP estimates bytes/bandwidth and sets compute costs dv to zero, assuming equal arithmetic work among heavy-op shardings and negligible lightweight work. It does not show all equal-FLOP kernels run equally fast. Post-ILP reduce-scatter/allgather can reduce replicated optimizer work without changing total collective bytes. +- §5/Eqs. 2–5: stages are contiguous in a given operator ordering; corresponding forward/backward ops colocate. Objective sum(stage latency)+(B−1)×max(stage latency) for the chosen static GPipe/1F1B timing model. DP chooses stage boundaries and restricted physical submesh shapes; intra-op choices are evaluated per stage/mesh. 1F1B feasibility uses memstage+s×memact≤memdevice. Infeasible stage/mesh pairs get infinite cost. Shape restriction ensures device coverage, not global-optimal search over arbitrary partitions. +- §5.2 says compile/profile stage plans including fusion and memory planning; §8.4 describes accelerating profiling with a piecewise-linear XLA-operation cost model. Do not present all plan costs as directly timed full stages. Search also clusters operators and prunes DP choices. +- §6/Fig. 6: cross-mesh resharding sends each needed tile across slow links then locally allgathers replicated destinations, avoiding redundant slow transfers. Static per-mesh instruction lists avoid continuous driver coordination. Optimal cross-mesh resharding is left to future work. +- §7: no inter-stage communication cost in the plan objective; microbatch count is an external hyperparameter, not internally optimized; static shapes/graphs and linear schedules; no optimization of computation/communication overlap. Two-level solution is not guaranteed globally optimal. +- §8: eight AWS p3.16xlarge nodes, eight V100 16-GB GPUs/node, intra-node NVLink, 25-Gbps cross-node bandwidth; 64 vCPU and 488-GB host memory/node. Metric is aggregate PFLOP/s on warmed-up dummy-data batches; model size grows with GPU count (weak scaling). Global batches: GPT and MoE 1024/FP16; Wide-ResNet 1536/FP32. GPT/MoE sequence 1024; image input 224×224×3. Microbatch tuned per configuration. +- §8.1/Fig. 7: GPT roughly matches grid-searched Megatron-LM v2; MoE beats DeepSpeed 3.5× on 16 GPUs (10B model) and 9.7× on 32 GPUs (27B), where the historical DeepSpeed baseline has no inter-op pipeline and slow network communication dominates. Wide-ResNet achieves author-reported 80% linear-scaling efficiency on 32 GPUs. These are not time-to-quality or equal-model strong-scaling results. +- §8.2/Fig. 8: isolate intra-op search on one eight-GPU node, disabling pipeline and gradient accumulation, with altered model shapes/batches versus §8.1. ILP is compared with data parallel, ZeRO-2/3 and largest-axis sharding heuristic. It cannot be merged numerically with the end-to-end setup. +- §8.3/Fig. 9: at 32 GPUs, Wide-ResNet DP plan is 2.6×/1.6× faster in PFLOP/s than equal-operator/equal-layer restrictions; equal-layer equals DP on homogeneous GPT. §8.5/Fig. 11: local-allgather resharding gives 2.0× throughput over send/recv-only on 32-GPU Wide-ResNet. One-byte signal control is a synthetic upper bound, not executable model semantics. +- §8.4/Table 5: GPT-39B/64-GPU compilation 1582.66 s, profiling 804.48 s, stage DP 1.65 s, other 4.47 s, total 2393.26 s versus >40 h without optimizations. This is one supplied microbatch-count run, not cost of searching all B. +- §8.6/Fig. 12: Wide-ResNet/16 GPUs chooses three stages on 4/4/8 GPUs, with early activation-heavy layers preferring batch partitioning and later weight-heavy work different sharding. Table 4 rounds the 32-GPU Wide-ResNet model to 6.7B while Table 8 says 6.8B; do not silently reconcile. + +## ZB: Zero Bubble Pipeline Parallelism + +- Full title: Zero Bubble Pipeline Parallelism. Penghui Qi, Xinyi Wan, Guangxing Huang, Min Lin. +- [Original version record](https://arxiv.org/abs/2401.10241v1), [pinned v1 PDF](https://arxiv.org/pdf/2401.10241v1), [same-version HTML](https://arxiv.org/html/2401.10241v1). The original record and PDF both give v1 as 2023-11-30 10:40:34 UTC despite the 2401 identifier; retain that source metadata. 19 PDF pages. arXiv's link boilerplate says "and 2 other authors" while its author list and PDF contain four; use the actual list. +- Actual relevant readset: §§1–7 (all subsections), Tables 1–8/Figs. 1–9; Appendices A–H including Figs. 10–11, Appendix B Eqs. 1–2, Appendix C Algorithm 1 (AdamW rollback), Appendix G Eqs. 3–7, Tables 9–12. Visually checked PDF pp. 7, 11 and 18 for Tables 4,6–8,11 and associated plots/text. The v1 HTML served as an additional same-version methods check. +- SHA256: 0de7cd6efd52eaa3f216129cd186ab755b1045bca1f6ddc422216295a7e9fee9. + +F, model and evidence: +- §§1–2: split backward into B (input gradient, critical across stages) and W (parameter gradient, movable after B). Delaying W retains its needed activations/gradients. Table 2's ideal comparison: 1F1B bubble (p−1)(TF+TB+TW), ZB-H1 (p−1)(TF+TB−TW), both peak activations pMB; ZB-H2 bubble (p−1)(TF+TB−2TW), peak (2p−1)MB. Zero-bubble equality depends on timing assumptions and removing the optimizer barrier; it is not a universal empirical zero-idle guarantee. +- §3/Appendix G: schedule ordering/end times with inter-stage F/B dependencies, device sequencing and cumulative activation-memory limits; input p,m, memory cap, profiled TF/TB/TW/Tcomm. Heuristic schedules W into gaps or when memory needs release; ILP is feasible only at limited problem scale. Appendix A proposes parameter-grouped tail W work for overlapping data-parallel allreduce; an isolated measured ablation of that proposal is unreported. +- §4/Appendix C: partial reductions followed by post-update validation; invalid speculative updates roll back and redo using global clipping/NaN state. AdamW arithmetic inverse is supplied to avoid a full historical state copy. This is not permission to omit clipping or accept stale-gradient training. Finite-precision rollback stability, rare-event failure frequency and broad optimizer support are not established by the reported throughput table. +- §5.1: Megatron-LM-based GPT-like models, up to 32 A100 SXM 80-GB GPUs on four RoCE RDMA nodes; sequence 1024; end stages have one fewer Transformer layer to offset embedding/loss work. Hardware bandwidth value is unreported. Table 3: 1.5B/6.2B/14.6B/28.3B on 8/8/16/32 pipeline GPUs, microbatch size 6/3/1/1 and microbatch counts 3p,4p,8p. 1F1B-I uses each Transformer layer as a chunk. Author correctness check uses identical fixed-seed per-iteration losses, without training to convergence; the reported number of correctness-check iterations is unreported. +- §5.2/Table 4, representative measured row: 28.3B, 32 GPUs, b=1,m=96: ZB-2p 0.99 samples/s/GPU at 74 GB, ZB-1p 0.87 at 44 GB, 1F1B 0.76 at 43 GB, 1F1B-I 0.82 at 58 GB. Doubling an activation budget does not double total memory. Same-activation-cap ZB-1p still has modestly higher measured total memory than 1F1B. +- §5.3/Table 5: bubble rates are schedule calculations using measured timing inputs, not directly measured idle percentages. For the above row: 1F1B 0.2646; ZB-H2 0.0641; ZB-1p 0.1421; ZB-2p 0.0038. Fig. 6 contrasts generated and profiled timelines and acknowledges extra real bubbles. Appendix D/Table 9 supplies timing inputs; its table does not explicitly label time units, so no unit is invented here. +- §5.4/Fig. 7/Appendix B: memory/idle tradeoff plateaus near 2pMB when TF≈TB and Tcomm is small. More memory can have diminishing returns; communication and first-B dependency chains remain. +- §6/Fig. 8: ZB-V maps two chunks/device in a forward-and-reverse V order, enabling earlier local backward and balanced activation demand. Ideal TF=TB=TW permits zero bubble at pMB; actual profiled schedules remain nonzero. Additional chunk boundaries introduce communication and computation-granularity tradeoffs. +- §6.1/Table 6 is the stronger approximately matched-memory/global-batch comparison: ZB-2p* halves b and doubles m, keeping global batch. 28.3B, 32 GPUs, base b=2,m=96: ZB-V 1.01 samples/s/GPU at 71 GB; ZB-2p* 1.00 at 72; ZB-1p 0.94 at 73; 1F1B 0.82 at 69. 6.2B/16 GPUs/base b=6,m=48: ZB-2p* 4.36 at 63 GB versus ZB-V 4.15 at 64; V is not universally fastest. +- Table 7 varies b with fixed m, changing global batch; the b=1→2 14.6B ZB-V row is 1.75→1.88 samples/s/GPU (7.43%). Do not present it as matched-global-batch isolation. Table 8's V bubble rates are calculated, like Table 5. +- Appendix E/Table 10: optimizer post-validation versus allreduce synchronization, samples/s/GPU: 1.5B/8 GPUs/m24 14.5 vs 13.11; 6.2B/8/m24 4.32 vs 4.00; 14.6B/16/m48 1.81 vs 1.68; 28.3B/32/m96 0.99 vs 0.91. No measured rollback-rate sensitivity curve is reported. +- Appendix F/Table 11 keeps listed m while changing b, so global batch differs. It also prints middle m=32 for the 14.6B and 28.3B blocks, inconsistent with the main setup's 64/128. Preserve as a source ambiguity; use Table 6 for fixed-global-batch evidence. Table 11 includes cases where larger-b ZB-1p exceeds ZB-2p, a useful counter-signal. +- Appendix H/Table 12: at m≤p benefits persist but bubbles remain. Example 14.6B,p16,m4,b1: 0.39→0.52 samples/s/GPU, 19→20 GB, 1F1B→ZB-2p. This is throughput at small microbatch count, not elimination of all bubbles. diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/sources.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/sources.md new file mode 100644 index 000000000..2ef6f4e1c --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/sources.md @@ -0,0 +1,61 @@ +# Cross-resource reference evidence + +Initial scoped inspection: 2026-10-15. CR5 historical-source follow-up: +2026-10-30. No hardware, dependency installation, benchmark or checkpoint +implementation investigation was performed. + +## CR1 — DeepSpeed + +- Implementation: [offload_config.py](https://github.com/deepspeedai/DeepSpeed/blob/5f266e26d216a705d9c64cac88fb813cefdbac4b/deepspeed/runtime/zero/offload_config.py), + whole short configuration file (parameter config 20–51, optimizer config + 54–111). Revision `5f266e26d216a705d9c64cac88fb813cefdbac4b`. +- License: Apache-2.0, confirmed by file header and downloaded root LICENSE. + Mechanisms are paraphrased; no source code copied. +- [Official ZeRO-3 docs](https://deepspeed.readthedocs.io/en/latest/zero3.html), + offload overview and parameter/optimizer configuration fields only. Live + `latest` HTML SHA-256: + `56beb8cdf148ace7a279518e1abe8256fa767038b471b273aa8650e55b295f46`. + Retrieved fields match the inspected config, including `pin_memory=True`; + this is not a claim that the entire docs build matches the source SHA. +- `max_in_cpu` is explicitly parameter elements. `buffer_size` units are not + defined in this approved config excerpt or its live field description; + no runtime consumer was inspected, so no byte-budget formula or unsupported + element-unit assertion is supplied for that field. +- `pipeline_read/write` descriptions establish intended tiled optimizer overlap, + not dispatch or measured overlap. CPU Adam core share is gated by stage 3 and + super-offload. No NVMe/pinned-memory support is inferred for NPU hardware. + +## CR6 — Stas ML Engineering + +Revision `ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7`; approved skill and targeted +performance sections only. Exact citations, adaptation license and limitations +are in the sibling Stas decision note linked directly from SKILL.md. +The source skill declares CC BY-SA 4.0; root `LICENSE` URL returned 404, so +that declaration, not a guessed root file, supplies attribution evidence. +Compute/network scripts were identified but not fetched or executed. + +## CR5 — MindSpeed + +The 2026-10-15 inspection was historical GitCode documentation only, with short +history ID `53193db8` and unresolved full pin/license. The 2026-10-30 follow-up +resolved `53193db8bf5def407c4041a9beb3f4c9e9773daf` through the original commit +link and official Ascend/MindSpeed GitHub source. Its root LICENSE supplies +default BSD-3-Clause terms with identified third-party exceptions; no later +documentation license replaces that historical evidence. + +The [historical case](mindspeed-historical.md) preserves the original date and +HTML hash. The [new bounded readset](mindspeed-source-readset.md) supports +selection versus validation, allocator/callback ownership, eligible shared-storage +rescue, explicit autograd-wrapper integration and conditional CPU-affinity +prerequisites. Complete search/cache behavior, current compatibility, numerical +correctness and measured benefit remain unqualified. Only independent mechanism +paraphrases are included; no upstream implementation or headline percentage is +copied. + +## Evidence distinctions + +DeepSpeed configuration is source code plus matched field documentation. +Stas material is attributed expert methodology. MindSpeed combines a historical +author-described case with bounded source observations at the recovered pin. +None is a measured InferRSI gain, a runtime qualification or an automatic +authorization to execute the original runbooks. diff --git a/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/stas-decision-notes.md b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/stas-decision-notes.md new file mode 100644 index 000000000..d23929590 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/playbooks/training-resource-budget/references/stas-decision-notes.md @@ -0,0 +1,41 @@ +# Stas Bekman scoped decision notes + +**Attribution:** Stas Bekman, *Machine Learning Engineering Open Book*, +[stas00/ml-engineering](https://github.com/stas00/ml-engineering/tree/ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7), +revision `ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7`. +The source skill explicitly declares **CC BY-SA 4.0**. This file is a shortened, +reorganized, paraphrased adaptation and is distributed under +[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). Retain attribution, +the license link and change indication in downstream adaptations; apply +share-alike to adapted material. This notice does not relicense independent +DeepSpeed/MindSpeed materials or the repository as a whole. No endorsement by +Stas Bekman is implied. + +Inspected 2026-10-15. No source commands were executed and no numerical gains +were transferred. These are practitioner decision principles, not local tests. + +## Incremental rules and their limits + +| Signal or choice | Decision principle | Evidence boundary | +|---|---|---| +| MFU/HFU changed after recomputation or precision changes | Retain the FLOP-count convention, theoretical denominator and timed interval. HFU can count recomputation that MFU excludes. Pair ratios with useful workload throughput. | Different operation counts or forward/backward-only versus full-step timing invalidate direct comparison; mixed precision complicates a single peak denominator. | +| High short-burst matmul result | Separate a transient attainable ceiling from sustained compute under the node's shared power/cooling load. | Maximum-achievable and maximum-sustainable concepts are source methodology; no ceiling benchmark was run here. | +| Slow collective or confusing bandwidth figure | Retain collective kind, payload size, participating ranks and intra-node versus inter-node path. Keep algorithm bandwidth and bus bandwidth distinct. | The benchmark script is only a source entry point, not an audited or executed implementation. Host/device copies and shared-memory IPC do not qualify this network cell. | +| CPU-heavy offload slows a rank | Relate process and memory locality to the actual accelerator/NUMA topology; rank-local CPU work can expose cross-socket cost. | Source notes small effect for CPU-light work. Never copy example CPU IDs or claim universal improvement. No affinity was changed. | +| Intermittent synchronized-step stalls | Correlate per-rank garbage-collection events with collective arrival/step spikes before attributing them to the fabric. | Source proposes scheduled manual collection when automatic collection creates stragglers. That is an experiment lead, not permission to disable collection or proof of cause; track memory if later authorized. | + +## Exact readset + +- [skills/ml-engineering/SKILL.md](https://github.com/stas00/ml-engineering/blob/ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7/skills/ml-engineering/SKILL.md#L21-L79): + attribution, bottleneck-first principles, compute/memory/network/NUMA/GC routing. +- [skills/evaluate-cluster/SKILL.md, first 100 lines](https://github.com/stas00/ml-engineering/blob/ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7/skills/evaluate-cluster/SKILL.md#L1-L100): + compute ceiling and collective-bandwidth definitions only. Ignore its + instructions to update to latest, install tools or run a cluster campaign. +- [training/performance/README.md, 129–180](https://github.com/stas00/ml-engineering/blob/ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7/training/performance/README.md#L129-L180): + MFU/HFU and comparison caveats. +- [NUMA, 748–789](https://github.com/stas00/ml-engineering/blob/ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7/training/performance/README.md#L748-L789) + and [garbage collection, 1030–1047](https://github.com/stas00/ml-engineering/blob/ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7/training/performance/README.md#L1030-L1047). + +Source fio, input-pipeline, recovery and other runbook sections were not mined. +No original benchmark script, raw experiment or historical model result was +validated. Concepts transfer only after workload/mode-specific qualification. diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.integration-notes.json b/src/inferrsi/knowledge/atoms/training-resource-budget.integration-notes.json new file mode 100644 index 000000000..e87eaed7d --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.integration-notes.json @@ -0,0 +1,75 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "title": "Pack C integration proposals", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md", + "sha256": "c55c6ad2131ef788866411dcc7056f221420ebff30c95c6bc919b09a4818cb73" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "id": "training-resource-budget.integration-notes", + "kind": "knowledge", + "entrypoint": "INTEGRATION_NOTES.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md", + "byte_range": [ + 0, + 7368 + ], + "sha256": "c55c6ad2131ef788866411dcc7056f221420ebff30c95c6bc919b09a4818cb73" + } + } + }, + "content": { + "INTEGRATION_NOTES.md": { + "path": "playbooks/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.mindspeed-historical.json b/src/inferrsi/knowledge/atoms/training-resource-budget.mindspeed-historical.json new file mode 100644 index 000000000..b9d1f9c4a --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.mindspeed-historical.json @@ -0,0 +1,75 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "title": "Historical MindSpeed adaptive-memory case", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/mindspeed-historical.md", + "sha256": "ad65c27f278c3d0ca3599a7630c02d3e529477a05b71b7703bd2d75f0d8fdd2c" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "id": "training-resource-budget.mindspeed-historical", + "kind": "knowledge", + "entrypoint": "mindspeed-historical.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/mindspeed-historical.md", + "byte_range": [ + 0, + 7580 + ], + "sha256": "ad65c27f278c3d0ca3599a7630c02d3e529477a05b71b7703bd2d75f0d8fdd2c" + } + } + }, + "content": { + "mindspeed-historical.md": { + "path": "playbooks/training-resource-budget/references/mindspeed-historical.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.mindspeed-source-readset.json b/src/inferrsi/knowledge/atoms/training-resource-budget.mindspeed-source-readset.json new file mode 100644 index 000000000..5279be998 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.mindspeed-source-readset.json @@ -0,0 +1,75 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "title": "MindSpeed historical source readset", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/mindspeed-source-readset.md", + "sha256": "4462d69ed6a941a03639c756968be3ce54f947e51f6ca618f4fb1cd43b643b35" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "id": "training-resource-budget.mindspeed-source-readset", + "kind": "knowledge", + "entrypoint": "mindspeed-source-readset.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/mindspeed-source-readset.md", + "byte_range": [ + 0, + 7158 + ], + "sha256": "4462d69ed6a941a03639c756968be3ce54f947e51f6ca618f4fb1cd43b643b35" + } + } + }, + "content": { + "mindspeed-source-readset.md": { + "path": "playbooks/training-resource-budget/references/mindspeed-source-readset.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.offload-delta.json b/src/inferrsi/knowledge/atoms/training-resource-budget.offload-delta.json new file mode 100644 index 000000000..3d25c44d6 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.offload-delta.json @@ -0,0 +1,75 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "title": "Incremental extension to training-offload knowledge", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md", + "sha256": "f8740fc5c8bbbe5ac13ff1cfec7ca499569d0b46e8cd56cf1f5a44c3a5e72242" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "id": "training-resource-budget.offload-delta", + "kind": "knowledge", + "entrypoint": "offload-delta.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md", + "byte_range": [ + 0, + 2026 + ], + "sha256": "f8740fc5c8bbbe5ac13ff1cfec7ca499569d0b46e8cd56cf1f5a44c3a5e72242" + } + } + }, + "content": { + "offload-delta.md": { + "path": "playbooks/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.original.json b/src/inferrsi/knowledge/atoms/training-resource-budget.original.json new file mode 100644 index 000000000..9c0d226b2 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.original.json @@ -0,0 +1,104 @@ +{ + "authority": "checkout", + "metadata": { + "id": "training-resource-budget.original", + "kind": "knowledge", + "entrypoint": "guide.md", + "title": "Choose training offload and resource-budget changes using pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case. Balance accelerator capacity, CPU work, pinned RAM and local storage; keep host/device transfer exposure distinct from collective network bottlenecks.\n", + "origin": [ + "external" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/SKILL.md", + "sha256": "e8adf9d115975844d6c7a1b1809c1cbc2baeabc1318198a777050f159a0fe8e2" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/SKILL.md", + "byte_range": [ + 0, + 12306 + ], + "sha256": "e8adf9d115975844d6c7a1b1809c1cbc2baeabc1318198a777050f159a0fe8e2" + } + } + }, + "content": { + "guide.md": { + "path": "playbooks/training-resource-budget.md" + } + }, + "parts": { + "navigation": { + "skill_section": "navigation", + "layer": "L0", + "byte_range": [ + 0, + 356 + ], + "sha256": "9c1682e170d92bea942cf3e7dcd886634df374d36a96a795b85be90e2deefd4b" + }, + "decision": { + "skill_section": "decision", + "layer": "L1", + "byte_range": [ + 0, + 4973 + ], + "sha256": "c430e1e846bb7aec1a91b42a4588f05cc44816233cb1832c9c3fa106c2848dc4" + }, + "procedure": { + "skill_section": "procedure", + "layer": "L2", + "byte_range": [ + 4973, + 12306 + ], + "sha256": "7a7316954032fb9cd4b6506f9f7b63ef72afc2a34ac5d55448850d18e020097a" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.paper-grounded-cases.json b/src/inferrsi/knowledge/atoms/training-resource-budget.paper-grounded-cases.json new file mode 100644 index 000000000..7e70b19a2 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.paper-grounded-cases.json @@ -0,0 +1,75 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "title": "Paper-grounded review cases", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md", + "sha256": "19bd25b1a944adb2351ebc6b1d795150ea033041a44f6cc261e881677812a101" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "id": "training-resource-budget.paper-grounded-cases", + "kind": "knowledge", + "entrypoint": "paper-grounded-cases.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md", + "byte_range": [ + 0, + 5649 + ], + "sha256": "19bd25b1a944adb2351ebc6b1d795150ea033041a44f6cc261e881677812a101" + } + } + }, + "content": { + "paper-grounded-cases.md": { + "path": "playbooks/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.source-readset.json b/src/inferrsi/knowledge/atoms/training-resource-budget.source-readset.json new file mode 100644 index 000000000..d02496ce0 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.source-readset.json @@ -0,0 +1,75 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "title": "Pack C: pinned sources and actual readset", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/references/source-readset.md", + "sha256": "2a5c166767f56fa47e7eba7386f1f36da8cb73702e5b5bbe14d6a456ca9ebfae" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "id": "training-resource-budget.source-readset", + "kind": "knowledge", + "entrypoint": "source-readset.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/references/source-readset.md", + "byte_range": [ + 0, + 22946 + ], + "sha256": "2a5c166767f56fa47e7eba7386f1f36da8cb73702e5b5bbe14d6a456ca9ebfae" + } + } + }, + "content": { + "source-readset.md": { + "path": "playbooks/training-resource-budget/references/papers-20261015/references/source-readset.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.sources.json b/src/inferrsi/knowledge/atoms/training-resource-budget.sources.json new file mode 100644 index 000000000..c730102a7 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.sources.json @@ -0,0 +1,75 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "title": "Cross-resource reference evidence", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/sources.md", + "sha256": "53d70671a183de4aaa3369f9caf2383a23b6f8a0a7b04464a8d8a639150afc6a" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "id": "training-resource-budget.sources", + "kind": "knowledge", + "entrypoint": "sources.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/sources.md", + "byte_range": [ + 0, + 3502 + ], + "sha256": "53d70671a183de4aaa3369f9caf2383a23b6f8a0a7b04464a8d8a639150afc6a" + } + } + }, + "content": { + "sources.md": { + "path": "playbooks/training-resource-budget/references/sources.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.stas-decision-notes.json b/src/inferrsi/knowledge/atoms/training-resource-budget.stas-decision-notes.json new file mode 100644 index 000000000..c6ff0a6ae --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.stas-decision-notes.json @@ -0,0 +1,94 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [ + { + "type": "git", + "repo": "https://github.com/stas00/ml-engineering", + "commit": "ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7", + "author": "Stas Bekman", + "title": "Machine Learning Engineering Open Book", + "license": "CC-BY-SA-4.0", + "license_url": "https://creativecommons.org/licenses/by-sa/4.0/" + } + ], + "empirical_validation": "not_run", + "title": "Stas Bekman scoped decision notes", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/stas-decision-notes.md", + "sha256": "f1a993e6c4ca9a035a2effcaf5500081f227b0cc56cc885a6b22fda0041fc744" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + }, + { + "type": "git", + "repo": "https://github.com/stas00/ml-engineering", + "commit": "ee7517e0f562ff0e7d56c3e88c619d0c0c496ba7", + "author": "Stas Bekman", + "title": "Machine Learning Engineering Open Book", + "license": "CC-BY-SA-4.0", + "license_url": "https://creativecommons.org/licenses/by-sa/4.0/" + } + ], + "id": "training-resource-budget.stas-decision-notes", + "kind": "knowledge", + "entrypoint": "stas-decision-notes.md", + "atom": { + "when": {}, + "license": "CC-BY-SA-4.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/stas-decision-notes.md", + "byte_range": [ + 0, + 4086 + ], + "sha256": "f1a993e6c4ca9a035a2effcaf5500081f227b0cc56cc885a6b22fda0041fc744" + } + } + }, + "content": { + "stas-decision-notes.md": { + "path": "playbooks/training-resource-budget/references/stas-decision-notes.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/training-resource-budget.training-memory-scheduling.json b/src/inferrsi/knowledge/atoms/training-resource-budget.training-memory-scheduling.json new file mode 100644 index 000000000..ce2084d13 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/training-resource-budget.training-memory-scheduling.json @@ -0,0 +1,75 @@ +{ + "authority": "checkout", + "metadata": { + "origin": [ + "external" + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "title": "Training memory and scheduling: incremental mechanisms", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md", + "sha256": "9aa6d3e01452dff95c8a8940ff62ead8c146ce215c9175b78c9f2ef508a7b2de" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "id": "training-resource-budget.training-memory-scheduling", + "kind": "knowledge", + "entrypoint": "training-memory-scheduling.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md", + "byte_range": [ + 0, + 18660 + ], + "sha256": "9aa6d3e01452dff95c8a8940ff62ead8c146ce215c9175b78c9f2ef508a7b2de" + } + } + }, + "content": { + "training-memory-scheduling.md": { + "path": "playbooks/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md" + } + } +} diff --git a/src/inferrsi/knowledge/compositions/training-resource-budget.json b/src/inferrsi/knowledge/compositions/training-resource-budget.json new file mode 100644 index 000000000..e6a405480 --- /dev/null +++ b/src/inferrsi/knowledge/compositions/training-resource-budget.json @@ -0,0 +1,176 @@ +{ + "authority": "checkout", + "metadata": { + "id": "training-resource-budget", + "kind": "skill", + "entrypoint": "playbooks/planning/training-resource-budget/SKILL.md", + "title": "Choose training offload and resource-budget changes using pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case. Balance accelerator capacity, CPU work, pinned RAM and local storage; keep host/device transfer exposure distinct from collective network bottlenecks.\n", + "origin": [ + "external" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/playbooks/planning/training-resource-budget/SKILL.md", + "sha256": "e8adf9d115975844d6c7a1b1809c1cbc2baeabc1318198a777050f159a0fe8e2" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "applicability": { + "scope": "Choosing training offload and resource-budget changes from pinned DeepSpeed configuration, attributed expert diagnosis and a historical MindSpeed case, balancing accelerator capacity, CPU work, pinned RAM and local storage while keeping host/device transfer exposure distinct from collective network bottlenecks", + "prerequisites": "The source boundaries are read; garbage-collection or affinity changes, privileged memlock changes and delayed parameter updates each need separate approval, and the skill authorizes no newest-wheel installation, scheduler-priority change, benchmark or failure injection; historical MindSpeed reuse requires compatible allocator symbols, tracked swappable storage, sufficient host capacity and verified device/NUMA/CPU mapping, not merely the presence of npu-smi and lspci", + "input_contract": "State attributed to parameters, optimizer state, gradients or activations with its current memory tier, lifetime and next consumer; whether the failure is allocation capacity or throughput; a per-host budget for input buffers, checkpoint snapshots, offloaded state, OS cache and CPU workers with the actual ranks sharing the host; the host/device link recorded apart from collective traffic; the exact source version and enabled execution mode", + "produced_artifact": "A candidate decision record per proposal: the observed limiting interval and owning state or resource, source version and execution mode, capacity released and resources consumed with units and uncertainty, overlap readiness and mutation boundaries with expected contention, and the fixed-workload step and correctness evidence required for later validation", + "failure_modes": [ + "A change that lets the model fit is presented as a speedup, although it can slow each step", + "A tensor copied to CPU is taken as an InfiniBand/RoCE bottleneck, or CPU/NVMe offload is counted as network evidence", + "Parameter max_in_cpu is read as a byte or total-host-memory cap instead of an element count", + "NVMe optimizer placement is assumed to remove CPU optimizer demand", + "The parameter buffer-pool count is transplanted to the optimizer, or all optimizers are assumed to hold identical states", + "Configuration presence or schema documentation is taken as evidence that a knob or overlap actually ran", + "Ordinary overlap is taken as permission for delayed, stale parameter updates" + ], + "refusal_point": "Claims no hardware validation, measured gain or current NPU compatibility, keeps source support and extracted coverage separate from measured improvement, and does not reuse the MindSpeed headline gain; historical source observations do not establish current-stack compatibility, whole-model correctness or measured benefit" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "required_resources": [ + "playbooks/planning/training-resource-budget/SKILL.md", + "playbooks/planning/training-resource-budget/references/mindspeed-historical.md", + "playbooks/planning/training-resource-budget/references/mindspeed-source-readset.md", + "playbooks/planning/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md", + "playbooks/planning/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md", + "playbooks/planning/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md", + "playbooks/planning/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md", + "playbooks/planning/training-resource-budget/references/papers-20261015/references/source-readset.md", + "playbooks/planning/training-resource-budget/references/sources.md", + "playbooks/planning/training-resource-budget/references/stas-decision-notes.md" + ], + "composition": { + "when": {}, + "license": "Apache-2.0 AND CC-BY-SA-4.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "nodes": { + "navigation": { + "ref": "checkout:training-resource-budget.original.navigation", + "revision": "sha256:b19739c8fc004b2c5170730dfad73e4f32c697491e9947a22b4fd2ccb1e4d265" + }, + "decision": { + "ref": "checkout:training-resource-budget.original.decision", + "revision": "sha256:9dcd3a132d7fa803876101fc771706ccfae58b8568a675f52993e8901687eb2c" + }, + "procedure": { + "ref": "checkout:training-resource-budget.original.procedure", + "revision": "sha256:bd56a9c7dbea94aef2f8da5f72f0a3621c83dcfdb2dd8fc2db6d34b8a33d9f89", + "requires": [ + "decision" + ] + }, + "original": { + "ref": "checkout:training-resource-budget.original", + "revision": "sha256:80065e316fe72be5795829d0d546f44d76fcc261578d0415558855ec74b0adbd" + }, + "mindspeed-historical": { + "ref": "checkout:training-resource-budget.mindspeed-historical", + "revision": "sha256:cd1389e4ce3954c068cbcd5426708af3a9bed2eab4a4d7bf3239c52941ecfd2d" + }, + "mindspeed-source-readset": { + "ref": "checkout:training-resource-budget.mindspeed-source-readset", + "revision": "sha256:e4ffe8d249d225e1f046d75ad67e168b78fb3b162f2f5dc035832e7ba94b9952" + }, + "integration-notes": { + "ref": "checkout:training-resource-budget.integration-notes", + "revision": "sha256:d83fd6a95cfd1642b772e995f0a2159d7f0f83a6b88be87440975f8eef2d6dbb" + }, + "paper-grounded-cases": { + "ref": "checkout:training-resource-budget.paper-grounded-cases", + "revision": "sha256:0f0247406022d43c95211471192fb477eb013c1cff273786f922b704793ac5ca" + }, + "offload-delta": { + "ref": "checkout:training-resource-budget.offload-delta", + "revision": "sha256:312d1730ff10ddd44bc2d9842fbbcc6cc7bd52317f382ee546a07cdb6d37e8be" + }, + "training-memory-scheduling": { + "ref": "checkout:training-resource-budget.training-memory-scheduling", + "revision": "sha256:b4ba8e0b8788c2b7a597202a4549653c64fcc9c09963912e2774e10672e9dcc6" + }, + "source-readset": { + "ref": "checkout:training-resource-budget.source-readset", + "revision": "sha256:7b406d2bce50493d9f1b06de5414b074f648c3219661c226e50954c29dc25920" + }, + "sources": { + "ref": "checkout:training-resource-budget.sources", + "revision": "sha256:9dc6255caf9dda0108ad1f64211e45d9213f8957a6e721e5fb19c60c6ed9570a" + }, + "stas-decision-notes": { + "ref": "checkout:training-resource-budget.stas-decision-notes", + "revision": "sha256:2e9f528f520f9d6c4aefcd503d74f9fa57f580ee8e39ae98661afcab36cf9a72" + } + }, + "routes": { + "navigation": { + "layer": "L0", + "required": [ + "navigation" + ] + }, + "decision": { + "layer": "L1", + "required": [ + "decision" + ] + }, + "procedure": { + "layer": "L2", + "required": [ + "procedure" + ] + }, + "originals": { + "layer": "L3", + "required": [ + "original", + "mindspeed-historical", + "mindspeed-source-readset", + "integration-notes", + "paper-grounded-cases", + "offload-delta", + "training-memory-scheduling", + "source-readset", + "sources", + "stas-decision-notes" + ] + } + } + } + }, + "directory_resources": { + "playbooks/planning/training-resource-budget/SKILL.md": "original", + "playbooks/planning/training-resource-budget/references/mindspeed-historical.md": "mindspeed-historical", + "playbooks/planning/training-resource-budget/references/mindspeed-source-readset.md": "mindspeed-source-readset", + "playbooks/planning/training-resource-budget/references/papers-20261015/INTEGRATION_NOTES.md": "integration-notes", + "playbooks/planning/training-resource-budget/references/papers-20261015/cases/paper-grounded-cases.md": "paper-grounded-cases", + "playbooks/planning/training-resource-budget/references/papers-20261015/knowledge/offload-delta.md": "offload-delta", + "playbooks/planning/training-resource-budget/references/papers-20261015/notes/training-memory-scheduling.md": "training-memory-scheduling", + "playbooks/planning/training-resource-budget/references/papers-20261015/references/source-readset.md": "source-readset", + "playbooks/planning/training-resource-budget/references/sources.md": "sources", + "playbooks/planning/training-resource-budget/references/stas-decision-notes.md": "stas-decision-notes" + } +} diff --git a/tests/knowledge/test_atomic_training_budget.py b/tests/knowledge/test_atomic_training_budget.py new file mode 100644 index 000000000..1b3fb8b73 --- /dev/null +++ b/tests/knowledge/test_atomic_training_budget.py @@ -0,0 +1,118 @@ +"""Replay the released training resource-budget guide, its references and adaptation terms.""" + +import json +import shutil + +import pytest + +from inferrsi.knowledge.atomic_build import build_generation +from inferrsi.knowledge.atomic_generation import InstalledGeneration +from inferrsi.knowledge.catalog import _skill_search_source +from inferrsi.knowledge.decision_cards import DecisionSource +from tests.knowledge.test_atomic_casebooks import ( + ATOMS, + FIXTURES, + RELEASE_COMMIT, + assert_empty, + canonical, + digest, + select, +) +from tests.knowledge.test_atomic_generation import RELEASE_ROOT, make_author_root +from tests.knowledge.test_atomic_reader import allow + +NAME = "training-resource-budget" +REF = "checkout:" + NAME +RELEASE = json.loads((FIXTURES / "playbook-domain-v0.3.4.json").read_bytes())["refs"][REF] +LIBRARY = "src/inferrsi/knowledge/data/skill_library/" + + +@pytest.fixture(scope="module") +def installed_budget(tmp_path_factory): + root = tmp_path_factory.mktemp("training-budget") + author = make_author_root(root) + release = root / "release" + shutil.copytree(RELEASE_ROOT, release) + composition = ATOMS.parent / "compositions" / (NAME + ".json") + shutil.copyfile(composition, author / "compositions" / composition.name) + declaration = json.loads(composition.read_bytes()) + nodes = declaration["metadata"]["composition"]["nodes"] + bindings = declaration["directory_resources"] + assert bindings.keys() == RELEASE["required_resources"].keys() + for logical, node in bindings.items(): + descriptor = ATOMS / (nodes[node]["ref"].removeprefix("checkout:") + ".json") + shutil.copyfile(descriptor, author / "atoms" / descriptor.name) + (resource,) = json.loads(descriptor.read_bytes())["content"].values() + raw = (ATOMS / resource["path"]).read_bytes() + assert digest(raw) == RELEASE["required_resources"][logical] + for dest in (author / "atoms" / resource["path"], release / (LIBRARY + logical)): + dest.parent.mkdir(parents=True, exist_ok=True) + dest.write_bytes(raw) + # Keep the deepest published resource above the legacy Windows path limit on a short drive. + target = root / ("installed-" + "nested-" * 12) / ("tenant-" * 8) / "release" + generation = build_generation(author, target, permits=allow, + source_roots={RELEASE_COMMIT: release}) + return InstalledGeneration(target, expected=generation) + + +def test_training_budget_preserves_released_layers_and_navigation_scope(installed_budget): + reader = installed_budget + _, bundle = reader.read_resolved(REF, revision=reader.catalog[REF]["revision"]) + assert bundle.view()["resources"] == RELEASE["required_resources"] + assert bundle.dependencies == RELEASE["dependencies"] == {} + entry = RELEASE["entrypoint"] + navigation = [link for link in RELEASE["relative_guide_links"].values() + if not link["in_directory"]] + assert len(navigation) == 3 + assert all(link["path"] not in bundle.content for link in navigation) + layers = {} + for level in ("L0", "L1", "L2", "L3"): + delivery = select(reader, REF, level, 1_000_000) + assert delivery.receipt["status"] == "delivered" + size = sum(map(len, delivery.bodies)) + assert select(reader, REF, level, size) == delivery + assert_empty(select(reader, REF, level, size - 1), "over_budget") + stale = select(reader, REF, level, size, revision=RELEASE["revision"]) + assert_empty(stale, "unavailable_revision") + for item, body in zip(delivery.receipt["delivered"], delivery.bodies, strict=True): + start, end = item["source_byte_range"] + path = item["source_path"].removeprefix(LIBRARY) + assert body == bundle.content[path][start:end] + assert item["source_range_verification"] == "verified_at_build" + assert item["source"]["commit"] == RELEASE_COMMIT + denied_ref = item["ref"] + assert_empty(select(reader, REF, level, size, + permits=lambda pin, op: pin.ref != denied_ref), "permission_denied") + layers[level] = delivery.bodies + + assert bundle.content[entry].startswith(layers["L0"][0]) + (decision,) = layers["L1"] + _, fields = _skill_search_source(decision.decode()) + card = DecisionSource(REF, RELEASE["revision"], "skill", entry, entry, fields).project()["card"] + assert card["status"] == "partial" and card["missing_fields"] == ["validation"] + assert digest(canonical(card)) == RELEASE["card_sha256"] + assert len(canonical(card)) == RELEASE["card_bytes"] + assert layers["L2"][0] == decision and b"".join(layers["L2"]) == bundle.content[entry] + assert layers["L3"] == tuple(bundle.content[path] for path in sorted(bundle.content)) + + +def test_training_budget_keeps_share_alike_on_the_adapted_note(installed_budget): + reader = installed_budget + _, bundle = reader.read_resolved(REF, revision=reader.catalog[REF]["revision"]) + nodes = bundle.metadata["composition"]["nodes"] + note = nodes["stas-decision-notes"] + _, atom = reader.read_resolved(note["ref"], revision=note["revision"]) + credit, = atom.metadata["attribution"] + assert atom.metadata["atom"]["license"] == credit["license"] == "CC-BY-SA-4.0" + assert credit["author"] == "Stas Bekman" and credit in atom.metadata["sources"] + content = atom.content["stas-decision-notes.md"] + assert credit["commit"].encode() in content and credit["license_url"].encode() in content + assert b"paraphrased adaptation" in content + for node in ("mindspeed-historical", "mindspeed-source-readset", "sources"): + pin = nodes[node] + _, independent = reader.read_resolved(pin["ref"], revision=pin["revision"]) + assert independent.metadata["atom"]["license"] == "Apache-2.0" + assert bundle.metadata["empirical_validation"] == "not_run" + denied = select(reader, REF, "L3", 1_000_000, operations={"redistribute"}, + permits=lambda pin, op: (pin.ref, op) != (note["ref"], "redistribute")) + assert_empty(denied, "permission_denied")