解决长文本生成中控制信号随长度衰减的问题。
LaPA$^2$: Length-Aware Prefix and Prompt Attention Augmentation for Long-Form Controllable Text Generation
- 通过动态放大前缀注意力权重,抵消注意力稀释效应。
- 在长文本生成中显著提升属性控制力,保持内容流畅与相关性。
- 无需训练、适配多种前缀方法,适合需要强控制的长文本任务。
基于前缀的方法因参数高效成为可控文本生成(CTG)的主流范式,但在长序列生成中控制能力会随序列增长而减弱。本文识别出注意力稀释是主要原因:随着序列变长,控制信号的注意力因softmax机制自然衰减,导致控制效果“弱化”。为此,我们提出LaPA²(Length-aware Prefix and Prompt Attention Augmentation),一种无需训练、模型无关的框架,旨在维持长上下文中的强控制能力。具体而言,LaPA²采用长度感知对数缩放,动态增强前缀注意力权重,数学上抵消稀释效应;可选的上下文锚点强化则同步增强提示词注意力,防止强控制干扰原始语义。该方法支持软前缀(连续嵌入)与硬前缀(离散指令)。在多个CTG任务上的实验表明,LaPA²能一致提升各类前缀方法在长文本场景下的性能,显著改善属性控制力,同时保持内容相关性与流畅性。代码与数据已公开于https://github.com/jiabingyang01/LaPA2。
原文摘要 · Abstract (English)
Prefix-based methods have emerged as a promising paradigm for Controllable Text Generation (CTG) due to their parameter efficiency. However, while effective in short sequences, their controllability tends to diminish as the generated sequence grows. In this paper, we identify Attention Dilution as a key factor behind this phenomenon: as the sequence length increases, the attention allocated to the control signal naturally decays due to the softmax mechanism, leading to a "fading" control effect. To address this, we propose LaPA$^2$ (Length-aware Prefix and Prompt Attention Augmentation), a training-free and model-agnostic framework designed to sustain robust control in long contexts. Specifically, LaPA$^2$ employs Length-Aware Logarithmic Scaling to dynamically amplify prefix attention weights, mathematically counteracting the dilution effect, while an optional Contextual Anchor Reinforcement applies synchronized augmentation to prompt tokens, preserving semantic coherence when strong attribute control risks overshadowing the original prompt. LaPA$^2$ is versatile, supporting both soft prefixes (continuous embeddings) and hard prefixes (discrete instructions). Experiments on multiple CTG tasks demonstrate that LaPA$^2$ consistently improves the performance of various prefix-based methods in long-form settings, leading to superior attribute controllability while preserving content relevance and fluency. Our code and data are publicly available at https://github.com/jiabingyang01/LaPA2.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。