arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2508.04047cs.CL
收藏

LaPA$^2$: 一种长度感知的前缀和提示注意力增强方法用于长形式可控文本生成

LaPA$^2$: Length-Aware Prefix and Prompt Attention Augmentation for Long-Form Controllable Text Generation

School of Artificial Intelligence(人工智能学院);New Laboratory of Pattern Recognition (NLPR)(模式识别新实验室);School of Computing(计算学院);School of Computer Science and Engineering(计算机科学与工程学院)

Jiabing Yang, Yixiang Chen, Zichen Wen, Chenhang Cui, Peiyan Li, Yuan Xu, Bowen Fang, Tao Yu, Ruikang Lin, Yan Huang, Liang Wang

AI总结:

本文提出LaPA$^2$方法,通过长度感知对数缩放和上下文锚点强化,解决长序列中注意力稀释问题,提升可控文本生成的性能和可控性。

摘要:

基于前缀的方法因参数效率成为可控文本生成(CTG)的有前景范式,但其在长序列中可控性下降。本文识别出注意力稀释是关键因素:随着序列增长,softmax机制导致控制信号注意力自然衰减,产生'模糊'控制效果。为此,我们提出LaPA$^2$(长度感知前缀和提示注意力增强),一种无需训练且模型无关的框架,旨在维持长上下文中的稳健控制。具体而言,LaPA$^2$采用长度感知对数缩放动态放大前缀注意力权重,数学上抵消稀释效应,同时可选的上下文锚点强化对提示词进行同步增强,当强属性控制风险覆盖原始提示时保持语义一致性。LaPA$^2$具有灵活性,支持软前缀(连续嵌入)和硬前缀(离散指令)。在多个CTG任务中的实验表明,LaPA$^2$在长形式设置中持续提升各种基于前缀的方法性能,实现更优的属性可控性,同时保持内容相关性和流畅性。我们的代码和数据可在https://github.com/jiabingyang01/LaPA2公开获取。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑