Skip to main content
QUICK REVIEW

[Paper Review] On Sparsifying Encoder Outputs in Sequence-to-Sequence Models

Biao Zhang, Ivan Titov|Zurich Open Repository and Archive (University of Zurich)|Apr 24, 2020
Topic ModelingComputer Science30 references7 citations
TL;DR

This paper proposes L₀ Drop, a differentiable sparsity-inducing layer that prunes up to 70% of encoder outputs in Transformer-based sequence-to-sequence models without significant performance drop. By applying an L₀ penalty to stochastic gates, the method learns to mask uninformative source representations—particularly function words and punctuation—resulting in up to 1.65× faster decoding on summarization tasks while maintaining competitive generation quality.

ABSTRACT

Sequence-to-sequence models usually transfer all encoder outputs to the decoder for generation. In this work, by contrast, we hypothesize that these encoder outputs can be compressed to shorten the sequence delivered for decoding. We take Transformer as the testbed and introduce a layer of stochastic gates in-between the encoder and the decoder. The gates are regularized using the expected value of the sparsity-inducing L0penalty, resulting in completely masking-out a subset of encoder outputs. In other words, via joint training, the L0DROP layer forces Transformer to route information through a subset of its encoder states. We investigate the effects of this sparsification on two machine translation and two summarization tasks. Experiments show that, depending on the task, around 40-70% of source encodings can be pruned without significantly compromising quality. The decrease of the output length endows L0DROP with the potential of improving decoding efficiency, where it yields a speedup of up to 1.65x on document summarization tasks against the standard Transformer. We analyze the L0DROP behaviour and observe that it exhibits systematic preferences for pruning certain word types, e.g., function words and punctuation get pruned most. Inspired by these observations, we explore the feasibility of specifying rule-based patterns that mask out encoder outputs based on information such as part-of-speech tags, word frequency and word position.

Motivation & Objective

  • To investigate whether encoder outputs in sequence-to-sequence models can be compressed by removing redundant or uninformative representations.
  • To reduce decoding complexity by shortening the sequence of encoder states delivered to the decoder.
  • To develop a differentiable, end-to-end trainable method for dynamic sparsification of encoder outputs.
  • To evaluate whether data-driven sparsity (L₀ Drop) generalizes across tasks or if rule-based patterns can be effective and transferable.
  • To analyze which types of words (e.g., function words, punctuation) are preferentially pruned and whether such patterns can be exploited for efficient inference.

Proposed method

  • Introduces a differentiable sparsity layer, L₀ Drop, placed between the encoder and decoder in a Transformer model.
  • L₀ Drop uses stochastic gates that are binary random variables, allowing exact zeroing out of entire encoder outputs via a differentiable approximation.
  • The sparsity is induced by adding an expected value of the L₀ penalty to the loss function, which encourages gate values to be zero.
  • The method is trained end-to-end, enabling the model to learn which encoder outputs are redundant and can be safely pruned.
  • A specialized decoding algorithm is introduced that only attends to non-masked (active) encoder states, reducing complexity from O(NM) to O(N′M), where N′ < N.
  • Rule-based sparsity patterns are designed based on analysis of L₀ Drop behavior, including POS tags, word frequency, and position-based filtering (e.g., odd positions only).

Experimental results

Research questions

  • RQ1Can encoder outputs in sequence-to-sequence models be effectively pruned without degrading generation quality?
  • RQ2Does pruning encoder outputs lead to measurable improvements in decoding efficiency?
  • RQ3Which types of words (e.g., function words, content words) are preferentially pruned by the L₀ Drop mechanism?
  • RQ4Can rule-based sparsity patterns—based on POS tags, frequency, or position—achieve similar performance to data-driven L₀ Drop?
  • RQ5Do rule-based sparsity patterns generalize across different tasks such as machine translation and abstractive summarization?

Key findings

  • Up to 70% of encoder outputs can be pruned using L₀ Drop with minimal impact on generation quality, achieving BLEU scores within 0.5 points of the baseline on WMT14 En-De.
  • On document summarization tasks, L₀ Drop achieves a decoding speedup of up to 1.65× by reducing the effective input length to the decoder.
  • L₀ Drop systematically prunes function words, punctuation, and high-frequency words, while preserving representations of rare, content-rich words.
  • Rule-based patterns such as POS filtering and frequency-based pruning achieve comparable performance to L₀ Drop on translation tasks (e.g., 46.7% sparsity, BLEU 27.11), but fail to generalize to summarization.
  • The Group Pattern (pruning every even-positioned encoding) caused a significant performance drop on CNN/Daily Mail (−5.82 ROUGE-L), indicating poor generalization across tasks.
  • The Inv Freq Pattern (pruning rare words) underperformed, supporting the information-theoretic intuition that frequent words carry less information and are more compressible.

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.