Sparse Attention Changes the Visibility Graph
Calculate dense, local-window, and global-token causal visibility edges, then separate guaranteed graph savings from task-dependent empirical quality.
Dense causal attention allows position to read every position from to . Sparse attention removes selected edges from this visibility graph. The immediate saving is countable; the effect on learning is task-dependent.
Count Dense Causal Edges
For length , row contains allowed keys. Therefore
At , dense causal attention has edges.
Count a Local Window
Let each query see itself and at most preceding tokens. Then
For and , the row counts are
so . Adding position 0 as a global key gives 26 edges because five later rows gain one edge that was not already local.
| Pattern | Edges at | Immediate fact |
|---|---|---|
| dense causal | 36 | every earlier position is directly visible |
| local causal, | 21 | direct visibility is limited to recent positions |
| local plus global position 0 | 26 | every row can also read the first token |
Fewer Edges Do Not Guarantee the Same Capability
With a local window, position 7 cannot directly read position 1. Information may travel through several layers, or a global/structured edge may connect the positions. Whether this is sufficient depends on the task and depth.
Longformer combines local and task-specific global attention. BigBird studies a different mix of local, global, and random connections. Their results support their specified graphs and experiments, not every sparse pattern.
Q1. Count local causal edges
For and , each query sees itself and at most one preceding token. How many edges are allowed?
Compute it first, then check your number.
Hint
Solution
State the Two Claims Separately
“This graph uses 21 rather than 36 edges” is an analytical result. “This graph preserves accuracy on a task” requires a controlled experiment.