[Paper Review] Positional Encoding to Control Output Sequence Length
This paper proposes length-dependent positional encodings (LDPE and LRPE) that extend Transformer's sinusoidal positional encoding to control output sequence length by encoding the distance to the target length. The method enables precise length control and improves ROUGE scores, even for lengths unseen during training, outperforming prior methods in headline generation tasks.
Neural encoder-decoder models have been successful in natural language generation tasks. However, real applications of abstractive summarization must consider additional constraint that a generated summary should not exceed a desired length. In this paper, we propose a simple but effective extension of a sinusoidal positional encoding (Vaswani et al., 2017) to enable neural encoder-decoder model to preserves the length constraint. Unlike in previous studies where that learn embeddings representing each length, the proposed method can generate a text of any length even if the target length is not present in training data. The experimental results show that the proposed method can not only control the generation length but also improve the ROUGE scores.
Motivation & Objective
- To address the lack of length control in neural encoder-decoder models for abstractive summarization.
- To enable generation of summaries with arbitrary target lengths, including those not present in training data.
- To improve both length precision and summary quality (ROUGE scores) in headline generation.
- To extend sinusoidal positional encoding in a continuous, differentiable way that encodes remaining length or length ratio.
Proposed method
- Extends Transformer's sinusoidal positional encoding to include the target length as a learnable input, creating length-difference (LDPE) and length-ratio (LRPE) encodings.
- LDPE encodes the difference between current position and target length, ensuring identical values for same remaining length.
- LRPE encodes the ratio of current position to target length, enabling generalization across different lengths with similar relative progress.
- The modified positional encodings are added to token embeddings in the decoder input layer, replacing standard positional encoding during inference.
- During training, the true length of the reference summary is used as the target length; during inference, the desired length is specified.
- The method uses a continuous representation of length, allowing generalization to unseen lengths without retraining.
Experimental results
Research questions
- RQ1Can positional encoding be extended to control output sequence length in Transformers without requiring length-specific embeddings?
- RQ2Can the model generate high-quality summaries at arbitrary target lengths, even if those lengths are rare or absent in training data?
- RQ3Does incorporating distance to terminal position improve both length precision and ROUGE scores compared to baseline methods?
- RQ4How does the proposed method compare to prior approaches like LenEmb, LenInit, and LC in terms of length control and generation quality?
Key findings
- LDPE achieved the most precise length control, with variance of 0.00 for desired lengths of 30 and 50 on the Japanese test set.
- The proposed method maintained high ROUGE scores even when trained on data excluding the desired length, indicating generalization to unseen lengths.
- On the DUC-2004 English test set, LDPE and LRPE significantly outperformed the bare Transformer and previous baselines in ROUGE scores, with LRPE+PE+re-ranking surpassing state-of-the-art results.
- For very short headlines (len=30), the method slightly reduced ROUGE-2 scores compared to the bare Transformer, but this was due to the baseline's inherent ability to generate short summaries, not a failure of the method.
- The method achieved a mean absolute difference of only 0.1 between generated and desired lengths for len=10 in Japanese, indicating high precision.
- Re-ranking based on source word overlap improved headline quality, with Transformer+LRPE+PE+re-ranking achieving the highest ROUGE scores on DUC-2004.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.