GOAT Attention
Generalized Optimal Transport Attention with Trainable Priors (GOAT), available as a PyTorch multi-head attention module.
Install name:
goat-attention(PyPI) · Import name:goat
Installation
- From PyPI (recommended):
uv add goat-attention
- pip:
pip install goat-attention
- From source (editable):
uv pip install -e .
- From source (editable, pip):
pip install -e .
Quickstart
import torch
from goat import GoatAttention
B, L, S, E, H = 2, 5, 7, 64, 8
xq = torch.randn(B, L, E)
xk = torch.randn(B, S, E)
xv = torch.randn(B, S, E)
attn = GoatAttention(
embed_dim=E,
num_heads=H,
batch_first=True,
pos_rank=2,
abs_rank=4,
enable_key_bias=True,
)
out, weights = attn(xq, xk, xv, is_causal=False, need_weights=True)
print(out.shape, None if weights is None else weights.shape)
CLI
After installation:
goat info
goat smoke
Documentation
See docs/:
Development
uv pip install -e ".[dev]"
pytest
License
MIT (see LICENSE).
Citation
If you find GOAT useful, please cite:
@misc{goat,
title = {You Need Better Attention Priors},
author = {Litman, Elon and ...},
year = {2026},
eprint = {XXXX.XXXXX},
archivePrefix = {arXiv},
primaryClass = {cs.LG}
}
Release files for goat-attention 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| goat_attention-0.1.1.tar.gz | 1.7 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| goat_attention-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.7 MB
Release files / goat_attention-0.1.1.tar.gz
| Download URL | goat_attention-0.1.1.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60abac5eb5c799a4df264132ee0b320af6174a8b2fe88fde4b26104e8a6367cd
|
|
BLAKE2b-256 checksum How to use checksums |
983250b4452fea93799297f2d8b60709703122093307976b4b9363d73a5ac4d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 2, 2026.
Transparency logRelease files / goat_attention-0.1.1-py3-none-any.whl
| Download URL | goat_attention-0.1.1-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61050720624be730be66cd38f7b77f4cac4780d53fcb8f5ccce45f01d53ecbfe
|
|
BLAKE2b-256 checksum How to use checksums |
2bd45ab91520b4b4b186af2851e881066a5dfd04504fbd19fa1fae647c89f33b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 2, 2026.
Transparency log