Skip to content

Commit 1fcc2bc

Browse files
committed
adding material
1 parent a880c04 commit 1fcc2bc

File tree

2 files changed

+349
-1
lines changed

2 files changed

+349
-1
lines changed

doc/src/week12/week12.do.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ DATE: April 16, 2026
77

88
!bblock Generative methods, energy models and Boltzmann machines
99
o Summary of discussions on Restricted Boltzmann machines, reminder from last week
10-
o Introduction to Variational Autoencoders (VAEs), basic mathematical formalims
10+
o Introduction to Variational Autoencoders (VAEs), basic mathematical formalism
1111
#o "Video of lecture":"https://youtu.be/Mm9Xasy8qNw"
1212
#o "Whiteboard notes":"https://github.com/CompPhysics/AdvancedMachineLearning/blob/main/doc/HandwrittenNotes/2025/NotesApril10.pdf"
1313
!eblock
Lines changed: 348 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,348 @@
1+
\documentclass{beamer}
2+
3+
\usepackage{amsmath,amsfonts,amssymb,bm}
4+
\usepackage{physics}
5+
\usepackage{graphicx}
6+
7+
\usetheme{Madrid}
8+
9+
\title{Normalizing Flows}
10+
\subtitle{Probability Transport and Invertible Models}
11+
\author{Morten Hjorth-Jensen}
12+
\date{Spring 2026}
13+
14+
\begin{document}
15+
16+
\frame{\titlepage}
17+
18+
%================================================
19+
\section{Motivation}
20+
%================================================
21+
22+
\begin{frame}{Generative Modeling Problem}
23+
We wish to model a probability density:
24+
\[
25+
p(x), \quad x \in \mathbb{R}^d
26+
\]
27+
28+
Goal:
29+
\begin{itemize}
30+
\item tractable likelihood
31+
\item efficient sampling
32+
\item expressive model
33+
\end{itemize}
34+
\end{frame}
35+
36+
%------------------------------------------------
37+
38+
\begin{frame}{Key Idea}
39+
Start with simple distribution:
40+
\[
41+
z \sim p_0(z), \quad p_0 = \mathcal{N}(0,I)
42+
\]
43+
44+
Apply invertible map:
45+
\[
46+
x = f(z)
47+
\]
48+
49+
Then:
50+
\[
51+
p(x) = p_0(z) \left| \det \frac{\partial z}{\partial x} \right|
52+
\]
53+
\end{frame}
54+
55+
%================================================
56+
\section{Change of Variables}
57+
%================================================
58+
59+
\begin{frame}{Change of Variables Theorem}
60+
For invertible $f$:
61+
\[
62+
x = f(z)
63+
\]
64+
65+
\[
66+
p(x) = p_0(z)\left|\det \frac{\partial f^{-1}}{\partial x}\right|
67+
\]
68+
69+
Equivalently:
70+
\[
71+
p(x) = p_0(z)\left|\det \frac{\partial f}{\partial z}\right|^{-1}
72+
\]
73+
\end{frame}
74+
75+
%------------------------------------------------
76+
77+
\begin{frame}{Log-Density}
78+
\[
79+
\log p(x) = \log p_0(z) - \log \left| \det \frac{\partial f}{\partial z} \right|
80+
\]
81+
\end{frame}
82+
83+
%================================================
84+
\section{Composition of Flows}
85+
%================================================
86+
87+
\begin{frame}{Flow Model}
88+
Define:
89+
\[
90+
x = f_K \circ f_{K-1} \circ \cdots \circ f_1(z)
91+
\]
92+
\end{frame}
93+
94+
%------------------------------------------------
95+
96+
\begin{frame}{Log-Likelihood}
97+
\[
98+
\log p(x) = \log p_0(z) - \sum_{k=1}^K \log \left|\det \frac{\partial f_k}{\partial h_{k-1}}\right|
99+
\]
100+
\end{frame}
101+
102+
%------------------------------------------------
103+
104+
\begin{frame}{Interpretation}
105+
\begin{itemize}
106+
\item Each layer transports probability mass
107+
\item Total transformation = composition
108+
\end{itemize}
109+
\end{frame}
110+
111+
%================================================
112+
\section{Simple Flow Layers}
113+
%================================================
114+
115+
\begin{frame}{Affine Transformation}
116+
\[
117+
x = Az + b
118+
\]
119+
120+
\[
121+
\det J = \det A
122+
\]
123+
\end{frame}
124+
125+
%------------------------------------------------
126+
127+
\begin{frame}{Planar Flow}
128+
\[
129+
f(z) = z + u \tanh(w^T z + b)
130+
\]
131+
132+
Jacobian:
133+
\[
134+
\det J = 1 + u^T \psi(z)
135+
\]
136+
\end{frame}
137+
138+
%------------------------------------------------
139+
140+
\begin{frame}{Radial Flow}
141+
\[
142+
f(z) = z + \beta \frac{z - z_0}{\alpha + \|z - z_0\|}
143+
\]
144+
\end{frame}
145+
146+
%================================================
147+
\section{Coupling Layers}
148+
%================================================
149+
150+
\begin{frame}{RealNVP Idea}
151+
Split variables:
152+
\[
153+
z = (z_1, z_2)
154+
\]
155+
156+
Transform:
157+
\[
158+
x_1 = z_1, \quad x_2 = z_2 \odot e^{s(z_1)} + t(z_1)
159+
\]
160+
\end{frame}
161+
162+
%------------------------------------------------
163+
164+
\begin{frame}{Jacobian}
165+
\[
166+
\det J = \exp\left(\sum s(z_1)\right)
167+
\]
168+
169+
\begin{itemize}
170+
\item triangular Jacobian → efficient
171+
\end{itemize}
172+
\end{frame}
173+
174+
%================================================
175+
\section{Autoregressive Flows}
176+
%================================================
177+
178+
\begin{frame}{Autoregressive Model}
179+
\[
180+
x_i = f_i(z_i; x_1,\dots,x_{i-1})
181+
\]
182+
\end{frame}
183+
184+
%------------------------------------------------
185+
186+
\begin{frame}{Jacobian}
187+
\[
188+
\det J = \prod_i \frac{\partial x_i}{\partial z_i}
189+
\]
190+
\end{frame}
191+
192+
%================================================
193+
\section{Continuous Normalizing Flows}
194+
%================================================
195+
196+
\begin{frame}{Continuous Flow}
197+
\[
198+
\frac{dx}{dt} = v(x,t)
199+
\]
200+
\end{frame}
201+
202+
%------------------------------------------------
203+
204+
\begin{frame}{Density Evolution}
205+
\[
206+
\frac{d}{dt} \log p(x(t)) = -\nabla \cdot v(x,t)
207+
\]
208+
\end{frame}
209+
210+
%------------------------------------------------
211+
212+
\begin{frame}{Connection to Physics}
213+
\begin{itemize}
214+
\item continuity equation
215+
\item Liouville equation
216+
\end{itemize}
217+
\end{frame}
218+
219+
%================================================
220+
\section{Geometric Interpretation}
221+
%================================================
222+
223+
\begin{frame}{Flows as Diffeomorphisms}
224+
\[
225+
f: \mathbb{R}^d \rightarrow \mathbb{R}^d
226+
\]
227+
228+
\begin{itemize}
229+
\item invertible
230+
\item smooth
231+
\end{itemize}
232+
\end{frame}
233+
234+
%------------------------------------------------
235+
236+
\begin{frame}{Manifold View}
237+
\begin{itemize}
238+
\item probability distributions as densities on manifold
239+
\item flow = transport map
240+
\end{itemize}
241+
\end{frame}
242+
243+
%================================================
244+
\section{Connection to Statistical Physics}
245+
%================================================
246+
247+
\begin{frame}{Boltzmann Distribution}
248+
\[
249+
p(x) = \frac{1}{Z} e^{-E(x)}
250+
\]
251+
\end{frame}
252+
253+
%------------------------------------------------
254+
255+
\begin{frame}{Partition Function Problem}
256+
\[
257+
Z = \int e^{-E(x)} dx
258+
\]
259+
260+
\begin{itemize}
261+
\item hard to compute
262+
\end{itemize}
263+
\end{frame}
264+
265+
%------------------------------------------------
266+
267+
\begin{frame}{Flow Interpretation}
268+
\[
269+
p(x) = p_0(z)\left|\det \frac{\partial z}{\partial x}\right|
270+
\]
271+
272+
\begin{itemize}
273+
\item replaces partition function with Jacobian
274+
\end{itemize}
275+
\end{frame}
276+
277+
%================================================
278+
\section{Optimal Transport Connection}
279+
%================================================
280+
281+
\begin{frame}{Transport Map}
282+
\[
283+
T: p_0(z) \rightarrow p(x)
284+
\]
285+
\end{frame}
286+
287+
%------------------------------------------------
288+
289+
\begin{frame}{Monge Problem}
290+
\[
291+
\min_T \int \|x - T(x)\|^2 p_0(x) dx
292+
\]
293+
\end{frame}
294+
295+
%------------------------------------------------
296+
297+
\begin{frame}{Relation to Flows}
298+
\begin{itemize}
299+
\item flows approximate transport maps
300+
\item connect to Wasserstein geometry
301+
\end{itemize}
302+
\end{frame}
303+
304+
%================================================
305+
\section{Training}
306+
%================================================
307+
308+
\begin{frame}{Maximum Likelihood}
309+
\[
310+
\mathcal{L} = \sum_i \log p(x_i)
311+
\]
312+
\end{frame}
313+
314+
%------------------------------------------------
315+
316+
\begin{frame}{Gradient}
317+
\[
318+
\nabla_\theta \log p(x) =
319+
\nabla_\theta \log p_0(z) -
320+
\nabla_\theta \log |\det J|
321+
\]
322+
\end{frame}
323+
324+
%================================================
325+
\section{Limitations}
326+
%================================================
327+
328+
\begin{frame}{Challenges}
329+
\begin{itemize}
330+
\item invertibility constraint
331+
\item Jacobian computation
332+
\item expressivity vs tractability
333+
\end{itemize}
334+
\end{frame}
335+
336+
%================================================
337+
\section{Summary}
338+
%================================================
339+
340+
\begin{frame}{Summary}
341+
\begin{itemize}
342+
\item normalizing flows = invertible transformations
343+
\item exact likelihood computation
344+
\item deep connection to physics and geometry
345+
\end{itemize}
346+
\end{frame}
347+
348+
\end{document}

0 commit comments

Comments
 (0)