RIFT: Token Influence Follows the Path of Least Resistance
Organizations: University of California, Los Angeles Los Angeles, CA, USA · Independent Researcher
Abstract
Which context tokens drive a language model's answer? Graph-based tools such as attention rollout and attention flow answer this from a single forward pass, yet their faithfulness in decoder-only models is rarely tested against interventions. We view the layers of a decoder as a causal network whose conductances are attention weights, and read a token's influence on the answer from the resistance between them. We propose RIFT (Resistance-based Information Flow in Transformers), which scores a token by the series resistance of its path of least resistance to the answer, found exactly by a classic shortest-path dynamic program. On synthetic in-context retrieval tasks and extractive question answering over Wikipedia paragraphs, RIFT predicts the effect of replacing a token with a Spearman correlation of 0.52-0.68; predicting a single replacement, it reaches 77-96% of the agreement between two different random replacements. It needs no gradients and no extra forward passes, scoring every token of a prompt in 0.9-3.4 ms on one CPU thread, whereas the replacement experiment needs a forward pass per token. On 576 held-out prompts from four models of two families (Qwen3 and Llama 3.2), it outperforms token distance, attention rollout and attention flow in every pre-specified comparison, by 0.23 to 0.88 in mean Spearman correlation, and it is the best or tied-best of all attention-based scores we test. Aggregates that add up all routes (attention flow, effective resistance and rollout) instead mostly encode token position: as a simple proposition shows, early tokens have many more parallel routes to the answer.
Figures & tables
| Advantage of RIFT over | ||||||||||
| Model | Prompts per task | Layout | Acc. % | Rel. | RIFT 1 | RIFT | distance | rollout | attention flow | |
| Synthetic tasks: confirmation (held out, pre-specified) | ||||||||||
| A | 1.7B base | single 32, first 32 | mixed | 95 | 0.61 | 0.49 | 0.53 | +0.41 [+0.32, +0.49] | +0.47 [+0.39, +0.55] | +0.64 [+0.55, +0.74] |
| B | 1.7B instruct | single 43, two-hop 21 | mixed | 92 | 0.71 | 0.60 | 0.63 | +0.63 [+0.53, +0.72] | +0.34 [+0.26, +0.41] | +0.63 [+0.55, +0.72] |
| C | 4B instruct | single 26, two-hop 13, first 25 | mixed | 97 | 0.67 | 0.51 | 0.53 | +0.42 [+0.33, +0.50] | +0.50 [+0.43, +0.57] | +0.65 [+0.57, +0.72] |
| D | 1.7B base | single 32, first 32 | interleaved | 86 | 0.67 | 0.53 | 0.55 | +0.64 [+0.52, +0.75] | +0.40 [+0.31, +0.48] | +0.47 [+0.37, +0.57] |
| Task | Rel. | RIFT | Distance | Rollout | Attn. flow | |
|---|---|---|---|---|---|---|
| Single-hop | 283 | 0.62 | 0.55 | 0.11 | 0.23 | 0.08 |
| Two-hop | 34 | 0.84 | 0.68 | 0.50 | 0.03 | 0.50 |
| First-value | 131 | 0.65 | 0.56 | 0.04 | 0.21 | 0.04 |
| SQuAD | 128 | 0.65 | 0.68 | 0.15 | 0.32 | 0.14 |
| max. attention | widest path | multiplicative path | |
|---|---|---|---|
| A | +0.05 [+0.01, +0.10] | +0.05 [+0.02, +0.08] | +0.03 [ 0.01, +0.06] |
| B | +0.20 [+0.15, +0.24] | +0.00 [ 0.03, +0.03] | +0.10 [+0.08, +0.13] |
| C | +0.15 [+0.11, +0.20] | 0.01 [ 0.03, +0.02] | +0.09 [+0.06, +0.12] |
| D | +0.03 [ 0.01, +0.06] | +0.05 [+0.01, +0.08] | +0.01 [ 0.02, +0.04] |
| E | +0.18 [+0.14, +0.23] | 0.01 [ 0.04, +0.03] | +0.09 [+0.05, +0.12] |
| F | +0.05 [+0.01, +0.09] | +0.04 [ 0.01, +0.08] | +0.04 [+0.01, +0.08] |
| Score | Position | Label |
|---|---|---|
| Token distance | 1.00 / 1.00 | 0.13 / 0.00 |
| Attention rollout | 0.73 / 0.60 | 0.02 / 0.28 |
| Attention flow | 1.00 / 1.00 | 0.13 / 0.00 |
| Eff. resistance, attention | 0.96 / 0.91 | 0.14 / 0.01 |
| Eff. resistance, Jacobian | 0.99 / 0.98 | 0.14 / 0.02 |
| Structural null | 1.00 / 1.00 | 0.13 / 0.00 |
Transformer Interpretability
Transformer interpretability studies how attention, feed-forward layers, and hidden representations support model predictions and behavior.
See all 338 papers