RSS Google AI Blog
Follow
Supercharging transformer residual connections
Traditional deep learning models suffer from the vanishing gradient problem, where learning signals degrade in deeper networks. Transformers address this using residual connections, which provide shortcuts for data to bypass layers. However, standard residual connections, using point-wise summation, dilute information by equally weighting all prior representations. This makes it difficult for networks to retrieve specific high-resolution details from earlier layers, hindering efficiency.Our ICML 2025 paper introduces DeepCrossAttention (DCA) to overcome this. DCA generalizes residual connections by dynamically selecting and routing features from preceding layers. Instead of a rigid additive pipeline, DCA reframes residual learning as a dynamic routing problem. It uses a lightweight, layer-wise module to combine previous embeddings on a per-token basis.DCA employs two primary mechanisms: dynamic layer routing and depth-wise cross-attention. Dynamic layer routing computes unique mixing weights for each token, adapting the processing structure. Depth-wise cross-attention applies attention across layers in depth, allowing each token to query a dynamically weighted mix of all prior layer embeddings.Experiments show DCA significantly improves convergence speed, training stability, and model quality. On language modeling benchmarks, DCA achieved lower perplexity with fewer training steps and layers than standard transformers. It achieved a lower perplexity with 30 layers compared to 42 for a standard transformer, representing a 29% reduction in depth and parameters.DCA adds a negligible number of parameters (less than 0.2%) and can be retrofitted onto pre-trained transformers for further perplexity reduction. The paper highlights a broader shift toward dynamic residual routing in deep learning. Other dynamic residual techniques, like attention residuals and hyper-connections, are also emerging.Attention residuals use learnable softmax attention to selectively weight and retrieve representations from earlier depths, improving gradient stability. Hyper-connections expand the residual stream into multiple parallel channels but can cause instability. Manifold-constrained hyper-connections address this by applying constraints to mixing matrices, ensuring stable signal propagation.DCA demonstrates the power of dynamic, attention-based routing for building more efficient models. By leveraging an expanded residual stream and depth-wise cross-attention, DCA empowers deep networks to selectively integrate token embeddings across layers. Future models are expected to dynamically route and weigh past layer representations based on specific tokens, leading to more expressive and deeper interactions.