Case Study 07
Char-RNN Text Generation
Character-level RNN & LSTM language models, cells built by hand
2025
PythonPyTorchNumPyMatplotlib
Built RNN and LSTM cells from scratch in PyTorch — explicit input/hidden/bias weight matrices and gate computations (input, forget, output with tanh/sigmoid) — instead of relying on the built-in nn.RNN / nn.LSTM modules.
What I did
4- 01
Built RNN and LSTM cells from scratch in PyTorch — explicit input/hidden/bias weight matrices and gate computations (input, forget, output with tanh/sigmoid) — instead of relying on the built-in nn.RNN / nn.LSTM modules.
- 02
Assembled character-level language models on top of those cells and trained them for autoregressive text generation.
- 03
Engineered the sequence-construction data pipeline (windowed character sequences) and a sampling-based generation loop.
- 04
Contrasted the basic RNN against the LSTM to demonstrate how gating mitigates vanishing gradients on longer dependencies.
Tech stack
PythonPyTorchNumPyMatplotlib
More projects