mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-06 11:04:06 +01:00
Integrate bounded admission, UI ownership and controls, opt-in durable MCP execution, rank-local TP2 groundwork, regression hardening and operator guides. Physical larger-memory and two-host qualification remain separate.
467 lines
30 KiB
Markdown
467 lines
30 KiB
Markdown
# Capacity planning before model acquisition
|
|
|
|
Capacity planning reads a model configuration and, when supplied, a safetensors
|
|
index. It constructs the native Transformers model on the meta device to obtain
|
|
tensor shapes and byte counts. It does not request checkpoint weights, create a
|
|
CUDA context, or treat aggregate advertised VRAM as available memory. A config
|
|
plan is an estimate; the loaded model's actual tensor types, ties and offload
|
|
backing must still pass the bounded-export check before editing.
|
|
|
|
The planner accepts a separate free-memory budget for every requested device.
|
|
These must describe the allocation that will run the workload, after other
|
|
processes and allocation limits have been accounted for. A whole decoder block
|
|
belongs to one device, every requested device must own at least one block, and
|
|
tied parameters stay together. Embeddings, the final norm, the output head and
|
|
other architecture modules are included in the inventory. Unequal devices receive
|
|
placement according to their individual budgets. The search considers every
|
|
allowed target for an untied output head and optimizes whole-block partitions
|
|
for each candidate, including head storage, edit workspace and forward outputs.
|
|
Tied heads retain their embedding placement; explicit device maps are honored.
|
|
A large device cannot cover a shortfall on a smaller device.
|
|
Explicit maps must assign weights to a requested CPU or disk offload tier;
|
|
an unused map entry does not satisfy that requirement.
|
|
|
|
Planning follows the execution device: `--device auto` can use all supplied GPU
|
|
budgets, while `--device cuda` or `cuda:N` confines the model to that visible
|
|
ordinal. Budgets remain in visible order, so selecting `cuda:1` requires entries
|
|
for ordinals 0 and 1. CPU commands use `--plan-host-memory` for execution and do
|
|
not require `--plan-free-memory`. Explicit devices cannot acquire a different
|
|
placement through `--plan-offload` or `--device-map`. Unsupported execution
|
|
backends refuse a capacity claim. Supply budgets for the allocation after any
|
|
GPU visibility selection.
|
|
|
|
Dry-runs apply `OBLITERATUS_DEVICE_MEMORY_CEILINGS`, including the host ceiling;
|
|
the qualification driver's `--device-ceilings` JSON takes precedence over that
|
|
environment setting. `--gpu-memory-utilization` scales the supplied free GPU
|
|
bytes before placement. Planning assumes a fresh process without existing CUDA
|
|
reservations. Scaling free rather than total memory conservatively bounds the
|
|
qualification worker's utilization limit under that assumption; execution still
|
|
checks actual total/free memory and allocator reservations.
|
|
|
|
Qualification plans also resolve `--reference` before admitting a run. A selected
|
|
reference receives its own single-device phase budgets in `reference_plan`, with
|
|
no offload. Both workers must fit; their RAM and VRAM demands are checked
|
|
separately because they run sequentially. For example, a BF16 72B edit can fit
|
|
across two 96 GiB GPUs while `--reference cuda:0` still refuses. Automatic
|
|
selection uses the planned host budget and `--reference-max-bytes`; execution
|
|
reuses that frozen decision and checks the reference's remaining headroom.
|
|
|
|
Plans retain the explicit device map, per-module weight sizes, workload settings,
|
|
per-phase component estimates and peak bytes, refusal reasons, export estimates,
|
|
and snapshot policy. JSON plans can be retained alongside the qualification
|
|
evidence. A refused plan is still useful evidence: it records which budget or
|
|
runtime constraint prevents that workload from fitting.
|
|
|
|
## Recorded configuration inputs
|
|
|
|
The offline fixtures in `tests/fixtures/capacity_configs/` contain published
|
|
configuration JSON, with formatting normalized. No dimensions were invented and
|
|
no weights were acquired. `provenance.json` records each public source, the last
|
|
configuration change revision shown by its official file history, and the SHA-256
|
|
digest of the normalized fixture. A configuration change revision does not pin
|
|
the full checkpoint: stage the intended model revision and index separately.
|
|
|
|
| Published model | Configuration | Decoder layers | Hidden / intermediate width | BF16 parameter bytes |
|
|
| --- | --- | ---: | --- | ---: |
|
|
| [Qwen2.5-72B-Instruct](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/blob/main/config.json) | `qwen2` | 80 | 8192 / 29568 | 145,412,407,296 |
|
|
| [Qwen2.5-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct/blob/main/config.json) | `qwen2` | 64 | 5120 / 27648 | 65,527,752,704 |
|
|
| [Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/config.json) | `qwen3_5` conditional | 64 text, 27 vision | 5120 / 17408 text | Determined from complete meta inventory |
|
|
|
|
The Qwen2 totals are independently checked from the published dimensions. For
|
|
hidden width `H`, KV width `K`, and MLP width `I`, one block has
|
|
`2*H*H + 2*H*K + 3*H*I + 3*H + 2*K` parameters. This includes Q/K/V biases and
|
|
both RMSNorms. Add two `vocab_size*H` matrices and one final `H` norm. The 72B
|
|
block occupies 1,755,369,472 bytes at BF16; the 32B block occupies 975,210,496
|
|
bytes. Whole-block placement therefore needs more than a check of total bytes.
|
|
|
|
The published Qwen3.8-27B config is a hybrid text-and-vision model, not a renamed
|
|
Qwen2 dense decoder. It includes 48 linear-attention and 16 full-attention text
|
|
blocks plus a vision tower. The planner inventories the complete conditional
|
|
model and retains the loader's current single-execution-device restriction.
|
|
Every execution plan for this hybrid model is currently refused because vision
|
|
and recurrent-kernel workspace need separate qualification. A multi-device
|
|
request also violates the current loader restriction. The metadata inventory
|
|
remains available for inspection; it does not establish runtime capacity.
|
|
|
|
## Phase estimates and reserves
|
|
|
|
The batch size, sequence length, generated-token count, sample count, number of
|
|
directions, attention implementation and dtype are part of the plan. Retained
|
|
activation storage and direction extraction consume host memory as well as
|
|
device memory. Attention and logits depend on the active batch and sequence
|
|
length. KV cache depends on key/value head count, head width, layer ownership and
|
|
the prompt plus generation length. Edit workspace depends on the largest logical
|
|
weight being edited. Eager attention needs a sequence-squared workspace reserve;
|
|
changing its implementation changes the estimate and must be recorded.
|
|
Config-enabled `output_attentions` and `output_hidden_states` are included in
|
|
forward peaks because activation collection inherits those settings. Their
|
|
retained outputs accumulate across decoder layers.
|
|
|
|
Generation also inherits output settings from the local generation config or
|
|
model defaults. The report records `generation_output_policy`. Hidden states
|
|
and attentions contribute to each forward's peak; when
|
|
`return_dict_in_generate` is enabled, their earlier decoding outputs remain
|
|
live too. Uncached decoding retains successively longer sequences, while cached
|
|
decoding retains prefill outputs and single-token decode outputs. Structured
|
|
generation also reserves per-step vocabulary rows for `output_scores` and
|
|
`output_logits`. Split execution includes returned attention copies on the
|
|
input device. Qualification comparisons explicitly disable these generation
|
|
outputs; their ordinary forwards still inherit model output settings.
|
|
|
|
Cache policy is recorded separately for ordinary forwards and generation.
|
|
Activation collection inherits the model config's `use_cache`; generation uses
|
|
the local `generation_config.json` beside the model config when present, with
|
|
model defaults as the fallback. Supply that file alongside an offline config
|
|
when the intended checkpoint overrides generation defaults. Uncached decoding
|
|
reserves attention and logits for the full prompt plus generated sequence,
|
|
without KV storage. Cached decoding bounds prefill and one-token decode peaks.
|
|
Placement uses the same policy. Enabled cache implementations other than dynamic
|
|
are refused until their workspace is modeled. Qualification comparisons explicitly
|
|
enable dynamic caching, so qualification plans bound that workload alongside the
|
|
diagnostics that inherit the configured policy. Generation estimates and placement
|
|
costs expand the batch by the larger of `num_beams` and `num_return_sequences`;
|
|
the report records `generation_batch_size`. Activation collection keeps its
|
|
ordinary batch size.
|
|
|
|
The report records the effective `generation_mode`, including the diagnostics'
|
|
`do_sample=False` override and Transformers defaults. Inherited contrastive
|
|
search, DoLa, grouped beam search and constrained beam search are refused before
|
|
checkpoint loading: their execution and workspace require separate contracts.
|
|
The supplied generation settings remain unchanged.
|
|
|
|
Inherited assisted decoding (`prompt_lookup_num_tokens`, `assistant_early_exit`,
|
|
or `use_mtp`) is refused until candidate verification and assistant state have a
|
|
separate workspace contract. Candidate verification can evaluate multiple query
|
|
tokens even with caching enabled, so the ordinary one-token decode bound does
|
|
not establish capacity. The report records `generation_assistance_policy` and
|
|
the refusal without changing the supplied generation settings.
|
|
|
|
When `guidance_scale` is set to a value other than 1, generation reserves two
|
|
branches, including separate conditional and unconditional KV caches. Each
|
|
branch conservatively uses the full prompt-plus-generation length and its own
|
|
activation/logit workspace; sequential onload staging is shared. The report
|
|
records `generation_guidance_scale` and `generation_cache_copies` in
|
|
`cache_policy`. Uncached guidance reserves both branches' growing forward
|
|
workspaces without KV storage. Qualification comparisons explicitly disable
|
|
guidance and keep their single-cache estimate.
|
|
|
|
Resident placement includes nonpersistent buffers such as rotary frequencies.
|
|
Checkpoint index validation, source bytes and snapshot accounting use serialized
|
|
state entries, which exclude those buffers.
|
|
|
|
Source download bytes use an index's `metadata.total_size` when supplied.
|
|
Otherwise they use serialized shapes and the config's source `dtype` or legacy
|
|
`torch_dtype`, including text-config defaults, independently of the requested
|
|
load dtype. Missing source dtype metadata reserves FP32 storage. Index shard
|
|
staging follows the same source sizes; without an index the operator supplies
|
|
the shard staging bound separately.
|
|
|
|
For each phase, the peak includes resident weights and the phase's temporary
|
|
components, with safety headroom. Loading, baseline evaluation, activation
|
|
collection, direction extraction, editing, verification and export are checked
|
|
separately. Host RAM and disk capacity are independent budgets. A plan with
|
|
enough total weight capacity can still fail on attention, retained observations,
|
|
the output head, a single oversized block, export staging or restore storage.
|
|
Free-memory estimates must be rechecked at execution time; they do not reserve
|
|
resources or establish measured GPU peaks.
|
|
|
|
Ordinary multi-direction extraction retains slices of the complete FP32 SVD
|
|
right-singular basis for each layer, even when only two directions are selected.
|
|
The planner charges those backing allocations and normalized primary directions
|
|
through extraction, editing, verification and saving. At 4,096 samples per class,
|
|
72B activations and retained bases alone occupy 30 GiB of host memory, before
|
|
workspace and reserves; a 28 GiB host budget is refused.
|
|
|
|
Plans record the selected `direction_method`. The `leace_exact` override reserves
|
|
FP64 sample, covariance, whitening and projection workspace independently of the
|
|
model's load dtype, including the previous layer's live FP32 eraser. For
|
|
Qwen2.5-72B BF16 with 6,000 samples per class, a 35.2 GiB host budget is refused.
|
|
Gated concept validation also reserves FP64 extraction workspace.
|
|
|
|
Concept denoising also retains the complete pooled-control PCA basis through
|
|
`LayerExtraction.removed_pcs`, including with one direction or an empty selected
|
|
PC prefix. Concept plans reserve this storage without acquiring the recipe.
|
|
At 8,192 samples per class, Qwen2.5-72B BF16 needs another 20 GiB for those bases;
|
|
activations, primary concatenations and PCA storage alone reach 100 GiB even
|
|
with gating disabled. A 96 GiB host budget is refused during direction planning.
|
|
|
|
Qualification plans count comparison prompts separately from extraction samples.
|
|
Each comparison set retains one FP32 vocabulary row and generated token IDs per
|
|
prompt. Stock results survive editing; verification and saving retain both stock
|
|
and edited sets. Reload reserves four sets to cover its fresh/saved results and
|
|
the later supervisor comparison of edit and reference observations. This is a
|
|
conservative bound even when no reference is selected. For Qwen2.5-72B, 100,000
|
|
comparison prompts require about 56.65 GiB per set before token IDs; a 32 GiB
|
|
host budget is refused before loading weights. Both preparation and `--plan-only`
|
|
count the selected workload's comparison list, including fixture defaults.
|
|
Disk admission also reserves both workers' observation files: four comparison
|
|
sets in total, plus their activation means and directions. This conservative
|
|
bound also applies when no reference is selected. Completed reference files are
|
|
already charged by current free space during execution rechecks; reload creates
|
|
no new observation file. A staged 32B BF16 workload with 100,000 comparison
|
|
prompts is refused with 150 GiB of free disk even when host memory suffices.
|
|
|
|
Gated custom-concept probes retain three auxiliary readouts alongside the primary
|
|
positive/control activations. This includes non-refusal `concepts baseline`, which
|
|
uses report gating. At 4,096 samples per class, these four readouts alone retain
|
|
40 GiB for Qwen2.5-32B BF16. Neighbour activations add one readout per row for
|
|
up to three groups. Plans default to three groups bounded by `--plan-samples`
|
|
each; use `--plan-neighbour-samples` to supply a different total neighbour-row
|
|
bound, including zero when no neighbours are collected. These bounds do not
|
|
truncate execution data. Primary commands with `--gate-mode off` collect neither
|
|
auxiliary nor neighbour readouts; a gate override still retains report readouts.
|
|
Concept writer rollback and activation collection are budgeted independently.
|
|
The direction phase also covers the all-layer positive/control concatenations
|
|
created during concept extraction. Report/enforce validation materializes every
|
|
primary, auxiliary and neighbour readout and retains FP64 copies alongside the
|
|
original chunks. These sequential phases use the larger materialization peak;
|
|
gates-off extraction still charges its primary concatenations. The 40 GiB of
|
|
32B readouts above therefore cannot fit a 48 GiB host budget during extraction
|
|
and validation, even with no neighbours.
|
|
|
|
The workload records `validation_gate` independently of custom readouts. Both
|
|
`refusal` and `core/refusal` baselines run report validation on their primary
|
|
positive/control rows. Their plans reserve three additional FP32 row-storage
|
|
equivalents for concatenations and FP64 copies, plus FP64 refit workspace.
|
|
At 4,096 samples per class, Qwen2.5-32B BF16 retains 10 GiB of primary rows and
|
|
needs another 30 GiB for gate materialization; a 32 GiB host budget is refused.
|
|
Ordinary refusal commands default to gates off; explicit `--gate-mode report`
|
|
or `enforce` receives the same validation allowance. CPU FP32 sequence backing
|
|
is charged separately from the compact rows materialized by validation.
|
|
Gated plans also reserve FP64 lexical presence and training matrices, ridge-solve
|
|
workspace and score scratch at the 1,024-feature cap across all primary/control
|
|
rows. Every row is treated as a training row for this bound; prompt texts and
|
|
fold assignments are not required for the tensor estimate. Feature strings,
|
|
per-prompt sets, the full vocabulary Counter and sorting metadata are reserved
|
|
separately under `lexical_metadata`. The 1,024-column cap and token sequence
|
|
length do not bound these allocations. Supply `--plan-prompt-characters` as a
|
|
bound on the total characters across the untruncated primary/control texts
|
|
(including expanded entry-point content). Local prompt pairs and built-in refusal
|
|
texts are counted automatically; an explicit bound cannot be smaller than that
|
|
count. When texts cannot be counted offline, a gated plan records a refusal until
|
|
the operator supplies this bound. These planning bounds do not truncate prompts
|
|
or change gate execution. Runtime gate admission counts prompt lengths without
|
|
constructing feature sets or a vocabulary, and conservatively reserves the full
|
|
column cap. Both lexical allowances are independent of model hidden size, layer
|
|
count and load dtype.
|
|
|
|
Pain-Axis `vectors` plans treat `--plan-samples` as a bound per retained dataset.
|
|
They count all seven datasets and two temporary dataset copies while the
|
|
collector stacks layer rows. For the 32B BF16 config and 8,192 prompts per dataset,
|
|
retained rows occupy 70 GiB and collection copies add 20 GiB before other host
|
|
workspace. These counts do not truncate or acquire the datasets during planning.
|
|
|
|
The default edit path also projects `lm_head`. Its 72B BF16 matrix alone is
|
|
2,491,416,576 bytes, and the FP32 projection copies/workspace need about 18.6 GiB
|
|
on the edit device. With the other edit workspace and reserves, a fully resident
|
|
2x 80 GiB 72B plan is conservatively refused even at a small batch/sequence size.
|
|
The 2x 96 GiB case has room for this estimate. Explicit CPU offload can place the
|
|
output head and at least one whole decoder block on CPU, moving head-edit
|
|
workspace to the host; the inference phases still budget onloading the head.
|
|
This placement uses additional host RAM and transfer time.
|
|
|
|
## Planning commands
|
|
|
|
Supply local metadata and the intended free budgets explicitly. This example
|
|
uses the checked-in 72B config, BF16, batch 1, 128 prompt tokens and 16 generated
|
|
tokens; replace `80 80` with the GPUs' available GiB and set host/disk budgets
|
|
from the intended allocation:
|
|
|
|
```bash
|
|
python scripts/gpu_qualification.py --output evidence/72b-plan \
|
|
--plan-only --plan-config tests/fixtures/capacity_configs/qwen2.5-72b-instruct.json \
|
|
--dtype bfloat16 --plan-free-memory 80 80 --plan-offload cpu \
|
|
--plan-host-memory 128 --plan-disk-memory 1024 \
|
|
--plan-batch-size 1 --plan-sequence-length 128 --plan-generation-tokens 16
|
|
```
|
|
|
|
The command prints the explicit map and phase budget table and writes
|
|
`evidence/72b-plan.capacity-plan.json`. An optional `--plan-index` checks a staged
|
|
safetensors index against the native model's tensor inventory and estimates
|
|
source-shard staging. With no index, `--plan-source-shard-gib` is the explicit
|
|
source-shard staging bound. No model directory or dataset is needed for this
|
|
config-only command. `--plan-offload cpu` explicitly allows host placement for
|
|
this 80 GiB pair; omit it when planning a fully resident 96 GiB pair. `--dry-run`
|
|
is an alias for `--plan-only`.
|
|
|
|
The qualification driver's `--device-map map.json` validates that exact placement
|
|
against the supplied budgets in a dry-run. Without a map, the planner chooses a
|
|
whole-block placement from those budgets.
|
|
Hardware dry-runs require exactly `--devices` GPU budgets. Rehearsal dry-runs
|
|
estimate CPU execution; their device count remains synthetic.
|
|
|
|
The same flags are available on `obliterate`/`abliterate`, concept `baseline`
|
|
and `steer`, and the three Pain-Axis scripts. They stop before model, direction
|
|
or dataset acquisition. For example:
|
|
|
|
```bash
|
|
python -m obliteratus obliterate Qwen/Qwen2.5-72B-Instruct \
|
|
--output-dir evidence/72b-concept-plan --method basic --plan-only \
|
|
--plan-config tests/fixtures/capacity_configs/qwen2.5-72b-instruct.json \
|
|
--dtype bfloat16 --plan-free-memory 96 96 \
|
|
--plan-host-memory 128 --plan-disk-memory 1024 \
|
|
--plan-batch-size 1 --plan-sequence-length 512 --plan-generation-tokens 120
|
|
```
|
|
|
|
Concept `baseline` and `steer` default to CPU placement, matching execution.
|
|
The Pain-Axis scripts plan their fixed single-device `cuda:0` execution;
|
|
additional GPU budgets do not enable splitting those runs.
|
|
|
|
Primary `obliterate`/`abliterate` plans default to a sibling of the checkpoint
|
|
directory: the example writes `evidence/72b-concept-plan.capacity-plan.json`.
|
|
This keeps the plan when a successful run atomically replaces that checkpoint
|
|
directory. The same rule applies to the primary command's default output path.
|
|
Use `--plan-output` to choose another evidence file; choose a path outside any
|
|
checkpoint directory that execution will replace. Existing files are preserved.
|
|
The JSON records `metadata_source.weights_loaded=false`, input hashes and the
|
|
configured workload. A refusal exits unsuccessfully after retaining the plan.
|
|
Primary commands derive the sample count from the selected built-in corpus or
|
|
local `--prompt-pairs-file`. Use `--plan-samples` to supply an explicit sample
|
|
bound when the corpus cannot be inspected without acquisition, including concept
|
|
packs, residue expansion and the Pain-Axis planners. The qualification planner
|
|
counts the selected workload JSON, or its three-prompt fixture default. Explicit
|
|
bounds must cover any known corpus count. The bound describes samples per class
|
|
and does not truncate execution data.
|
|
Primary-command defaults bound activation batches of 16 and refusal verification
|
|
batches of 4 with 512 prompt tokens (or the explicit `--max-seq-length`), and
|
|
reserve at least 200 generated tokens for capability diagnostics. Concept
|
|
baseline probing defaults to batch 16 and 256 prompt tokens. Entry points without
|
|
a prompt truncation bound use the config's context length; explicit
|
|
`--plan-sequence-length` and other `--plan-*` workload overrides remain available
|
|
for planning a chosen workload. These overrides do not change execution settings.
|
|
Recovery training is outside the inference estimator and explicitly refuses a
|
|
training-capacity claim.
|
|
|
|
Requested `--quantization 4bit` or `8bit` also refuses a capacity claim and marks
|
|
bounded export ineligible: a dense config cannot describe the resulting packed
|
|
parameters or their execution and save workspace. Normal quantized execution
|
|
remains available.
|
|
|
|
The estimator covers basic sequential projection and concept output-writer
|
|
transactions, including their retained CPU rollback copies. Ordinary basic runs,
|
|
including `--concept refusal`, receive no concept rollback charge unless
|
|
`--preserve` requests protected surgery. Optional method,
|
|
embedding-edit, LoRA and coherence repair workspaces require a separate estimate
|
|
and are reported as refusals. This includes default repair for non-refusal
|
|
concepts: protected repair may retain both pristine and edited full-model host
|
|
copies even when `--plan-snapshot disabled` is selected. `--skip-repair` plans the
|
|
corresponding workload without repair. Actual-run controls remain available. Use
|
|
`--plan-directions` to record a direction count when it cannot be inherited from
|
|
the entry point.
|
|
|
|
## Saving and restoration
|
|
|
|
Large eligible native checkpoints use the bounded writer: it stages one CPU
|
|
shard plus at most one offload owner, rather than gathering a full state dict.
|
|
A tensor larger than the nominal shard size is admitted at its actual size.
|
|
Module placement or CPU/disk offload alone does not disqualify an untied native
|
|
Qwen2 checkpoint. Runtime checks still reject unsupported custom serialization,
|
|
quantized/adapted layouts and ambiguous offloaded ties. Config-only eligibility
|
|
is explicitly provisional until the loaded backing layout is checked.
|
|
Resident tied GPT-2, Llama and Qwen configs can receive provisional bounded-export
|
|
estimates. Known CPU/disk-offloaded ties are ineligible during planning, including
|
|
CPU-offload rehearsals. `--allow-unbounded-export` admits their whole-state
|
|
fallback only when four state equivalents fit the host budget and records
|
|
`operator_allowed_fallback` in the frozen plan. Qualification rechecks eligibility
|
|
before editing and saving; unexpected fallback without that admission fails
|
|
before a whole-state gather.
|
|
|
|
Initial disk admission includes output and export staging. After a successful
|
|
qualification reference export, the edit worker credits its recorded artifact
|
|
bytes, capped at one planned checkpoint, when rechecking remaining disk demand.
|
|
The reference already occupies space in the current free-space measurement;
|
|
the fresh edit export, offload files and reserve still require headroom. The
|
|
frozen preparation plan remains unchanged. Fresh-process reload
|
|
checks its remaining phase demand against then-current free space: new offload
|
|
files and reserve. The completed export and other files already on disk are
|
|
accounted for by that free-space measurement.
|
|
|
|
A 145 GB model exceeds the default 64 GiB snapshot cap. Choose a disk-backed
|
|
snapshot with a sufficient explicit cap and disk budget, or disable snapshots
|
|
with a recorded reason and an independent immutable source checkpoint. A disabled
|
|
snapshot cannot support rollback. Plans must account for snapshot files,
|
|
restored/offloaded backing, staging output and an existing destination that must
|
|
survive a failed export. Snapshot payloads and per-file overhead count each
|
|
logical entry, including both tied embedding names; resident weight storage
|
|
counts a tie once. Export and restore reserve host staging separately from
|
|
model storage; neither policy authorizes an unbounded whole-model host copy.
|
|
Accelerate dispatch uses disk-restorable loaders for both CPU and disk offload,
|
|
so snapshots reserve two additional backing copies for either tier. CPU-only
|
|
`cpu_offload` rehearsals use plain mappings and reserve host overlays instead.
|
|
Snapshot staging admission applies the runtime 50% limit to host availability
|
|
after resident CPU weights load, including CPU-offloaded weights. Disk-backed
|
|
weights do not count as resident host storage for this calculation. The complete
|
|
load peak still includes resident weights, staging and reserves.
|
|
|
|
On `obliterate`/`abliterate` and concept `baseline`/`steer`, snapshots default to
|
|
disabled in both planning and execution. Use `--snapshot disk` and
|
|
`--snapshot-max-gib 256` (aliases of `--plan-snapshot disk` and
|
|
`--plan-snapshot-max-gib 256`) to select an
|
|
explicit disk snapshot and cap for either mode. Remote primary runs forward the
|
|
same policy and cap. The pipeline Python API retains automatic loader snapshots
|
|
when `snapshot_enabled=None`; pass `False` to disable or `True` with
|
|
`snapshot_max_bytes` to request an explicit cap. Snapshot flags on the
|
|
qualification and Pain-Axis planners describe estimates only; those execution
|
|
paths capture no optional loader snapshot.
|
|
|
|
## Validation and rehearsal status
|
|
|
|
`tests/test_capacity_planning.py` checks exact Qwen2 arithmetic, independent meta
|
|
instantiation of all three published configs, free-memory asymmetry, whole-block
|
|
occupancy on three/four devices, ties, index mismatches, infeasible workloads and
|
|
host/disk refusal. Export tests instrument live staged allocations on tiny
|
|
models. The qualification driver's CPU/disk rehearsal uses the same planning and
|
|
bounded writer before a fresh-process reload.
|
|
|
|
These model/meta tests and the rehearsal run in the full test suite. No physical
|
|
two-GPU result or 72B execution measurement is claimed by these estimates.
|
|
|
|
## Planner limits and practical choices
|
|
|
|
Concept pipeline batteries, including supplied `ModelEvaluator` batteries, honor
|
|
`--max-seq-length` after chat formatting. With no explicit cap the pipeline uses
|
|
512 prompt tokens. Generation also leaves room inside the model context for its
|
|
continuation. Planning overrides describe the workload to estimate; they do not
|
|
change execution. Match `--plan-sequence-length` to the execution cap.
|
|
|
|
Host estimates retain up to sixteen harmless prompts' sequence-wide pristine KL
|
|
logits and last-token copies through editing and verification, bounded at FP32.
|
|
Sequence KL also reserves FP32 conversion and probability workspace for one
|
|
prompt. A large vocabulary or a longer prompt cap can therefore make host RAM
|
|
the limiting resource even when all weights fit on GPUs.
|
|
|
|
`--preserve refusal` without `--refusal-direction` runs a separate built-in probe
|
|
with batch 16 and 256 prompt tokens. Its activations, materialization and
|
|
distillation overlap the primary concept caches. The plan records
|
|
`workload.preserve_refusal`; supplying a cached refusal direction removes that
|
|
probe reservation. Primary `--max-seq-length` does not change this helper's limits.
|
|
|
|
The partition search charges each device its own forward workspace, including
|
|
logits on the input/head devices and per-block KV cache. Keeping an untied head
|
|
on the input GPU can leave more block capacity on another GPU. For the published
|
|
BF16 Qwen2.5-72B config, a 36/44 block split with the head on GPU 0 fits the
|
|
estimated batch-16, 384-prompt-token, 200-generated-token workload on two 85 GiB
|
|
free-memory budgets. This is a config estimate, not measured hardware evidence.
|
|
Explicit maps remain useful when additional application constraints matter.
|
|
Returned hidden states/attentions retain conservative all-layer search bounds;
|
|
all final phase rows must fit independently.
|
|
|
|
Disk planning retains a selected reference export alongside fresh output and
|
|
staging. It separately reserves original disk offload, edited backing files and
|
|
reload offload headroom. These bounds also cover `.bin` sources whose original
|
|
`.dat` backing persists after edits; config-only estimates conservatively reserve
|
|
these copies even when a safetensors loader can reuse existing files. Reload
|
|
admission compares only new offload and reserve bytes with then-current free
|
|
space, which already reflects retained exports and backing files.
|
|
|
|
Diagnostics force deterministic generation. Planning rejects
|
|
`num_return_sequences > 1` with `num_beams=1`, and return counts exceeding the
|
|
beam count, before loading weights. Correct the source generation config or
|
|
choose compatible settings explicitly; sampling defaults do not make those
|
|
combinations valid after the deterministic override.
|
|
|
|
Unknown kernel workspace, unsupported methods, quantization, hybrid execution
|
|
and repair still require separate contracts. Runtime admission, exact export
|
|
eligibility and measured qualification remain mandatory; a feasible plan cannot
|
|
certify hardware or weaken a qualification protocol.
|