File:MLP-training-loop.svg
Summary
| Description |
English: Flowchart illustrating the iterative training process for a multilayer perceptron (MLP). The diagram shows: (1) Forward pass: computing predictions from input and calculating loss; (2) Backward pass: computing gradients via backpropagation and updating parameters (3) Convergence check to determine whether to continue training or stop.
Diagram conceived and designed by the uploader; TikZ code generated with assistance from ChatGPT 5.2 based on the uploader's sketch. Rendered using Overleaf. |
| Date | |
| Source | Own work |
| Author | Alexis0Olson |
Source code
TikZ/LaTeX source for editing (rendered with Overleaf, exported via Inkscape with text as paths):
\documentclass[tikz,border=6pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath,amssymb}
\usepackage{xcolor}
\usetikzlibrary{arrows.meta,positioning,fit,calc,shapes.geometric,backgrounds}
\tikzset{font=\sffamily\small, >=Latex}
\tikzset{arrow/.style={->, thick}}
\tikzset{lbl/.style={font=\sffamily\footnotesize, inner sep=1pt}}
\tikzset{box/.style={draw, rounded corners=3pt, thick, fill=white, minimum height=11mm, align=center, inner sep=4pt, text width=34mm}}
\tikzset{term/.style={box, rounded corners=6pt, text width=28mm}}
\tikzset{decision/.style={draw, diamond, aspect=2.0, thick, fill=white, align=center, inner sep=2pt, minimum width=28mm}}
\tikzset{phase/.style={draw, rounded corners=2pt, thick, inner xsep=12pt, inner ysep=12pt, fill=black!3}}
\tikzset{phaseTitle/.style={font=\sffamily\bfseries, fill=white, inner sep=2.5pt}}
\begin{document}
\begin{tikzpicture}[node distance=12mm and 14mm]
\node[term] (start) {Training Step};
\node[decision, below=15mm of start] (conv) {Converged?};
\node[term, below=15mm of conv] (end) {Stop Training};
\node[box, right=34mm of start] (pred) {Compute\\predictions\\$\hat{y}$};
\node[box, right=14mm of pred] (loss) {Compute\\loss\\$L(\hat{y},y)$};
\node[box, below=22mm of pred, text width=42mm] (upd) {Update\\parameters\\$\theta \leftarrow \theta - \eta \nabla_{\theta} L$};
\node[box, right=14mm of upd] (grad) {Compute\\gradients\\$\nabla_{\theta} L$};
\begin{scope}[on background layer]
\node[phase, fit=(pred) (loss)] (fwd) {};
\node[phase, fit=(upd) (grad)] (bwd) {};
\end{scope}
\node[phaseTitle, anchor=north] at ($(fwd.north)+(0,13pt)$) {Forward Pass};
\node[phaseTitle, anchor=north] at ($(bwd.north)+(0,13pt)$) {Backward Pass};
\draw[arrow] (start.east) -- node[lbl, above] {Minibatch $(\mathbf{x},y)$} (pred.west);
\draw[arrow] (pred.east) -- (loss.west);
\coordinate (R) at ($(fwd.east)+(6mm,0)$);
\draw[arrow, rounded corners=8pt] (loss.east) -- (R |- loss.east) -- (R |- grad.east) -- (grad.east);
\draw[arrow] (grad.west) -- (upd.east);
\coordinate (L) at ($(bwd.west)+(-12mm,0)$);
\draw[arrow, rounded corners=8pt] (bwd.west) -- (L) |- (conv.east);
\draw[arrow] (conv.north) -- node[lbl, right, xshift=2mm] {No (continue)} (start.south);
\draw[arrow] (conv.south) -- node[lbl, right, xshift=2mm] {Yes (stop)} (end.north);
\end{tikzpicture}
\end{document}
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.