Supercharging transformer residual connections
The paper introduces DeepCrossAttention (DCA), a transformer residual architecture that replaces static point‑wise addition with learnable, depth‑wise cross‑attention routing weights, enabling each token to dynamically combine embeddings from all preceding layers. DCA delivers comparable or better model quality up to **three times faster** while cutting required parameters by **30‑40%**. By computing per‑token mixing weights (W) from a static learnable base plus an input‑dependent projection, DCA mitigates information dilution inherent in traditional residual connections. Engineers can adopt DCA to accelerate training of very deep transformer models without a substantial parameter overhead.
⚡ Key Takeaways
- Models using DCA achieve the same quality **up to three times faster** than standard residual transformers.
- DCA adds a lightweight, layer‑wise module that computes dynamic routing weights (W) via depth‑wise cross‑attention.
- Parameter count is reduced by **30‑40%** compared with equivalent residual networks.
- Integration requires replacing the point‑wise summation in each residual block with the DCA routing module that mixes prior layer embeddings per token.
- The approach relies on a static learnable base and an input‑dependent projection; without these components the dynamic routing behavior is not realized.
Faster convergence and lower parameter budgets directly lower training compute costs, making it feasible to scale transformers to hundreds of layers in production pipelines.
✅ Practical Steps
- Replace each residual addition in your transformer implementation with the DCA module that computes per‑token mixing weights (W) from a static learnable base plus an input‑dependent projection.
- Train the modified model as usual; the dynamic routing will automatically learn to select the most relevant historic embeddings, yielding faster convergence.
Want the full story? Read the original article.
Read on Google Research ↗