Depth Memory
Summary
Reframes depth mixing as memory management. The Depth Memory framework describes PreLN (one additive residual stream), Attention Residuals (a growing key–value cache of every earlier layer output — explicit depth memory), and mHC (an expanded residual stream — implicit depth memory) as streams with Read/Write operators, then proposes Linear Depth Memory (LDM): three streams per token — the standard residual stream, a fixed-size matrix-valued associative memory M, and an inverse-covariance stream P. M is maintained as the EXACT solution of a "depth regression" — least squares over past layers, fitting a linear map that reconstructs earlier layer outputs v_i from their keys k_i — solved online by recursive least squares (Sherman–Morrison) with learnable per-layer forgetting factors, dynamic importance weights, and a ridge penalty. Each write is an error-correcting rank-1 update M ← M + u·κᵀ (u = current prediction error, κ = RLS gain from P); reads add a gated memory retrieval to the residual stream, x + γ⊙M(g⊙q). Depth can afford the exact solve that sequence mixing cannot, because layers are already evaluated sequentially — this is test-time regression (delta rule / MesaNet lineage) transplanted from the sequence axis to the depth axis, and the fixed-size RLS state replaces AttnRes's depth-growing cache. Memory is split into G=16 groups with per-group covariance; main config D_k=8 (memory matrix 8D entries/token, 2× mHC's 4D). Hardware-aware implementation: the RLS recurrence is reversible, so the backward pass unwinds states from the final M instead of storing one per layer, and windowed writes (E=4) defer updates within a window — CuTe DSL kernels for Hopper/Blackwell. Results on FineWeb-Edu with per-method LR sweeps and ~1% extra parameters over PreLN: 400M (Llama-like, 50B tokens) validation PPL 12.08 vs Block AttnRes 12.12, mHC 12.23, Full AttnRes 12.35, PreLN 12.73 — lowest also on WikiText-2 (20.70) and LAMBADA (19.10); zero-shot average 50.46, second to Block AttnRes (50.61). 1.5B (Qwen-like, 100B tokens): validation PPL 9.15 vs mHC 9.25, Block AttnRes 9.26, PreLN 9.48; WikiText-2 14.21 and LAMBADA 8.42, both lowest; highest zero-shot average (59.71). A D_k=4 variant whose memory matrix matches mHC's state size still beats mHC on all three perplexities. Throughput (B200, 1.7B–14B): exceeds Full AttnRes in every setting and mHC in all training and most inference settings; competitive with Block AttnRes, especially in decode. Ablations (400M, 15B tokens): the separate residual stream is load-bearing — memory-only layer input (+1.88 PPL) or replacing the stream with the layer output (+0.87) both fall below PreLN (+0.78); replacing RLS with a delta rule (+0.06) or plain outer-product update (+0.07) still beats PreLN but not RLS; storing the residual stream instead of layer outputs hurts most among addressing choices (+0.33); disabling forgetting is a wash (−0.01). On the DepthBench aspect-ratio protocol, LDM beats PreLN at every width/depth ratio at 400M and 1.6B and is lowest at every 1.6B ratio; the deepest 400M shape is the lone exception (HC slightly better). Caveats: quality evidence stops at 1.5B / 100B tokens (larger scales appear only in throughput tests); LDM can add peak training memory; all results first-party, no independent reproduction.
- Venue
- arXiv cs.LG, v1 submitted 13 Oct 2026
- Source
- arxiv
- Access
- free
- Language
- en
- Added
- Oct 20, 2026
- Verified
- Oct 20, 2026
- Found via
- #askalphaxiv
Research notes
- Discovery: Hudson shared the @askalphaxiv post 2026-10-20 4:08 AM ET (~5.8K views; https://x.com/askalphaxiv/status/2112455949881573494; link https://alphaxiv.org/abs/2610.18809). Senior author Shiwei Liu is also senior author of DepthBench (ID 870; queue #42) — LDM's code builds on the DepthBench codebase and its aspect-ratio study follows the DepthBench protocol exactly; first author González-Martínez is a DepthBench co-author. Cluster: residual-stream expansion / depth mixing — #48 xHC (expands the residual stream itself and reads across streams), #11 MSAR (multi-stream attention residuals), #73 Hyperloop (mHC-style hyper-connections applied across loop iterations), #41 ScalingDepth (Keyu Wang's hub; Wang leads DepthBench). The design contrast worth keeping: xHC widens the stream, AttnRes keeps everything and attends back, mHC mixes a fixed expanded state with learned maps — LDM instead keeps the plain residual stream untouched and bolts on a fixed-size associative memory whose contents are the exact least-squares fit of past layer outputs, i.e. the "memory as online regression" framing of #56 (Alex Wang's associative-memory explainer) made literal over depth. Relevance to Hudson's stack: depth-axis and orthogonal to his 3:1 SWA:full-attention sequence mixing — a ~1%-parameter drop-in candidate for his pretraining runs, with the caveat that evidence is dense Llama/Qwen-like backbones at academic scale only (no MoE or hybrid-attention test, nothing above 1.5B quality). Code is unusually complete: training, eval, ablations, and throughput for LDM and all baselines, plus released checkpoints — the ablation table (esp. residual-stream interruption and solver swaps) is directly reusable as a checklist for any depth-mixing experiment.
- License: paper arXiv default nonexclusive-distrib (verified via OAI record — no CC/custom marker); code MIT
Similar entries
- Code Agent Memory Repo (Cognition) — open spec for persistent agent memory
- Code Block Delta Memory (BDM): Sparse Recurrent Memory with Dense Execution
- Paper Balancing Memory Pathways: Analyzing and Improving Memory Utilization in Hybrid LMs
- Post Depth Hybrid Attention (DHA): Depth-Wise Value Mixing for Hybrid Attention Architectures
- Paper Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory
- Paper Metis: Memory Foundation Model