# philipperemy/keras-attention

Keras Attention Layer (Luong and Bahdanau scores).

Repository: https://github.com/philipperemy/keras-attention
Canonical: https://ross.abutalabs.com/products/keras-attention
Language: Python
License: Apache-2.0
License Family: permissive
Topics: keras, keras-neural-networks, attention-mechanism, attention-model, deep-learning
Last push: 2026-03-12T05:12:09+00:00

## Health v2 (maintenance only)
Score: 55/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 71, release rhythm 8, longevity 100
- inputs: {"age_days": 3389, "days_push": 174, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2809, forks 648 (observed 2026-08-28T04:07:23.633608+00:00)

## What it is
A Keras layer implementing attention mechanisms with Luong (multiplicative) and Bahdanau (additive) score functions for TensorFlow 2.x. It plugs into sequential models like LSTMs to compute attention-weighted context vectors.

## Use cases
- add attention to a keras LSTM model
- implement luong attention in tensorflow
- implement bahdanau attention in keras
- visualize attention weights of a sequence model
- improve sequence classification accuracy with attention

## When to choose
- you use TensorFlow 2.x / Keras and want a drop-in attention layer
- you need classic Luong or Bahdanau attention scores
- you want to inspect attention weights for interpretability

## When to avoid
- you use PyTorch or JAX instead of TensorFlow/Keras
- you need transformer-style self-attention (use built-in MultiHeadAttention)
- you need the latest Keras 3 multi-backend support

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, deep-learning
- domain: machine-learning, deep-learning
- platform: python
- tags: keras, attention-mechanism, tensorflow, luong-attention, bahdanau-attention, neural-networks, natural-language-processing

## Member repositories
- philipperemy/keras-attention (main) score 55

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:23.633608+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T08:14:25.602595+00:00, confidence not recorded.
  - readme: https://github.com/philipperemy/keras-attention (fetched 2026-08-28T04:07:23.633608+00:00, sha 129f5e456eee)
- Data as of 2026-08-30T08:39:29.467469+00:00.
