# allenai/longformer

Longformer: The Long-Document Transformer

Repository: https://github.com/allenai/longformer
Canonical: https://ross.abutalabs.com/products/longformer
Homepage: https://arxiv.org/abs/2004.05150
Language: Python
License: Apache-2.0
License Family: permissive
Last push: 2023-02-08T02:52:14+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 2346, "days_push": 1302, "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 2205, forks 286 (observed 2026-08-28T04:06:25.931383+00:00)

## What it is
Longformer is a pretrained transformer model family (including the LongformerEncoderDecoder/LED variant) that processes long documents up to 16K tokens using a linear-scaling attention mechanism combining local windowed and global attention. It is integrated with Hugging Face Transformers and released under Apache-2.0 by the Allen Institute for AI.

## Use cases
- process long documents with a transformer model
- summarize long scientific papers or reports
- question answering over long documents
- fine-tune a transformer on documents longer than 512 tokens
- convert an existing pretrained model into a long-context version
- character-level language modeling on long text

## When to choose
- you need transformer models that handle documents of thousands of tokens
- you want a drop-in Hugging Face-compatible long-context encoder or encoder-decoder
- you need pretrained weights for long-document QA, classification, or summarization

## When to avoid
- your inputs fit within standard 512-token limits and a regular BERT/RoBERTa suffices
- you need actively developed long-context models with the latest architectures
- you lack GPU resources, since long sequences require significant memory

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, deep-learning, nlp, llm-training
- domain: deep-learning, machine-learning
- platform: python
- tags: transformer, long-context, attention-mechanism, huggingface, pretrained-models, summarization, question-answering, natural-language-processing, gpu

## Member repositories
- allenai/longformer (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:25.931383+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-30T02:46:36.833278+00:00, confidence not recorded.
  - readme: https://github.com/allenai/longformer (fetched 2026-08-28T04:06:25.931383+00:00, sha 0fea3373e039)
  - homepage: https://arxiv.org/abs/2004.05150 (fetched 2026-08-29T10:26:58.471999+00:00, sha 994cb8b7acb4)
  - site_page: https://info.arxiv.org/about/donate.html (fetched 2026-08-29T10:26:58.481373+00:00, sha cca9c3a11c56)
  - site_page: https://info.arxiv.org/about/ourmembers.html (fetched 2026-08-29T10:26:58.485178+00:00, sha 47cbc55ff1de)
  - site_page: https://info.arxiv.org/about (fetched 2026-08-29T10:26:58.486959+00:00, sha a1f16f915a9a)
  - site_page: https://info.arxiv.org/labs/index.html (fetched 2026-08-29T10:26:58.483492+00:00, sha b14a8d05a0ec)
- Data as of 2026-08-30T08:39:29.467469+00:00.
