Repository: drwjkirkpatrick-web/depth-width-graph-separation
Theorem: Theorem 5 — Pure attention has a strict rank barrier that
depth cannot overcome; only FFN width can increase representational rank
Status: Verified — SVD rank tracking on synthetic graphs (Jetson GPU)
Date: 2026-06-20
Graph Transformers (GTs) interleave self-attention with feed-forward networks (FFNs). Researchers ask: can we replace FFNs with more attention layers?
Answer: NO.
Theorem 5.1: A depth-$L$ pure-attention GT (no FFN) has node representations bounded by rank
$\leq d$ at every layer,> regardless of depth$L$ or graph size$n$ .Theorem 5.2: An FFN with hidden dimension
$m$ achieves rank$> d$ in hidden activations, even though output is projected back to$d$ .Theorem 5.3: Consequently, FFN-augmented GTs have strictly larger representational capacity than pure-attention GTs for
$m > d$ .
cd ~/projects/depth-width-graph-separation
# Run GPU verification
source ~/heartlib/.venv/bin/activate
python empirical/verify.py
# Run pytest suite
python -m pytest tests/ -vdepth-width-graph-separation/
├── THEOREM.md ← Formal theorem statement (3 parts)
├── proof/
│ └── proof.md ← Full derivations + rank analysis
├── empirical/
│ └── verify.py ← SVD rank tracking on GT variants
├── tests/
│ └── test_depth_width.py ← pytest suite (12 tests)
├── paper/
│ └── paper.tex ← AMS-LaTeX paper
└── README.md ← This file
| Setup | Metric | Result |
|---|---|---|
|
|
Max rank |
8 (exactly |
| Multi-head (4 heads) | Barrier | Still |
| Star graph (degree diversity) | Barrier | Unbroken — still |
The rank barrier is a conservation law. Like mixing colored paints — no matter how many times you stir, you can't create new colors from the original palette.
Theorem 5.2 — FFN Hidden Rank Exceeds $d$
| Setup | Pure Hidden | FFN Hidden | Gain |
|---|---|---|---|
|
|
8 | 16 | 2× |
The FFN acts as a prism: input light enters at
| Metric | Pure GT | FFN-GT | Verdict |
|---|---|---|---|
| Max internal rank | 8 | 16 | ✅ FFN |
| Rank bound |
|
Capacity separation proved |
| Part | Claim | Status |
|---|---|---|
| 5.1 | Pure attention rank |
✅ Verified (flat across depth) |
| 5.2 | FFN hidden rank |
✅ Verified (16 > 8 on star graphs) |
| 5.3 | FFN-GT capacity |
✅ Verified (rank separation) |
Each attention layer computes:
The product
Depth just remixes the same
Why FFN wins:
The ReLU creates sparsity patterns: different input rows activate
different hidden units. With
- Architecture search: Don't search for "deeper attention" as a replacement for FFN. The rank barrier is structural.
- Lightweight GTs (no FFN) have a hard expressivity ceiling for tasks requiring high-rank node discrimination.
- Real-world GTs (GraphGPS, SAN) use both for a reason — the combination is strictly more powerful.
- Python ≥ 3.10
- NumPy ≥ 1.26
- PyTorch ≥ 2.0 (GPU on Jetson)
- pytest ≥ 7.0
MIT.