# harvardnlp/annotated-transformer

An annotated implementation of the Transformer paper.

Repository: https://github.com/harvardnlp/annotated-transformer
Canonical: https://ross.abutalabs.com/products/annotated-transformer
Homepage: http://nlp.seas.harvard.edu/annotated-transformer
Language: Jupyter Notebook
License: MIT
License Family: permissive
Topics: annotated, notebook, python
Last push: 2024-04-07T09:58:46+00:00

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

## Adoption (not part of the score)
Stars 7459, forks 1564 (observed 2026-08-28T04:10:00.010905+00:00)

## What it is
An annotated, line-by-line Jupyter notebook implementation of the 'Attention Is All You Need' Transformer paper from Harvard NLP. It pairs explanatory prose with working PyTorch code to teach the Transformer architecture.

## Use cases
- learn how the transformer architecture works
- understand self-attention with code
- study an annotated implementation of the attention is all you need paper
- teach deep learning concepts with a runnable notebook
- reference implementation of transformer encoder and decoder

## When to choose
- you want to deeply understand the Transformer paper through code
- you prefer learning from annotated notebooks with explanations
- you need a minimal, readable PyTorch Transformer implementation

## When to avoid
- you need a production-ready or optimized Transformer library
- you want pre-trained models or training pipelines
- you need features like tokenizers, distributed training, or model serving

## Facets
- artifact type: learning-resource
- maturity: stable
- function: deep-learning, nlp, machine-learning
- domain: deep-learning, tutorials
- platform: python, cross-platform
- tags: annotated-implementation, jupyter-notebook, transformer-architecture, educational, attention-mechanism, natural-language-processing

## Member repositories
- harvardnlp/annotated-transformer (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:00.010905+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-29T17:37:39.106220+00:00, confidence not recorded.
  - readme: https://github.com/harvardnlp/annotated-transformer (fetched 2026-08-28T04:10:00.010905+00:00, sha f253666294cb)
  - homepage: http://nlp.seas.harvard.edu/annotated-transformer (fetched 2026-08-29T08:33:04.824200+00:00, sha 2c95b7c9309c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
