💡 [REQUEST] - Tutorial: Visualizing the Mathematics Behind Neural Network Training
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Documentación
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- python, pytorch
Línea de trabajo
Comienza en beginner_source/ y compara autogradqs_tutorial.py, autograd_tutorial.py y buildmodel_tutorial.py para identificar la brecha didáctica restante. Crea un tutorial ejecutable en CPU que cubra las seis secciones propuestas, incluidas las operaciones matriciales observables, los gradientes, grad_fn y los cambios del optimizador. Se considerará terminado cuando los pasos matemáticos se puedan seguir y verificar en el código.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🚀 Describe the improvement or the new tutorial
A beginner-friendly tutorial that traces the mathematical operations inside a PyTorch training loop — connecting linear algebra to torch.nn.Linear, the chain rule to torch.autograd.backward(), and gradient descent to torch.optim — with runnable code that makes each step observable and verifiable.
Why this is needed:
Many learners use autograd as a black box. Existing tutorials explain the API (how to call .backward(), how to access .grad) but do not trace what is happening mathematically at each step. This tutorial bridges that gap by making the math visible through code:
- Print a weight matrix, verify it matches x @ W.T + b
- Call .backward(), then manually verify the gradient using the chain rule
- Walk the grad_fn graph to see the operations autograd recorded
- Compare parameters before and after optimizer.step() to see gradient descent in action
Proposed structure:
- Linear Algebra — what nn.Linear computes, verified with manual matrix multiplication
- Activation Functions — why nonlinearity matters, visualizing ReLU gradients
- The Chain Rule — what backward() computes, manually verifying gradients
- The Computational Graph — inspecting grad_fn to trace operations
- Gradient Descent — what optimizer.step() does, before/after comparison
- Putting It Together — forward, backward, step mapped to three branches of mathematics
This approach has been validated in practice: I presented this material at Grace Hopper Celebration 2025 ("The Math Behind the Magic: Understanding the Role of Mathematics in Deep Learning"). Talk materials: https://github.com/AddyM/Math_behind_ML
Difficulty level: Beginner
Target location: beginner_source/
I am happy to write and submit this tutorial as a PR.
Existing tutorials on this topic
-
autogradqs_tutorial.py — covers autograd API usage (requires_grad, backward, grad). Focuses on how to use autograd, not what it computes mathematically.
https://pytorch.org/tutorials/beginner/basics/autogradqs_tutorial.html -
autograd_tutorial.py — conceptual overview of automatic differentiation and computational graphs. Does not include manual verification of gradients or tracing the chain rule step by step.
https://pytorch.org/tutorials/beginner/blitz/autograd_tutorial.html -
buildmodel_tutorial.py — covers nn.Module and model building. Does not connect layer operations to their underlying linear algebra.
https://pytorch.org/tutorials/beginner/basics/buildmodel_tutorial.html
Additional context
PyTorch's eager execution model makes the mathematics of deep learning observable in a way static graph frameworks do not allow. This tutorial leans into that strength — every intermediate result is printable, every gradient is inspectable, every operation in the computational graph is traceable.
No GPU required — the entire tutorial runs on CPU, making it accessible to all learners.
References:
GHC 2025 talk materials: https://github.com/AddyM/Math_behind_ML
PyTorch Discuss thread on this approach: https://discuss.pytorch.org/ (search: "Building a PyTorch curriculum that teaches math through code")
- Lenguaje dominante
- Python
- Estrellas
- 9.3k
- Forks
- 4.4k
- Merge medio
- 1 d 21 h
- PR fusionados (30 d)
- 4
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pytorch/tutorials
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
Todos los issues de pytorch/tutorials
Issues similares
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Abiertoarea: harness bug status: needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Human-Agent-Society/reef#625 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
learningequality/kolibri#15351 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Name consistency Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
eellak/triplestore#65 · 1 comentario ·