# bentrevett/pytorch-seq2seq architecture

> Architecture diagram of the GitHub repository bentrevett/pytorch-seq2seq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bentrevett/pytorch-seq2seq
- Repository: https://github.com/bentrevett/pytorch-seq2seq

## Overview

This repository is an educational collection, not a deployable translation service. Its principal workflow is a learner progressing through PyTorch German-to-English seq2seq tutorials: first an encoder–decoder baseline, then a GRU model addressing information compression, then attention-based translation. The README documents those capabilities and identifies legacy tutorials; notebook internals were not sampled, so the graph does not infer their code-level data flow.

Main entry points: [`2 - Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation.ipynb`](https://github.com/bentrevett/pytorch-seq2seq/blob/main/2%20-%20Learning%20Phrase%20Representations%20using%20RNN%20Encoder-Decoder%20for%20Statistical%20Machine%20Translation.ipynb) (GRU Encoder Decoder), [`1 - Sequence to Sequence Learning with Neural Networks.ipynb`](https://github.com/bentrevett/pytorch-seq2seq/blob/main/1%20-%20Sequence%20to%20Sequence%20Learning%20with%20Neural%20Networks.ipynb) (LSTM Baseline), [`3 - Neural Machine Translation by Jointly Learning to Align and Translate.ipynb`](https://github.com/bentrevett/pytorch-seq2seq/blob/main/3%20-%20Neural%20Machine%20Translation%20by%20Jointly%20Learning%20to%20Align%20and%20Translate.ipynb) (Attention Translation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_current["Current Tutorials"]
  node_tutorial1["LSTM Baseline"]
  node_tutorial2["GRU Encoder Decoder"]
  node_tutorial3["Attention Translation"]
end

subgraph group_legacy["Legacy Tutorials"]
  node_legacy1["Legacy LSTM"]
  node_legacy2["Legacy GRU"]
  node_legacy3["Legacy Attention"]
  node_legacy4["Inference and BLEU"]
  node_legacy5["Convolutional Seq2Seq"]
  node_legacy6["Transformer Tutorial"]
end

node_learner(("Learner"))

node_learner -->|"studies first"| node_tutorial1
node_learner -->|"studies next"| node_tutorial2
node_learner -->|"studies next"| node_tutorial3
node_tutorial1 -->|"builds on"| node_tutorial2
node_tutorial2 -->|"extends with attention"| node_tutorial3

click node_tutorial1 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/1%20-%20Sequence%20to%20Sequence%20Learning%20with%20Neural%20Networks.ipynb"
click node_tutorial2 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/2%20-%20Learning%20Phrase%20Representations%20using%20RNN%20Encoder-Decoder%20for%20Statistical%20Machine%20Translation.ipynb"
click node_tutorial3 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/3%20-%20Neural%20Machine%20Translation%20by%20Jointly%20Learning%20to%20Align%20and%20Translate.ipynb"
click node_legacy1 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/1%20-%20Sequence%20to%20Sequence%20Learning%20with%20Neural%20Networks%20.ipynb"
click node_legacy2 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/2%20-%20Learning%20Phrase%20Representations%20using%20RNN%20Encoder-Decoder%20for%20Statistical%20Machine%20Translation.ipynb"
click node_legacy3 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/3%20-%20Neural%20Machine%20Translation%20by%20Jointly%20Learning%20to%20Align%20and%20Translate.ipynb"
click node_legacy4 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/4%20-%20Packed%20Padded%20Sequences%2C%20Masking%2C%20Inference%20and%20BLEU.ipynb"
click node_legacy5 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/5%20-%20Convolutional%20Sequence%20to%20Sequence%20Learning.ipynb"
click node_legacy6 "https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/6%20-%20Attention%20is%20All%20You%20Need.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tutorial1,node_tutorial2,node_tutorial3 toneBlue
class node_legacy1,node_legacy2,node_legacy3,node_legacy4,node_legacy5,node_legacy6 toneAmber
class node_learner toneIndigo
```

## Components

### Current Tutorials

- [LSTM Baseline](https://github.com/bentrevett/pytorch-seq2seq/blob/main/1%20-%20Sequence%20to%20Sequence%20Learning%20with%20Neural%20Networks.ipynb): `1 - Sequence to Sequence Learning with Neural Networks.ipynb`
- [GRU Encoder Decoder](https://github.com/bentrevett/pytorch-seq2seq/blob/main/2%20-%20Learning%20Phrase%20Representations%20using%20RNN%20Encoder-Decoder%20for%20Statistical%20Machine%20Translation.ipynb): `2 - Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation.ipynb`
- [Attention Translation](https://github.com/bentrevett/pytorch-seq2seq/blob/main/3%20-%20Neural%20Machine%20Translation%20by%20Jointly%20Learning%20to%20Align%20and%20Translate.ipynb): `3 - Neural Machine Translation by Jointly Learning to Align and Translate.ipynb`

### Legacy Tutorials

- [Legacy LSTM](https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/1%20-%20Sequence%20to%20Sequence%20Learning%20with%20Neural%20Networks%20.ipynb): `legacy/1 - Sequence to Sequence Learning with Neural Networks .ipynb`
- [Legacy GRU](https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/2%20-%20Learning%20Phrase%20Representations%20using%20RNN%20Encoder-Decoder%20for%20Statistical%20Machine%20Translation.ipynb): `legacy/2 - Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation.ipynb`
- [Legacy Attention](https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/3%20-%20Neural%20Machine%20Translation%20by%20Jointly%20Learning%20to%20Align%20and%20Translate.ipynb): `legacy/3 - Neural Machine Translation by Jointly Learning to Align and Translate.ipynb`
- [Inference and BLEU](https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/4%20-%20Packed%20Padded%20Sequences%2C%20Masking%2C%20Inference%20and%20BLEU.ipynb): `legacy/4 - Packed Padded Sequences, Masking, Inference and BLEU.ipynb`
- [Convolutional Seq2Seq](https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/5%20-%20Convolutional%20Sequence%20to%20Sequence%20Learning.ipynb): `legacy/5 - Convolutional Sequence to Sequence Learning.ipynb`
- [Transformer Tutorial](https://github.com/bentrevett/pytorch-seq2seq/blob/main/legacy/6%20-%20Attention%20is%20All%20You%20Need.ipynb): `legacy/6 - Attention is All You Need.ipynb`

### Other components

- **Learner**

## Connections

- Learner → LSTM Baseline: studies first (evidence: `README.md`)
- Learner → GRU Encoder Decoder: studies next (evidence: `README.md`)
- Learner → Attention Translation: studies next (evidence: `README.md`)
- LSTM Baseline → GRU Encoder Decoder: builds on (evidence: `README.md`)
- GRU Encoder Decoder → Attention Translation: extends with attention (evidence: `README.md`)
