# Phase memory admission Admission runs immediately before each phase, including baseline/evaluation, after previous temporaries are freed. A mandatory-work rejection emits the existing stage error and uses `PipelineFailure` cleanup before work starts. Batches, dtype, placement and outputs are unchanged. Checks cannot atomically reserve memory against unrelated processes. OOM-tolerant diagnostics have their own admission boundaries. BASELINE admits reference-loss forwards first, then checks coherence generation separately. VERIFY admits reference-loss forwards and configured KL verification first; coherence, capability and refusal generation, optional KL measurement and spectral certification are checked immediately before their respective operations. Pristine KL-logit capture before EXCISE is also checked separately when KL optimization is disabled. With KL optimization enabled, both pristine capture and verification remain mandatory. The optional capture check includes the upcoming edit/rollback workspace because captured host logits remain live through surgery; a capture rejection leaves that capacity for mandatory work. For the measured dense basic Qwen2.5-1.5B case, the calibrated CUDA EXCISE demand remains exactly **2,803,988,480 bytes** with or without optional KL capture: the tied-head edit is the larger sequential peak. Separating that forward does not lower the calibrated bound used by the apps02/noodle rejection evidence. In default and strict modes, diagnostic admission rejection uses the existing skip result: baseline coherence is NaN, VERIFY coherence/refusal or optional KL is unset, capability checks are recorded as unsuccessful, and spectral certification remains unset. A coherence skip also skips dependent capability and refusal generation, as an execution-time OOM does. Other diagnostics continue independently. Mandatory forwards and edits retain their calibrated bounds and fatal rejection behavior. Diagnostic admission never changes beam counts, generation lengths, cache settings or model placement. ## Confidence and modes Each additional allocation has a `DemandComponent` with `name`, `device`, `bytes`, `confidence` and optional `reason`. Confidence is `calibrated` or `estimated`; an unmodelled component is estimated with `bytes=None`. A computed byte count alone does not establish calibration. CPU profiler regressions improve estimates but do not promote a path into the approved hardware-calibrated scope. `OBLITERATUS_PHASE_ADMISSION` selects the policy; public admission functions also accept `mode=`, which overrides the environment: | Mode | Before phase work starts | |---|---| | Unset / `default` | Reject only if calibrated demand alone exceeds available memory. If calibrated plus estimated demand exceeds availability, or any component is unmodelled, emit one prominent WARNING per phase/device and proceed. | | `strict` | Enforce the total calibrated plus estimated demand; reject unmodelled components and missing/invalid observations. | | `fail-closed` | Require every demand component to be calibrated. Reject estimated and unknown work even when its computed size would fit; also enforce observations and capacity. | | `off` | Bypass estimation and observations; always log an explicit WARNING. | Any other value, including an empty string, raises a clear `ValueError` at first use naming `default`, `strict`, `fail-closed` and `off`. Successful known checks stay silent at default verbosity; DEBUG records contain total required, calibrated and available bytes. A warning names phase, device, numeric estimated shortfall (or unknown shortfall), and the estimate-only/unmodelled components. Warning-only admission does not claim that an uncertain run will fit, and never skips its configured work. The loader shares a context-local warning scope across dequantization, subsequent weight loading and retries in one SUMMON invocation. Every check observes fresh capacity and retains its complete report warnings; only duplicate log emissions for the same phase/device are suppressed. The main and informed pipeline drivers also share a scope with nested refinement and Ouroboros loops. Each benchmark method, Concept Lab apply/evaluate/repair/export call, and standalone concept evaluation has its own scope. Nested helpers inherit the enclosing scope; direct helper calls create one. A later independent invocation gets a fresh scope, including after failure. Scope sharing never bypasses a later rejection. Qualification callers can opt into `fail-closed` to distinguish measured bounds from estimates. This mode intentionally rejects CPU/offload and other estimated components until they have a calibrated allocation contract. A run using `strict` still checks those estimates against current capacity, and must record that policy in its evidence. The explicit `off` escape hatch remains available to operators. `OBLITERATUS_DEVICE_MEMORY_CEILINGS` optionally supplies per-device ceilings as a JSON object of integer bytes, for example `{"cuda:0": 8589934592, "cuda:1": 12884901888, "cpu": 17179869184}`. The public load and admission functions also accept `device_memory_ceiling_bytes=`, whose explicit mapping overrides the environment; an empty mapping clears those ceilings. CUDA ordinal integer keys and numeric strings are accepted as aliases for visible `cuda:N` ordinals. Existing CUDA allocator reservations count toward the device ceiling. CPU ceilings bound additional host headroom. A ceiling can only tighten the observed free-memory bound; spare memory on another device cannot compensate for a shortfall. Nonempty ceilings enable load admission for explicit and automatic devices even when `phase_admission` is omitted. The selected admission mode still controls enforcement, warnings and explicit bypass. Automatic CUDA placement measures each visible device with `mem_get_info`. Its default weight budget reserves the greater of 15% of that device's current free memory or 2 GiB; an explicit `gpu_memory_utilization` instead takes that fraction of current free bytes. Operator ceilings tighten the result after existing CUDA reservations are subtracted. The CPU placement budget uses 85% of current available host memory, including cgroup and process address-space limits, without a minimum budget that could exceed remaining RAM. Failed memory observations fail placement instead of falling back to total capacity. Sequential work retains peak arithmetic: the calibrated portion is its own independently known peak; the estimated portion is the incremental peak above that floor, not a sum of disjoint operations. Retained buffers add where their lifetimes overlap. A later modelling failure cannot erase an independently known calibrated component. In particular, uncertainty about optional work must not hide the measured dense ordinary-edit allocation. Classification follows effective operations, not equality of configuration records: inactive SAE metadata cannot demote basic extraction. Basic aliases and single-direction legacy SVD resolve to difference of means. Optional refinements retain that calibrated extraction floor and add estimate-only work. Similarly, spectral cascade, steering and other additional surgery preserve the ordinary basic edit floor. The shared target selector separates first-pass ordinary matrices/head from optional embeddings, SAE and future refinement targets. Successful LoRA has no ordinary targets; empty LoRA selection retains the ordinary fallback's calibration. | Component / scope | Tier | Evidence or limit | |---|---|---| | Plain Llama/Qwen2-family load residents, entirely CUDA placed | Calibrated | Operator-approved dense scope; target dtype tensor bytes, including tied storage and per-device replicas. Qwen2.5-1.5B BF16 load measured on RTX 4090 24 GiB and RTX 3060 12 GiB. | | Dense Llama/Qwen2 CUDA SDPA/eager activations, KV and ordinary logits, with each decoder layer on one GPU | Calibrated | Approved shared decoder scope; Qwen2.5-1.5B BF16 basic baseline/probe/verify measured on both GPUs. Whole-layer multi-GPU sharding retains calibration. SDPA math-fallback extras and optional returned attention/hidden/router outputs and retained generation scores/logits remain estimated. | | Forward with modules of a decoder layer split across devices | Estimated | The full-layer FFN/KV workspace is conservatively duplicated on every participating GPU. Until allocation placement is modelled, this forward cannot establish calibrated per-device demand. Independent weight, basic distill and ordinary edit calibration remains intact. | | Basic difference-of-means distill for that qualified CUDA dense model | Calibrated | Basic Qwen2.5-1.5B run on both GPUs, including its host direction-vector work. Other extraction methods/options remain estimated. | | Basic ordinary dense CUDA edit, including selected/tied lm_head | Calibrated | Qwen2.5-1.5B BF16 basic measured 2.61 GiB additional peak; transaction and actual edit selection retained. | | Native export plan host demand | Calibrated | Exactly `native_export_host_demand(plan)` from #247: the same allocation contract independently enforced by the writer. No duplicate shard formula. | | Load source/staging/conversion; quantized or dequantized weights | Estimated | Metadata/quantizer contracts, source mapping and storage tests; no operator-approved hardware calibration for these paths. Conversion provenance survives stripped quantization metadata through the subsequent weight-load check and retries; conversion workspace is charged only before conversion. | | Retained generation scores/logits (`output_scores` / `output_logits` with `return_dict_in_generate`) | Estimated | Separate batch × vocabulary vectors retained across generated tokens; excluded from the ordinary calibrated logits bound. Only their incremental sequential peak is charged. With flags off, the ordinary calibrated demand is unchanged. | | CPU/MPS model work, mixed CPU/disk offload, MoE/hybrids/recurrent, Falcon and other architectures | Estimated | Execution-derived geometry and CPU peak regressions; these are not the approved CUDA dense calibration. Fully GPU sharded plain dense weights retain their calibrated resident accounting. | | Non-basic distill, LoRA, SAE, repair, KL rollback, validation gate, optional hooks/sub-algorithms | Estimated | Known workspace models remain useful diagnostics; some optional overlap contracts remain unmodelled. | | Bayesian optimization with a supported reversible execution scope | Finite model-aware demand; existing component confidence applies | Execution-owned snapshot bytes plus bounded sequential refusal/KL forwards and host FP32 logits. Finite demand alone does not qualify CPU, compiled or other uncalibrated work for fail-closed admission. Unsupported execution scopes are rejected. | | Opaque callbacks/backends/quantizers, unresolved layouts/caches | Estimated, unknown size | Default warns and proceeds; strict rejects with the specific path and `OBLITERATUS_PHASE_ADMISSION=off`. | | Fallback full-gather/save_pretrained export | Estimated | Shared checkpoint-writer estimate; only the native plan is in the calibrated export scope. | ## Public contract and observations `obliteratus.phase_admission` provides immutable `DeviceDemand`, `DemandComponent`, `PhaseDemand`, `MemoryObservation`, `ForwardWorkload`, `ActivationBatch`, `DistillationWorkload` and `AdmissionReport`. `admit_phase` checks explicit demands, `model_phase_demand` estimates a realized handle, and `admit_model_phase` combines them. `AdmissionReport` exposes the per-component confidence, warnings and resolved mode as well as demands, observations and available bytes. Explicit `DeviceDemand` mappings without confidence metadata are estimate-only; pass `PhaseDemand.components` or `admit_phase(..., components=...)` to state evidence. `admit_model_load(name_or_config, *, device, dtype, quantization, gpu_memory_utilization, observer=None, mode=None, ...)` works without pipeline state for issue #246. Config objects work offline; `local_files_only=True` supports cached names. Optional placement/checkpoint/dequantization arguments describe the loader's policy. `dequantize=True` includes pending conversion work; pass `dequantized=True` on subsequent checks to preserve the estimated weight tier without repeating conversion workspace. `cache_dir`, `revision`, `token` and `local_files_only` reach trusted-code class resolution with the same constraints as real loading, without leaking Hub options into model constructors. Load checks preserve RNG and allocate no weight storage. SUMMON enables loader `phase_admission=True`. Direct UI loads and reloads call the same `admit_model_load` with the same semantics, admitting the UI's actual placement without `max_memory`. Rejections stop allocation and show the admission error; default warnings proceed, and `OBLITERATUS_PHASE_ADMISSION=off` explicitly bypasses admission. Failed loads drop partial handles, free accelerator memory and release the lifecycle. A previous model is cleanly unloaded and remains lazily recoverable when its checkpoint is valid. Caller-provided device maps preserve Torch placement semantics: unindexed `"cuda"` and `torch.device("cuda")` destinations resolve to `torch.cuda.current_device()`. Integer ordinals and indexed destinations remain unchanged. When no map is supplied, the loader's CLI policy maps an explicit `device="cuda"` request to GPU 0. An observer is a callable `device_name -> MemoryObservation | None`; tests inject CPU/CUDA/MPS observations without accelerators. Already resident weights are diagnostic: free memory already excludes them. Only additional weight, activation, KV, staging, logits and edit bytes are charged. CUDA uses `torch.cuda.mem_get_info` on each device, bounded by `total * gpu_memory_utilization - memory_reserved`, then subtracts a 64 MiB reserve. No GPU borrows another GPU's free memory. Before the default observer reads accelerator capacity, admission calls `device.free_gpu_memory()` (garbage collection plus accelerator cache release). For PROBE and VERIFY's spectral collection, the pipeline moves this release before the free-memory sizing heuristic, resolves collection limits once, and passes `release_cache=False` through `admit_model_phase` to `admit_phase`. The admission boundary therefore releases cache once, before both sizing and observation. Direct callers retain the default release before observation. Utilization and broker ceilings use the remaining reservations; live allocations are preserved. Injected observers do not trigger cleanup inside `admit_phase`. Off mode bypasses admission cleanup, sizing and observations. The pipeline retains the resolved batch size, truncation limit and sizing message in `_admitted_collection_limits`. Planning and every collection in that invocation reuse the selection, including harmful/control, neighbour, jailbreak and shield groups, and the spectral pair. Per-batch cleanup does not change the selection. PROBE and spectral collection clear it on completion or failure; each new admission also clears previous state, including when admission is off. The common boundary covers informed baseline-to-probe, benchmark baseline-logits-to-probe, extraction entries and refinement reruns. With admission off, each collection computes limits at its original execution point. The sizing thresholds, tokenization, grouping and activation readouts are unchanged. An active lifecycle broker grant separately bounds aggregate process CUDA reservations plus calibrated CUDA demand in default mode, or total CUDA demand in strict mode. Reading the grant waits up to two seconds for lifecycle state locks; brief heartbeat contention does not masquerade as a zero-byte grant. Unavailable grant information rejects calibrated work (all work in strict), while estimated-only default work warns. A genuine zero/released grant is a real zero budget, not an observation timeout. CPU uses `available_host_bytes`, including cgroup/address-space budgets. MPS uses host headroom bounded by `recommended_max_memory - max(driver_allocated_memory, current_allocated_memory)`; combined CPU/MPS demand shares the host budget. Absent older MPS metrics fall back to host headroom. CPU-only runs observe only CPU. `device.get_device` supports CPU/CUDA/MPS; XPU is already unsupported there. Missing or invalid memory observations fail closed when the device has calibrated demand; a device with only estimated demand warns in default mode and rejects in strict mode. MPS metric failures follow the same confidence rule. `PhaseAdmissionError` retains `phase`, `device`, `required_bytes`, `available_bytes`, `shortfall_bytes` and `reason`. For example: `Phase 'probe' needs 9878424781 bytes (9.20 GiB) on cuda:0 but only 6549825126 bytes (6.10 GiB) is available (shortfall 3328599655 bytes (3.10 GiB)).` The required amount is the enforced tier: calibrated alone in default, total in strict. The message suggests freeing memory, reducing batch/sequence length or changing dtype/quantization. Estimator failures become specific unknown components in default mode; strict preserves structured `PhaseAdmissionError` with its underlying cause. Invalid mode selection remains a caller `ValueError`. ## Demand model * **Load:** meta-model geometry and Transformers placement count target-dtype weights, including all experts. Local safetensors headers/indexes bound the largest consumed source shard plus largest-tensor conversion. Registered Transformers renamings/converters resolve the source-to-target keys before lazy staging is counted: unused keys are never materialized. ZIP mmap storage offsets and byte-range unions deduplicate tied/overlapping source views, while separate destination tensors/devices still require separate allocations. Unknown conversion operations or unresolved targets are unknown estimated components. Without metadata, use an unsharded source in config dtype (FP32 if unspecified). Same-dtype CPU mmap pages count once. Installed Transformers 5.15 streams safetensors and ZIP `.bin` (`torch.load(mmap=True)`); legacy `.bin`/eager HF-mount reads charge full sources. Older preallocated CPU/MPS paths receive no mmap-sharing credit. Dequantization checks source/expanded shards and unpacking workspace before conversion, then rechecks loading. Synthetic Qwen2.5-7B BF16: 14.185 GiB weights + 1.015 GiB staging fits 16 GiB host; 21 GiB GPU / 22 GiB host also passes. Native quantization uses the quantizer-transformed meta parameters/buffers and parameter byte widths, including scales. A shared loader helper resolves the native checkpoint's **effective** auto dtype (saved config, otherwise local floating-tensor headers, followed by `quantizer.update_dtype`); requested dtype does not override native embedding/head precision. Missing dtype metadata warns as unknown in default mode and rejects in strict mode. Tests cover both requested/checkpoint dtype directions. BNB checkpoint headers replace scale bounds with exact stored bytes. Native 7B BNB4 needs 5.450 GiB GPU weights plus 1.015 GiB staging (unquantized embeddings/head included), fitting 8 GiB; BNB8 fits 12 GiB. Explicit FP8/compressed-tensor expansion charges its actual destination and conversion. Missing headers for renamed/fused indexed tensors produce unknown components instead of guessing an entire FP32 model. Disk placements stay on disk: SUMMON charges a CPU tensor/conversion window, plus buffers that the loader really retains on CPU. GPU transfer occurs in later phases, charged to each actual AlignDevicesHook scope; sibling scopes run sequentially, ancestor scopes overlap, and no next-layer prefetch is assumed. FlashAttention fallback is shared with the loader and applied to the private config before meta construction, including pre-dequantization admission. `test_load_attention_admission.py` exercises unavailable FlashAttention with NVFP4, blockwise FP8 and compressed-tensors FP8: admission reaches conversion when memory fits, rejects before conversion in strict mode when it does not, and logs the loaded-config fallback once. * **Forwards:** `ForwardWorkload` describes actual padded batch/query, KV-cache and logit lengths. Preflight tokenizes prompts on CPU with execution's chat, readout and truncation policy; it does not replace short prompts with truncation ceilings. Sequential calls take a maximum, not a sum. Baseline uses serial reference loss/coherence; verify adds capability/refusal generation, KL and spectral probes. Generate has separate prefill/decode bounds, using one logit position when `_supports_logits_to_keep()` confirms the Transformers 5.15 contract. Without it, full prefill logits remain charged. Disabled caches and configured beams/retained scores are respected. `GenerationConfig.use_cache=None` inherits `model.config.use_cache`; absent/None model defaults resolve to True. Explicit False is preserved without changing either configuration. Probe calls the full causal LM (`abliterate.py`, `_collect_activations`) and needs full-vocabulary logits. Unlabelled logits use the realized head dtype, refined by a previously observed output dtype; loss and generation add their actual FP32 calculation buffers. Configured hidden states retain embedding and layer outputs on their producing devices, including Accelerate transfers. Generation adds earlier outputs only when its own hidden-output and return-dict flags retain them. Per-layer KV/recurrent state accumulates; transient layer workspace takes a maximum. Eager scores use query × served-key length, including the **full prefill** under sliding masks. Implicit sliding/ chunked schedules match Transformers 5.15 `DynamicCache`. Its sliding cache keeps a view of full concatenated storage: prefill retains T tokens; decode retains Q + min(previous, window−1). Gemma3n shared-KV layers retain source storage once. SDPA asks installed PyTorch's `torch._fused_sdp_choice` metadata dispatcher, including **CPU Flash Attention**, rather than reproducing eligibility rules. Tiny broadcast Q/K/V and bool/float mask views preserve head geometry, GQA, dtype, dropout, causal masking and backend-enable flags without a forward or sequence-sized allocation. Standard masked calls test the possible HF mask dtypes; unknown mask metadata or an unavailable dispatcher uses the math bound. That fallback's quadratic scores and FP32 promotion are always estimate-only, even for a qualified dense CUDA model. They cannot turn uncertainty about dispatch into a default-mode rejection. Explicit eager computation retains its calibrated score workspace for the approved dense scope. Optional returned attention maps, hidden histories and router outputs remain estimated without removing calibration from independently known forward allocations. Attention dtype comes from each realized Q/K/V projection's output contract, respecting active autocast and known quantizer input/output contracts. FP32 LayerNorm parameters alongside BF16 projections do not change attention dtype; a quantizer elsewhere in the model does not imply math attention. Unknown packed/custom dtype contracts become unknown components naming the layer, rather than manufacturing a quadratic estimate (strict mode rejects with the opt-out). Config-only `transformer_demands` callers without realized projection metadata retain their documented unknown-backend bound; `model_phase_demand` resolves attention dtype or records the unknown contract. Forced math includes scores, softmax and FP32 promotion. Fused CPU additionally budgets native per-thread query/KV tiles (at most 256/512), result accumulators, low-precision cast tiles and logsumexp. Default-dispatch CPU profiling checks the real kernel peak; a separate 4,096-token estimate fits 256 MiB. Forced math warns for an insufficient estimate-only CPU budget, and strict mode rejects it. MPS/unknown eligibility and unequal MLA head dimensions keep the math bound. Unpadded sliding attention follows HF's mask-skip boundary. Flash and Flex backends retain their linear workspace contract; requested attention maps are additional. Non-dynamic generation caches are unknown components named in the default warning (strict rejection with opt-out), because static preallocation/offloaded cache placement needs a separate allocation contract. Each CUDA forward includes 16 MiB for kernel workspace/allocator granularity. Execution hooks include embedding/output-only devices; only transferred or packed weights need tensor staging. Weight staging follows the offload hook that actually materializes each tensor. An ancestor hook that only moves inputs does not move descendant weights or create a weight-staging charge. A meta tensor without a materializing offload scope remains unknown rather than borrowing an ancestor's execution device. Falcon old MQA caches one KV head regardless of `num_kv_heads`; the new decoder expands KV to query heads before caching. Tiny eager/SDPA CPU forwards verify exact cache bytes. Unknown attention backends warn by name in default mode and reject in strict, without substituting eager attention's potentially enormous score matrices. * **Retention/distill:** classic probe's `hidden[:, -1, :].detach().cpu().float()` (`abliterate.py:3532`, `_collect_activations` hook) preserves full sequence storage on CPU FP32, verified through the actual hook in tests. Pooled or dtype-converted rows are compact. `ActivationBatch` records each actual padded collection batch and readout policy. Repeated shapes retain their multiplicity even though sequential forward demands are deduplicated. One long prompt expands only its own batch. Planning and collection share grouping, tokenizer padding/truncation and readout helpers. Only newly collected rows are charged; distill does not charge already-resident rows again. Basic difference of means adds only FP32 direction vectors and vector temporaries. Thin SVD uses rows × hidden and thin U/Vh storage, including retained basis views. Only whitened/Fisher/LEACE/Wasserstein paths allocate their actual FP32 covariance/solve matrices. PCA, RDO and expert refinements add their own row/vector workspaces; custom recipes include concatenated control matrices. SAE models tied encoder parameters, gradients, Adam moments, best state, row batches and retained directions on their real device, using the same expansion/ placement helper as execution. `_sae_training_samples` also supplies both execution and admission with the actual harmful/control rows per eligible layer; jailbreak/shield rows cannot enable training. Initial CPU construction is included. `_activation_collection_limits` retains its existing policy; `_resolved_activation_collection_limits` supplies its single admitted selection to planning and collection, or computes limits during collection in off mode. * **Excise:** selected parameter names reflect projection target, Qwen output-only manifests, SAE, norm restoration, LoRA, and possible refinement targets. Dense projections use FP32 (FP64 stays FP64), pending updates and transactional rollback. Peak is the largest live transaction: a BF16 matrix's conversion, broadcast product and subtraction need `3 * numel * 4` bytes plus vectors; FP32 conversion aliases its source. Sandwich-norm folding adds a conservative allowance for folded/unfolded matrices, retained norm scales, and LoRA factors in the writer dtype. This allowance is estimate-only, not hardware calibrated. Add 1 MiB per edited CUDA device for small allocation rounding. Input embeddings enter only when edited or tied to an edited head. Standard surgery projects `lm_head` (`abliterate.py`, `_excise`); successful LoRA and Qwen manifest paths omit it. Live fused experts edit one slice at a time; packed/offloaded tensors also need full logical materialization. Successful LoRA has a separate construction/merge model: execution and admission share `lora_projection_targets`, actual rank clamping and order. Construction retains FP16 pairs while the previous FP32 weight conversion can overlap the next conversion. Merge retains the previous FP16 update while forming the next, with destination casts as needed. No ordinary transaction/rollback copies are charged unless selection produces no adapters and execution falls back. `edit_adapter_ranks` exposes ordered per-target ranks; existing `edit_adapter_rank` remains supported for uniform standalone callers. `calibrated_edit_parameter_names` restricts the calibrated floor to ordinary targets when the complete edit selection also includes optional operations; leaving it unset preserves the standalone selection contract. Expert transplant uses a sequential host mean/conversion/temporary peak, not a sum with ordinary edits; target blend casts are included on their actual device. Spectral DCT has its own selected-layer matrix/vector peak. Steering installation retains direction clones and subsequent forwards add projection-hook buffers. KL snapshots/logits add workspace. KL capture retains the actual logits dtype (BF16 stays two bytes); later sequence-KL FP32 conversions/softmax are separate verify workspace. KL forwards and edits take separate peaks. Basic excise has no refinement forward; enabled iterative re-probe/distill receive fresh checks. Bayesian optimization obtains finite demand from the same reversible execution backend used by the trials. EXCISE includes its exact host snapshot bytes, a host FP32 KL-logit allowance (`4 × maximum KL token length × vocabulary size`), and sequential refusal prefill/generation and KL forward workloads. Generation accounts for up to 128 new tokens, the model's cache use and logit retention. The optimizer separately admits execution-owned host/disk snapshot storage before capture. The generic backend owns selected attention/FFN parameters and the LM head; unsupported scopes (for example, additional embedding projection) require an execution adapter that owns the complete mutation/rollback scope. Strict and fail-closed reject such scopes during EXCISE planning, before capture or forward work. Turning admission off does not make an unsupported execution scope valid. Finite demand retains each component's existing confidence: unknown compiled workspace or unqualified hardware is not made calibrated by this model. The effective trial-count selector is shared with execution, including preset defaults. Other unmodelled combinations follow the mode policy described below. * **Repair:** VALIDATE includes pristine writer snapshots, transfer scratch and newly concatenated retained activations, using the same writer selection as `WeightRepair`. EXCISE adds edited snapshots and overlapping repair candidates; LoRA repair includes thin SVD workspace and full Vh backing retained by slices. Non-CPU finite scans take a per-device sequential peak. Adapter conversion and rank/output buffers use writer precision and overlap each repair forward; VERIFY includes them only when a repair adapter is installed. Optional shared API fields `sequential_workspace_bytes` and `forward_workspace_bytes` express these lifetimes. Existing pristine/activation storage is not charged again. Unsupported repair writers follow the existing unavailable-repair path, without inventing snapshots. * **Export:** `plan_native_export(model, max_shard_size)` selects the merged native writer. When a plan exists, host demand is **exactly** `native_export_host_demand(plan)`; admission adds no constant or duplicate shard math. That function is owned by the native export writer (#247), which applies the same figure as its own host-budget check before materializing shards, so admission uses the writer's demand as the calibrated host component. Admission still applies its observation/reserve policy. Its onload accounting is conservative for root-level offload (whole offload-owner subtree); tightening it belongs to the writer, not to admission. Admission and `_rebirth` share the 2GB default; `model_phase_demand(..., max_shard_size=...)` supports custom writer limits. Pipeline preflight normalizes dequantized export metadata first, deferring its existing logs until REBIRTH, so admission and writing select the same path. This preparation is transactional: rejection (including strict modelling errors) restores the quantizer, quantization config/method/flag, reverse conversions and preparation cache with their original attribute presence and identity. If planning returns None, `checkpoint_writer.estimate_model_export_memory` retains full-gather/save_pretrained accounting: newly materialized full-model host storage, credited CPU backing, disk transients, ties, noncontiguous copies and serialization staging. The fallback's 1 MiB buffer remains included. Neither planner materializes offloaded weights. Rejection precedes checkpoint files; the native writer also rechecks host capacity before each shard. DiskSnapshot is independent of this writer: its merged `staging_bytes=None` policy uses 50% of currently available host memory; explicit values are hard caps. Admission contains no old 1 GiB snapshot default or duplicated policy. * **Snapshot transfers:** the shared [`clone_tensor_to_cpu`](../obliteratus/analysis/numerical_contracts.py) helper allocates a detached, contiguous CPU destination at the tensor's original dtype. Strided cross-device copies use pieces of at most 64 MiB to bound transfer scratch; same-device or contiguous equal-dtype copies use the direct path. The full host destination and retained rollback copies still need admission: 64 MiB is not a total snapshot-size limit. Disk snapshots, offload surgery and reversible Bayesian execution use these shared copy contracts. ## Per-phase allocation and lifetime inventory Admission measures **new** storage: the observation already includes loaded weights, activation caches and previous phase results. The following inventory follows each phase's execution order; sequential alternatives take a peak, while retained results add to the next operation. These are tensor/storage bounds, not an assertion that every Python allocator byte is predictable. | Phase / shared execution inputs | New allocations and lifetime | |---|---| | SUMMON: effective dtype, quantizer metadata, HF source-key conversion/placement helpers | Target weights and persistent buffers survive loading. Lazy source mappings are counted by consumed shard and physical storage union; conversion/offload windows are transient. Eager readers retain the full materialized source and their read buffer. Dequantization adds expanded destinations and unpacking work before load. Meta construction does not allocate weight payloads. | | BASELINE: `_stock_coherence_prompts`, reference texts and generation policy | Token IDs/masks, embedding/residual/norm/projection/FFN/router work and attention scores or fused tiles are per forward. Layer KV/recurrent state survives that forward or generation. Full logits plus FP32 loss buffers are transient; coherence generation retains its cache and configured score/logit/hidden histories until the completion is decoded. Scalar loss/quality results survive. | | PROBE: retained `_resolved_activation_collection_limits`, shared `_activation_batch_slices`, `_tokenize_activation_batch`, `_activation_readout_policy` | Forward allocations as above; full LM logits are transient in their realized dtype. Hook rows survive all subsequent batches. CPU FP32 classic rows retain each batch's sequence backing; converted/pooled/auxiliary readouts retain compact rows. Means, stacking/winsorization and contrast vectors have linear row/vector scratch; router observations and optional expert routing rows survive collection. Repeated batch shapes are not dropped from retention. | | DISTILL: configured extractor, `_sae_training_samples`, `_sae_training_policy` | Already-cached inputs are excluded. Means/directions/contrast updates are vectors. Stacked/centered examples and thin SVD outputs are transient, except basis views retained across layers. Covariance/solve/eigen work occurs only for named covariance methods. PCA, RDO optimizer buffers and expert refinements add their own operands. Eligible SAE training adds initialized parameters, gradients, Adam/best-state buffers and activations, then retains extracted directions; ineligible layers allocate none of them. | | VALIDATE: shared `GateCacheInputs`, `validation_recipe_and_folds`, lexical vocabulary and neighbour selection | Gate concatenations remain live for the call. FP64 primary copies survive all fits/tests. CV retains full-fit compact subspaces and denoising thin-Vh backing while indexed fold inputs/refits run sequentially. Method-specific SVD/covariance/solve workspace is temporary. Auxiliary readout/masked/neighbour FP64 copies overlap the later random-null, control/neighbour tests and AUC/indexing buffers. Lexical presence/design/Gram/solve matrices run in their own sequential peak. Null score records and fold indices are included. Enabled evaluation forwards and pristine repair snapshots/activation captures add their separately described demands. | | EXCISE: selected edit parameters, `_kl_capture_prompts`, actual writer selection | Pristine token logits survive in output precision; first-token clones and their concatenation overlap at capture completion. Ordinary projections retain only the current transaction's conversions, products, pending sibling updates and rollback clones. Successful LoRA instead retains FP16 pairs, current/previous FP32 construction conversions and sequential merge products; shared target/rank selection determines this branch. Transplant source/mean/difference, spectral vectors/DCT and selected KL snapshots overlap their respective operations. Steering installs retained direction clones. Enabled repair retains edited snapshots, candidate weights/adapter factors and thin-SVD backing; candidate forward hooks add their buffers. Refinement re-enters admitted collection/extraction. Supported Bayesian execution adds exact snapshot storage and model-aware sequential forward demand; unsupported scopes reject during strict/fail-closed planning. Unmodelled future auxiliary selections warn in default mode; strict rejects before these allocations. | | VERIFY: `_verification_prompts`, `_verification_harmful_prompts`, shared collection helpers | Loss, serial coherence/capability generation and batched refusal generation reuse sequential forward space. KL comparison promotes current/baseline logits to FP32 only during divergence/softmax computation. Spectral certification collects fresh activation batches; their retention is counted independently of the main probe. Installed repair adapters add forward buffers. Small metrics/output text survive. | | REBIRTH: shared `plan_native_export` / `native_export_host_demand`, or `estimate_model_export_memory` | Native path uses exactly the writer's enforced shard/onload demand. Fallback retains the gathered host state and transient device/host copies, noncontiguous clones and serializer staging. Existing CPU backing is credited. Preparation rollback restores attributes if admission rejects; files are created only after admission. DiskSnapshot keeps its separate current-headroom policy. | Shared-input tests cover each phase: load's real conversion/materialization mapping; baseline/verify prompt selection; probe tokenization/readout grouping; distill SAE eligibility; validate cache materialization/recipe selection; excise KL prompt selection/dtype; and rebirth's actual planner and shard-size argument. `ForwardWorkload.output_hidden_states` and `retained_hidden_tokens` additionally separate a model's raw-forward defaults from generation's explicit output flags. **Scope and residual limits:** scalar metrics, tokenizer strings and small Python containers are covered by the normal safety reserve rather than per-object accounting (large gate null records are explicit). External-process allocations can race the observation. CUDA library/allocator overhead has the documented fixed allowance; CPU Flash tiles are explicit, and opaque/custom kernels are not hardware-certified. Arbitrary callback allocation, unknown recurrent geometry, unknown conversion operations and unsupported cache policies become unknown estimated components: warn in default mode, reject with the opt-out in strict, without hiding uncertainty inside a full-model multiplier. Checkpoint export and DiskSnapshot have their own enforced allocation contracts. ## Calibration Measurements: RTX 4090 **24 GiB**, local workstation; Qwen2.5-1.5B Instruct BF16, basic, seed 7, verify sample 4, refusal eval 8, refusal max tokens 32. Resident weights were about 2.88 GiB and main's peak reserved memory was 5.53 GiB. Output shards and metrics were identical to upstream main. Additional end-to-end hardware checks (not measurements from the CPU tests): | Hardware / run | Upstream main | Admission branch | |---|---|---| | RTX 4090 24 GiB, local; Qwen2.5-1.5B BF16 basic at `d5ad837` | Completes | Every phase admitted, byte-identical output, no warnings | | RTX 3060 Laptop 6 GiB, noodle; same model/method at `d5ad837` | EXCISE OOM requesting 892 MiB | Rejects before EXCISE: 2.61 GiB required, 2.50 GiB available, 0.11 GiB shortfall | | RTX 3060 12 GiB, apps02; earlier same model/method | Completes | Every phase admitted, byte-identical output | | RTX 3060 12 GiB, apps02; another process holds 7 GiB | EXCISE OOM | Rejects before EXCISE, 1.23 GiB shortfall | New estimates below use synthetic weight geometry and locally cached tokenizer lengths, not a new GPU measurement. All values are **additional GiB**: | Phase | Previous CUDA estimate | Measured CUDA peak | New CUDA estimate | New host estimate | |---|---:|---:|---:|---:| | baseline | 1.48 | 0.080 | 0.100 | 0 | | probe | 3.20 | 0.135 | 0.196 | 0.289 | | distill | 0 | 0 | 0 | 0.000206 | | validate | 1.48 | unavailable | 0 | 0 | | excise | 10.44 | 2.610 | 2.611 | ≈0.046 | | verify | 4.60 | 0.095 | 0.142 | 0.023 | | rebirth | 0.43 | 0 | 0 | native plan† | † The earlier 1.841 GiB host estimate described save_pretrained. After the upstream native-export merge, the planner's own host bound replaces that figure. The fallback keeps its original accounting. The current table includes the conservative math-SDPA fallback when eligibility cannot be proved offline; proven fused probe/verify remain below these bounds; raw BF16 logits now use their realized two-byte precision. Host KL capture is approximately half its former bound. No new GPU measurement is claimed here. Reference padded shapes: probe 16×27, reference loss 1×35, refusal prefill 4×42 / decode 4×1 with at most 74 cached tokens, verify spectral probe 16×19. Unit tests pin these bounds and real head-edit selection. The optional local/random CUDA test checks each phase against measured additional allocation: estimate ≥ peak and estimate ≤ 4×peak+64 MiB. No test downloads weights or requires network access. Fast CPU peak regressions use smaller, still-discriminating geometries and explicit intra-op counts of 1, 4 and 8 (restored after each test). Mamba2 retains padded BF16 and multi-chunk scan checks and proves omitting its scan workspace misses the real peak; the original large geometry still has a metadata-only budget regression. Hidden-output retention, Bayesian snapshots and RWKV retain actual forward/peak checks. No slow marker removes these behaviours from PR coverage. ### Portable CPU peak checks CPU native workspace remains **estimated**, including paths covered by local profiler tests. Flash Attention reserves worker tiles using `torch.get_num_threads()`, plus shared logsumexp and reduced-precision packed K/V storage. Reduced-precision workers additionally reserve FP32 query/key packing tiles; independent slabs round up to 4 KiB. This covers CPU instruction-set variants whose packing allocations are absent on the local AVX2 path. LoRA CPU merge reserves an FP32 output accumulator and packed operand panels per worker (at least two 64×64 FP32 tiles), with 64-byte allocation rounding. These are portable estimated allowances, not new CUDA calibration or exact claims about every BLAS implementation. CUDA edit accounting is unchanged. CPU autocast also reserves lower-precision parameter copies for known dense Linear, Conv1D and FalconLinear forwards on their execution device. Inference mode or disabled autocast caching uses the largest operator's cast operands; otherwise eligible FP32 leaf copies accumulate, deduplicating tied parameters, alongside the largest transient cast, following [PyTorch's autocast lifetime rules](https://github.com/pytorch/pytorch/blob/v2.13.0/aten/src/ATen/autocast_mode.cpp#L112-L145). Each copy rounds to 64 bytes and coexists with onloaded weights and activation buffers. FalconLinear's transposed weight is a transient cast; its separate bias is not cast and can promote the matmul result back to FP32. This staging is independent of the attention output dtype and affects only the estimated CPU demand. The Falcon regression keeps a 32-token forward to expose casts that larger activation budgets can conceal. CPU SDPA has its own [lower-precision autocast policy](https://github.com/pytorch/pytorch/blob/v2.13.0/aten/src/ATen/autocast_mode.cpp#L312-L337). Falcon's FP32 bias can therefore leave FP32 Q/K/V and cache backing alive while SDPA creates BF16 operand copies. The estimate keeps the cache/projection dtype and separately uses the autocast dtype for CPU kernel selection, Flash packing workspace and math-kernel promotion. Cast copies include the full served KV history, with query-head expansion for the new decoder and one KV head for old MQA; each independent copy rounds to 64 bytes. These are estimated CPU activation bytes; CUDA accounting is unchanged. The apps02 four-worker, B1/T32/H8/D8 new-decoder Falcon case with FP32 weights, bias and BF16 autocast measured **288,896 bytes**, exceeding the old **279,040-byte** bound. The missing Q/K/V casts add **12,288 bytes** and budgeting BF16 instead of FP32 Flash workspace adds **212,992 bytes**, giving a **504,320-byte** estimate. This is a source-derived correction, not a new calibration or a fitted small-tensor allowance. Metadata regressions retain the remote peak floor, cover cached decode and forced math, and check unchanged CUDA demands. The real 32-token forward and its 4×peak+1 MiB assertion remain. Round 17e adds a separate **Falcon CPU reduced-precision GEMM** estimate. Old MQA still selects math SDPA, but its projections and FFN execute FP16/BF16 matrix multiplies, including FP32 parameters under CPU autocast before bias promotion. [PyTorch's MKLDNN matmul implementation](https://github.com/pytorch/pytorch/blob/v2.13.0/aten/src/ATen/native/mkldnn/Matmul.cpp) routes eligible reduced-precision multiplies to oneDNN. [oneDNN 3.12 BRGEMM scratchpad accounting](https://github.com/oneapi-src/oneDNN/blob/v3.12/src/cpu/x64/matmul/brgemm_matmul_utils.cpp#L2251-L2305) reserves packing, accumulation and auxiliary buffers per configured worker. The reported aggregate peaks alone do not identify which matmul owns the peak; they are not evidence of an extra Flash allocation on the old decoder. `_cpu_reduced_gemm_workspace(M, K, N)` reserves FP32 A/B/C panels per worker, a two-64×64-panel minimum, batch descriptors and AMX tile space. Independent slabs round to 4 KiB, and full K is retained rather than assuming all backends pack a fixed 64-element reduction tile. This is a conservative geometry-based envelope, not a reproduction of a particular ISA's blocking choices. Complete operand panels also leave room for native conversions/fused copies beyond the eight hardware AMX tiles. The envelope can be pessimistic for larger matrices, especially vocabulary projections. Falcon takes the maximum of sequential QKV, output-projection, configured FFN and LM-head GEMMs and SDPA scratch. Eager attention includes QK/PV GEMMs and adds scratch to its score storage, since score locals survive through the output projection. The physical QKV width precedes new-decoder KV broadcast. Both decoder variants receive the allowance. Cache, parameter staging and returned-output counts are unchanged; all added bytes are estimated CPU workspace, with CUDA unchanged. Old-decoder (MQA) Falcon at eight CPU threads, B1/T32/H8/D8, measured on a four-core x86 host (bytes, excluding resident weights): | Parameters / bias / autocast | Measured peak | Bound without GEMM scratch | Bound | |---|---:|---:|---:| | BF16 / off / off | 336,512 | 198,144 | 1,082,880 | | BF16 / on / off | 336,512 | 198,144 | 1,082,880 | | FP32 / off / BF16 | 379,520 | 308,736 | 1,193,472 | | FP32 / on / BF16 | 416,384 | 331,264 | 1,210,880 | These totals remain below 4× the measured peaks even without the existing 1 MiB slack. Regressions pin the remote floors and prove removing the GEMM term loses them; isolated expansion/contraction forwards cover FP16/BF16 at 1/4/8 threads. Metadata checks cover nondefault FFN width, original QKV groups, serial maximum arithmetic, LM-head token count and unchanged CUDA/calibrated paths. The 32-token full-forward regression and its tightness assertion remain. Static scan of the other reduced-geometry CPU paths: | Path | Thread-workspace assessment | |---|---| | SDPA | Flash already scales worker slabs. The forced-math score test checks shapes and score accounting without profiling its native peak; this remains a coverage gap. | | Gate | SVD/solve intermediates are modeled; tiny recipe, denoising and lexical peaks cover 1/4/8 threads. BLAS-specific scratch remains a portability watch item. | | LoRA | Merge already reserves per-worker packing and FP32 accumulation, with 1/4/8-thread peak coverage. | | Mamba | Scan helpers account for broadcast/reduction intermediates, with padded, multichunk, BF16 and decode peak coverage. No corresponding worker slab was established by the scan. | | Optional | Existing peak checks exercise the reduced geometries at 1/4/8 threads. Low-precision steering forwards and other architectures' reduced-precision projections are not independently qualified for GEMM scratch by this Falcon change. | | Outputs | Retained storage has no worker multiplier. The eager-output fixture profiles its complete forward; generation-history checks count storage without profiling complete generation. | | Edit | Ordinary stable FP32/FP64 matrix-vector and broadcast edits have 1/4/8-thread peak coverage; the scan found no basis for applying half-GEMM packing to every edit. | | Repair | **Suspicious uncovered path:** `WeightRepair.candidate_forward_bytes` counts casts and logical tensors, while adapter hooks execute two matmuls in output dtype. The repair peak fixture only installs/removes hooks; its body performs no forward. CPU FP16/BF16 hook GEMM scratch has no measured peak regression yet (estimated tier). | | Rollback | Snapshot clones and transfers need no GEMM slab. The snapshot regression replaces KL scoring; actual model forwards are admitted separately. | The slow-marked thread variants validate the exercised branches, not the uncovered ones above. CPU LoRA rank growth therefore need not equal the raw FP16 payload delta: rank-one pairs may already occupy the same cache lines as larger pairs. `test_lora_adapter_storage_accumulates_across_selected_layers` checks monotone rank growth and at least one additional pair per added layer. The real construction/merge regression separately checks exact retained FP16 pair bytes. The measured GitHub ubuntu-latest BF16 Flash peak was 3,428,352 bytes at two threads; the new bound is 3,694,592 bytes. The measured CI LoRA peaks (163,328 bytes for FP16/BF16 and rank-two construction; 196,096 for FP32) have explicit regression floors as well as fresh real-kernel tests. The local backend does not reproduce all runner allocations, so these floors are retained independently of its peaks. | Local BF16 CPU Flash, B1/H4/T1024/D64 | Measured additional bytes | Portable bound bytes | |---|---:|---:| | 1 thread | 1,394,688 | 2,641,920 | | 2 threads | 2,248,704 | 3,694,592 | | 4 threads | 3,956,736 | 5,799,936 | | 8 threads | 7,372,800 | 10,010,624 | `tests/test_phase_memory_helpers.py` supplies one CPU allocator-trace method for all real peak checks. It tracks live addresses allocated inside the measurement; frees of older resident tensors cannot reduce the peak. Shape recording stays disabled because it can extend tensor lifetimes. Estimates and forwards run under the same pinned thread count, restored even after failure. The default PR suite runs each real peak at **4 threads**. Matching **1- and 8-thread** cases carry `pytest.mark.slow`; Flash also retains its 2-thread cases as slow. Run `-m slow` on these modules to exercise the additional worker counts. Each slow case has the same geometry and assertions as its 4-thread fast sibling. The real SDPA math-score inventory, Falcon dtype tests and LoRA use the same `cpu_threads` fixture as the edit, gate, repair and rollback allocator checks. The thread context restores the previous setting in `finally`; its failure-path regression checks restoration. This measures PyTorch allocator allocations, including native kernel buffers, not process RSS or private allocations outside that allocator. Peak fixtures use small discriminating geometry. Gate refits use two layers, two folds and four samples per primary group, retaining lexical solves, denoised PCs and auxiliary caches. Their dense-refit peaks must exceed the generic difference-of-means allowance. The independent tensor tracker forgets freed storage after each operation, avoiding repeated scans of historical allocations. Mamba scan and hidden-output cases retain the geometry needed to fail when their workspace terms are omitted. Large CI-reported peak floors and original budget thresholds remain cheap metadata/arithmetic regressions. CPU Flash uses 768 tokens for its wide query-tile path and 257 tokens with an unaligned head dimension for the edge case. The small full-model Flash peak also has to exceed the demand computed with its native workspace term removed. | Peak-test audit | What is measured and controlled | |---|---| | SDPA, mixed projection dtypes and Falcon | Actual default/math kernel selection; dtype, mask and thread-dependent native workspace. | | Mamba/DeltaNet and other recurrent fallbacks | Real chunked, padded and decode scans at each thread count; omitted-scan mutation still fails the bound. | | Hidden outputs and optional surgery | Real returned-storage lifetimes, snapshots and native forward/edit allocations; hidden-retention regression uses eager attention to isolate that contract from Flash worker tiles. | | Ordinary edits, validation gate and repair | Native allocator peak alongside tensor-storage lifetime inventory, including gate FP64/refits and repair SVD. | | KL rollback | Snapshot lifetime and native allocation inventory; KL forward workspace is admitted separately. | | LoRA | Actual construction/conversion/merge at 1/4/8 threads, plus the independent reported CI peak floors. | | Cache and retained-activation storage | Exact unique-storage inventories are independent of kernel threads; native peak checks use the shared profiler. | ## Differential non-regression matrix `tests/test_phase_matrix.py` retains **2,400 combinations** in **300 grouped pytest cases** (plus five standalone regressions): 10 architecture families × 6 quantization choices × 5 placements × 8 public extraction names. Families are Llama, Qwen2, Mixtral, Qwen2-MoE, Qwen3-MoE, Qwen3-next, Mamba, Mamba2, old-MQA Falcon and new-decoder Falcon. Quantization choices are none, BNB4, BNB8, GPTQ, AWQ and FP8; placement is one GPU, whole layers on multiple GPUs, a decoder layer split across GPUs, CPU offload or disk offload. Extraction includes basic/diff_means, SVD, whitened SVD, Fisher LDA, LEACE/leace_exact and Wasserstein, protecting aliases as well as pipeline method names. Every combination checks summon and all seven subsequent phases. Each family/quantization/placement handle is built once and loops over all eight methods. Load and the six method-independent phase reports are computed once per handle; each method still runs its own real DISTILL demand and admission. All original invariants run for every combination, and one failing method does not stop the others: the final assertion lists every failing full combination ID. The apps02 over-budget rejection remains a standalone test. Real tiny Transformers configs produce meta/fake tensor models; optional quantizer contracts provide packed storage metadata without importing kernels or fetching models. Single-GPU and split-layer rows use one decoder layer where architecture discovery supports it; multi-GPU, offload, mixed Qwen3-next and families requiring generic layer discovery keep two. Sparse MoE rows retain two routed experts and one unrouted expert. Packed templates are shared during the module, with independent handles for each placement and explicit preservation of their logical quantized shapes. Exact-number regressions keep their original two-layer geometry. `_INVALID_COMBINATIONS` records explicit skip reasons if a combination is not meaningful. Currently all listed combinations are meaningful at the metadata-contract boundary; this does not claim every architecture has an installed quantizer runtime backend. The shared `main_style_headroom` helper is independent of admission's answer: short B2/T16 forwards, retained FP32 direction rows and sequential edits receive 8 MiB host / 32 MiB per-GPU workspace. SUMMON/REBIRTH additionally receive three times the actual stored payload for resident/source/staging overlap. The small matrix explicitly disables the fixed safety reserve so it tests component budgets; separate policy tests exercise the reserve. No case grants arbitrary 100 GiB headroom. Default admission must never reject a fitting row; unknown components must warn instead of erasing the phase. Additional matrix regressions retain default rejection for the Qwen2.5-1.5B-like BF16 basic edit at 1.38 GiB available versus approximately 2.61 GiB required, and strict rejection when an estimate-only total exceeds its budget. Exact single-GPU and whole-layer multi-GPU forward numbers are pinned separately. The split query-projection case retains the 117,821,440-byte estimate on its secondary GPU; 20 MiB of independently chosen headroom admits with a default warning and rejects in strict mode. This is an offline metadata regression, not a GPU measurement. ## Architecture coverage Configuration tests enumerate causal decoder families from profiles, presets, strategy mappings, tiny configs and fused-MoE regressions. Bounds cover dense/ GQA/MLA, Gemma3/3n sliding/full, GPT-OSS, Llama4 chunked attention and varying FFN widths. MoE includes router logits, top-k routed workspace and shared experts (including DBRX); resident/load weights include every expert. DeepSeek V4.1 (`deepseek_v41_text`) has a separate [eager CSA2/mHC/Engram geometry model](../obliteratus/analysis/deepseek_v41_memory.py). It validates the compression/source schedule and accounts for shared compressed and index caches, sparse selection, mHC workspace, expert gathers, and retained Engram rows with transfers from the actual table device. Ordinary FFN, logits and weight staging remain part of the combined demand. Unsupported topology, backend or dtype is rejected by the geometry contract, not relabelled as generic attention. These are conservative estimates with CPU regression coverage, not GPU calibration; split layers charge the full local workspace to each participating device. ```mermaid flowchart LR C[Validated V4.1 geometry and realized placement] -->|specialized allocation contract| S[CSA2, mHC and Engram estimates] S -->|combine per device| D[Complete forward demand] G[Ordinary FFN, logits and weight staging] -->|existing contracts| D D -->|apply confidence and observed headroom| A[Phase admission decision] ``` Qwen3-next/3.5 bounds FP32 DeltaNet matrices and convolution history. Granite, Jamba and Zamba use Mamba1 state/selective-scan dimensions. Mamba2, Falcon-H1, GraniteMoeHybrid, Nemotron-H and Zamba2 share the installed torch chunk-scan bound: FP32 padding, persistent L/G/M/decay/state arrays, and the sequential maximum of C×B and M×X broadcast products, diagonal output and inter-chunk recurrence. Qwen3-next/3.5 torch DeltaNet additionally includes 64×64 chunk matrices and solve clones. Runtime callable inspection distinguishes chunk scans from single-token state updates; unknown/Hub/compiled replacements without a qualified workspace contract remain unknown estimates (default warning, strict rejection). LFM2 bounds convolution history; RecurrentGemma/RWKV use their state geometry. Hybrid layers combine state and attention. Ordinary integer buffers/parameters use `numel * max(element_size, 4)` for expanded workspace; integer dtype alone does not imply packed weights. Packing requires positive evidence (quantization state, a known quantized module/parameter class, or a model quantizer on an integer parameter/packed weight buffer). Only these packed tensors require logical shape or linear input/output dimensions. Unknown recurrence/dimensions, ambiguous hooks and evidenced packed weights without logical geometry produce specific unknown components: omitted allocations cannot be bounded honestly, so default warns and strict rejects. Encoder-decoder profile detection does not imply causal-pipeline support. Custom code/kernels can exceed geometry estimates; admission is not an OOM guarantee. ## Coverage by execution path **Hardware run evidence (operator reports):** dense Qwen2.5-1.5B Instruct BF16, basic method, all phases, on the local workstation's RTX 4090 24 GiB and RTX 3060 12 GiB. The numerical table above is the supplied 4090 trace; no separate 3060 per-phase trace was supplied. The tier table above states the operator-approved shared dense scope and native writer contract; other paths below remain **estimate-only**, with source-based accounting and mocked or tiny CPU tests. A finite architecture-config estimate or CPU profiler regression is not evidence of an approved GPU peak calibration. | Path audited | Decision | |---|---| | Dense load, CPU/CUDA/MPS | Target dtype residents; ZIP source-range sharing; resolved consumed keys only for lazy staging; eager sources only when actually eager. Separate destination allocations remain charged. | | Native BNB4/8, GPTQ/AWQ, FP8/compressed tensors | Shared checkpoint/quantizer effective dtype for embeddings/heads; packed widths/transformed shapes and exact available headers. Missing effective dtype is unknown: default warning, strict rejection. | | Trusted custom-code load | Same revision/token/offline/cache constraints as loader class resolution; CPU tests intercept both lookup paths. | | Native packed MXFP4 / unknown native formats | Unknown component naming unresolved kernel storage (default warning, strict rejection); MXFP4 swizzling hides scales/padding outside registered meta tensors and may fetch kernels. Explicit dequantization remains supported. | | Missing renamed/fused checkpoint headers | Unknown metadata component; no full-model surrogate bound. Default warns, strict rejects. | | CPU/disk offload, including MoE | Disk is not RAM residency; load streams on host, forward checks use actual nested/leaf hook scopes and actual dtype. | | Baseline/probe/verify, dense and MoE | Actual token/batch/logit/cache shapes, sequential maximum; top-k expert/router/shared FFN buffers, not all expert activations. Dense basic path has the hardware evidence above. | | Sliding/chunked/Gemma3n | Actual implicit/explicit schedule, physical cache backing and served-key length; shared KV retained once. Tiny Mistral/Gemma3/Gemma3n CPU forwards verify storage and prefill scores. | | SDPA and masks | Per-layer projection/quantizer/autocast output dtype feeds the installed CPU/CUDA selector. Mixed FP32 norms/BF16 projections use CPU Flash in a real 768-token regression, with a separate 4,096-token admission-budget check. Unresolved realized dtype is unknown; SDPA math scores/promotion remain estimate-only, including when dispatch is unavailable. Optional returned outputs are also estimate-only. | | Falcon attention/cache | Old MQA: one cached head; new decoder: expanded query-head cache. Exact FalconLinear matmul/bias dtype contract and CPU autocast weight staging; direct SDPA uses neither the generic helper's KV repetition nor enable_gqa. Real tiny CPU forwards check cache size, actual math/Flash selection and measured peaks for both decoder layouts. | | Hybrid/recurrent | Inspect frozen scan callables and, for Qwen, both convolution callables and every submodule's Hub-kernel flag. Mamba1 known torch/pscan/mamba_ssm retains its existing contracts. Mamba2-family torch broadcasts and Qwen DeltaNet chunk/decode workspace have real CPU peak tests; opaque replacements warn as unknown in default and reject in strict. FLA 0.5.2/causal-conv1d 1.7.0 remain unqualified; see [source findings and pending GPU checks](recurrent-memory-admission.md). These CPU measurements are not GPU calibration. | | MLA/DSA | DeepSeekV2/V3, MiniCPM3 and GLM4-MoE-Lite retain compressed latent/RoPE caches and expand per layer. DSA families retain expanded KV plus indexer keys and query×key scores. Tiny CPU cache regressions; no GPU calibration. | | Distill | Shared actual SAE training rows/eligibility; basic linear vectors; thin SVD and named covariance methods have distinct budgets; enabled PCA/RDO/SAE/expert/custom-recipe work only. Unknown algorithms warn by name in default and reject in strict. | | Validate/evaluation | Zero for inactive basic gate; shared cache selection and method/fold helpers account for concatenations, FP64 copies, refits, auxiliaries, lexical solve and null calibration. Enabled evaluations use actual serial forward workloads and retained rows. Supplied pack callbacks use their own prompt groups. Opaque/custom callbacks and optional probes produce unknown estimated components. | | Repair validate/excise | Actual writer selection: pristine then edited snapshots/candidates; retained SVD backing and enabled repair work. 16-layer H512/I2048 capture exceeds 65 MiB headroom: default warns, strict rejects. | | Excise | Ordinary transactions and successful LoRA construction/merge have separate bounds selected by execution's own target/rank helper. Empty-adapter fallback uses ordinary surgery. KL rollback uses selected snapshots at their original dtype. | | DiskSnapshot | None follows merged 50%-of-current-headroom policy; explicit cap preserved. No admission assumption of 1 GiB. | | Rebirth native/fallback | Native plan: exactly the writer's own `native_export_host_demand` (same check the writer enforces). No plan: checkpoint_writer full-gather accounting. No duplicated shard multiplier. | | MPS / multi-device / broker | Shared CPU/MPS headroom counted once for weights; each device checked independently; process-wide grant checked separately. No cross-device borrowing. | Unmodelled paths and estimator failures name their cause in the default warning. Strict rejection also points to the explicit, warning-logged `OBLITERATUS_PHASE_ADMISSION=off` escape hatch. This acknowledges missing evidence instead of disguising it as an inflated byte requirement. Custom callbacks or kernels need their own allocation contract before a defensible bound can be claimed; these tests do not certify arbitrary remote code. ## Alternate entries and refinement admission Every admission updates the active stage, including bypass mode. Iterative refinement admits PROBE, DISTILL and VALIDATE immediately before each operation; VALIDATE passes `gate_only=True`: it uses only the host gate concatenation/refit plan, even when collateral evaluation or repair is enabled. It never charges CUDA forwards or pristine capture that refinement does not execute. After freeing captured rows, it re-admits EXCISE with `work_scope="projection"` for the new edit targets, excluding already executed pre-passes and driver-owned evaluation. A nested rejection reports its own stage through the existing pipeline failure contract. The trace regression rejects before gate materialization; real gate planning also checks default warning versus strict rejection with zero usable host headroom. A separate regression also confirms that refinement's host gate proceeds with 1 MiB of usable CUDA headroom where full validation's calibrated evaluation forwards reject. Alternate callers use the following admission boundaries: | Entry | Admission boundary | |---|---| | Concept baseline and Concept Lab extraction/validation | PROBE, DISTILL and VALIDATE before the corresponding work. Standalone validation uses only the host gate plan, excluding full-pipeline evaluation forwards and repair capture. | | Saved-checkpoint evaluation | VERIFY before evaluation; rejection retains lifecycle cleanup and the failed evaluation record. | | Informed pipeline and Ouroboros reruns | Fresh baseline/probe/distill/excise/verify/rebirth checks, including sparse refinement and EXCISE after Bayesian configuration. ANALYZE, the separate informed distillation executor (including category enrichment), sparse surgery and raw `save_pretrained` export carry named unknown estimates. Plain re-distillation uses its own base contract, without charging unused category enrichment. | | Concept Lab apply/evaluate/repair/export | Fresh checks before pristine capture, previews, intervention, dose evaluation, repair candidates and export. Retained updates, unmerged adapters and arbitrary UI prompts differ from the main executor, so these custom workspaces remain unknown estimates. | | Standalone intervention evaluation | Checks before repair capture, pristine evaluation, intervention, post-edit evaluation, repair and artifact saving; caller-supplied callbacks and separate intervention storage remain unknown estimates. | | SOTA comparison script | Standard PROBE/DISTILL checks and surgery-scoped EXCISE, plus named unknown estimates before its custom baseline logits and refusal/KL/capability evaluations. | Standalone permanent concept edits validate every target before mutation. Large embeddings and residual writers project independent rows (stored Linear columns) in compute chunks of at most 16 MiB, staging complete results on CPU. Scratch is bounded by a few chunk buffers plus hidden-width vectors; an oversized single row computes on CPU. Offloaded updates remain on CPU until commit; resident updates are recomputed one writer at a time, with CPU rollback snapshots. Host RAM therefore still scales with selected weights. Permanent `untie` also needs an additional resident head; `edit_both` keeps the shared weight. Projection arithmetic and storage-cast order are unchanged. Coordinate-direction edits without norm preservation remain bit-exact. General GEMV kernels can differ by compute-dtype rounding when chunk shape changes. Norm preservation makes a preliminary pass for a global ratio per matrix/expert; its chunked sums can also differ by floating-point rounding. Low-precision storage rounds these results again, so values near a rounding boundary can differ by a storage ULP. Embedding LoRA construction chunks its weight conversion as well. Scalar finiteness scans no longer allocate weight-sized masks. These changes do not reduce the ordinary pipeline EXCISE estimate: it still models its own executor. Standalone concept workspace remains explicitly unknown, including host staging and rollback. Informed and benchmark calls that execute only `_excise()` pass `work_scope="surgery"`. This excludes the main driver's pristine KL capture and evaluation/repair finishing work. Surgery still includes its own snapshots, Bayesian trials, optional edits and KL scoring of an existing baseline, including already installed repair hooks. Full main-driver admission retains the complete phase demand. Checkpoint VERIFY and extraction PROBE/DISTILL boundaries continue to describe their matching executors. Unknown custom work warns and proceeds in default mode, rejects before the operation in strict mode, and obeys the explicit off mode. Raw `save_pretrained` callers do not inherit the native writer's calibrated contract. Main-pipeline LoRA, repair, KL capture/rollback and native REBIRTH already run inside their matching admitted phases; their existing workspace regressions remain in the validation suite. Ordinary app reruns use the main pipeline, and distributed probe/distill retains its own resource-admission boundary. ## Optional algorithm workspace checks Offline profiler regressions execute real forwards, extraction and surgery, checking new live tensor allocations against the admission bound. Small fixtures retain the relevant allocation lifetimes; larger admission thresholds have separate metadata checks. Optional work must either have a named workspace estimate or produce an explicit unknown component. | Optional path | Execution-based decision and regression | |---|---| | Bayesian optimization | Execution-owned snapshot bytes plus bounded model-aware refusal/KL workloads and host FP32 logits; shared effective trial selector. [Admission contract tests](../tests/test_device_memory_admission.py) check exact finite demand and pre-allocation rejection of unsupported scopes in strict/fail-closed modes. [Optional workspace tests](../tests/test_phase_optional_admission.py) retain the real snapshot-peak regression. These CPU checks do not qualify compiled workspace or hardware bounds. | | Expert transplant | Shared eligible ModuleList expert groups. Source dtype determines CPU alias credit; running mean/difference/division and target cast/scaled update form sequential peaks. Transplant-only FFNs never enter ordinary projection transactions. FP32/BF16/FP64 helper and complete EXCISE peaks tested. Fused containers are execution no-ops here. | | Attention-head surgery | Scores are row/head vectors. Subsequent selected-head updates are slices of already-selected ordinary projections, run sequentially after full projection. Existing matrix transaction bound covers the complete real EXCISE peak with surgery enabled. | | Spectral cascade | Shared selected-layer eligibility; retained normalized direction vectors, L×L FP32 DCT basis and O(L) reconstruction/coherence buffers. Separate sequential peak validated against the real helper. | | RDO | DISTILL stacks rows, optimizes one direction with Adam, and retains projected examples/gradient buffers. The peak regression runs three real updates to cover first-step state allocation and subsequent overlap/reuse, asserting that all updates and refinement ran. Production uses 500 steps; iterations reuse the same workspace. | | Wasserstein | DISTILL's FP32 covariance, regularized cost matrix, solve/lstsq and row operands use its named matrix allowance; actual extractor execution/peak tested. | | Float layer interpolation | Python scalar Gaussian/norm weights, no extra tensor matrix. Real DISTILL peak tested with nonempty resulting interpolation weights. | | Activation steering | Shared layer selection; retained CPU direction clones plus coefficient/product/result/dtype-cast buffers during actual forward hooks. Zero strength retains installation clones but requires no forward buffers. Hook/install peaks tested. Split/offloaded layers or non-CPU direction storage produce unknown components because their transfer lifetime is unqualified. | | Safety-neuron masking | Row projections, z-score/mask vectors and optional dequantization run sequentially after ordinary projection of the same matrices. Complete enabled EXCISE peak covered by existing edit workspace. | | Embedding projection | Only requested/tied edited embeddings enter the target set; same projector/norm-preservation transaction model. Complete enabled EXCISE peak tested. | | Invert/reflection | Changes projection scale, not tensor geometry. Router safety classification uses matrix-vector scores; expert/head projection lifetimes remain sequential. Complete enabled dense EXCISE peak and existing fused-MoE regressions cover this path. | | Refinement + transplant/steering | Unknown combination component (default warning, strict rejection): future re-probes can change direction/expert selections, so the first EXCISE bound cannot certify their eventual auxiliary buffers. Ordinary refinement freshly admits PROBE, DISTILL, VALIDATE and then EXCISE before continuing with reselected targets. Successful LoRA skips these later options just as execution does. | Default warnings and strict rejections name each unknown path. Strict rejection also names the warning-logged `OBLITERATUS_PHASE_ADMISSION=off` escape hatch. No optional algorithm is silently omitted. CPU peak regressions do not establish hardware calibration for estimate-only paths.