Papers
Topics
Authors
Recent
Search
2000 character limit reached

Declarative Attention (DA)

Updated 4 September 2026
  • Declarative Attention (DA) is a mechanism where an agent or model explicitly specifies the required information scope for subsequent computations, enhancing task efficiency and interpretability in long-context tasks, dynamic epistemic logic, and structured data processing.
  • In long-context language models, DA reduces KV-cache reads by using declarative tags to specify global, focused, or local attention scopes, optimizing computational efficiency and leveraging pre-existing context to generate accurate responses [2609.02737].
  • For epistemic systems, DA involves the use of explicit logic propositions to express agent awareness, thereby giving attention updates an explicit structure, somewhat more similar to guided attention, but fundamentally different.

Declarative Attention (DA) denotes an attention mechanism in which an agent or model explicitly specifies the information scope required for a subsequent computation, rather than relying exclusively on an implicitly learned or externally inferred attention distribution. The term has multiple uses: in long-context language-model inference, DA is a protocol in which a model emits declarations selecting global, focused, or local context regions that an inference engine converts into KV-cache masks (Ho et al., 2 Sep 2026); in dynamic epistemic logic, selective attention is represented through explicit propositions, event preconditions, and update rules (Belardinelli et al., 2023). Related mechanisms have also been described as “guided attention” in dialogue-act prediction, where a known utterance–label alignment is imposed as an attention prior, although that paper does not formally use “Declarative Attention” as the method name (Colombo et al., 2020).

1. Terminology and conceptual scope

The central idea of DA is that attention selection is made explicit as a structural or declarative object. The declaration may specify which context region a LLM should access, which propositions an epistemic agent attends to, or which source position is structurally associated with an output label. In each case, the attention mechanism exploits information about the task that is available independently of an unconstrained attention computation.

The term should not be conflated with every mechanism that performs feature selection or gating. “Dynamic Additive Attention Adaption” (DA3DA^3) describes a memory-efficient multi-domain adaptation method whose supplied material establishes a dynamic spatial gate based on sigmoid and Gumbel-Sigmoid relaxation, hard thresholding at $0.5$, and differentiable training; it does not establish a formal Declarative Attention mechanism (Yang et al., 2020). Similarly, “Diverse and Adaptive Attention” (DA2DA^2-Net) is a convolutional attention module that generates multi-resolution feature maps and applies input-dependent local feature-map gating (Girma et al., 2021). These systems are adaptive or parameterized attention mechanisms, but their supplied descriptions do not identify them as declarative.

The most direct commonality among the principal uses is the separation of attention specification from attention computation. A declaration, structural prior, or logical constraint determines what may be attended to; the underlying model then performs inference, decoding, or belief update over the permitted information.

2. Declarative Attention for long-context LLMs

The long-context formulation of DA is a protocol for reducing KV-cache reads during autoregressive decoding. At each decoding step, ordinary global attention reads the preceding context through the KV cache, even when useful information is concentrated in a small subset of positions. DA asks the LLM to declare its intended attention scope in its generated reasoning trace. An inference-side state machine parses the declarations and modifies the visible KV-cache block table (Ho et al., 2 Sep 2026).

DA divides generation into three modes:

  1. Global mode: the model attends to the entire addressable context.
  2. Focus mode: the model attends to one or more named context regions.
  3. Local mode: the model attends only to the persistent scaffold and generated response, without long-context segments.

The always-attended portion consists approximately of the system scaffold and all response tokens generated before the current step. Global mode adds every context chunk, focus mode adds the chunks named by the declaration, and local mode adds no long-context chunks. The model may alternate among these modes as needed rather than following a fixed schedule.

A typical protocol uses tags such as:

tt9

The long context is divided into addressable “magic chunks,” approximately 2,048 tokens in the prompt-construction procedure, with a hard cap of approximately 2,560 tokens. Segmentation preferentially occurs at paragraph, newline, sentence, clause, and word boundaries. The chunks are lossless substrings with stable token offsets and are rendered as simulated tool responses, for example Magic Chunk 2.

The protocol is intended to make attention scope semantically interpretable. Global mode is used for navigation; focus mode extracts a short value from a selected region; local mode performs arithmetic, planning, synthesis, or answer construction over values already present in the response history. The model is instructed not to reconstruct unexamined chunk contents during local mode and instead to return to global mode if additional evidence is required.

3. Runtime implementation and computational behavior

The runtime parser watches the generated token stream. When it detects the completion of an opening focus tag such as <focus magic_chunks="K">, it parses the referenced chunk identifiers and updates the attention mask before decoding the next token. An opening <local> tag switches to local mode. Closing </focus> and </local> tags return the state to global mode. An explicit <global> tag is primarily structural because global mode is already the default between declared spans.

The engine maps each named chunk to its token span and then to the KV-cache blocks containing that span. The visible block sets are therefore the persistent scaffold and response history plus either all context blocks, selected context blocks, or no context blocks. The mask is rounded outward to block boundaries, so a selected span may include up to approximately b1b-1 additional tokens at each edge for block size bb.

DA does not evict KV entries. Previously hidden information remains available for later global or focus phases. This makes the mechanism reversible in the sense that a subsequent declaration can re-attend to a context region without re-prefilling the entire prompt. The prototype changes attention metadata and block tables while using existing FlashAttention or Triton paged-attention kernels; it does not modify kernels or the scheduler (Ho et al., 2 Sep 2026).

The attention operation itself remains ordinary causal attention over a mode-dependent index set. In global mode, the index set contains all preceding context positions. In focus mode, it contains the scaffold, response history, and selected chunks. In local mode, it contains only the scaffold and response history. DA applies to context-length-dependent global-attention layers, not to Gemma sliding-window-attention layers or Qwen Gated DeltaNet layers whose recurrent state has context-independent size.

The computational benefit is measured through total attended tokens:

A=t=1Dat,A=\sum_{t=1}^{D} a_t,

where ata_t is the number of KV positions attended at decoding step tt. Relative reduction is defined as

1ADAAvanilla.1-\frac{A_{\mathrm{DA}}}{A_{\mathrm{vanilla}}}.

This metric includes both attention sparsity and the number of generated tokens. DA often produces longer responses because the model explicitly generates navigation, extraction, and mode-transition text. Consequently, reduced per-step KV traffic is partially offset by additional decoding steps.

4. Empirical results and trade-offs

The reported evaluation covers 15 long-context sources from RULER, LongBench v1, LongBench v2, LooGLE, and ZeroScrolls. The principal comparison uses Gemma-4-31B and Qwen-3.6-27B. The evaluated systems are vanilla full attention, a maskless DA prompt condition, and DA with the runtime mask (Ho et al., 2 Sep 2026).

For Gemma-4-31B, vanilla decoding reaches 87.01%87.01\% accuracy and DA reaches $0.5$0, a decline of $0.5$1 percentage points. Attended tokens decrease from $0.5$2 million to $0.5$3 million, corresponding to a $0.5$4 reduction. For Qwen-3.6-27B, accuracy decreases from $0.5$5 to $0.5$6, a decline of $0.5$7 percentage points, while attended tokens decrease from $0.5$8 million to $0.5$9 million, a DA2DA^20 reduction.

The maskless DA prompt is nearly accuracy-neutral relative to vanilla for Gemma, but it increases attended tokens because the protocol elicits longer responses. Applying the runtime mask reduces attended tokens relative to the maskless condition by DA2DA^21 for Gemma and DA2DA^22 for Qwen. This isolates the principal computational contribution of DA: the savings arise from modifying the visibility of KV blocks rather than merely from chunked presentation or additional reasoning instructions.

Performance depends on model scale and protocol adherence. The largest models approach approximately DA2DA^23 focus-parse success, whereas Gemma-4-E4B reaches only DA2DA^24. Invalid or incorrect declarations can select the wrong region, fail to extract evidence, induce additional global phases, or cause format failures. A wrong focus declaration may be more damaging than full attention because the model can reason confidently over incomplete or irrelevant information.

DA performs most favorably when answers depend on a few localized spans and extracted values can be carried forward in the generated response. It is less reliable for multi-span reasoning, global counts, tables split across chunk boundaries, document-wide ordering, per-segment output, and tasks requiring output proportional to document size. These failure modes arise because independently focused regions may not preserve the cross-segment structure required by the task.

The principal efficiency trade-off is therefore between declaration correctness and attention sparsity. Global phases remain expensive because they read the entire context. In the Gemma-4-31B analysis, global mode accounts for roughly DA2DA^25 of generated tokens, while focus and local modes account for approximately DA2DA^26. Focus steps attend to roughly DA2DA^27 as many tokens as vanilla steps, and local steps attend to roughly DA2DA^28. Global-mode usage increases with context length, limiting savings on the longest inputs.

Roofline projections on a B200, using BF16, DA2DA^29 MFU, b1b-10 MBU, and b1b-11 TB/s peak HBM bandwidth, estimate total decode-time ratios of approximately b1b-12 for Gemma-4-31B and b1b-13 for Qwen-3.6-27B relative to vanilla. These are theoretical projections rather than measured end-to-end latency results. They assume a large-batch, memory-bound decoding regime and exclude prefill.

5. Selective attention in dynamic epistemic logic

A distinct declarative formulation treats attention as an explicit component of an agent’s epistemic state. Belardinelli and Bolander generalize earlier dynamic epistemic logic models in which agents were either fully attentive or entirely inattentive. Their model permits an agent to attend to arbitrary subsets of atomic propositions (Belardinelli et al., 2023).

For each agent b1b-14 and proposition b1b-15, the attention atom

b1b-16

means that agent b1b-17 is paying attention to whether b1b-18. A Kripke model contains ordinary propositional atoms and attention atoms. The belief operator b1b-19 describes what holds throughout the worlds accessible to agent bb0. Attention need not be introspective: an agent may believe that she attends to bb1 while in fact failing to attend to it.

An event model specifies possible combinations of stimulus truth and attention states. Its edges encode how attention controls the information accessible after an event. The central principles are:

  • Attentiveness: if bb2 holds in the source event, every event considered possible by bb3 contains both the attended fact and the fact that bb4 attended to bb5.
  • Inertia: if bb6 does not hold, the update does not force the agent to learn the corresponding literal.
  • Defaulting: in the default model, if bb7 does not hold, the agent’s accessible events contain the default value assigned to bb8.

Under the no-default model, unattended information remains subject to the agent’s prior epistemic state. Under the default model, inattention may generate a false belief. A default map assigns each proposition one of bb9, A=t=1Dat,A=\sum_{t=1}^{D} a_t,0, or A=t=1Dat,A=\sum_{t=1}^{D} a_t,1, where A=t=1Dat,A=\sum_{t=1}^{D} a_t,2 preserves prior beliefs. If an agent attends to A=t=1Dat,A=\sum_{t=1}^{D} a_t,3 but not to A=t=1Dat,A=\sum_{t=1}^{D} a_t,4, and A=t=1Dat,A=\sum_{t=1}^{D} a_t,5, then an actual stimulus A=t=1Dat,A=\sum_{t=1}^{D} a_t,6 can yield the posterior belief A=t=1Dat,A=\sum_{t=1}^{D} a_t,7 despite the fact that A=t=1Dat,A=\sum_{t=1}^{D} a_t,8 is true. This represents inattentional blindness as a systematic epistemic consequence of selective attention.

The framework therefore separates three components: what happens, what an agent attends to, and what the agent believes happened. Product update transforms the prior epistemic model into a posterior model by combining world states with event states whose preconditions and accessibility relations encode attention.

6. Structural priors and guided attention

Dialogue-act prediction provides another interpretation of declarative attention. In the sequence-to-sequence model of Milajevs and colleagues, a context window consists of utterances A=t=1Dat,A=\sum_{t=1}^{D} a_t,9 and corresponding dialogue-act labels ata_t0. The task has a known positional alignment: ata_t1 is the label of ata_t2. Unlike machine translation, the source and target sequences have equal length and a direct correspondence between positions (Colombo et al., 2020).

The model reframes dialogue-act classification as sequence prediction:

ata_t3

For a fixed context window, the decoder models the label sequence autoregressively, conditioning each label on the encoder representation and previously generated labels. This enables sequential and nonlocal dependencies among dialogue acts.

The paper calls its attention mechanism guided attention, specifically hard guided attention and soft guided attention. Hard guided attention imposes the known alignment:

ata_t4

Consequently, the attention context is the encoder representation of the current utterance. Because that representation is generated by a dialogue-level recurrent encoder, it still contains contextual information from neighboring utterances. Hard guided attention is therefore a deterministic diagonal attention matrix, not stochastic hard attention.

Soft guided attention retains the learned attention scores but adds a score bias of ata_t5 to the aligned position ata_t6 before normalization. The current utterance is favored, while neighboring utterances remain available if their learned scores are sufficiently high.

This mechanism is “declarative” only in the broad sense that it declares a known structural fact about the task and injects it as an inductive bias. The paper does not use “Declarative Attention” as the formal name, does not require a separate alignment annotation, and does not use dialogue-act labels as an additional attention mask. The alignment follows from the task representation and is available at inference.

The model uses a hierarchical encoder: a word-level bidirectional GRU produces utterance representations, and an utterance-level bidirectional GRU models dependencies across the context window. The reported experiments use ata_t7. An evaluated persona hierarchy models speaker turns, but the final model uses the ordinary hierarchical GRU because the persona layer substantially harms performance in some settings.

The strongest configuration combines the ordinary hierarchical encoder with hard guided attention. Sequence-level fine-tuning with beam-generated candidates produces final accuracies of ata_t8 on SwDA and ata_t9 on MRDA. On MRDA, the result is competitive but below a reported CRF-based result of tt0. The method’s limitations include fixed context length, dependence on known segmentation and one-label-per-utterance alignment, unstable persona modeling, class imbalance, and the absence of explicit legal-transition constraints.

7. Relation to adaptive and gated attention mechanisms

Declarative attention differs from mechanisms whose selection policy is learned implicitly from feature activations. In tt1, the supplied material describes a continuous logistic gate, a differentiable Gumbel-Sigmoid relaxation, hard thresholding at tt2 during the forward pass, and gradient-based optimization through the relaxed gate (Yang et al., 2020). This is a dynamic parameterized spatial gate. The available description does not establish an additive-attention formulation, a declarative constraint language, or a formal connection to Declarative Attention.

tt3-Net separates diverse feature extraction from adaptive feature selection. It applies sequential grouped depthwise-separable convolutions with filter sizes such as tt4, tt5, and tt6, performs global average pooling, computes local feature-map weights using a one-dimensional convolution, and reweights the feature maps through sigmoid gates (Girma et al., 2021). Its attention is input-dependent and structurally lightweight, but the selection is produced by learned computation rather than an explicit external declaration or logical rule.

The distinction can be summarized as follows:

Mechanism Selection source Primary object selected
Long-context DA Model-generated scope declaration KV-cache context chunks
Epistemic selective attention Logical attention atoms and event rules Propositional information
Guided attention Known task alignment Source utterance position
tt7 gate Learned sigmoid/Gumbel-Sigmoid scores Spatial feature locations
tt8-Net Learned local feature-map weights CNN feature maps

The common principle is explicit control over information access, but the control may be linguistic, logical, structural, or learned. Only the first three mechanisms are directly described in the supplied material as declarative or structurally specified attention. The latter two are best classified as dynamic gating or adaptive feature selection unless a broader editorial definition of DA is adopted.

Across these formulations, the principal unresolved issues are capacity limits, graded or probabilistic attention, robust handling of segmentation boundaries, efficient execution of declarative policies, training models to produce valid declarations, and integrating attention with awareness, observability, or richer temporal environments.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Declarative Attention (DA).