Backends¶
compile_graph() compiles the same source / target edgelist into one of
the supported sparse PyTorch models defined by the backend. The backend
controls how the model is executed.
Feedforward¶
Compiles an acyclic, layerable graph into successive masked layer blocks: a sparse multilayer perceptron whose connectivity comes from the edgelist.
Skip edges are expanded internally with pseudo nodes so every compiled hop is
adjacent layer-to-layer. Pseudo nodes never appear in
artifact.interpretation_sites or in node attribution.
Omit steps. Feature and node attribution both work. Node sites are
layer_1, layer_2, and so on, starting after the input layer, so inputs
are not in result.sites (use result.table).
Use this when the graph is hierarchical. It will not compile cyclic graphs or directed graphs that cannot be layered.
State-update¶
Keeps the original topology, including cycles, and applies a shared masked
update for a fixed number of steps (default 3). steps is the unrolling
count per forward pass, not a training epoch count and not a sequence length
in the data. Passing steps with backend="feedforward" raises.
Each node is a scalar. Vector or matrix nodes are currently not supported.
After every step, input-node values are re-injected.
Every node that can influence an output must be reachable from at least one
input. Read named edge weights with edge_weights(model).
Feature and node attribution both work. Node sites are step_1, step_2,
and so on, and include all visible nodes, including inputs.
result.table and result.sites store signed Captum scores.
result.summary(aggregation=...) collapses those repeated columns
(peak, mean_abs, or last). "peak" (default) keeps the signed
score from the step with largest magnitude; "last" is also signed;
"mean_abs" averages magnitudes.
Use this for cycles or feedback. It is not an LSTM or sequence model, does
not learn different weights per unrolled step, and does not run a
converge-until loop inside compile_graph().