# LSTM mechanism reference

Run `python examples/lstm.py` for deterministic self-checks or `python examples/lstm.py --json` for parity data. Python 3.9+; standard library only.

## Source and provenance

- Authors: Sepp Hochreiter, Jürgen Schmidhuber.
- Version: Neural Computation 9(8), 1735–1780 (1997), author manuscript.
- Primary source: https://www.bioinf.jku.at/publications/older/2604.pdf
- PDF: https://www.bioinf.jku.at/publications/older/2604.pdf
- PDF SHA-256: `ceb9e53dbc0493f5b3bf5520ed940f3e6b526064d17b2118d77e51f79c0edcc6`
- Source crops: `public/images/papers/lstm/source-crops.json` records one-based PDF pages, PDF-point rectangles, render scale, dimensions and image hashes. These are attributed cropped/rasterized excerpts; no open license was verified.
- Reference authored for Abhik Sarkar's review, 2026-11-06. Outputs are calculated teaching values, not recorded checkpoint predictions.

## Scope and limitations

Models the original 1997 memory-cell recurrence without a forget gate, with original g(x)=2\*tanh(x/2) and h(s)=tanh(s/2). Input/output gates are supplied, not learned. Direct CEC derivatives hold gate values and writes fixed; they are not total network gradients. The original task-specific topologies and truncated-gradient training algorithm are not reproduced. This is not a modern forget-gated LSTM library implementation.

## Reproducibility

`node --test test/lstm.test.mjs` checks independent mathematical invariants and JavaScript/Python parity. Canonical source lives in `examples/lstm.py`; named region excerpts and public downloads are regenerated by `scripts/sync-paper-examples.mjs`. Do not edit generated mirrors.

To verify crop bytes, obtain the pinned PDF and run `uv run --with pymupdf python scripts/render-paper-crops.py --manifest public/images/papers/lstm/source-crops.json --pdf /path/to/paper.pdf`. PyMuPDF is an authoring tool, not an application or reference dependency.
