Manuscript Offprint

arXiv:2611.03142

DepthGraft: Structural Regularization through Hierarchical Cross-Layer KV Reconstruction

Xiaohan Qin, Xiangdong Zhang, Yu Wang, Huaijin Wu, Zhuo Xia, Yebin Yang, Junchi Yan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Xiaohan Qin1,2,3^{1,2,3}, Xiangdong Zhang1,3^{1,3}, Yu Wang3^{3}, Huaijin Wu1,3^{1,3}, Zhuo Xia1,3^{1,3}, Yebin Yang1,3^{1,3}, Junchi Yan1,†^{1,\dagger}

1^{1}School of AI, Shanghai Jiao Tong University 2^{2}Shanghai Innovation Institute 3^{3}Dots Studio, Xiaohongshu Inc.

Project page: https://github.com/jianke0604/DepthGraft

Scaling depth is a key route to stronger large language models, but Pre-LN architectures often suffer from depth-wise information dilution, limiting the effective use of deep layers. While cross-layer connectivity has proven effective at mitigating this problem, existing designs usually introduce additional computation or memory access. We revisit cross-layer KV sharing as an efficient form of such connectivity. Beyond cache compression, each KV reuse edge creates a direct gradient path from deep layers to source KV projections, turning KV sharing into an implicit structural regularizer for KV representation geometry. We provide a systematic analysis of this mechanism, showing that proper sharing topologies sharpen key retrieval directions while enriching the value content subspace, whereas existing adjacent or global-anchor designs do not fully exploit this effect. Motivated by this, we propose DepthGraft, a hierarchical KV-sharing architecture that reconstructs deep-layer KV from stride-aligned shallow-middle source pairs. DepthGraft distributes non-local gradient flow across source layers, while preserving prefill early completion and reducing KV cache by roughly one third. Experiments on dense and MoE models from 0.5B to 16B parameters show consistent downstream improvements under both GQA and MLA. Notably, on the 16B MoE model, DepthGraft achieves a 7.0% absolute improvement on MMLU-Pro, along with gains of 6.6% on CMMLU and 6.4% on C3. These results validate the potential of DepthGraft as a scalable design for large-scale pretraining. The project page is available at https://github.com/jianke0604/DepthGraft.

Figure

Figure 1 | Results on the 16B MoE model. Left two: DepthGraft demonstrates a consistent advantage throughout training. Right two: DepthGraft reduces prefill time (TTFT) and KV cache usage by approximately one-third, while incurring almost no loss in decoding speed.

†^{\dagger}Corresponding author: yanjunchi@sjtu.edu.cn.

1. Introduction

Scaling depth has been a primary lever for improving Transformer-based large language models (LLMs) [21, 32, 42]. In modern Pre-Layer-Normalization Transformers [40], however, adding layers does not always yield the expected improvements [11, 22]. The residual stream [12] aggregates all preceding computations through a single hidden-state trajectory with fixed additive updates; as the stack grows deeper, features formed in early layers can be progressively diluted and become difficult for later layers to retrieve. This depth-wise information dilution limits the effective use of additional layers, making depth scaling less efficient than its representational capacity would suggest [9, 30].

Recent work has validated cross-layer connectivity as an effective remedy for information dilution along depth. Instead of forcing all depth history through the residual stream, recent designs allow deep layers to directly read earlier representations: Attention Residuals [33] reweights preceding hidden states to replace fixed residual accumulation, while Mixture-of-Depths Attention (MoDA) [48] augments attention with key-value pairs from previous layers. Such connections give deep layers direct access to earlier features and create shorter gradient paths to shallow layers. However, dense cross-layer access also introduces additional computation, memory traffic, and system complexity, requiring careful performance-efficiency trade-offs and sophisticated systems-level engineering.

We note that cross-layer KV sharing can also be viewed as a form of such connectivity: it provides deep layers with a channel that bypasses information dilution in the residual stream by granting direct access to shallow-layer memory representations, while gradients flow from deep layers back through the shared KV to shallow layers, supplying shallow-layer KV with optimization signals driven by deep-layer task demands—thus holding the potential to improve depth utilization. Although cross-layer KV sharing has been explored in prior work [4, 31, 49], existing methods predominantly approach it from the perspective of cache compression and inference acceleration. No prior work has systematically studied the cross-layer gradient dynamics of KV sharing, especially how such connections reshape KV representation geometry during pretraining and how the sharing topology determines this effect.

In this paper, we propose that KV sharing is not merely a cache-saving mechanism, but also a form of cross-layer gradient regularization. When a source layer's KV is reused by a distant deep layer, the source KV receives training signals from multiple query spaces. This reshapes KV representation geometry in an asymmetric way: keys are encouraged to concentrate around shared discriminative retrieval directions, while values are pushed to cover a richer content subspace. With a proper sharing topology, this specialization sharpens memory retrieval while increasing the expressive capacity of the value content channel, yielding a useful structural bias for training. We use this lens to revisit existing KV-sharing methods and find that their topologies expose complementary limitations. Adjacent-layer sharing provides too little query-space separation, whereas global-anchor sharing concentrates heterogeneous deep-layer gradients on a few sources, preventing either design from fully exploiting the regularization effect.

Motivated by this analysis, we propose DepthGraft, a simple hierarchical KV-sharing design derived from the cross-layer regularization view. DepthGraft partitions the network into shallow, middle, and deep stages. The shallow and middle stages compute KV normally, while each deep layer reconstructs its KV from a stride-aligned shallow-middle source pair using learnable channel-wise coefficients. This construction creates non-local source-reuse connections with sufficient query-space separation, distributes cross-layer gradients across many source layers rather than a few global anchors, and gives each deep layer access to memory bases at two abstraction levels. As a result, DepthGraft preserves the efficiency benefits of KV sharing, including prefill early completion and KV-cache reduction, while turning the memory pathway into an effective regularized cross-layer connection. Training-dynamics analyses further support our theory, showing that DepthGraft reshapes KV representation geometry as predicted, and experiments across dense and MoE models demonstrate consistent performance gains at multiple scales.

Our main contributions are as follows.

1). KV sharing as cross-layer gradient regularization. We identify KV sharing as a form of cross-layer connectivity and provide a systematic analysis of how its gradient paths reshape KV geometry. Our analysis shows that proper KV sharing sharpens key retrieval directions while enriching the value content subspace, and that this effect is governed by the sharing topology.

2). Hierarchical cross-layer KV reconstruction. We propose DepthGraft, which uses a hierarchical stage layout to reconstruct deep-layer KV from stride-aligned shallow-middle source pairs. This yields a distributed non-local connectivity pattern with two abstraction-level memory bases, avoiding the concentrated-anchor structure of prior KV-sharing methods.

3). Efficient and scalable implementation. DepthGraft removes independent KV materialization from the deep stage, reducing KV cache by roughly 13\frac{1}{3} and allowing KV construction to finish before the final stage during prefill. Its stride-aligned source assignment is engineering-friendly and naturally compatible with PP/VPP schedules, making the design suitable for large-scale distributed training.

4). Consistent empirical gains. We validate DepthGraft on both dense and MoE models, covering model scales from 0.5B to 16B total parameters. Across scales and attention variants, DepthGraft consistently improves downstream performance while preserving inference efficiency.

References (46)