Simulating Hard Attention Using Soft Attention
We study conditions under which transformers using soft attention can simulate hard attention, that is, effectively focus all attention on a subset of positions. First, we examine several subclasses of languages recognized by hard-attention transformers, which can be defined in variants of linear temporal logic. We demonstrate how soft-attention transformers can compute formulas of these logics using unbounded positional embeddings or temperature scaling. Second, we demonstrate how temperature scaling allows softmax transformers to simulate general hard-attention transformers, using a temperature that depends on the minimum gap between the maximum attention scores and other attention scores.
Code (0)
등록된 구현이 없습니다.
Tasks
Hard AttentionMethods 이 논문이 사용한 방법론
Similar Papers 제목 키워드 기반
Latent Alignment and Variational Attention
Neural attention has become central to many state-of-the-art models in natural language processing and related domains. Attention networks are an easy-to-train and effective method for softly simulating alignment; howeve…
Hard AttentionMachine TranslationQuestion AnsweringTranslation+3Reinforced Self-Attention Network: a Hybrid of Hard and Soft Attention for Sequence Modeling
Many natural language processing tasks solely rely on sparse dependencies between a few tokens in a sentence. Soft attention mechanisms show promising performance in modeling local/global dependencies by soft probabiliti…
Hard AttentionNatural Language InferenceSentenceLearning Visual Question Answering by Bootstrapping Hard Attention
Attention mechanisms in biological perception are thought to select subsets of perceptual information for more sophisticated processing which would be prohibitive to perform on all sensory inputs. In computer vision, how…
Hard AttentionQuestion AnsweringVisual Question AnsweringVisual Question Answering (VQA)Hard Non-Monotonic Attention for Character-Level Transduction
Character-level string-to-string transduction is an important component of various NLP tasks. The goal is to map an input string to an output string, where the strings may be of different lengths and have characters take…
Hard AttentionImage CaptioningSigmoid Attention as a Better Substrate for Learned KV Cache Eviction
Learned KV-cache eviction often faces a soft-to-hard mismatch: during training, differentiable gates typically attenuate token contributions, whereas inference saves memory only when KV entries are physically removed. We…