local-attention
Local attention, window with lookback, for language modeling
Decision gist · record as of 2026-08-14
Yes, if you are building or experimenting with transformer models and need efficient local attention. The package has low install friction, permissive licensing, and no known vulnerabilities. However, the 394-day gap since the last release and aging maintenance status suggest it is stable but not actively developed—suitable for production use in established architectures but not for cutting-edge research requiring frequent updates.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires torch and einops as runtime dependencies; intended for use within transformer architectures.
- Low install friction with a pure Python wheel.
- Maintenance status is aging—last release was 394 days ago—but the repository remains active and unarchived with recent commits, suggesting the package is stable rather than abandoned.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
last release 2025-07-16 (394 days) · last repo commit 2025-07-16 · 503 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 311,627 downloads/mo, #7,728 on PyPI
Alternatives
Verify before relying
pip install local-attention
import torch
from local_attention import LocalAttention
q = torch.randn(2, 8, 2048, 64)
k = torch.randn(2, 8, 2048, 64)
v = torch.randn(2, 8, 2048, 64)
attn = LocalAttention(dim=64, window_size=512, causal=True)
out = attn(q, k, v)- Performance characteristics compared to standard attention or other sparse attention implementations
- Compatibility with recent PyTorch versions and whether Python 3.6 support is still maintained
- Whether the package is actively maintained or in maintenance-only mode given the 394-day release gap
What it is and what it does
Local-attention is a PyTorch module that implements local windowed attention—a restricted form of transformer attention where each query attends only to keys and values within a fixed window, rather than the entire sequence. This is useful for language modeling because it allows transformer models to use computationally cheaper local attention in lower layers while reserving global attention for higher layers to integrate information across the full context.
The package provides configurable windowed attention with support for causal (auto-regressive) masking, lookback/lookahead windows, shared query-key spaces (Reformer-style), and automatic padding. It depends on torch for tensor operations and einops for tensor reshaping, plus hyper-connections as a utility dependency. The implementation is described as battle-tested across multiple repositories.
Use it for
- Building efficient language models where full-sequence attention is computationally prohibitive for long contexts.
- Implementing Reformer-style architectures with shared query-key spaces and local attention windows.
- Replacing standard attention in transformer layers to reduce memory and compute while maintaining reasonable model capacity.
- Prototyping sparse attention patterns in transformer research without writing custom CUDA kernels.
- Training models on long sequences (e.g., 8192 tokens) where quadratic attention complexity becomes a bottleneck.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building or experimenting with transformer models and need efficient local attention.
The package has low install friction, permissive licensing, and no known vulnerabilities. However, the 394-day gap since the last release and aging maintenance status suggest it is stable but not actively developed—suitable for production use in established architectures but not for cutting-edge research requiring frequent updates.
Install
local-attention on PyPI
Before you install
Low install friction with a pure Python wheel. Maintenance status is aging—last release was 394 days ago—but the repository remains active and unarchived with recent commits, suggesting the package is stable rather than abandoned.
Requires torch and einops as runtime dependencies; intended for use within transformer architectures.
License in practice
MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install local-attention
import torch
from local_attention import LocalAttention
q = torch.randn(2, 8, 2048, 64)
k = torch.randn(2, 8, 2048, 64)
v = torch.randn(2, 8, 2048, 64)
attn = LocalAttention(dim=64, window_size=512, causal=True)
out = attn(q, k, v)
Verify before relying
- Performance characteristics compared to standard attention or other sparse attention implementations
- Compatibility with recent PyTorch versions and whether Python 3.6 support is still maintained
- Whether the package is actively maintained or in maintenance-only mode given the 394-day release gap
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packageseinopshyper-connectionstorch |
| Maintenance | Aging 394 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 311,627 / month, #7,728 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.6Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: local_attention-1.11.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “local windowed attention transformer”
- local-attentionImplements local windowed attention for transformer models, allowing…
- CoLT5-attentionImplements conditionally routed efficient attention mechanisms for…
- conformerProvides PyTorch implementations of the Conformer architecture—a…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also CoLT5-attention · axial-positional-embedding · conformer · vit-pytorch · x-transformers · mamba-ssm · flash-attn · rotary-embedding-torch · transformer-lens · fla-core