TL;DR
DepthGraft reimagines cross-layer Key-Value (KV) sharing not just as a trick for saving memory, but as a powerful structural regularizer for training. By reconstructing deep-layer KV pairs from a hierarchical mix of shallow and middle layers, it reduces KV cache by one-third while simultaneously boosting performance—achieving a massive 7.0% absolute gain on MMLU-Pro for a 16B Mixture-of-Experts (MoE) model.
What Problem Does This Paper Address?
As Large Language Models (LLMs) get deeper, they often suffer from depth-wise information dilution. In standard architectures, information from early layers must pass through a long chain of residual blocks to reach the end. By the time it gets to the deepest layers, the signal can become "blurry," making it difficult for the model to effectively utilize its full depth.
While researchers have tried adding direct "shortcuts" between distant layers, these usually come with a heavy tax: more computation, more memory access, or complex system engineering. Previous attempts at "KV sharing" (where multiple layers reuse the same Key and Value tensors) were designed primarily to save memory during inference, often at the cost of a slight dip in model quality. DepthGraft flips this script, asking: Can we design a sharing topology that actually makes the model smarter?
Methods
The authors propose a hierarchical architecture called DepthGraft. Instead of every layer having its own unique KV projections, the network is partitioned into three stages: Shallow, Middle, and Deep.
- Shallow & Middle Stages: These layers compute their KV tensors normally.
- Deep Stage: These layers do not have their own KV projections. Instead, they reconstruct their KV tensors using a stride-aligned pair from the earlier stages. Specifically, a deep layer $\ell$ combines one source from the shallow stage and one from the middle stage using learnable, channel-wise coefficients.
This "stride-aligned" approach ensures that the gradient flow is distributed evenly across the early layers rather than congesting a few "global anchors." It also allows the deep layers to draw from two different levels of abstraction: the lexical/local patterns of shallow layers and the semantic/abstract states of middle layers.
Datasets
The models were trained from scratch and evaluated on a comprehensive suite of downstream benchmarks:
- Knowledge & Understanding: MMLU, MMLU-Pro, LAMBADA, C-Eval, CMMLU.
- Reasoning & Math: ARC-Challenge, SIQA, GSM8K.
- Code Generation: HumanEval, MBPP, LCBench.
- Long Context: RULER (needle-in-a-haystack, variable tracking, etc.).
The experiments covered both dense models (0.5B to 1.5B) and MoE models (3B to 16B).
Key Insights and Ideas
- KV Sharing as Regularization: The "aha moment" is that every KV reuse edge is a direct highway for gradients. When a deep layer reuses a shallow layer's KV, the shallow layer receives training signals directly from the deep layer's task demands.
- Asymmetric Geometry: This cross-layer gradient flow reshapes the "geometry" of the representations. It forces Keys to become more compact and discriminative (sharpening retrieval) while pushing Values to cover a richer, more diverse content subspace.
- Topology Matters: The authors show why previous methods were sub-optimal. Adjacent sharing (sharing with the next layer) provides too little diversity in signals. Global-anchor sharing (everyone sharing one or two specific layers) creates "gradient congestion," overloading a few layers with too many conflicting objectives. DepthGraft’s distributed, hierarchical approach strikes the perfect balance.
Key Results
- Performance Boost: On the 16B MoE model, DepthGraft achieved a 7.0% absolute improvement on MMLU-Pro, 6.6% on CMMLU, and 6.4% on C3 compared to a standard Grouped-Query Attention (GQA) baseline.
- Efficiency Gains: It reduces the KV cache size by approximately one-third. Because the deep layers don't need to wait for their own KV to be computed, "prefill" (the time it takes to process the initial prompt) is significantly faster—reducing Time-to-First-Token (TTFT) by up to 28.8% at 128K context.
- Scaling: The advantages were consistent across all model sizes, from tiny 0.5B models to 16B MoE architectures.
Limitations and Future Work
- Kernel Optimization: While the theoretical speedups are clear, the authors note that reaching the full potential of decoding speed requires specialized CUDA kernels to handle the reconstruction step efficiently.
- Theoretical Depth: While the paper provides a spectral analysis of the regularization effect, a more rigorous mathematical framework for how different sharing topologies affect the "effective depth" of Transformers remains an open area for research.
- Data Privacy: The pretraining corpus used was proprietary, which makes exact replication of the training dynamics difficult for the broader community, though the architectural code is public.
Summary updated