Skip to content

Latest commit

Β 

History

679 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Deep Learning


The most structured deep learning curriculum on GitHub.
Every topic ships with rigorous mathematical theory, production-grade PyTorch code, and a line-by-line explanation β€” nothing is left unexplained.


Open in Colab View on GitHub


**Made with ❀️ by Ayush Kumar Singh


πŸ“Œ Table of Contents


🎯 Why This Repository

Most deep learning resources give you one of three things: theory without code, code without intuition, or tutorials that don't scale. This repository gives you all three β€” for every single topic, without exception.

What you'll find here What you won't find here
βœ… Full mathematical derivations with LaTeX ❌ "Just run this Colab" tutorials
βœ… Self-contained, runnable PyTorch code ❌ Code that requires hidden setup
βœ… Line-by-line explanations of why ❌ Copy-paste snippets without context
βœ… Inline tensor shape annotations ❌ Undocumented tensor ops
βœ… Empirical proof of theoretical claims ❌ Theory disconnected from results
βœ… CPU + GPU compatible, zero config ❌ Environment hell

πŸ”© The 3-Component System

Every topic in this repository follows an identical, non-negotiable 3-file structure:

topic-name/
β”œβ”€β”€ theory.md           ← Mathematics, architecture, intuition
β”œβ”€β”€ implementation.py   ← Production-ready PyTorch code
└── explanation.md      ← Line-by-line code breakdown

What each file contains

πŸ“ theory.md

  • Full mathematical derivations
  • LaTeX-rendered equations
  • ASCII/Mermaid architecture diagrams
  • Geometric and visual intuition
  • Historical context and paper references
  • Common pitfalls and misconceptions

βš™οΈ implementation.py

  • Fully executable PyTorch code
  • Dataset loading + preprocessing
  • Model definition + training loop
  • Evaluation + metrics
  • Matplotlib visualizations
  • Best-weight saving & reproducibility

πŸ” explanation.md

  • Every non-obvious line explained
  • Tensor shape traces [B, T, D]
  • Design decisions justified
  • Common bug table per topic
  • no_grad() vs eval() distinctions
  • Why each function call exists

πŸ—Ί Curriculum Map

deep-learning-mastery/
β”‚
β”œβ”€β”€ πŸ“¦ phase-1-foundations/              ← The bedrock of everything
β”‚   β”œβ”€β”€ 01-perceptron-and-mlp/
β”‚   β”œβ”€β”€ 02-activation-functions/
β”‚   β”œβ”€β”€ 03-gradient-descent-and-backprop/
β”‚   β”œβ”€β”€ 04-loss-functions-and-overfitting/
β”‚   β”œβ”€β”€ 05-regularization-optimizers-batchnorm/
β”‚   β”œβ”€β”€ 06-hyperparameter-tuning-augmentation/
β”‚   └── 07-extra-linear-algebra-pytorch-tensors/
β”‚
β”œβ”€β”€ πŸ–Ό  phase-2-cnns/                    ← Vision intelligence
β”‚   β”œβ”€β”€ 01-convolution-basics/
β”‚   β”œβ”€β”€ 02-architectures-lenet-to-densenet/
β”‚   β”œβ”€β”€ 03-object-detection-rcnn-yolo/
β”‚   β”œβ”€β”€ 04-segmentation-unet-maskrcnn/
β”‚   └── 05-transfer-learning-finetuning/
β”‚
β”œβ”€β”€ πŸ”„ phase-3-sequential/              ← Memory and sequences
β”‚   β”œβ”€β”€ 01-rnns/
β”‚   β”œβ”€β”€ 02-lstm-and-gru/
β”‚   β”œβ”€β”€ 03-seq2seq-nlp/
β”‚   └── 04-extra-state-space-models-mamba/
β”‚
β”œβ”€β”€ 🧠 phase-4-attention-transformers/  ← The modern backbone
β”‚   β”œβ”€β”€ 01-attention-mechanisms/
β”‚   β”œβ”€β”€ 02-transformer-architecture/
β”‚   └── 03-vision-transformers-swin/
β”‚
β”œβ”€β”€ 🎨 phase-5-generative-ai/           ← Create, not just classify
β”‚   β”œβ”€β”€ 01-autoencoders-and-vaes/
β”‚   β”œβ”€β”€ 02-gans-dcgan-cyclegan/
β”‚   β”œβ”€β”€ 03-llms-bert-gpt/
β”‚   β”œβ”€β”€ 04-diffusion-models-ddpm/
β”‚   └── 05-extra-lora-rag-rlhf/
β”‚
└── πŸš€ phase-6-advanced-deployment/     ← From model to production
    β”œβ”€β”€ 01-graph-neural-networks/
    β”œβ”€β”€ 02-deep-reinforcement-learning/
    └── 03-mlops-quantization-onnx-serving/

πŸ“š Phase Breakdown

Phase 1 β€” Deep Learning Foundations (7 topics)
# Topic Key Concepts
01 Perceptron & MLP Biological neuron, convergence theorem, Universal Approximation
02 Activation Functions Sigmoid, ReLU, GELU, SELU, SiLU β€” vanishing gradient proof
03 Gradient Descent & Backprop SGD, mini-batch, autodiff chain rule, computational graphs
04 Loss Functions & Overfitting BCE, CE, MSE, bias-variance trade-off
05 Regularization & Optimizers L1/L2, Dropout, BatchNorm, Adam, RMSprop, Early Stopping
06 Hyperparameter Tuning LR schedules, batch size effects, data augmentation strategies
07 β˜… Linear Algebra & PyTorch Tensor ops, broadcasting, einsum, autograd mechanics
Phase 2 β€” Convolutional Neural Networks (5 topics)
# Topic Key Concepts
01 Convolution Basics 1D/2D/3D kernels, parameter sharing, receptive field, pooling
02 Architectures LeNet β†’ AlexNet β†’ VGG β†’ ResNet β†’ DenseNet β†’ GoogLeNet
03 Object Detection Faster R-CNN, anchor boxes, RPN, YOLO v1–v8
04 Segmentation U-Net skip connections, Mask R-CNN instance segmentation
05 Transfer Learning Feature extraction vs fine-tuning, domain adaptation
Phase 3 β€” Sequential Modeling (4 topics)
# Topic Key Concepts
01 RNNs Unrolled computation, BPTT, exploding/vanishing gradients
02 LSTM & GRU Cell state, forget/input/output gates, GRU simplification
03 Seq2Seq Encoder-decoder, teacher forcing, attention bridge
04 β˜… State Space Models Mamba, Jamba, selective scan, linear recurrence
Phase 4 β€” Attention & Transformers (3 topics)
# Topic Key Concepts
01 Attention Mechanisms Scaled dot-product, multi-head, causal masking
02 Transformer Architecture Encoder-decoder, positional encoding, LayerNorm placement
03 Vision Transformers ViT patch embedding, Swin shifted windows, hierarchical features
Phase 5 β€” Generative AI & LLMs (5 topics)
# Topic Key Concepts
01 Autoencoders & VAEs Bottleneck, ELBO, reparameterization trick
02 GANs DCGAN, CycleGAN, mode collapse, Wasserstein loss
03 LLMs β€” BERT & GPT Masked LM, causal LM, fine-tuning, summarization, translation
04 Diffusion Models DDPM, forward/reverse diffusion, noise schedules, U-Net backbone
05 β˜… LoRA / RAG / RLHF Parameter-efficient fine-tuning, retrieval augmentation, DPO alignment
Phase 6 β€” Advanced Topics & Deployment (3 topics)
# Topic Key Concepts
01 Graph Neural Networks Message passing, GCN, GAT, node/edge/graph classification
02 Deep Reinforcement Learning DQN, PPO, policy gradients, replay buffer
03 MLOps INT8 quantization, ONNX export, FastAPI serving, Dockerization

πŸ“Š Live Results Snapshot

These are actual empirical outputs from the implementations β€” not theoretical claims:

Phase 1 β€” Topic 1: Perceptron & MLP

Experiment Result
Perceptron β€” AND gate Converged in 4 epochs, 100% accuracy
Perceptron β€” XOR gate Hit max 1000 epochs, stuck at 50% (proves single-layer limitation)
MLP Scratch β€” XOR 100% accuracy from epoch ~2000 onward
Production MLP β€” make_moons 99% val accuracy in 150 epochs, 6,465 parameters

Phase 1 β€” Topic 2: Activation Functions

Activation Input-Layer Gradient Norm Output-Layer Gradient Norm Ratio
Sigmoid 2.82e-10 2.62e-01 1.1e-09 ← catastrophic vanishing
Tanh 1.78e-01 9.63e-02 1.8Γ— ← manageable
ReLU 3.78e-03 3.16e-03 1.2Γ— ← stable
SiLU/Swish β€” β€” Lowest val loss (0.0155)

Every topic will include its own results table as it is completed.


⚑ Getting Started

1. Clone the repository

git clone https://github.com/Ayush-2703/deep-learning-mastery.git
cd deep-learning-mastery

2. Set up the environment

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate        # Linux/macOS
# venv\Scripts\activate         # Windows

# Install dependencies
pip install -r requirements.txt

3. Run any topic independently

Every implementation is fully self-contained β€” no shared state, no hidden dependencies:

# Example: Run the MLP implementation
python phase-1-foundations/01-perceptron-and-mlp/implementation.py

# Example: Run the Activation Functions comparison
python phase-1-foundations/02-activation-functions/implementation.py

4. Open in Google Colab (zero setup)

Click the Colab badge at the top of any implementation.py or browse directly:

https://colab.research.google.com/github/Ayush-2703/deep-learning-mastery

πŸ›  Prerequisites

Python knowledge assumed:

  • Comfortable with Python classes, decorators, and list comprehensions
  • Familiarity with NumPy arrays

Math assumed:

  • High-school calculus (derivatives, chain rule)
  • Basic linear algebra (matrices, dot products)

Everything beyond this is taught from scratch inside theory.md.

Software:

Python     β‰₯ 3.10
PyTorch    β‰₯ 2.0
NumPy      β‰₯ 1.24
Matplotlib β‰₯ 3.7
scikit-learn β‰₯ 1.3

βœ… Progress Tracker

Phase Topics Status
Phase 1 β€” Foundations 7 topics 🟩 Completed
Phase 2 β€” CNNs 5 topics 🟩 Completed
Phase 3 β€” Sequential 4 topics 🟩 Completed
Phase 4 β€” Attention & Transformers 3 topics 🟩 Completed
Phase 5 β€” Generative AI & LLMs 5 topics 🟩 Completed
Phase 6 β€” Advanced & Deployment 3 topics 🟩 Completed

Overall: 27 / 27 topics completed


🀝 Contributing

Contributions are welcome, but this repository maintains a strict quality bar. Before submitting a PR, please read the guidelines:

  1. Every PR must follow the 3-component structure (theory.md, implementation.py, explanation.md)
  2. Code must run end-to-end without modification
  3. Tensor shapes must be annotated inline: # [batch, seq_len, d_model]
  4. No black-box functions β€” every non-obvious call gets a comment
  5. Results must be empirically verified and included in the explanation
# Fork, clone, and create a branch
git checkout -b feature/phase-2-topic-1-convolutions

# After your changes
git commit -m "feat: add phase-2/01-convolution-basics (theory + impl + explanation)"
git push origin feature/phase-2-topic-1-convolutions

Then open a Pull Request with a brief description of what your implementation demonstrates empirically.


πŸ“œ License

Distributed under the MIT License. See LICENSE for details.
You're free to use, fork, and build on this for personal and commercial projects.


πŸ‘€ Author

Ayush Kumar Singh

Researcher in Adversarial ML, Geospatial AI, and LLM/NLP Systems

GitHub LinkedIn Email


If this repository helped you, please consider giving it a ⭐
It takes 2 seconds and helps others discover it.

About

A comprehensive Deep Learning repository featuring Neural Networks, CNNs, RNNs, LSTMs, Transformers, Generative AI, and practical machine learning implementations in Python.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages