Skip to main content
QUICK REVIEW

[Paper Review] Sparse and Continuous Attention Mechanisms

André F. T. Martins, António Farinhas|arXiv (Cornell University)|Jun 12, 2020
Topic ModelingComputer Science51 references10 citations
TL;DR

This paper introduces continuous-domain attention mechanisms by extending sparsemax and entmax to continuous spaces using deformed exponential families and Tsallis statistics, enabling sparse, interpretable attention over 1D and 2D regions. It derives efficient backpropagation algorithms for α ∈ {1,2}, showing improved localization in text classification, machine translation, and visual question answering by focusing on compact intervals and regions rather than discrete tokens or pixels.

ABSTRACT

Exponential families are widely used in machine learning; they include many distributions in continuous and discrete domains (e.g., Gaussian, Dirichlet, Poisson, and categorical distributions via the softmax transformation). Distributions in each of these families have fixed support. In contrast, for finite domains, there has been recent work on sparse alternatives to softmax (e.g. sparsemax and alpha-entmax), which have varying support, being able to assign zero probability to irrelevant categories. This paper expands that work in two directions: first, we extend alpha-entmax to continuous domains, revealing a link with Tsallis statistics and deformed exponential families. Second, we introduce continuous-domain attention mechanisms, deriving efficient gradient backpropagation algorithms for alpha in {1,2}. Experiments on attention-based text classification, machine translation, and visual question answering illustrate the use of continuous attention in 1D and 2D, showing that it allows attending to time intervals and compact regions.

Motivation & Objective

  • To extend sparse attention mechanisms (e.g., sparsemax, entmax) from discrete to continuous domains.
  • To establish a theoretical link between continuous sparse attention and Tsallis statistics and deformed exponential families.
  • To develop efficient backpropagation algorithms for continuous attention with α ∈ {1,2}.
  • To demonstrate the utility of continuous attention in real-world NLP and vision tasks, such as text classification, machine translation, and visual question answering.
  • To enable attention mechanisms that focus on compact, contiguous regions (e.g., time intervals, image patches) rather than individual discrete units.

Proposed method

  • Proposes α-entmax for continuous domains by generalizing the entmax transformation to measure spaces using deformed exponential families.
  • Derives the continuous attention mechanism as an α-entmax transformation of score functions over continuous domains, producing sparse probability densities with varying support.
  • Introduces the Jacobian of the transformation as a generalized covariance matrix, enabling efficient gradient computation via implicit differentiation.
  • Uses a temperature parameter τ to control concentration, with the low-temperature limit converging to a Dirac delta at the global maximizer.
  • Applies the continuous attention mechanism to 1D (text) and 2D (images) by defining score functions over continuous time or spatial coordinates.
  • Employs backpropagation through the continuous attention layer using the derived Jacobian structure, enabling end-to-end training in neural networks.

Experimental results

Research questions

  • RQ1Can sparse attention mechanisms be generalized from discrete to continuous domains?
  • RQ2What is the theoretical connection between continuous sparse attention and Tsallis statistics or deformed exponential families?
  • RQ3How can efficient backpropagation be achieved for continuous attention mechanisms with α ∈ {1,2}?
  • RQ4Can continuous attention improve interpretability and performance in tasks requiring localization of compact regions?
  • RQ5How does continuous attention compare to discrete attention in terms of focus localization and task performance?

Key findings

  • The continuous α-entmax mechanism produces sparse attention distributions with varying support, enabling selection of compact 1D intervals or 2D regions in data.
  • For α = 1 and α = 2, the method achieves efficient backpropagation via a closed-form Jacobian expressed as a generalized covariance matrix.
  • In text classification, continuous attention localized to meaningful sentence spans, improving interpretability without sacrificing accuracy.
  • In machine translation, the continuous attention mechanism showed competitive performance compared to discrete softmax, with better localization in attention maps.
  • In visual question answering, continuous attention correctly focused on relevant image regions (e.g., counting objects in contiguous areas), outperforming discrete attention in cases requiring spatial coherence.
  • Visual examples (Figures 4–7) demonstrate that continuous attention avoids splitting focus across multiple unrelated regions, leading to more accurate answers in complex counting and localization tasks.

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.