Files
OBLITERATUS/docs/input-execution-device.md
T
2026-10-18 14:44:12 -04:00

45 lines
2.7 KiB
Markdown

# Input execution devices
Token tensors use `resolve_input_execution_device(model)` in evaluation,
benchmarks, the ablation pipeline, automatic runs, chat, concept steering,
concept evaluation and KV-cache probes. For dispatched
models, the resolver uses the input embedding's Accelerate execution hook (or
its nearest supported ancestor hook). It otherwise uses materialized embedding
storage, a root execution hook, or a resident model device.
The nearest hook takes precedence when ancestor hooks route through a different
device. Conflicting execution devices within that hook remain ambiguous.
A meta tensor describes storage without supplying a usable execution device.
An ambiguous meta layout or an unsupported embedding hook raises
`InputDeviceResolutionError` before token placement. Parameterless models
without a device use CPU. Chat preserves dispatched model placement instead
of moving the entire model with `.to()`.
Auxiliary gate attention and span masks move to each hidden tensor's device
before indexing. Readout positions are created on that same device. Steering
vectors, erasure factors and unmerged LoRA factors follow each module's output;
LoRA hooks also move the original input arguments, since Accelerate may have
moved inputs inside its wrapped forward. Permanent concept edits use logical
parameter transactions to update authoritative CPU/disk backing weights.
Resident split models can use weight repair. Repair candidates that snapshot
weights remain unavailable on meta-backed/offloaded models and are reported as
unavailable by the repair ladder. They do not write to placeholder tensors.
LoRA recovery training has a separate single-device boundary and rejects split
or offloaded placement before training; see [recovery.md](recovery.md).
The Pain-Axis replication and Appendix D scripts accept `--device-map auto`
or a JSON module map, optional `--max-memory` JSON device budgets, and
`--offload-folder`. Their outputs record requested placement, the realized map,
storage devices and the input execution device. Python callers can pass the
same `device_map`, `max_memory` and `offload_folder` keywords to the replication
loader across multiple extraction, editing and evaluation steps. The combined
recovery script accepts concrete resident maps and rejects unsupported training
placement before loading its first model.
CPU tests exercise real Accelerate CPU and disk offload as well as supported
hook layouts and invalid device metadata. Resident/offload parity tests compare
edited authoritative weights, repeated logits and greedy generated tokens.
Physical CUDA, MPS and multi-GPU qualification must run separately on the target
hardware; CPU offload parity does not establish those results.