Substrate · Context-Window Degradation

Vector Databases & RAG Complexity Profile

The algorithmic boundary of vector databases & rag modeled via graph theory.

A retrieval-augmented index is a similarity graph; the cost of coherent multi-hop retrieval tracks the treewidth of the activated subgraph, not its raw size. Every profile below reads the same substrate through a different graph invariant and structural regime, and prices it with Ross’s Law.

Read the volume (PDF, 895 pp)

A retrieval-augmented index looks like a pile of vectors, but it behaves like a graph. Each chunk is a vertex; each strong semantic-similarity link is an edge. A single lookup touches one neighborhood and is cheap. The cost that surprises people is coherent multi-hop retrieval — pulling a set of chunks that have to make sense together — and that cost does not track the size of the index. It tracks the treewidth of the subgraph the query activates.

This is why a RAG system can feel sharp at ten thousand documents and start dragging in half the corpus at a million, with no change to the model or the prompt. What changed is the structure: the similarity graph crossed a threshold and stopped being separable. The five invariants below each measure where that threshold is, from a different direction. Each sorts the index into a shadow regime (clean neighborhoods, retrieval stays local and cheap), a mirror regime (one dense tangle where “relevant” means “everything”), or the equilibrium band between them.

retrieval cost ≈ exp(Θ(tw(G)))Ross’s Law for retrieval: the cost of resolving a coherent multi-hop query scales with the treewidth of the activated subgraph, not the document count. Sharding and indexing buy you everything in the shadow regime and nothing in the mirror.

Treewidth bounds

Treewidth is the quantity that actually prices multi-hop retrieval: the width of the worst cut you must reason across to assemble a coherent answer.

Shadow
tw(G) = O(1) — tight, well-separated topic clusters. A query lands in one neighborhood and returns it. Retrieval is local and precise.
Equilibrium
tw(G) = Θ(log N) — clusters with bridges between them. Multi-hop still works, but answers begin to span more of the index; reranking starts earning its keep.
Mirror
tw(G) = Ω(N) — an over-connected index where everything is a little similar to everything. No clean neighborhood exists; precision collapses and retrieval spreads. This is the degradation you cannot tune away.

Graph degeneracy

Degeneracy is the early-warning gauge, polynomial to compute as the index grows. It measures the densest core of mutually-similar chunks — the part of the corpus that has fused.

Shadow
d(G) = O(1) — no dense core; the graph peels apart into clean communities.
Equilibrium
d(G) = Θ(log N) — a core is thickening. Watch this number: a knee near log N is the signal that behavior is about to change kind.
Mirror
d(G) = Ω(N) — an irreducible similarity core. Retrieval can no longer isolate a topic because the topics have merged.

Embedding-space entropy

The entanglement analogue for an index is the entropy of its embedding distribution across a partition — how much the two halves of the corpus “know” about each other. Concentrated embeddings are shadow; embeddings that fill the space are mirror.

Shadow
S(ρ) ∝ ∂A — area law. Cross-partition similarity lives on a thin boundary; a compact index captures the corpus.
Equilibrium
S(ρ) ∝ log N — the index is informative but spreading; compression is straining.
Mirror
S(ρ) ∝ |A| — volume law. Embeddings saturate the space; no low-rank summary survives and every query is global.

Fiedler-value connectivity

The Fiedler value asks whether the similarity graph has a natural seam to cut — a clean way to split the corpus that retrieval can exploit.

Shadow
λ₂ → 0 — nearly disconnected topics. Sharding is free and lossless.
Equilibrium
λ₂ = Θ(1/N) — a faint seam. Partitioning works but cuts a few real links.
Mirror
λ₂ = Ω(1) — an expander. The corpus resists every partition equally; there is no shard boundary that does not sever relevance.

Bipartite treewidth

The bipartite cut is the stress test: split the corpus in two and measure how wide the relevance interface between the halves is — the worst case for any partition-based retrieval scheme.

Shadow
twᵇ(G) = O(1) — the halves are nearly independent; a constant interface suffices.
Equilibrium
twᵇ(G) = Θ(√N) — a perimeter-shaped interface, the signature of a geometrically clustered embedding space.
Mirror
twᵇ(G) = Ω(N) — every split severs a linear number of relevant links. The index is irreducibly whole.

The same meter, four other substrates

A RAG index is one instance of the universal meter. The same five invariants read these too: