Generalized Optimal Transport Attention with Trainable Priors (PyTorch).
Project description
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}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file goat_attention-0.1.1.tar.gz.
File metadata
- Download URL: goat_attention-0.1.1.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60abac5eb5c799a4df264132ee0b320af6174a8b2fe88fde4b26104e8a6367cd
|
|
| MD5 |
91c767a64937d825db5b9971bdbd0f14
|
|
| BLAKE2b-256 |
983250b4452fea93799297f2d8b60709703122093307976b4b9363d73a5ac4d5
|
Provenance
The following attestation bundles were made for goat_attention-0.1.1.tar.gz:
Publisher:
publish.yml on elonlit/goat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goat_attention-0.1.1.tar.gz -
Subject digest:
60abac5eb5c799a4df264132ee0b320af6174a8b2fe88fde4b26104e8a6367cd - Sigstore transparency entry: 788745075
- Sigstore integration time:
-
Permalink:
elonlit/goat@1f41654d09d4a10f4844b3c2b6abd79a537d6351 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/elonlit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1f41654d09d4a10f4844b3c2b6abd79a537d6351 -
Trigger Event:
push
-
Statement type:
File details
Details for the file goat_attention-0.1.1-py3-none-any.whl.
File metadata
- Download URL: goat_attention-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61050720624be730be66cd38f7b77f4cac4780d53fcb8f5ccce45f01d53ecbfe
|
|
| MD5 |
fcdd89fce42daefd1eb168d1c0f379d6
|
|
| BLAKE2b-256 |
2bd45ab91520b4b4b186af2851e881066a5dfd04504fbd19fa1fae647c89f33b
|
Provenance
The following attestation bundles were made for goat_attention-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on elonlit/goat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goat_attention-0.1.1-py3-none-any.whl -
Subject digest:
61050720624be730be66cd38f7b77f4cac4780d53fcb8f5ccce45f01d53ecbfe - Sigstore transparency entry: 788745091
- Sigstore integration time:
-
Permalink:
elonlit/goat@1f41654d09d4a10f4844b3c2b6abd79a537d6351 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/elonlit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1f41654d09d4a10f4844b3c2b6abd79a537d6351 -
Trigger Event:
push
-
Statement type: