Skip to content

order

order

The forward order of a standardized model's values, measured by one probe run (see probe).

available

available(host: Any, prefix: str = '') -> list[tuple[str, Any, Any]]

(name, host, value) for every value host has (support gives no reason).

block_values

block_values(block: Any) -> list[tuple[str, Any, Any]]

available over a block and its standard children, by dotted name ("self_attn.attention_queries").

probe

probe(model: Any, targets: list[tuple[int | None, str, Any, Any]], run: Any) -> list[tuple[int | None, str, Any]]

(layer, name, location) for each target, in the order the forward reached them.

One run (model.scan, meta tensors and no weights needed, or model.trace) with one invoke for a prompt and one empty invoke per value. Each empty invoke reads its value, which parks it until the forward reaches that value's location, then appends the location it was served at, so the list comes out in forward order. Workers parked on one location resume in the order they were written, not in any order the forward gives them, so values served at one location (the attention call's queries, keys and values) tie: either read order is legal. A derived value, computed from several locations, is its own location (layer, name).

compute

compute(model: Any) -> dict[int, dict[str, int]]

Every available value's rank, by side: -1 the root's values before the blocks, each layer its block's, num_layers the root's after.

One block of each shape (block class and the values it has) is probed, so a hybrid's linear- and softmax-attention blocks are each measured. A rank counts distinct locations in forward order: from 0 in each block, and once across the root's two sides. A forward that cannot run on meta tensors (one that branches on its data: Granite's torch.equal, OPT's data-dependent shapes, a grouped-mm mixture of experts in float32) is probed with a trace, which loads the weights of a model not yet dispatched.

cached

cached(model: Any) -> dict[int, dict[str, int]]

compute, once per model: route kernels before the model runs, so what fires never changes after.