Papers
Topics
Authors
Recent
Search
2000 character limit reached

Local Bidirectional Attention (LBA)

Updated 3 January 2026
  • Local Bidirectional Attention (LBA) is an attention mechanism that integrates local sliding-window processing with bidirectional latent synthesis to capture both short-range and global dependencies.
  • It employs local and cross-attention blocks to efficiently model sequential data and multimodal correspondences, reducing computational complexity compared to full self-attention.
  • Empirical studies demonstrate LBA’s effectiveness in boosting accuracy for long-range text parsing and enhancing cross-lingual style transfer in automatic dubbing.

Local Bidirectional Attention (LBA) is an attention mechanism that synthesizes local and bidirectional context, enabling efficient and expressive modeling of sequential data and multimodal word-level correspondences. It is employed in high-efficiency long-range parsers such as BLRP for textual and vision data (Leotescu et al., 2024), as well as in cross-lingual style transfer frameworks for automatic dubbing (Li et al., 2023). LBA constructs local sliding-window or local cross-lingual attention blocks and aggregates bidirectional latent representations, capturing both short-range dependencies and global structure with computational scalability.

1. Formal Definition and Core Principles

LBA builds on the principle of local attention, restricting each input segment’s receptive field to a short neighborhood, and bidirectional passes, whereby local features are synthesized in both forward and backward directions and merged through a global latent representation. This is instantiated in BLRP by partitioning the input XRN×dX \in \mathbb{R}^{N \times d} into TT non-overlapping segments X1,...,XTX_1, ..., X_T of length tt and constructing, for each segment ii, a window WiW_i containing ww tokens from adjacent segments:

Wi=[Xi1(s);Xi;Xi+1(p)]W_i = [X_{i-1}^{(s)}; X_i; X_{i+1}^{(p)}]

where Xi1(s)X_{i-1}^{(s)} are the last w/2\lfloor w/2 \rfloor tokens of the previous segment, and TT0 are the first TT1 tokens of the next segment. Standard scaled-dot-product self-attention is applied within each window.

In cross-lingual sequence modeling (Li et al., 2023), LBA takes two word-level feature matrices (source and target sequences), projects keys and values for each, and computes a shared bidirectional attention matrix:

TT2

TT3

Row-wise softmax yields attention weights in both directions, supporting simultaneous fusion of multimodal features across languages.

2. Mathematical Formulation

BLRP Local Sliding-Window Attention

For each segment TT4, queries, keys, and values are:

  • TT5
  • TT6
  • TT7

The local attention output is:

TT8

with each pre-softmax element:

TT9

Softmax normalization over window positions X1,...,XTX_1, ..., X_T0 yields attention weights X1,...,XTX_1, ..., X_T1:

X1,...,XTX_1, ..., X_T2

Bidirectional Latent-Space Synthesis

A latent block X1,...,XTX_1, ..., X_T3 is updated via two passes:

  • Forward: X1,...,XTX_1, ..., X_T4
  • Backward: X1,...,XTX_1, ..., X_T5

Each cross-attention step uses scaled-dot-product attention analogous to self-attention.

Cross-Lingual Bidirectional Attention

Local bidirectional attention between source and target sequences uses two sets of keys/values X1,...,XTX_1, ..., X_T6:

  • X1,...,XTX_1, ..., X_T7 yields source X1,...,XTX_1, ..., X_T8 target alignment.
  • X1,...,XTX_1, ..., X_T9
  • Summarized outputs: tt0 and tt1 Concatenated with textual features and projected to generate predicted local style tokens.

3. Algorithm and Implementation

Pseudocode for BLRP’s LBA module:

WiW_i5

Key implementation recommendations include segment/window size tt2, latent block size tt3, overlapping tokens at segment boundaries, independent forward/backward projection heads, and AdamW optimization with fine-tuned learning rates and hyperparameters (Leotescu et al., 2024).

4. Computational Efficiency

LBA achieves substantial improvements in runtime and memory usage relative to full self-attention. For BLRP:

  • Full self-attention: tt4 time, tt5 memory.
  • Local attention (LBA): For tt6 segments each attending a window tt7, tt8 total time.
  • Cross-attention: tt9; if ii0, overall ii1, nearly linear in ii2 for fixed ii3.

This scaling allows efficient processing of very long sequences (ii4 up to 16k), with only linear memory growth, in contrast to quadratic blowup for vanilla Transformers (Leotescu et al., 2024).

5. Empirical Performance and Ablation Studies

LBA contributes significant gains in accuracy and modeling fidelity across tasks.

BLRP (Long-Range-Arena Text Benchmarks):

  • ListOps accuracy: 41.43% (Longformer: 37.5%, TLB: 38.2%)
  • Text classification: 82.83% (Longformer: 66.0%, TLB: 82.08%)
  • Retrieval: 83.43% (Longformer: 81.79%, TLB: 76.91%)

Ablations confirm LBA’s effectiveness:

  • Small segment sizes (e.g., ii5) degrade performance (ii638% accuracy).
  • Bidirectional updates outperform unidirectional passes, evidenced by ListOps accuracy drops into the high 39s for unidirectional variants.
  • Linear scaling up to sequence lengths ii7 without GPU memory exhaustion (Leotescu et al., 2024).

Automatic Dubbing (Cross-lingual Multi-scale Style Transfer):

  • Mel-spectrogram MSE (en→zh): FastSpeech 2 baseline 4.694, duration-transfer 3.695, multi-scale transfer with LBA 1.392.
  • MOS for style: None 3.16±0.08, duration-only 3.92±0.07, multi-scale (GST+LST via LBA) 4.12±0.07.
  • User preference: Multi-scale LBA solution preferred by 65.5%.
  • Removing local LBA raises mel-MSE from 1.39 to 1.68, confirming its necessity for style fidelity (Li et al., 2023).

6. Architectural Variants and Cross-Task Generalization

LBA enables versatile pattern modeling. In BLRP, short-range dependencies are modeled with sliding windows, while recurrent latent blocks synthesize context bidirectionally. In cross-lingual frameworks, LBA mediates word-level style and text correspondence across languages by simultaneously computing source-to-target and target-to-source attention and enabling joint training objectives.

A shared pair of projection networks and attention blocks enforce a unified semantic-style mapping. Bidirectionality is realized not only by using both sequence orientations, but also by tying the model parameters and alignment matrices across translation directions.

7. Practical Recommendations and Limitations

Select window/segment sizes matched to the task domain, typically ii8 for long-text or word-level applications. Latent block size should equal segment length (ii9) for optimal accuracy. Utilize two independent dynamic-projection heads for forward and backward passes. When implementing, include overlapping tokens at segment boundaries to mitigate loss of context. Depth per layer should consist of two local self-attention operations and two cross-attentions. AdamW optimizer with batch size 32, embedding size 64, hidden size 128, and 8 attention heads is recommended for LRA tasks; learning rate WiW_i0, WiW_i1, WiW_i2, WiW_i3, weight decay WiW_i4, and linear decay scheduling yield strong convergence (Leotescu et al., 2024).

A plausible implication is that LBA’s local partitioning is sensitive to hyperparameter choices, particularly segment size and overlap. Under-sizing severely limits expressiveness, whereas excessive overlap or overly large windows may erode the method’s scalability. Modelers should balance locality against latent block dimension to avoid performance collapse.


In summary, Local Bidirectional Attention integrates local, context-sensitive modeling with bidirectional latent-space aggregation, demonstrably improving long-sequence parsing efficiency and performance as well as multimodal cross-lingual alignment for tasks requiring rich local structure and global context synthesis (Leotescu et al., 2024, Li et al., 2023).

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 Local Bidirectional Attention (LBA).