3 sheets · A4 landscape · free PDF

AI Cheat Sheets

One-page references for PyTorch Lightning, LLM fine-tuning with LoRA and QLoRA, and neural network training. Each one has working code, the formulas behind it, and the flags you actually use. Print it or keep it open next to your editor.

  1. 01

    PyTorch Lightning

    LightningModule hooks, LightningDataModule, Trainer flags, callbacks, logging, checkpoints, multi-GPU training and debugging flags.

    Lightning 2.x

    PyTorch Lightning cheat sheet: LightningModule, Trainer, DataModule, callbacks and logging
  2. 02

    LLMs with PyTorch

    A tiny GPT from scratch, pretraining loop, tokenizers, small open models, generation, LoRA, QLoRA, PEFT, TRL SFT and GPU memory per parameter.

    PyTorch 2.x · transformers · peft · trl

    LLM fine-tuning cheat sheet: tiny GPT, LoRA, QLoRA, PEFT in PyTorch
  3. 03

    Neural Net Training

    Activation functions, loss functions, optimizers, LR schedules and metrics, each with its formula plus NumPy and PyTorch code, and backprop from scratch.

    NumPy · PyTorch 2.x · torchmetrics

    Neural network training cheat sheet: activation functions, loss functions, optimizers, metrics with NumPy and PyTorch

Notes

The code targets PyTorch 2.x, Lightning 2.x and current Hugging Face transformers, peft and trl. Every sheet is a single self-contained HTML file, so you can fix or extend it and print a new PDF.

Found a mistake? Open an issue or a pull request on GitHub. Licensed CC BY 4.0.