Performance and repeated calls#

TreeIG is already fast enough for most applications and remains the default. When attribution speed matters and an NVIDIA GPU is available, GPUTreeIG can be materially faster: the recorded T4 comparisons show roughly 9–20× speedups on the workloads reported there. The gain depends on the model, batch size, and baseline distribution; small workloads can still favor the CPU.

TreeIG uses Numba for fast parallel attribution kernels. The first call includes JIT compilation. You can compile in advance with warmup:

ig = tig.TreeIG(model, baseline=x0).warmup(X_eval[:3])
phi = ig.attribute(X_eval)

Subsequent calls on the same model are fast. Attribution for thousands of observations on a typical ensemble completes in well under a second after warmup.

Measuring your workload#

Separate model fitting, explainer construction, and the first compilation call from repeated attribution timing. Reuse the explainer with the same fitted model. Use several warmed repetitions and report the batch size, baseline count, model shape, package versions, hardware, and thread settings alongside timings.

Use attribute() when only the values are needed. explain() also evaluates model outputs to provide baseline values and completeness errors. More baselines mean more paths; use batching when memory, rather than latency, is the constraint.

See TreeIG and TreeSHAP for the recorded CPU comparison and the benchmark notes for additional measured workloads. Timings are examples, not performance guarantees.