Skip to main content
QUICK REVIEW

[Paper Review] An Efficient Transformer Decoder with Compressed Sub-layers

Yanyang Li, Ye Lin|arXiv (Cornell University)|Jan 3, 2021
Network Packet Processing and OptimizationComputer Science23 references10 citations
TL;DR

This paper proposes Compressed Attention Network (CAN), a novel Transformer decoder architecture that compresses the three standard sub-layers—self-attention, cross-attention, and feed-forward network—into a single unified attention mechanism through mathematical equivalence under mild conditions. The method achieves up to 2.82× faster inference than the standard Transformer baseline with no significant performance drop, while maintaining high parallelism and ease of implementation.

ABSTRACT

The large attention-based encoder-decoder network (Transformer) has become prevailing recently due to its effectiveness. But the high computation complexity of its decoder raises the inefficiency issue. By examining the mathematic formulation of the decoder, we show that under some mild conditions, the architecture could be simplified by compressing its sub-layers, the basic building block of Transformer, and achieves a higher parallelism. We thereby propose Compressed Attention Network, whose decoder layer consists of only one sub-layer instead of three. Extensive experiments on 14 WMT machine translation tasks show that our model is 1.42x faster with performance on par with a strong baseline. This strong baseline is already 2x faster than the widely used standard baseline without loss in performance.

Motivation & Objective

  • To address the high inference latency of Transformer decoders caused by their deep, sequential sub-layer architecture.
  • To improve inference efficiency without sacrificing translation quality by increasing parallelism in the decoder.
  • To propose a simplified, single-sub-layer decoder architecture that maintains performance while reducing computational overhead.
  • To establish a stronger baseline using a deep encoder and shallow decoder for fairer comparison with prior acceleration methods.

Proposed method

  • The authors mathematically prove that self-attention and cross-attention can be merged into a single attention mechanism when their inputs are sufficiently similar, a condition empirically validated on WMT data.
  • They further show that the feed-forward network can be combined with the attention sub-layer due to the linearity of its operations, enabling full compression of the three sub-layers into one.
  • The resulting Compressed Attention Network (CAN) uses a single attention layer that performs the functions of self-attention, cross-attention, and feed-forward transformation in parallel.
  • The method relies on parameter sharing across attention heads and maintains residual connections to preserve gradient flow and model stability.
  • A strong baseline is constructed by using a deep encoder and a shallow decoder, which is 2× faster than the standard Transformer without performance loss.

Experimental results

Research questions

  • RQ1Can the three sub-layers in a Transformer decoder be mathematically compressed into a single attention mechanism without performance degradation?
  • RQ2Under what conditions is the compression of self-attention and cross-attention into one layer valid and effective?
  • RQ3Does merging the feed-forward network with the attention layer preserve model performance while improving inference speed?
  • RQ4Can a shallow, single-sub-layer decoder achieve competitive speedups compared to standard and prior acceleration methods?

Key findings

  • CAN achieves up to 2.82× faster inference than the standard Transformer baseline across 14 WMT machine translation tasks, with negligible performance drop.
  • Compared to a stronger baseline with a deep encoder and shallow decoder, CAN still delivers 1.42× speedup, outperforming other methods like SAN and AAN, which achieve only 1.12–1.16× speedup.
  • The cosine similarity between inputs of adjacent sub-layers is high (e.g., >0.9 on WMT14 En-De), validating the assumption that inputs are sufficiently similar for compression.
  • The model converges stably during training, with minimal performance degradation despite compression, indicating robustness of the architectural simplification.
  • The proposed method is simple to implement and does not require architectural modifications or additional parameters beyond standard training.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.