Why LLMs need creases: folding manifolds before the final linear cut
Stacking linear layers without an activation collapses into one flat matrix and stalls at ln(2) on symmetric classes; ReLU and GELU hinges fold scattered contexts together so one final unembedding hyperplane can slice out the next token.
December 1, 2026 · Research note · What is not yet established
Stacking linear layers without a non-linear activation adds zero expressive power: a hundred matrices multiply down to one flat hyperplane cut. Revisiting Christopher Olah’s Neural Networks, Manifolds, and Topology alongside Daniel Smilkov and Shan Carter’s TensorFlow Playground—both newly added to my reading list—changed how I picture what language models do between input tokens and readout, a geometric counterpart to how writing collapses continuous latents into discrete tokens.
The mechanism doing the work
Without an activation, $W_L(\cdots W_1 x) = W_{\text{eff}} x + b_{\text{eff}}$ can shear, rotate, or stretch space, but never fold two opposite regions onto the same side of a plane. Elementwise ReLU ($\max(0, z)$) puts an origami crease along $z = 0$: pairing $\text{ReLU}(+x_0) + \text{ReLU}(-x_0) = |x_0|$ folds $(-2, 0)$ directly onto $(+2, 0)$ while keeping $(0, \pm 2)$ at $0$. In a Transformer, attention routes context across token positions via weighted sums, while each MLP block (d -> 4d -> d) creases the residual manifold so thousands of surface contexts fold into one half-space before the final linear unembedding matrix $W_U$ slices out the next token.
Benchmark (float64, blind recompute <= 2.5e-16) | Creases H | Active cells (Zaslavsky cap) | Cross-entropy | Accuracy / SGD solve rate |
|---|---|---|---|---|
3-layer Linear (2->16->16->2) on cross & rings | 0 | 1 (1) | 0.6931 (ln 2) | 50.0% (exact affine ceiling) |
Analytic V-fold on antipodal cross (4 pts) | 2 | 2 (4) | 0.000045 | 100.0% (abs(x_0) fold) |
Random-SGD ReLU on cross (20 seeds) | 2 / 4 / 8 | <= 4..37 | 0.4124 / 0.0059 / 0.0011 | 4/20 → 17/20 → 20/20 |
Open ReLU troughs on concentric rings (240 pts) | 1 / 2 | 2 (2) / 3 (4) | 0.5625 / 0.3776 | 67.5% / 85.0% (unbounded) |
Closed ReLU polygon on concentric rings (240 pts) | 3 / 6 | 7 (7) / 14 (22) | 0.0257 / 0.0061 | 100.0% / 100.0% (enclosed) |
Two mechanisms stand out in the interactive manifold-folding explorer, LaTeX preprint (PDF) (.tex), and reproduction bundle:
- Why networks widen before projecting back (
d -> 4d). Two hinges separate the antipodal cross analytically, yet random SGD solves only4/20seeds atH = 2because dead half-spaces zero out gradients; expanding toH = 8(4xinput width, matching standard Transformer MLPs) solves20/20. - Enclosure threshold (
H >= d + 1). By Zaslavsky’s theorem, $H \le d$ hyperplanes cannot bound a cell in $\mathbb{R}^d$; on 2D rings, accuracy jumps to100.0%exactly atH = 3(7regions).
Agent context: sources, method and working notes
1. Exact algebraic collapse of uncreased linear stacks and the antipodal $\ln 2$ barrier
Consider an $L$-layer affine network $f(x) = T_L(T_{L-1}(\cdots T_1(x)))$ with $T_\ell(u) = W_\ell u + b_\ell$ and no elementwise non-linearity. By associativity of matrix multiplication,
$$f(x) = W_{\text{eff}} x + b_{\text{eff}}, \qquad W_{\text{eff}} = W_L W_{L-1} \cdots W_1, \qquad b_{\text{eff}} = \sum_{\ell=1}^L \Big(\prod_{k=\ell+1}^L W_k\Big) b_\ell.$$
Regardless of intermediate width (2 -> 16 -> 16 -> 2 in our verified benchmark), the entire stack lies in the space of affine maps $\mathbb{R}^{d_{\text{in}}} \to \mathbb{R}^C$. For binary classification ($C = 2$), the logit gap $g(x) = (e_0 - e_1)^\top (W_{\text{eff}} x + b_{\text{eff}}) = w^\top x + \beta$ defines a single flat decision hyperplane ${x : w^\top x + \beta = 0}$.
Proposition 1 (Antipodal $\ln 2$ lower bound). Let $\mathcal{D} = {(x_i, y_i)}{i=1}^{2m}$ be any balanced binary dataset whose support and labels are invariant under negation: $(-x_i, y_i) \in \mathcal{D}$ for every $(x_i, y_i) \in \mathcal{D}$, with $m$ points in Class 0 and $m$ points in Class 1 (such as the 4-point symmetric cross $(\pm 2, 0) \mapsto 0$, $(0, \pm 2) \mapsto 1$, or concentric centered rings). Then for every $L$-layer linear network $f$, mean cross-entropy satisfies $\mathcal{L}{\text{CE}}(f) \ge \ln 2 \approx 0.693147$, achieved at $W_{\text{eff}} = 0, b_{\text{eff}} = 0$.
Proof. Pair each sample $x_i$ with its antipode $-x_i$ (which carries the same label $y_i \in {0, 1}$). Let $g(x) = w^\top x + \beta$ be the Class-0 minus Class-1 logit margin, and $\ell_y(g) = \log(1 + e^{(1 - 2y)g})$ the binary cross-entropy loss, which is convex in $g$. Averaging across each antipodal pair $(x, -x)$ of Class 0 ($y = 0$) and Class 1 ($y = 1$):
$$\frac{1}{2}\big[\ell_0(w^\top x + \beta) + \ell_0(-w^\top x + \beta)\big] \ge \ell_0(\beta) = \log(1 + e^{-\beta}),$$ $$\frac{1}{2}\big[\ell_1(w^\top x + \beta) + \ell_1(-w^\top x + \beta)\big] \ge \ell_1(\beta) = \log(1 + e^{+\beta}),$$
by Jensen’s inequality. Averaging equal class masses yields $\mathcal{L}_{\text{CE}} \ge \frac{1}{2}\big[\log(1 + e^{-\beta}) + \log(1 + e^{\beta})\big] \ge \ln 2$ (minimized uniquely at $\beta = 0$). Furthermore, if $w \ne 0$ and no points lie on $w^\top x + \beta = 0$, strict antipodal sign reversal $w^\top(-x) = -w^\top x$ splits every antipodal pair across the hyperplane unless undermined by $\beta$, capping strict classification accuracy at $50%$ whenever class centroids coincide at the origin. $\square$
In /research/why-llms-need-creases/code/verify_manifold_folding.py (independently recomputed in pure Python stdlib without NumPy or PyTorch in /research/why-llms-need-creases/independent/recompute_check.py), a 3-layer linear stack (2 -> 16 -> 16 -> 2) matches its collapsed $2 \times 2$ matrix $(W_{\text{eff}}, b_{\text{eff}})$ to 1.32e-16 on the 4-point cross and 2.50e-16 on 240 concentric-ring points, and 5,000 random affine draws never dip below $\ln 2$ (min CE = 0.7105, global optimum 0.693147).
2. Piecewise-linear origami, Zaslavsky’s theorem, and the width lottery
Inserting elementwise $\text{ReLU}(z) = \max(0, z)$ after $W_1 x + b_1 \in \mathbb{R}^H$ partitions $\mathbb{R}^d$ along $H$ arrangement hyperplanes $\mathcal{A} = {h_k(x) = w_k^\top x + b_{1,k} = 0}{k=1}^H$. Within each sign cell $\sigma \in {0, 1}^H$, the activation mask $D\sigma = \text{diag}(\sigma)$ is constant, so $f(x) = W_2 D_\sigma (W_1 x + b_1) + b_2$ remains locally affine—but different sign cells apply different projections $W_2 D_\sigma W_1$, folding cells along their shared hyperplane hinges (Montúfar et al., 2014).
By Thomas Zaslavsky’s (1975) theorem on hyperplane arrangements in general position in $\mathbb{R}^d$:
- Maximum total linear regions: $R(H, d) = \sum_{j=0}^d \binom{H}{j}$ (for $d = 2$: $1 + H + \binom{H}{2}$, giving
1, 2, 4, 7, 11, 22, 37for $H = 0, 1, 2, 3, 4, 6, 8$). - Maximum bounded regions: $B(H, d) = \binom{H - 1}{d}$ for $H \ge 1$, which equals
0whenever $H \le d$ and first reaches1at $H = d + 1$ (a triangle at $H = 3$ in $\mathbb{R}^2$; a tetrahedron at $H = 4$ in $\mathbb{R}^3$).
Complete verified empirical tables (out/results.json & independent/audit_report.json)
Experiment (float64) | Width H | Zaslavsky cap $R(H,2)$ | Observed active sign cells | Best / median CE loss | Accuracy / solve rate |
|---|---|---|---|---|---|
A1. 3-layer Linear (2->16->16->2) on cross (4 pts) | 0 | 1 | 1 | 0.693147 (exact $\ln 2$) | 50.0% (max diff = 1.32e-16) |
A2. Analytic ReLU V-fold on cross (4 pts) | 2 | 4 | 3 | 0.000045 | 100.0% ($h_0 + h_1 = \lvert x_0 \rvert$) |
B1. Random-SGD ReLU on cross (20 seeds, 600 steps) | 2 | 4 | 1–3 | 0.0029 best / 0.4124 med | 4 / 20 (20%) reach 100% |
B2. Random-SGD ReLU on cross (20 seeds, 600 steps) | 4 | 11 | 3–4 | 0.0014 best / 0.0059 med | 17 / 20 (85%) reach 100% |
B3. Random-SGD ReLU on cross (20 seeds, 600 steps) | 8 (4x d_in) | 37 | 4 | 0.0007 best / 0.0011 med | 20 / 20 (100%) reach 100% |
C0. 3-layer Linear (2->16->16->2) on rings (240 pts) | 0 | 1 | 1 | 0.693147 | 50.0% (max diff = 2.50e-16) |
C1. Trained ReLU on concentric rings (r=1.0 vs 2.4) | 1 | 2 | 2 | 0.562545 | 67.5% (single half-plane step) |
C2. Trained ReLU on concentric rings (240 pts) | 2 | 4 | 3 | 0.377581 | 85.0% (unbounded trough leaks) |
C3. Trained ReLU on concentric rings (240 pts) | 3 | 7 | 7 | 0.025724 | 100.0% (first closed triangle) |
C4. Trained ReLU on concentric rings (240 pts) | 4 | 11 | 10 | 0.019518 | 100.0% |
C5. Trained ReLU on concentric rings (240 pts) | 6 | 22 | 14 | 0.006127 | 100.0% |
C6. Trained ReLU on concentric rings (240 pts) | 8 | 37 | 27 | 0.006542 | 100.0% |
3. Division of geometric labor inside a Transformer LLM
A decoder-only Transformer predicts next-token probabilities via $\text{softmax}(W_U,\text{LN}(h_L))$ where $W_U \in \mathbb{R}^{V \times d_{\text{model}}}$ is a single linear projection: each vocabulary token $v \in {1, \dots, V}$ owns one direction $w_{U,v} \in \mathbb{R}^{d_{\text{model}}}$, and winning the next-token argmax requires $h_L$ to enter the convex polytope Cone / Voronoi cell where $w_{U,v}^\top \hat{h}_L$ beats all $V - 1$ rivals.
Yet in natural language, the same next token (say " Paris") must win across thousands of surface contexts whose raw token embeddings sit in unrelated regions of $\mathbb{R}^{d_{\text{model}}}$ (“The capital of France is”, “After landing at Charles de Gaulle, we drove into”, “Treaty signed at Versailles outside”). Two operations cooperate across depth $L$ to make that final linear cut work:
- Self-attention routes across positions ($h_i \leftarrow h_i + \sum_{j \le i} \alpha_{ij}(h) W_{OV} h_j$): because $\alpha_{ij}(h)$ depends softmax-nonlinearly on query-key inner products, attention moves context vectors between token positions, assembling the relevant multi-token cues into position $i$‘s residual stream. For a fixed attention pattern $\alpha$, however, the value-output path $W_{OV}$ is purely linear.
- MLP blocks fold within each position ($h_i \leftarrow h_i + W_{\text{down}},\sigma(W_{\text{up}} \tilde{h}i)$ with $W{\text{up}} \in \mathbb{R}^{4 d_{\text{model}} \times d_{\text{model}}}$): expanding width
4x(H = 4 d_model) creates thousands of live coordinate creases (or smooth gated bends underGELU/SwiGLU) without suffering the minimal-width dead-hinge lottery, folding disparate contextual clusters toward the target unembedding cone $w_{U,v}$ while pushing near-miss contexts away. Depth compounds these folds exponentially (Montúfar et al., 2014): composing $L$ creased layers folds already-folded sheets, multiplying the number of input regions that map onto the same readout half-space.
4. Rival accounts and boundary conditions
| Rival account | What it claims | Where it holds vs. breaks |
|---|---|---|
| 1. “Softmax attention is already non-linear, so MLP creases are optional.” | Query-key softmax(QK^T / sqrt(d_k)) provides enough non-linearity even if MLPs are linear or removed. | Attention non-linearity acts across sequence positions (routing weights $\alpha_{ij}$), whereas for a single token or fixed routing pattern, value aggregation $\sum_j \alpha_{ij} W_{OV} x_j$ stays inside the convex hull of linearly transformed token vectors; removing MLP activations severely degrades factual recall and per-position feature disentanglement (Dong, Cordonnier & Loukas, 2021). |
| 2. “ReLU just sparsifies activations by zeroing negative noise.” | Setting $z < 0 \mapsto 0$ works like denoising thresholding rather than topological folding. | Thresholding explains single-feature gating, but misses why summing opposing half-spaces ($W_2,\text{ReLU}(W_1 x + b_1)$) identifies antipodal regions ($ |
3. “Smooth activations (GELU, SwiGLU) don’t have hard creases.” | Modern LLMs replaced ReLU with smooth gates, invalidating polyhedral counting. | Smooth gates replace $C^0$ kinks with high-curvature smooth hinges ($\text{GELU}(z) \approx z\Phi(z) \to \text{ReLU}(z)$ at scale), preserving macroscopic manifold folding while giving near-dead negative units small non-zero recovery gradients. |
5. Public artifacts & verification record
- Reading-list canonisation (
/reading/,tier: picked):- Christopher Olah (2014), Neural Networks, Manifolds, and Topology (
src/content/reading/colah-manifolds-and-topology.yaml) - Daniel Smilkov & Shan Carter (2016), TensorFlow Playground (
src/content/reading/tensorflow-playground.yaml)
- Christopher Olah (2014), Neural Networks, Manifolds, and Topology (
- Interactive paired-panel explorer:
/interactive/why-llms-need-creases/(6 verified presets + continuous0%–100%fold interpolation slider + URL state sync + full static HTML no-JS fallback table). - Preprint & open bundle:
preprint.pdf·preprint.tex·README.md·code/verify_manifold_folding.py·out/results.json·independent/recompute_check.py·independent/audit_report.json.