Who Said Neural Networks Aren't Linear?
Paper • 2510.08570 • Published
steps int64 | lr float64 | seed int64 | hist list | collapse_mse_100 float64 | collapse_mse_1000 float64 | linearity_abs_max_f64 float64 | linearity_rel_f64 float64 | onestep_mode_counts list | data_mode_counts_n4096 list |
|---|---|---|---|---|---|---|---|---|---|
8,000 | 0.001 | 0 | [
{
"step": 0,
"loss": 2.3126,
"recon": 2.2903,
"scale_pen": 2.23
},
{
"step": 250,
"loss": 1.8734,
"recon": 1.8512,
"scale_pen": 2.22
},
{
"step": 500,
"loss": 1.6121,
"recon": 1.5899,
"scale_pen": 2.21
},
{
"step": 750,
"loss": 1.4402,
"recon":... | 0 | 0 | 0 | 0 | [
580,
522,
442,
521,
573,
551,
455,
452
] | [
547,
493,
481,
497,
515,
509,
563,
491
] |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
A ~250-line 2D toy that proves the paper's core principle end to end. Not a full-paper reproduction (no LPIPS, no image diffusion, no large-scale training) — just the smallest experiment that demonstrates:
f(x) = g⁻¹(A·g(x)) satisfies f(a·x+b) = a·f(x) + b·f(0) to machine precision when the identity is evaluated in the space where the algebra happens (g-space), in float64: abs err 4.4e-16, rel err 1.9e-14.B = ∏ₜ (I + Δt·(A_t − I)/(1−t)) over 100 steps matches running 100 Euler steps pointwise with MSE 2.5e-13 (1000 steps: 1.7e-12) — to float32 machine precision.B once to g_x ~ N(0,I) and inverting through g produces samples covering all 8 modes of the target distribution with near-uniform coverage (one-step counts [580, 522, 442, 521, 573, 551, 455, 452] vs. data counts [547, 493, 481, 497, 515, 509, 563, 491] for n=4096).repro.py — the entire thing (training + all three checks + figure), runnable via uv run repro.py (PEP 723 deps) or plain python repro.py.metrics.json — raw numbers from the run.linearizer_toy.png — data vs 100-step vs one-step samples, plus the loss curve.(The trained checkpoint.pt is not stored here — rerun repro.py to regenerate it; ~20 minutes on CPU.)
g.A_t = I + U·diag(a(t))·Vᵀ, with scalar time-dependence per rank via a small MLP on a sinusoidal time embedding — the small analog of the paper's time-dependent linear operator.g(x₀) − g(x₁) from g(x_t) with x_t = (1−t)·x₁ + t·x₀, x₁ ~ N(0,I). LPIPS replaced by MSE since there are no images here; the induced-space structure (what the paper actually linearizes) is preserved exactly.Loss, sampler, and collapse-matrix construction copied in structure from one_step/train_one_step.py (commit adfca2c) of the official repo (assafshocher/Linearizer); the 2D modules (InvertibleG, LinearCore) are the 2D analogs of the official modules/linear_network.py components.
g⁻¹ amplifies float round-trip error because g is ill-conditioned at this scale — the identity is exact where the algebra happens.