pranamanam commited on
Commit
dd6a1a1
·
verified ·
1 Parent(s): 7cadbce

Delete lecture_7

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. lecture_7/EQUATION_READINGS.md +0 -1553
  2. lecture_7/EXERCISES.md +0 -47
  3. lecture_7/MATHEMATICS.md +0 -5
  4. lecture_7/README.md +0 -103
  5. lecture_7/SLIDE_CODE_MAP.md +0 -35
  6. lecture_7/SOURCES.md +0 -41
  7. lecture_7/check_examples.py +0 -53
  8. lecture_7/data/README.md +0 -4
  9. lecture_7/discrete_learning.py +0 -67
  10. lecture_7/examples/01_ot.py +0 -7
  11. lecture_7/examples/02_sinkhorn.py +0 -7
  12. lecture_7/examples/03_finite_sb.py +0 -7
  13. lecture_7/examples/04_discrete_imf.py +0 -7
  14. lecture_7/examples/05_ctmc_sb.py +0 -7
  15. lecture_7/examples/06_gaussian_sb.py +0 -7
  16. lecture_7/examples/07_reward_tilt.py +0 -7
  17. lecture_7/examples/08_branch_mass.py +0 -7
  18. lecture_7/examples/09_cone_geometry.py +0 -7
  19. lecture_7/examples/10_dsb.py +0 -7
  20. lecture_7/examples/11_dsbm.py +0 -7
  21. lecture_7/examples/12_sf2m.py +0 -7
  22. lecture_7/examples/13_tr2d2.py +0 -7
  23. lecture_7/examples/14_branch.py +0 -7
  24. lecture_7/examples/15_entangled.py +0 -7
  25. lecture_7/examples/16_ddsbm.py +0 -7
  26. lecture_7/examples/17_csbm.py +0 -7
  27. lecture_7/learned_bridges.py +0 -276
  28. lecture_7/lecture7_examples.ipynb +0 -288
  29. lecture_7/lecture7_ot_sbm_notes.md +0 -0
  30. lecture_7/lecture_core.py +0 -4
  31. lecture_7/numerical_examples.py +0 -4
  32. lecture_7/ot_sbm_examples.py +0 -165
  33. lecture_7/paper_manifest.json +0 -84
  34. lecture_7/requirements.txt +0 -3
  35. lecture_7/run.py +0 -110
  36. lecture_7/run_all.py +0 -26
  37. lecture_7/sampling.py +0 -218
  38. lecture_7/source_manifest.json +0 -339
  39. lecture_7/tests/test_mathematics.py +0 -15
  40. lecture_7/verified_examples/README.md +0 -7
  41. lecture_7/verified_examples/branch-mass/config.json +0 -11
  42. lecture_7/verified_examples/branch-mass/generation_report.json +0 -12
  43. lecture_7/verified_examples/branch-mass/losses.json +0 -1
  44. lecture_7/verified_examples/branch-mass/report.json +0 -1734
  45. lecture_7/verified_examples/branch-mass/sample_report.json +0 -12
  46. lecture_7/verified_examples/branch-mass/samples.json +0 -529
  47. lecture_7/verified_examples/branch-mass/samples.txt +0 -128
  48. lecture_7/verified_examples/branch/config.json +0 -14
  49. lecture_7/verified_examples/branch/generation_report.json +0 -28
  50. lecture_7/verified_examples/branch/losses.json +0 -1
lecture_7/EQUATION_READINGS.md DELETED
@@ -1,1553 +0,0 @@
1
- # Lecture 7 · Equation readings
2
-
3
- The presentation reveals the equation, then its spoken reading, then intuition. This guide reproduces the literal readings; the teaching notes retain the surrounding derivations and explanations.
4
-
5
- ## A transport map chooses a destination for every starting point
6
-
7
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u003_r0)
8
-
9
- Applying the map T to a source sample must produce the target distribution.
10
-
11
- $$
12
- T_{\#}\mu=\nu\quad\Longleftrightarrow\quad X\sim\mu\ \Rightarrow\ T(X)\sim\nu
13
- $$
14
-
15
- The pushforward condition says that applying T to a random sample with law μ produces a sample with law ν; the map must transform the entire source distribution into the target distribution.
16
-
17
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u003_r1)
18
-
19
- Monge chooses the admissible map with the smallest average transport cost c.
20
-
21
- $$
22
- \inf_{T:\,T_{\#}\mu=\nu}\ \int c(x,T(x))\,\mu(dx)
23
- $$
24
-
25
- The Monge objective chooses, among maps that send μ to ν, the smallest average of the movement cost c from each source point x to its assigned destination T(x).
26
-
27
- ## A single source atom may need to split its probability
28
-
29
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u004_r0)
30
-
31
- Our source has masses 0.6 and 0.4, while the target needs masses 0.3 and 0.7.
32
-
33
- $$
34
- a=(0.6,0.4),\qquad b=(0.3,0.7)
35
- $$
36
-
37
- The source probability vector a assigns masses 0.6 and 0.4 to its two states, while the target vector b requires masses 0.3 and 0.7.
38
-
39
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u004_r1)
40
-
41
- A coupling assigns a nonnegative mass πᵢⱼ to each source and target pair.
42
-
43
- $$
44
- \Pi(a,b)=\{\pi\geq0:\ \pi\mathbf1=a,\ \pi^{\mathsf T}\mathbf1=b\}
45
- $$
46
-
47
- The set Π(a,b) contains nonnegative matrices π whose row sums equal a and whose column sums equal b; each matrix entry specifies how much probability travels between one source and one target.
48
-
49
- ## We can now minimize the cost over all valid couplings
50
-
51
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u005_r0)
52
-
53
- Kantorovich minimizes the expected cost under the joint distribution π.
54
-
55
- $$
56
- \operatorname{OT}_{c}(\mu,\nu)=\inf_{\pi\in\Pi(\mu,\nu)}\int c(x,y)\,\pi(dx,dy)
57
- $$
58
-
59
- The Kantorovich cost is the smallest average movement cost c(x,y) over joint distributions π with source marginal μ and target marginal ν.
60
-
61
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u005_r1)
62
-
63
- For finite supports, the integral becomes a sum over entries of the cost matrix C.
64
-
65
- $$
66
- \min_{\pi\in\Pi(a,b)}\langle C,\pi\rangle,\qquad C_{ij}=\lVert x_i-y_j\rVert^2
67
- $$
68
-
69
- For finite states, the objective sums each transported mass π times its corresponding matrix cost C, where C is the squared distance between the source and target locations.
70
-
71
- ## The constraints reduce our example to one unknown
72
-
73
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u006_r0)
74
-
75
- For source locations 0 and 2 and target locations 1 and 3, squared distance gives C.
76
-
77
- $$
78
- C=\begin{pmatrix}1&9\\1&1\end{pmatrix}
79
- $$
80
-
81
- The cost matrix assigns cost one to three possible moves and cost nine to the move from the first source at zero to the second target at three.
82
-
83
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u006_r1)
84
-
85
- Let r be the mass sent from the first source to the first target.
86
-
87
- $$
88
- \pi(r)=\begin{pmatrix}r&0.6-r\\0.3-r&0.1+r\end{pmatrix},\qquad 0\leq r\leq0.3
89
- $$
90
-
91
- Choosing the first entry r fixes the other three transported masses through the marginal constraints; nonnegativity restricts r to the interval from zero to 0.3.
92
-
93
- ## Increasing r removes the most expensive move
94
-
95
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u007_r0)
96
-
97
- Multiplying each transported mass by its cost gives a linear function of r.
98
-
99
- $$
100
- \langle C,\pi(r)\rangle=r+9(0.6-r)+(0.3-r)+(0.1+r)=5.8-8r
101
- $$
102
-
103
- The transport cost is the sum of four mass-times-cost terms, which simplifies to 5.8 minus eight times r; increasing r therefore decreases the objective.
104
-
105
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u007_r1)
106
-
107
- The largest feasible r gives the optimal coupling and total cost.
108
-
109
- $$
110
- r^*=0.3,\qquad \pi^*=\begin{pmatrix}0.3&0.3\\0&0.4\end{pmatrix},\qquad \operatorname{OT}=3.4
111
- $$
112
-
113
- Setting r to its largest feasible value, 0.3, gives masses 0.3, 0.3, zero, and 0.4 in the coupling matrix and yields total transport cost 3.4.
114
-
115
- ## A second optimization can certify that this cost is minimal
116
-
117
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u008_r0)
118
-
119
- Introduce source prices f and target prices g in the Lagrangian.
120
-
121
- $$
122
- \mathcal L(\pi,f,g)=a^{\mathsf T}f+b^{\mathsf T}g+\sum_{ij}\pi_{ij}(C_{ij}-f_i-g_j)
123
- $$
124
-
125
- The Lagrangian adds the source and target masses weighted by prices f and g, then sums each transported mass times its cost minus the two endpoint prices.
126
-
127
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u008_r1)
128
-
129
- Minimizing over nonnegative π leaves the dual feasibility condition.
130
-
131
- $$
132
- \max_{f,g}\ a^{\mathsf T}f+b^{\mathsf T}g\quad\text{subject to}\quad f_i+g_j\leq C_{ij}
133
- $$
134
-
135
- The dual maximizes the total mass-weighted source and target prices, subject to the condition that the two prices on every possible move sum to at most that move’s cost.
136
-
137
- ## Our example has an exact primal and dual certificate
138
-
139
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u009_r0)
140
-
141
- The source and target prices below satisfy every cost inequality.
142
-
143
- $$
144
- f=(0,-8),\quad g=(1,9),\quad f\mathbf1^{\mathsf T}+\mathbf1g^{\mathsf T}=\begin{pmatrix}1&9\\-7&1\end{pmatrix}\leq C
145
- $$
146
-
147
- The chosen source prices are zero and minus eight, and the target prices are one and nine; their pairwise sums are no greater than the corresponding entries of C.
148
-
149
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u009_r1)
150
-
151
- Their lower bound equals the cost of the coupling we already found.
152
-
153
- $$
154
- a^{\mathsf T}f+b^{\mathsf T}g=-3.2+0.3+6.3=3.4=\langle C,\pi^*\rangle
155
- $$
156
-
157
- Weighting these prices by a and b gives 3.4, exactly the cost of the proposed coupling, so the feasible dual lower bound meets the feasible primal upper bound.
158
-
159
- ## Distance costs give the Wasserstein distances
160
-
161
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u010_r0)
162
-
163
- The p-Wasserstein distance takes the pth root of the minimum pth-power distance cost.
164
-
165
- $$
166
- W_p(\mu,\nu)=\left[\inf_{\pi\in\Pi(\mu,\nu)}\int\lVert x-y\rVert^p\,d\pi\right]^{1/p}
167
- $$
168
-
169
- The p-Wasserstein distance minimizes the expected pth power of the distance between coupled samples, then takes the pth root to return to the units of distance.
170
-
171
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u010_r1)
172
-
173
- On the real line, matching equal quantiles gives the optimal cost.
174
-
175
- $$
176
- W_p^p(\mu,\nu)=\int_0^1\left|F_\mu^{-1}(u)-F_\nu^{-1}(u)\right|^pdu
177
- $$
178
-
179
- On the real line, the pth power of the Wasserstein distance averages the pth power of the gap between source and target quantiles at the same probability level u.
180
-
181
- ## The one-dimensional rule follows by uncrossing pairs
182
-
183
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u011_r0)
184
-
185
- For ordered points x₁<x₂ and y₁<y₂, compare crossing and ordered assignments.
186
-
187
- $$
188
- (x_1-y_2)^2+(x_2-y_1)^2-(x_1-y_1)^2-(x_2-y_2)^2=2(x_2-x_1)(y_2-y_1)>0
189
- $$
190
-
191
- The cost of the two crossed assignments minus the cost of the ordered assignments equals twice the source gap times the target gap, which is positive when both pairs are strictly ordered.
192
-
193
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u011_r1)
194
-
195
- Moving any shared positive mass δ from crossing edges to ordered edges lowers the cost.
196
-
197
- $$
198
- \Delta\operatorname{cost}=-2\delta(x_2-x_1)(y_2-y_1)<0
199
- $$
200
-
201
- Moving a positive mass δ from crossed to ordered assignments changes the cost by minus twice δ times the two positive gaps, so the change is strictly negative.
202
-
203
- ## We can describe the same transport through a velocity field
204
-
205
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u012_r0)
206
-
207
- Benamou and Brenier minimize the kinetic action over densities ρₜ and velocities vₜ.
208
-
209
- $$
210
- W_2^2(\mu,\nu)=\inf_{\rho,v}\int_0^1\!\int\lVert v_t(x)\rVert^2\rho_t(x)\,dx\,dt
211
- $$
212
-
213
- The squared Wasserstein distance minimizes, over density and velocity paths, the time integral of squared speed averaged under the current density ρ.
214
-
215
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u012_r1)
216
-
217
- The continuity equation moves probability while preserving the required endpoints.
218
-
219
- $$
220
- \partial_t\rho_t+\nabla\!\cdot(\rho_tv_t)=0,\qquad \rho_0=\mu,\quad\rho_1=\nu
221
- $$
222
-
223
- The continuity equation says that the time change in density plus the divergence of probability flux ρv is zero, while the initial and final densities are constrained to μ and ν.
224
-
225
- ## Straight constant-speed motion attains the dynamic optimum
226
-
227
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u013_r0)
228
-
229
- For each path, Cauchy-Schwarz bounds displacement by its integrated squared speed.
230
-
231
- $$
232
- \lVert X_1-X_0\rVert^2=\left\lVert\int_0^1\dot X_t\,dt\right\rVert^2\leq\int_0^1\lVert\dot X_t\rVert^2dt
233
- $$
234
-
235
- The squared endpoint displacement equals the squared integral of velocity and is bounded above by the integral of squared speed over the unit time interval.
236
-
237
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u013_r1)
238
-
239
- An optimal endpoint coupling achieves equality with linear interpolation.
240
-
241
- $$
242
- (X_0,X_1)\sim\pi^*,\qquad X_t=(1-t)X_0+tX_1,\quad\dot X_t=X_1-X_0
243
- $$
244
-
245
- Sampling endpoints from the optimal coupling and linearly interpolating between them gives a constant velocity equal to the endpoint difference, attaining equality in the speed bound.
246
-
247
- ## Entropy spreads mass across feasible assignments
248
-
249
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u016_r0)
250
-
251
- Let ε>0 control the entropy penalty added to the transport cost.
252
-
253
- $$
254
- \min_{\pi\in\Pi(a,b)}\ \langle C,\pi\rangle+\varepsilon\sum_{ij}\pi_{ij}(\log\pi_{ij}-1)
255
- $$
256
-
257
- The entropic objective adds the transport cost to ε times the sum of π times log π minus π, and minimizes that total over couplings with the required marginals.
258
-
259
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u016_r1)
260
-
261
- Stationarity of the Lagrangian gives the positive kernel K and its two scaling vectors.
262
-
263
- $$
264
- \pi_{ij}=e^{f_i/\varepsilon}e^{-C_{ij}/\varepsilon}e^{g_j/\varepsilon}=u_iK_{ij}v_j
265
- $$
266
-
267
- Every optimal coupling entry factors into a source scaling u, a kernel entry K equal to the exponential of negative cost divided by ε, and a target scaling v.
268
-
269
- ## Each marginal constraint gives one scaling update
270
-
271
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u017_r0)
272
-
273
- Matching the row sums gives u by dividing a by K times v.
274
-
275
- $$
276
- \pi\mathbf1=u\odot(Kv)=a\quad\Longrightarrow\quad u\leftarrow a\oslash(Kv)
277
- $$
278
-
279
- The row sums of the scaled kernel are u multiplied elementwise by Kv; matching them to a gives the update that divides each source mass by the corresponding entry of Kv.
280
-
281
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u017_r1)
282
-
283
- Matching the column sums then gives v by dividing b by K transpose times u.
284
-
285
- $$
286
- \pi^{\mathsf T}\mathbf1=v\odot(K^{\mathsf T}u)=b\quad\Longrightarrow\quad v\leftarrow b\oslash(K^{\mathsf T}u)
287
- $$
288
-
289
- The column sums are v multiplied elementwise by the transpose of K times u; matching them to b gives the update that divides each target mass by that corresponding column quantity.
290
-
291
- ## We can calculate the first Sinkhorn iteration by hand
292
-
293
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u018_r0)
294
-
295
- For ε=2, exponentiating the negative half-cost gives the kernel.
296
-
297
- $$
298
- K=\begin{pmatrix}0.60653&0.01111\\0.60653&0.60653\end{pmatrix},\qquad v^{(0)}=(1,1)
299
- $$
300
-
301
- With ε equal to two, each kernel entry is the exponential of negative half its cost, and the initial target scaling vector v is set to one in both coordinates.
302
-
303
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u018_r1)
304
-
305
- Row scaling gives u, then column scaling gives the next v.
306
-
307
- $$
308
- u^{(1)}\approx(0.97144,0.32974),\qquad v^{(1)}\approx(0.38013,3.32081)
309
- $$
310
-
311
- The first row normalization gives u approximately equal to (0.97144, 0.32974), and the following column normalization gives v approximately equal to (0.38013, 3.32081).
312
-
313
- ## A path measure assigns probabilities to entire trajectories
314
-
315
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u023_r0)
316
-
317
- A Markov path probability multiplies its initial law and transition kernels.
318
-
319
- $$
320
- R(x_{0:N})=r_0(x_0)\prod_{k=0}^{N-1}K_k(x_k,x_{k+1})
321
- $$
322
-
323
- The reference probability of a complete Markov trajectory equals the probability of its initial state multiplied by the transition probability for every consecutive pair of states.
324
-
325
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u023_r1)
326
-
327
- Relative entropy averages the log likelihood ratio of two path measures.
328
-
329
- $$
330
- \operatorname{KL}(P\Vert R)=\mathbb E_P\!\left[\log\frac{dP}{dR}\right]
331
- $$
332
-
333
- The path-space KL is the expectation under P of the logarithm of P’s density relative to R, so trajectories are weighted according to P when comparing the two path laws.
334
-
335
- ## The bridge changes the reference as little as possible
336
-
337
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u024_r0)
338
-
339
- Fix both endpoint marginals and minimize relative entropy on path space.
340
-
341
- $$
342
- P^*=\arg\min_{P:\,P_0=\mu,\,P_1=\nu}\operatorname{KL}(P\Vert R)
343
- $$
344
-
345
- The Schrödinger bridge P star minimizes KL relative to the reference path law R over all path laws whose initial marginal is μ and whose terminal marginal is ν.
346
-
347
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u024_r1)
348
-
349
- The KL chain rule separates the endpoint cost from the conditional path cost.
350
-
351
- $$
352
- \operatorname{KL}(P\Vert R)=\operatorname{KL}(\pi\Vert R_{01})+\mathbb E_{\pi}\operatorname{KL}(P^{xy}\Vert R^{xy})
353
- $$
354
-
355
- The total path KL equals the KL between endpoint couplings plus the average, over the chosen endpoint coupling π, of the KL between paths conditioned on those endpoints.
356
-
357
- ## The static bridge selects the optimal endpoint coupling
358
-
359
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u025_r0)
360
-
361
- Nonnegativity of conditional KL makes the reference conditional bridges optimal.
362
-
363
- $$
364
- \pi^*=\arg\min_{\pi\in\Pi(\mu,\nu)}\operatorname{KL}(\pi\Vert R_{01}),\qquad P^*(d\omega)=\int R^{xy}(d\omega)\,\pi^*(dx,dy)
365
- $$
366
-
367
- The optimal endpoint coupling minimizes KL relative to the reference endpoint law, and the optimal path law mixes the reference’s endpoint-conditioned bridges using that coupling.
368
-
369
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u025_r1)
370
-
371
- The optimal coupling rescales the reference endpoint law by two positive potentials.
372
-
373
- $$
374
- \pi^*(dx,dy)=f(x)g(y)R_{01}(dx,dy)
375
- $$
376
-
377
- The optimal joint endpoint law equals the reference joint law multiplied by a source potential f(x) and a terminal potential g(y), which adjust the two marginals.
378
-
379
- ## A Brownian reference recovers entropy-regularized transport
380
-
381
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u026_r0)
382
-
383
- Brownian motion with noise variance ε has a Gaussian endpoint transition density.
384
-
385
- $$
386
- K_{01}(x,y)=(2\pi\varepsilon)^{-d/2}\exp\!\left[-\frac{\lVert y-x\rVert^2}{2\varepsilon}\right]
387
- $$
388
-
389
- The Brownian transition density is an isotropic Gaussian centered at x with covariance ε times the identity, so reaching y incurs the exponential of negative squared displacement divided by twice ε.
390
-
391
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u026_r1)
392
-
393
- Substituting this density into the static KL gives squared-distance transport plus entropy.
394
-
395
- $$
396
- \varepsilon\operatorname{KL}(\pi\Vert R_{01})=\tfrac12\mathbb E_\pi\lVert X_1-X_0\rVert^2-\varepsilon H(\pi)+\text{constant}
397
- $$
398
-
399
- For fixed endpoint marginals, ε times the endpoint KL equals half the expected squared displacement minus ε times the coupling entropy, plus a constant independent of the coupling.
400
-
401
- ## A two-state chain gives a bridge we can compute exactly
402
-
403
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u027_r0)
404
-
405
- Let R use the same transition matrix A at two consecutive steps.
406
-
407
- $$
408
- a=(0.5,0.5),\quad b=(0.2,0.8),\quad A=\begin{pmatrix}0.8&0.2\\0.3&0.7\end{pmatrix}
409
- $$
410
-
411
- The reference starts with equal probabilities, the desired terminal probabilities are 0.2 and 0.8, and each row of A gives one step’s destination probabilities from its corresponding source state.
412
-
413
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u027_r1)
414
-
415
- The reference joint endpoint probabilities equal the initial masses times A squared.
416
-
417
- $$
418
- R_{02}=\operatorname{diag}(a)A^2=\begin{pmatrix}0.35&0.15\\0.225&0.275\end{pmatrix}
419
- $$
420
-
421
- Multiplying the two-step transition matrix A squared by the initial masses gives the reference joint endpoint probabilities 0.35, 0.15, 0.225, and 0.275.
422
-
423
- ## Sinkhorn rescales the endpoint probabilities of the chain
424
-
425
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u028_r0)
426
-
427
- Scaling the reference endpoint matrix to a and b gives π star.
428
-
429
- $$
430
- \pi^*=\begin{pmatrix}0.14&0.36\\0.06&0.44\end{pmatrix}
431
- $$
432
-
433
- The optimal endpoint coupling assigns joint probabilities 0.14 and 0.36 from the first source and 0.06 and 0.44 from the second, matching both prescribed marginals.
434
-
435
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u028_r1)
436
-
437
- One convenient choice of endpoint potentials gives the required scaling.
438
-
439
- $$
440
- f=(0.4,\,4/15),\qquad g=(1,6),\qquad \pi^*_{ij}=f_i(R_{02})_{ij}g_j
441
- $$
442
-
443
- Multiplying each reference endpoint probability by its source factor f and destination factor g gives the optimal coupling, with g favoring the second destination by a factor of six.
444
-
445
- ## The terminal potential can be propagated backward
446
-
447
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u029_r0)
448
-
449
- Let hₖ be the expected terminal potential given the current state.
450
-
451
- $$
452
- h_k(x)=\mathbb E_R[g(X_N)\mid X_k=x],\qquad h_k=A_kh_{k+1},\quad h_N=g
453
- $$
454
-
455
- The potential h at state x and step k is the reference expectation of the final potential g given that current state; it is computed backward by multiplying the next potential by A.
456
-
457
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u029_r1)
458
-
459
- Doob’s transform uses the ratio of future and current potentials to modify each transition.
460
-
461
- $$
462
- Q_k(x,y)=A_k(x,y)\frac{h_{k+1}(y)}{h_k(x)}
463
- $$
464
-
465
- The transformed transition Q from x to y equals the reference transition A multiplied by the next potential at y divided by the current potential at x.
466
-
467
- ## The backward recursion normalizes every transition
468
-
469
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u030_r0)
470
-
471
- Summing the transformed transitions gives one by the recursion for h.
472
-
473
- $$
474
- \sum_yQ_k(x,y)=\frac{\sum_yA_k(x,y)h_{k+1}(y)}{h_k(x)}=1
475
- $$
476
-
477
- Summing Q over all destinations divides the reference-weighted sum of next-step potentials by the current potential; the backward recursion makes this ratio exactly one.
478
-
479
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u030_r1)
480
-
481
- Multiplying transitions cancels all intermediate potentials.
482
-
483
- $$
484
- \prod_k\frac{Q_k(x_k,x_{k+1})}{A_k(x_k,x_{k+1})}=\frac{g(x_N)}{h_0(x_0)}
485
- $$
486
-
487
- Multiplying the transformed-to-reference transition ratios along a path cancels every intermediate potential, leaving only the final potential g divided by the initial future potential h.
488
-
489
- ## The transformed chain reaches the requested endpoint exactly
490
-
491
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u031_r0)
492
-
493
- Substituting the potentials gives the two transition matrices.
494
-
495
- $$
496
- Q_0=\begin{pmatrix}0.64&0.36\\0.16&0.84\end{pmatrix},\qquad Q_1=\begin{pmatrix}0.4&0.6\\1/15&14/15\end{pmatrix}
497
- $$
498
-
499
- The first transformed transition uses rows (0.64, 0.36) and (0.16, 0.84), while the second uses rows (0.4, 0.6) and (one fifteenth, fourteen fifteenths).
500
-
501
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u031_r1)
502
-
503
- Successive probability updates give the intermediate and terminal distributions.
504
-
505
- $$
506
- (0.5,0.5)Q_0=(0.4,0.6),\qquad (0.4,0.6)Q_1=(0.2,0.8)
507
- $$
508
-
509
- Multiplying the initial probability vector by the first transition gives (0.4, 0.6), and multiplying again by the second gives the required terminal probabilities (0.2, 0.8).
510
-
511
- ## For a diffusion, we can change the drift and keep the noise
512
-
513
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u033_r0)
514
-
515
- The reference drift b and noise scale √ε define the original stochastic paths.
516
-
517
- $$
518
- R:\ dX_t=b_t(X_t)dt+\sqrt\varepsilon\,dW_t
519
- $$
520
-
521
- Under the reference law R, the state increment equals drift b times the time increment plus a Brownian increment scaled by the square root of ε.
522
-
523
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u033_r1)
524
-
525
- A control u changes the drift and defines the path measure P superscript u.
526
-
527
- $$
528
- P^u:\ dX_t=[b_t(X_t)+u_t(X_t)]dt+\sqrt\varepsilon\,dW_t^u
529
- $$
530
-
531
- Under the controlled law, the increment adds control u to the reference drift b while retaining the same noise scale; the resulting trajectories define the new path law P.
532
-
533
- ## Girsanov turns drift changes into a path likelihood ratio
534
-
535
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u034_r0)
536
-
537
- Under the controlled law, the log ratio contains a martingale and control energy.
538
-
539
- $$
540
- \log\frac{dP^u}{dR}=\frac1{\sqrt\varepsilon}\int_0^1u_t\cdot dW_t^u+\frac1{2\varepsilon}\int_0^1\lVert u_t\rVert^2dt
541
- $$
542
-
543
- With matching initial laws, the controlled-to-reference log likelihood ratio is a noise-scaled stochastic integral of u plus one over twice ε times the integrated squared control.
544
-
545
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u034_r1)
546
-
547
- Taking the controlled expectation removes the martingale term.
548
-
549
- $$
550
- \operatorname{KL}(P^u\Vert R)=\frac1{2\varepsilon}\mathbb E_{P^u}\int_0^1\lVert u_t\rVert^2dt
551
- $$
552
-
553
- The KL from the controlled process to the reference equals one over twice ε times the controlled expectation of integrated squared control, because the martingale term has zero expectation.
554
-
555
- ## The backward potential determines the continuous control
556
-
557
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u035_r0)
558
-
559
- The conditional expectation h satisfies the backward Kolmogorov equation.
560
-
561
- $$
562
- h_t(x)=\mathbb E_R[g(X_1)\mid X_t=x],\qquad \partial_th+b\cdot\nabla h+\tfrac\varepsilon2\Delta h=0
563
- $$
564
-
565
- The future potential h averages the terminal potential under the reference conditioned on the current state, and its time derivative plus reference drift and diffusion terms sums to zero.
566
-
567
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u035_r1)
568
-
569
- The continuous Doob transform adds the gradient of log h to the drift.
570
-
571
- $$
572
- u_t^*(x)=\varepsilon\nabla\log h_t(x),\qquad dX_t=[b_t+\varepsilon\nabla\log h_t](X_t)dt+\sqrt\varepsilon\,dW_t
573
- $$
574
-
575
- The optimal added control is ε times the spatial gradient of log h, so the bridge drift is the reference drift plus this control and the Brownian noise scale is unchanged.
576
-
577
- ## Taking the logarithm gives an optimal-control equation
578
-
579
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u036_r0)
580
-
581
- Bellman’s equation minimizes the local control cost plus the change in value V.
582
-
583
- $$
584
- \partial_tV+b\cdot\nabla V+\tfrac\varepsilon2\Delta V+\min_u\{u\cdot\nabla V+\tfrac12\lVert u\rVert^2\}=0
585
- $$
586
-
587
- Bellman’s equation adds the time, reference-drift, and diffusion changes in value V to the minimum over controls of control–value alignment plus half the squared control norm.
588
-
589
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u036_r1)
590
-
591
- Completing the square gives u star and the Hopf-Cole transform linearizes the equation.
592
-
593
- $$
594
- u^*=-\nabla V,\qquad V=-\varepsilon\log h\quad\Longrightarrow\quad\partial_th+b\cdot\nabla h+\tfrac\varepsilon2\Delta h=0
595
- $$
596
-
597
- The minimizing control is minus the gradient of V, and substituting V equal to minus ε times log h converts the nonlinear control equation into the linear backward equation for h.
598
-
599
- ## Two potentials recover every intermediate marginal
600
-
601
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u037_r0)
602
-
603
- Propagate the initial scaling forward and the terminal scaling backward.
604
-
605
- $$
606
- \widehat h_t(y)=\int f(x)r_0(x)K_{0t}(x,y)dx,\qquad h_t(y)=\int K_{t1}(y,z)g(z)dz
607
- $$
608
-
609
- The forward potential averages the initial density weighted by f through the reference transition to time t, while the backward potential averages g through the transition from t to the endpoint.
610
-
611
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u037_r1)
612
-
613
- Their product gives the bridge density at time t.
614
-
615
- $$
616
- \rho_t(y)=\widehat h_t(y)h_t(y),\qquad \rho_0=\mu,\quad\rho_1=\nu
617
- $$
618
-
619
- The bridge density at an intermediate state is the product of its forward and backward potentials, with the two potentials chosen so that the endpoint densities equal μ and ν.
620
-
621
- ## A Brownian bridge gives an explicit training path
622
-
623
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u038_r0)
624
-
625
- Given both endpoints, the intermediate state is a Gaussian around the straight line.
626
-
627
- $$
628
- X_t\mid x_0,x_1\sim\mathcal N((1-t)x_0+tx_1,\ \varepsilon t(1-t)I)
629
- $$
630
-
631
- Conditioned on both endpoints, the Brownian bridge state at an interior time t is Gaussian with the linearly interpolated mean and covariance ε times t times one minus t.
632
-
633
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u038_r1)
634
-
635
- The conditional drift points toward the endpoint, scaled by the remaining time.
636
-
637
- $$
638
- \beta_t(x\mid x_1)=\frac{x_1-x}{1-t}
639
- $$
640
-
641
- The conditional Brownian bridge drift equals the remaining displacement from x to the terminal point divided by the remaining time one minus t.
642
-
643
- ## Bridge noise changes the Gaussian interior
644
-
645
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u039_r0)
646
-
647
- For unit-variance Gaussian endpoints and ε=1, the covariance has a closed form.
648
-
649
- $$
650
- \mu=\mathcal N(0,1),\quad\nu=\mathcal N(2,1),\qquad c^*=\frac{\sqrt{\varepsilon^2+4}-\varepsilon}{2}\approx0.61803
651
- $$
652
-
653
- For unit-variance Gaussian endpoints with means zero and two, the optimal endpoint covariance is half of the square root of ε squared plus four minus ε, approximately 0.61803 when ε is one.
654
-
655
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u039_r1)
656
-
657
- At the midpoint, conditional interpolation and Brownian variance add together.
658
-
659
- $$
660
- \mathbb E[X_{1/2}]=1,\qquad \operatorname{Var}(X_{1/2})=\tfrac12+\tfrac12c^*+\tfrac\varepsilon4\approx1.05902
661
- $$
662
-
663
- The midpoint mean is one, while its variance combines one half from the endpoint variances, one half of their covariance, and ε divided by four from the conditional Brownian bridge.
664
-
665
- ## Iterative proportional fitting corrects one endpoint at a time
666
-
667
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u043_r0)
668
-
669
- A terminal projection replaces the terminal marginal while retaining the conditional paths.
670
-
671
- $$
672
- P^{2n+1}(d\omega)=\frac{\nu(X_1)}{P^{2n}_1(X_1)}P^{2n}(d\omega)
673
- $$
674
-
675
- The terminal projection multiplies each current path probability by the desired terminal density ν divided by the current terminal density, evaluated at that path’s endpoint.
676
-
677
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u043_r1)
678
-
679
- An initial projection then restores the source marginal.
680
-
681
- $$
682
- P^{2n+2}(d\omega)=\frac{\mu(X_0)}{P^{2n+1}_0(X_0)}P^{2n+1}(d\omega)
683
- $$
684
-
685
- The next projection multiplies each path probability by the desired initial density μ divided by the current initial density, evaluated at the starting point, to restore the source marginal.
686
-
687
- ## Time reversal makes each endpoint correction useful
688
-
689
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u044_r0)
690
-
691
- Bayes’ rule gives the reverse transition of a discrete-time reference chain.
692
-
693
- $$
694
- K_k^{\leftarrow}(y,x)=\frac{p_k(x)K_k(x,y)}{p_{k+1}(y)}
695
- $$
696
-
697
- The reverse transition from y to x equals the forward joint probability of x then y divided by the marginal probability of y at the next step.
698
-
699
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u044_r1)
700
-
701
- For a diffusion, reverse time s=1−t changes the drift and adds its density score.
702
-
703
- $$
704
- dY_s=[-b_{1-s}(Y_s)+\varepsilon\nabla\log p_{1-s}(Y_s)]ds+\sqrt\varepsilon\,d\overline W_s
705
- $$
706
-
707
- In reverse time, the diffusion drift is minus the forward drift plus ε times the forward density score, while the Brownian noise scale remains the square root of ε.
708
-
709
- ## DSB learns each reverse step by regression on simulated pairs
710
-
711
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u045_r0)
712
-
713
- Let Fₖ be the current forward mean map, with a Gaussian transition around it.
714
-
715
- $$
716
- X_{k+1}\sim\mathcal N(F_k(X_k),\,2\gamma_{k+1}I)
717
- $$
718
-
719
- The next state is sampled from a Gaussian whose mean is the current forward map F applied to the present state and whose covariance is twice the step parameter γ times the identity.
720
-
721
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u045_r1)
722
-
723
- The paper regresses a backward mean map B onto a target formed from the current F.
724
-
725
- $$
726
- \min_B\ \mathbb E\left\lVert B(X_{k+1})-\left[X_{k+1}+F_k(X_k)-F_k(X_{k+1})\right]\right\rVert^2
727
- $$
728
-
729
- The backward regression minimizes the expected squared difference between B at the next state and a target formed by that next state plus F at the previous state minus F at the next state.
730
-
731
- ## An endpoint mixture can retain hidden history
732
-
733
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u049_r0)
734
-
735
- An endpoint coupling π and reference conditional paths define a reciprocal mixture Λ.
736
-
737
- $$
738
- \Lambda=\int R^{xy}\,\pi(dx,dy)
739
- $$
740
-
741
- The reciprocal mixture Λ first draws an endpoint pair from π and then draws an entire reference bridge conditioned on that pair.
742
-
743
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u049_r1)
744
-
745
- A Markov law depends on the present state; the mixture can retain its start.
746
-
747
- $$
748
- P(X_{t+\Delta}\mid X_{[0,t]})=P(X_{t+\Delta}\mid X_t)\quad\text{for a Markov law}
749
- $$
750
-
751
- For a Markov law, conditioning the future on the complete past gives the same distribution as conditioning only on the current state; the earlier history supplies no additional information.
752
-
753
- ## Markov projection averages the conditional drift
754
-
755
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u050_r0)
756
-
757
- Average the Brownian bridge drift over pairs that pass through the current state.
758
-
759
- $$
760
- v_t^*(x)=\mathbb E_\Lambda\!\left[\frac{X_1-X_t}{1-t}\,\middle|\,X_t=x\right]
761
- $$
762
-
763
- The projected drift at x is the conditional average, over mixture trajectories passing through x, of the displacement to their terminal states divided by the remaining time.
764
-
765
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u050_r1)
766
-
767
- Squared-error regression learns this conditional expectation.
768
-
769
- $$
770
- \min_\theta\ \mathbb E_{t,\Lambda}\left\lVert v_\theta(t,X_t)-\frac{X_1-X_t}{1-t}\right\rVert^2
771
- $$
772
-
773
- The drift-matching loss averages squared error between the learned drift at the current state and the endpoint-conditioned Brownian bridge drift, over times and trajectories from Λ.
774
-
775
- ## Reciprocal projection restores the reference bridges
776
-
777
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u051_r0)
778
-
779
- Keep the endpoint coupling and replace the process’s conditional bridges.
780
-
781
- $$
782
- \mathcal R(M)=\int R^{xy}\,M_{01}(dx,dy)
783
- $$
784
-
785
- The reciprocal projection retains M’s joint endpoint distribution and replaces every endpoint-conditioned path law with the corresponding reference bridge.
786
-
787
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u051_r1)
788
-
789
- Iterative Markovian fitting alternates the two projections.
790
-
791
- $$
792
- M^{n+1}=\mathcal M(\Lambda^n),\qquad \Lambda^{n+1}=\mathcal R(M^{n+1})
793
- $$
794
-
795
- One fitting cycle first takes the Markov projection of the current reciprocal mixture, then takes the reciprocal projection of that resulting Markov process.
796
-
797
- ## A KL identity explains why exact projection makes progress
798
-
799
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u052_r0)
800
-
801
- The KL identity separates the correction from the remaining distance to the SB.
802
-
803
- $$
804
- \operatorname{KL}(P^n\Vert P^*)=\operatorname{KL}(P^n\Vert P^{n+1})+\operatorname{KL}(P^{n+1}\Vert P^*)
805
- $$
806
-
807
- Under the exact projection theorem’s assumptions, the current KL to the bridge splits into the KL paid by the projection plus the new KL remaining to the bridge.
808
-
809
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u052_r1)
810
-
811
- The correction is nonnegative, so the distance to the bridge cannot increase.
812
-
813
- $$
814
- \operatorname{KL}(P^{n+1}\Vert P^*)\leq\operatorname{KL}(P^n\Vert P^*)
815
- $$
816
-
817
- Because the projection’s KL contribution is nonnegative, the next exact iterate’s KL to the bridge is no larger than the current iterate’s KL.
818
-
819
- ## The conditional Gaussian gives both a velocity and a score
820
-
821
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u055_r0)
822
-
823
- Differentiate the mean mₜ and standard deviation σₜ of the Gaussian interpolant.
824
-
825
- $$
826
- m_t=(1-t)x_0+tx_1,\quad\sigma_t^2=\varepsilon t(1-t),\quad v_t^c=x_1-x_0+\frac{1-2t}{2t(1-t)}(x-m_t)
827
- $$
828
-
829
- The conditional velocity combines endpoint displacement with a correction proportional to deviation from the interpolated mean, while the Gaussian variance is ε times t times one minus t.
830
-
831
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u055_r1)
832
-
833
- Differentiating the Gaussian log density gives the conditional score.
834
-
835
- $$
836
- s_t^c(x)=\nabla_x\log p_t(x\mid x_0,x_1)=-\frac{x-m_t}{\varepsilon t(1-t)}
837
- $$
838
-
839
- The conditional score is the gradient of the Gaussian log density, equal to the negative displacement from the interpolated mean divided by the conditional variance.
840
-
841
- ## The learned velocity and score recover either an ODE or an SDE
842
-
843
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u056_r0)
844
-
845
- Match both conditional targets with a positive score-loss weight λₜ.
846
-
847
- $$
848
- \mathcal L=\mathbb E\!\left[\lVert v_\theta-v_t^c\rVert^2+\lambda_t^2\lVert s_\theta-s_t^c\rVert^2\right]
849
- $$
850
-
851
- The loss averages the squared velocity-prediction error plus the squared score-prediction error multiplied by λ squared, with both targets supplied by the conditional Gaussian bridge.
852
-
853
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u056_r1)
854
-
855
- Adding half the diffusion variance times the score recovers the SDE drift.
856
-
857
- $$
858
- dX_t=\left[v_\theta(t,X_t)+\tfrac\varepsilon2s_\theta(t,X_t)\right]dt+\sqrt\varepsilon\,dW_t
859
- $$
860
-
861
- The sampling SDE uses learned velocity plus ε over two times the learned score as its drift, and adds Brownian noise with scale equal to the square root of ε.
862
-
863
- ## A rate describes the probability of a jump over a short interval
864
-
865
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u060_r0)
866
-
867
- For distinct states x and y, the off-diagonal generator entry is a nonnegative rate.
868
-
869
- $$
870
- \Pr(X_{t+dt}=y\mid X_t=x)=G_t(x,y)\,dt+o(dt),\qquad y\ne x
871
- $$
872
-
873
- Over a sufficiently small interval, the probability of jumping from x to a different state y is the rate G from x to y times the interval, plus a smaller-order remainder.
874
-
875
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u060_r1)
876
-
877
- The diagonal records the total rate of leaving, so each generator row sums to zero.
878
-
879
- $$
880
- G_t(x,x)=-\sum_{y\ne x}G_t(x,y),\qquad \dot p_t=p_tG_t
881
- $$
882
-
883
- The diagonal generator entry is minus the sum of all outgoing rates, and the row probability vector evolves by multiplying itself by the generator.
884
-
885
- ## Changing rates also changes the waiting times
886
-
887
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u061_r0)
888
-
889
- The log ratio sums jump terms and integrates the difference in escape rates.
890
-
891
- $$
892
- \log\frac{dP^Q}{dR}=\log\frac{p_0(X_0)}{r_0(X_0)}+\sum_{\tau:\,\mathrm{jump}}\log\frac{Q_\tau(X_{\tau^-},X_\tau)}{G_\tau(X_{\tau^-},X_\tau)}-\int_0^1(\lambda_t^Q-\lambda_t^G)(X_t)\,dt
893
- $$
894
-
895
- The path log ratio adds the initial-density log ratio and the log rate ratio at each realized jump, then subtracts the time integral of the difference in total escape rates.
896
-
897
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u061_r1)
898
-
899
- Taking its expectation gives a local control cost for each possible transition.
900
-
901
- $$
902
- \operatorname{KL}(P^Q\Vert R)=\operatorname{KL}(p_0\Vert r_0)+\mathbb E_{P^Q}\!\int_0^1\sum_{y\ne X_t}\!\left[Q\log\frac QG-Q+G\right](X_t,y)\,dt
903
- $$
904
-
905
- The controlled path KL equals the initial KL plus the controlled expectation of the time integral, summed over destinations, of Q log(Q/G) minus Q plus G.
906
-
907
- ## Conditioning a jump process also produces a Doob transform
908
-
909
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u062_r0)
910
-
911
- A positive future potential solves a backward equation on the state graph.
912
-
913
- $$
914
- h_t=K_{t1}g,\qquad \partial_t h_t=-G_t h_t
915
- $$
916
-
917
- The future potential h is the terminal potential propagated backward through the reference transition kernel, and its time derivative is minus the generator applied to h.
918
-
919
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u062_r1)
920
-
921
- The bridge multiplies each off-diagonal rate by the ratio of future potentials.
922
-
923
- $$
924
- Q_t(x,y)=G_t(x,y)\frac{h_t(y)}{h_t(x)},\quad y\ne x;\qquad Q_t(x,x)=-\sum_{y\ne x}Q_t(x,y)
925
- $$
926
-
927
- Each off-diagonal bridge rate equals the reference rate times the destination potential divided by the source potential at the same time; the diagonal is reset to minus the outgoing-rate sum.
928
-
929
- ## Our two-state example now evolves in continuous time
930
-
931
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u063_r0)
932
-
933
- Choose a generator and solve the endpoint scaling problem using its matrix exponential.
934
-
935
- $$
936
- G=\begin{pmatrix}-2&2\\1&-1\end{pmatrix},\quad a=(0.5,0.5),\quad b=(0.2,0.8),\quad K_{01}=e^G
937
- $$
938
-
939
- The generator has jump rates two from state zero and one from state one, and its matrix exponential gives the unit-time reference transition used to match a to b.
940
-
941
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u063_r1)
942
-
943
- At the midpoint, the future-potential ratio changes both jump rates.
944
-
945
- $$
946
- h_{1/2}=(0.91138,1.05216),\quad Q_{1/2}(0,1)=2.30894,\quad Q_{1/2}(1,0)=0.86620
947
- $$
948
-
949
- At the midpoint, the potential values approximately 0.91138 and 1.05216 reweight the reference rates into 2.30894 toward state one and 0.86620 toward state zero.
950
-
951
- ## The conditional bridge supplies a rate target for DDSBM
952
-
953
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u066_r0)
954
-
955
- Conditioning on terminal state z reweights the reference jump rate.
956
-
957
- $$
958
- G_t^z(x,y)=G_t(x,y)\frac{K_{t1}(y,z)}{K_{t1}(x,z)},\qquad y\ne x
959
- $$
960
-
961
- Conditioning on endpoint z multiplies the reference rate from x to y by the reference probability of reaching z from y divided by the probability of reaching z from x.
962
-
963
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u066_r1)
964
-
965
- Average this rate over destinations consistent with the current state.
966
-
967
- $$
968
- Q_t^*(x,y)=\mathbb E_\Lambda[G_t^{X_1}(x,y)\mid X_t=x]
969
- $$
970
-
971
- The projected rate averages those endpoint-conditioned reference rates over the terminal states consistent with the mixture’s current state x.
972
-
973
- ## Rate matching penalizes excessive jumping
974
-
975
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u067_r0)
976
-
977
- Match each conditional rate r with a positive predicted rate q.
978
-
979
- $$
980
- \mathcal L=\mathbb E\int_0^1\sum_{y\ne X_t}\left[r_t^y\log\frac{r_t^y}{q_\theta^y}-r_t^y+q_\theta^y\right]dt
981
- $$
982
-
983
- The rate loss averages over paths the time integral, summed over possible destinations, of target rate r times log(r/q), minus r, plus the predicted positive rate q.
984
-
985
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u067_r1)
986
-
987
- Differentiating with respect to a positive predicted rate gives its conditional mean.
988
-
989
- $$
990
- \frac{\partial}{\partial q}\mathbb E[r\log(r/q)-r+q\mid X_t=x]=1-\frac{\mathbb E[r\mid X_t=x]}q=0
991
- $$
992
-
993
- Differentiating the conditional expected rate loss with respect to q gives one minus the conditional mean target rate divided by q, which vanishes when q equals that conditional mean.
994
-
995
- ## Markov projection learns adjacent conditionals
996
-
997
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u070_r0)
998
-
999
- Project a path distribution Λ onto the Markov chain defined by its adjacent conditionals.
1000
-
1001
- $$
1002
- \mathcal M(\Lambda)(x_{0:N})=\Lambda_0(x_0)\prod_{k=0}^{N-1}\Lambda(x_{k+1}\mid x_k)
1003
- $$
1004
-
1005
- The Markov projection assigns a path its original initial probability multiplied by the original mixture’s adjacent conditional probabilities at every step.
1006
-
1007
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u070_r1)
1008
-
1009
- A categorical cross-entropy learns each of those conditional distributions.
1010
-
1011
- $$
1012
- \min_\theta\ \mathbb E_\Lambda\left[-\sum_{k=0}^{N-1}\log q_\theta(X_{k+1}\mid X_k,k)\right]
1013
- $$
1014
-
1015
- The categorical objective minimizes the expectation under Λ of the sum of negative log probabilities that the learned transitions assign to the observed next states.
1016
-
1017
- ## The reciprocal step restores conditional paths
1018
-
1019
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u071_r0)
1020
-
1021
- Normalize the path product by the reference endpoint transition probability.
1022
-
1023
- $$
1024
- R(x_{1:N-1}\mid x_0,x_N)=\frac{\prod_{k=0}^{N-1}K_k(x_k,x_{k+1})}{K_{0N}(x_0,x_N)}
1025
- $$
1026
-
1027
- The probability of the intermediate reference path conditioned on its endpoints equals the product of its one-step transitions divided by the total reference transition probability between those endpoints.
1028
-
1029
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u071_r1)
1030
-
1031
- Keep the fitted endpoint coupling and restore the reference conditional paths.
1032
-
1033
- $$
1034
- \Lambda^{n+1}(x_{0:N})=M^n_{0N}(x_0,x_N)R(x_{1:N-1}\mid x_0,x_N)
1035
- $$
1036
-
1037
- The next reciprocal mixture multiplies the fitted joint endpoint probability by the reference probability of the intermediate path conditioned on that same endpoint pair.
1038
-
1039
- ## A reward expresses a preference over trajectories
1040
-
1041
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u077_r0)
1042
-
1043
- Let R be the pretrained path law and α control the cost of changing it.
1044
-
1045
- $$
1046
- \max_{P\ll R}\ \mathbb E_P[r(X_1)]-\alpha\operatorname{KL}(P\Vert R),\qquad \alpha>0
1047
- $$
1048
-
1049
- The objective maximizes expected terminal reward under P minus α times the path KL from P to the pretrained reference R, restricting P to trajectories supported by R.
1050
-
1051
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u077_r1)
1052
-
1053
- Exponentiating the terminal reward gives the optimal tilted law.
1054
-
1055
- $$
1056
- P^*(d\omega)=\frac{e^{r(X_1)/\alpha}}Z R(d\omega),\qquad Z=\mathbb E_R[e^{r(X_1)/\alpha}]
1057
- $$
1058
-
1059
- The optimal path law multiplies each reference trajectory’s probability by the exponential of its terminal reward divided by α, then divides by the reference expectation Z of that multiplier.
1060
-
1061
- ## The gap to the optimum is another KL divergence
1062
-
1063
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u078_r0)
1064
-
1065
- Insert log(dP*/dR)=r(X₁)/α−log Z into the relative entropy.
1066
-
1067
- $$
1068
- \mathbb E_P[r]-\alpha\operatorname{KL}(P\Vert R)=\alpha\log Z-\alpha\operatorname{KL}(P\Vert P^*)
1069
- $$
1070
-
1071
- Expected reward minus the reference KL penalty equals α times log Z minus α times KL to the optimally tilted path law, so the remaining gap is itself a KL penalty.
1072
-
1073
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u078_r1)
1074
-
1075
- Its terminal law is a reward-weighted version of the pretrained terminal distribution.
1076
-
1077
- $$
1078
- p_1^*(x)=\frac{p_1^R(x)e^{r(x)/\alpha}}Z
1079
- $$
1080
-
1081
- The optimal terminal density is the reference terminal density multiplied by the exponential reward factor and divided by the same normalizer Z.
1082
-
1083
- ## Three outcomes reveal the reward–reference tradeoff
1084
-
1085
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u079_r0)
1086
-
1087
- Suppose the base probabilities are (0.5,0.3,0.2) and the reward multipliers are (1,2,4).
1088
-
1089
- $$
1090
- p^R=(0.5,0.3,0.2),\quad r=\log(1,2,4),\quad \alpha=1,\quad Z=1.9
1091
- $$
1092
-
1093
- The reference assigns probabilities 0.5, 0.3, and 0.2, the exponentiated rewards multiply them by one, two, and four, and their resulting total mass is Z equal to 1.9.
1094
-
1095
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u079_r1)
1096
-
1097
- Multiply first, then normalize to obtain the desired terminal probabilities.
1098
-
1099
- $$
1100
- p^*=\frac{(0.5,0.6,0.8)}{1.9}=(0.26316,0.31579,0.42105)
1101
- $$
1102
-
1103
- Multiplying the reference masses by their reward factors gives 0.5, 0.6, and 0.8; dividing by their sum 1.9 gives the normalized target probabilities shown.
1104
-
1105
- ## A random fixed source needs conditional normalization
1106
-
1107
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u080_r0)
1108
-
1109
- A global terminal tilt changes a random initial law by its future reward potential.
1110
-
1111
- $$
1112
- P_0^*(x)=R_0(x)\frac{h_0(x)}Z,\qquad h_0(x)=\mathbb E_R[e^{r(X_1)/\alpha}\mid X_0=x]
1113
- $$
1114
-
1115
- A global terminal reward tilt multiplies each initial-state probability by its expected future reward multiplier h, then divides by the global normalizer Z.
1116
-
1117
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u080_r1)
1118
-
1119
- Keeping that initial law fixed instead requires conditional normalization.
1120
-
1121
- $$
1122
- \frac{d\widehat P}{dR}(\omega)=\frac{e^{r(X_1)/\alpha}}{h_0(X_0)}
1123
- $$
1124
-
1125
- To preserve the reference initial law instead, each path’s reward multiplier is divided by the future-reward normalizer conditioned on that path’s own starting state.
1126
-
1127
- ## Off-policy samples estimate weighted denoising
1128
-
1129
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u081_r0)
1130
-
1131
- For trajectories sampled from a proposal Pᵛ, use the target-to-proposal likelihood ratio.
1132
-
1133
- $$
1134
- w(\omega)=\frac{dP^*}{dP^v}(\omega)\propto e^{r(X_1)/\alpha}\frac{dR}{dP^v}(\omega)
1135
- $$
1136
-
1137
- The importance weight is the target path density divided by the proposal path density, proportional to the reward multiplier times the reference-to-proposal path likelihood ratio.
1138
-
1139
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u081_r1)
1140
-
1141
- The target expectation becomes a weighted expectation under the proposal.
1142
-
1143
- $$
1144
- \mathbb E_{P^*}[\mathcal L_{\rm denoise}(\theta;X_1)]=\mathbb E_{P^v}[w(\omega)\mathcal L_{\rm denoise}(\theta;X_1)]
1145
- $$
1146
-
1147
- The expected denoising loss under the target law equals the proposal expectation of that same loss multiplied by its normalized path importance weight.
1148
-
1149
- ## Matched masking schedules simplify the weight
1150
-
1151
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u082_r0)
1152
-
1153
- The paper accumulates log probabilities along the unmasking trajectory.
1154
-
1155
- $$
1156
- \log\widetilde w=\frac{r(X_1)}\alpha+\sum_{\ell\in\mathrm{unmasking\ events}}\log\frac{p_{\rm pre}(x_\ell\mid x_{<\ell})}{p_v(x_\ell\mid x_{<\ell})}
1157
- $$
1158
-
1159
- The log weight adds terminal reward divided by α to the sum, over unmasking events, of log pretrained-token probability divided by proposal-token probability under the visible context.
1160
-
1161
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u082_r1)
1162
-
1163
- Normalizing in log space avoids overflow and gives the weighted training loss.
1164
-
1165
- $$
1166
- \overline w_i=\frac{e^{\log\widetilde w_i}}{\sum_j e^{\log\widetilde w_j}},\qquad \widehat{\mathcal L}_{\rm WDCE}=\sum_i\overline w_i\,\mathcal L_{\rm denoise}(\theta;x_i)
1167
- $$
1168
-
1169
- Exponentiating and normalizing the log weights gives batch weights that sum to one, and the WDCE estimate sums each example’s denoising loss multiplied by its batch weight.
1170
-
1171
- ## The search score balances reward and exploration
1172
-
1173
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u084_r0)
1174
-
1175
- The selection score adds an exploration bonus to the accumulated reward.
1176
-
1177
- $$
1178
- U(s,a)=\frac{R(s,a)}{M\,N(s,a)}+c\,p_\theta(a\mid s)\frac{\sqrt{N(s)}}{1+N(s,a)}
1179
- $$
1180
-
1181
- The search score adds accumulated reward divided by M times the action visit count to an exploration bonus scaled by c, the model’s action prior, and the parent and action visit counts.
1182
-
1183
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u084_r1)
1184
-
1185
- Effective sample size measures how many paths contribute to the weighted update.
1186
-
1187
- $$
1188
- N_{\rm eff}=\frac{(\sum_i w_i)^2}{\sum_i w_i^2}=\frac1{\sum_i\overline w_i^2}
1189
- $$
1190
-
1191
- Effective sample size is the squared sum of unnormalized weights divided by their squared-weight sum, or equivalently the reciprocal of the squared normalized-weight sum.
1192
-
1193
- ## The interpolant preserves each branch’s endpoints
1194
-
1195
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u090_r0)
1196
-
1197
- The correction vanishes at both endpoints because it is multiplied by t(1−t).
1198
-
1199
- $$
1200
- I_t^k(x_0,x_1^k)=(1-t)x_0+tx_1^k+t(1-t)\phi_\eta^k(t,x_0,x_1^k)
1201
- $$
1202
-
1203
- The branch interpolant adds linear motion from the source to that branch’s endpoint to a learned correction multiplied by t times one minus t, which makes the correction zero at both ends.
1204
-
1205
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u090_r1)
1206
-
1207
- Differentiating all time-dependent terms gives the conditional velocity target.
1208
-
1209
- $$
1210
- \partial_t I_t^k=x_1^k-x_0+(1-2t)\phi_\eta^k+t(1-t)\partial_t\phi_\eta^k
1211
- $$
1212
-
1213
- The interpolant’s time derivative equals endpoint displacement plus the derivative of the correction’s time factor and the correction network’s own time derivative, by the product rule.
1214
-
1215
- ## A state cost can guide the route between endpoints
1216
-
1217
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u091_r0)
1218
-
1219
- The interpolant is trained with kinetic energy and a state-dependent path cost.
1220
-
1221
- $$
1222
- \mathcal L_{\rm traj}=\sum_k\mathbb E\int_0^1\left[\tfrac12\lVert\partial_t I_t^k\rVert^2+V_t(I_t^k)\right]dt
1223
- $$
1224
-
1225
- The trajectory loss sums over branches the expected time integral of half the squared interpolant speed plus the state-dependent cost V evaluated along that interpolant.
1226
-
1227
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u091_r1)
1228
-
1229
- A separate velocity model then matches the fitted conditional derivative.
1230
-
1231
- $$
1232
- \mathcal L_{\rm flow}=\sum_k\mathbb E\left\lVert u_\theta^k(t,I_t^k)-\partial_t I_t^k\right\rVert^2
1233
- $$
1234
-
1235
- The flow loss sums over branches the expected squared difference between the learned velocity evaluated on the interpolant and the interpolant’s time derivative.
1236
-
1237
- ## Branch weights record how much mass follows each trajectory
1238
-
1239
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u092_r0)
1240
-
1241
- The primary branch begins with unit mass and the secondary branches with zero.
1242
-
1243
- $$
1244
- w_0^0=1,\quad w_0^k=0\ (k>0),\qquad w_t^k=w_0^k+\int_0^t g_s^k\,ds
1245
- $$
1246
-
1247
- The primary branch starts with weight one and every secondary branch starts with zero, and each later branch weight equals its initial weight plus the integrated growth rate.
1248
-
1249
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u092_r1)
1250
-
1251
- A weighted mixture reconstructs the total population at each time.
1252
-
1253
- $$
1254
- \mu_t=\sum_k\mathbb E\!\left[w_t^k\,\delta_{X_t^k}\right],\qquad w_t^k\geq0
1255
- $$
1256
-
1257
- The population measure is the sum over branches of their expected point masses at their current states, each multiplied by a nonnegative branch weight.
1258
-
1259
- ## The weighted continuity equation includes growth
1260
-
1261
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u093_r0)
1262
-
1263
- Differentiate a weighted test function along a branch trajectory.
1264
-
1265
- $$
1266
- \frac d{dt}\mathbb E[w_t^k f(X_t^k)]=\mathbb E[g_t^k f(X_t^k)+w_t^k\nabla f(X_t^k)\cdot u_t^k]
1267
- $$
1268
-
1269
- The time derivative of a branch’s weighted test-function expectation has one term from growth changing its weight and another from velocity changing the test function along its motion.
1270
-
1271
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u093_r1)
1272
-
1273
- Choosing the constant function f=1 gives the conservation condition.
1274
-
1275
- $$
1276
- \frac d{dt}\mu_t(\mathcal X)=\sum_k\mathbb E[g_t^k],\qquad \sum_k g_t^k=0\ \Longrightarrow\ \mu_t(\mathcal X)=1
1277
- $$
1278
-
1279
- The total population mass changes at the sum of expected branch growth rates; starting from mass one, growth rates summing to zero conserve total mass one.
1280
-
1281
- ## We can allocate sixty percent to one destination
1282
-
1283
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u094_r0)
1284
-
1285
- Choose linear branch weights so that the source mass is gradually reassigned.
1286
-
1287
- $$
1288
- (w_t^0,w_t^1,w_t^2)=(1-t,\,0.6t,\,0.4t),\qquad (g_t^0,g_t^1,g_t^2)=(-1,0.6,0.4)
1289
- $$
1290
-
1291
- The primary branch loses weight at rate one while the other two gain weight at rates 0.6 and 0.4, producing weights one minus t, 0.6t, and 0.4t.
1292
-
1293
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u094_r1)
1294
-
1295
- At the midpoint and endpoint, every weight is nonnegative and the total stays one.
1296
-
1297
- $$
1298
- w_{1/2}=(0.5,0.3,0.2),\qquad w_1=(0,0.6,0.4),\qquad \sum_k w_t^k=1
1299
- $$
1300
-
1301
- The branch weights are (0.5, 0.3, 0.2) halfway through and (zero, 0.6, 0.4) at the endpoint, while their sum remains one at every time.
1302
-
1303
- ## Growth losses encourage valid branch masses
1304
-
1305
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u095_r0)
1306
-
1307
- The terminal matching term compares each final branch weight with its target.
1308
-
1309
- $$
1310
- \mathcal L_{\rm match}=\sum_k\mathbb E[(w_1^k-w_{\rm target}^k)^2]
1311
- $$
1312
-
1313
- The terminal matching loss sums, across branches, the expected squared difference between the branch’s final weight and its prescribed target weight.
1314
-
1315
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u095_r1)
1316
-
1317
- A separate penalty discourages incorrect total mass and negative branch weights.
1318
-
1319
- $$
1320
- \mathcal L_{\rm mass}=\mathbb E\int_0^1\left[(\sum_k w_t^k-w_{\rm total}(t))^2+\sum_k\max(0,-w_t^k)\right]dt
1321
- $$
1322
-
1323
- The mass penalty integrates the squared error in total branch weight plus the sum of negative-weight violations, then averages this quantity over the sampled trajectories.
1324
-
1325
- ## The underdamped reference evolves position and velocity
1326
-
1327
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u102_r0)
1328
-
1329
- Position changes according to the current velocity.
1330
-
1331
- $$
1332
- dr_i=v_i\,dt,\qquad \sigma_i=\sqrt{2\gamma k_BT/m_i}
1333
- $$
1334
-
1335
- A particle’s position increment is its velocity times the time increment, and its thermal noise scale is the square root of twice friction times thermal energy divided by mass.
1336
-
1337
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u102_r1)
1338
-
1339
- Forces, friction, learned bias, and thermal noise determine the velocity increment.
1340
-
1341
- $$
1342
- dv_i=[m_i^{-1}(-\nabla_iU(R)+b_i(R,V))-\gamma v_i]dt+\sigma_i\,dW_i
1343
- $$
1344
-
1345
- The velocity increment combines potential force and learned force bias divided by mass, subtracts friction proportional to velocity, and adds a Brownian increment scaled by the particle’s thermal noise.
1346
-
1347
- ## The control cost must use the units of the reference noise
1348
-
1349
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u103_r0)
1350
-
1351
- Write the drift change as σu so that u is measured relative to the noise covariance.
1352
-
1353
- $$
1354
- dZ_t=[a(Z_t)+\sigma(Z_t)u_\theta(Z_t)]dt+\sigma(Z_t)dW_t
1355
- $$
1356
-
1357
- The controlled state increment uses reference drift a plus noise matrix σ times a dimensionless control u, and the same matrix σ scales the Brownian increment.
1358
-
1359
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u103_r1)
1360
-
1361
- For the velocity equation above, a force bias corresponds to a noise-scaled control.
1362
-
1363
- $$
1364
- u_i=\frac{b_i}{\sqrt{2\gamma k_BT\,m_i}},\qquad \operatorname{KL}(P^u\Vert R)=\frac12\mathbb E_{P^u}\int_0^1\sum_i\lVert u_i\rVert^2dt
1365
- $$
1366
-
1367
- The force bias divided by its mass-and-noise scale gives control u; with matching initial laws, path KL is half the controlled expectation of the time-integrated sum of squared controls.
1368
-
1369
- ## The bias has aligned and perpendicular components
1370
-
1371
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u104_r0)
1372
-
1373
- Normalize the target gradient and project a free vector into its perpendicular space.
1374
-
1375
- $$
1376
- s_i=\nabla_i\log\pi_B,\quad \widehat s_i=s_i/\lVert s_i\rVert,\quad b_i=\operatorname{softplus}(\alpha_i)\widehat s_i+(I-\widehat s_i\widehat s_i^\top)h_i
1377
- $$
1378
-
1379
- For a nonzero target score s, the bias adds a positive softplus-scaled component along its normalized direction to the component of a free vector h perpendicular to that direction.
1380
-
1381
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u104_r1)
1382
-
1383
- The perpendicular component has zero dot product with the target gradient.
1384
-
1385
- $$
1386
- b_i\cdot s_i=\operatorname{softplus}(\alpha_i)\lVert s_i\rVert\geq0
1387
- $$
1388
-
1389
- The bias–score dot product is the positive softplus coefficient times the score norm, because the perpendicular component contributes zero, so their local alignment is nonnegative.
1390
-
1391
- ## A finite inward step still needs a step-size bound
1392
-
1393
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u105_r0)
1394
-
1395
- For a point target, write d=x★−x and expand the squared distance after a bias-only step.
1396
-
1397
- $$
1398
- \lVert d-\Delta t\,b\rVert^2-\lVert d\rVert^2=-2\Delta t\,d\cdot b+\Delta t^2\lVert b\rVert^2
1399
- $$
1400
-
1401
- The change in squared target distance after a bias-only step equals minus twice the step size times inward alignment plus the squared step size times squared bias magnitude.
1402
-
1403
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u105_r1)
1404
-
1405
- A positive inward component gives a sufficient upper bound on the step size.
1406
-
1407
- $$
1408
- 0\leq\Delta t\leq\frac{2d\cdot b}{\lVert b\rVert^2}\quad\Longrightarrow\quad \lVert x+\Delta t b-x^\star\rVert\leq\lVert x-x^\star\rVert
1409
- $$
1410
-
1411
- A nonnegative step size no larger than twice the inward dot product divided by squared bias magnitude ensures that the bias-only update does not increase distance to the point target.
1412
-
1413
- ## A two-dimensional calculation shows both parts of the bias
1414
-
1415
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u106_r0)
1416
-
1417
- Use displacement (3,4), free vector (2,−1), and aligned magnitude 0.8.
1418
-
1419
- $$
1420
- \widehat s=(0.6,0.8),\quad h_\perp=(1.76,-1.32),\quad b=0.8\widehat s+h_\perp=(2.24,-0.68)
1421
- $$
1422
-
1423
- Normalizing displacement (3,4) gives direction (0.6,0.8), projecting the free vector gives perpendicular component (1.76, minus 1.32), and adding the aligned component yields bias (2.24, minus 0.68).
1424
-
1425
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u106_r1)
1426
-
1427
- The dot product is positive, and a step of 0.1 reduces squared distance.
1428
-
1429
- $$
1430
- d\cdot b=4,\quad \Delta t_{\max}=1.45985,\quad \lVert d-0.1b\rVert^2=24.2548<25
1431
- $$
1432
-
1433
- The displacement–bias dot product is four, the maximum allowed step is approximately 1.45985, and using step 0.1 reduces squared target distance from 25 to 24.2548.
1434
-
1435
- ## Cross-entropy fits the target path distribution
1436
-
1437
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u107_r0)
1438
-
1439
- A terminal potential g defines a path law through a reference-relative tilt.
1440
-
1441
- $$
1442
- P^*(d\omega)=Z^{-1}g(X_1)R(d\omega)
1443
- $$
1444
-
1445
- The target path probability is its reference probability multiplied by the terminal potential g and divided by Z, the normalizer over reference trajectories.
1446
-
1447
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u107_r1)
1448
-
1449
- Cross-entropy minimizes KL from the target path law to the learned process.
1450
-
1451
- $$
1452
- \min_\theta\ -\mathbb E_{P^*}[\log p_\theta(\omega)]\quad\Longleftrightarrow\quad\min_\theta\operatorname{KL}(P^*\Vert P_\theta)
1453
- $$
1454
-
1455
- Minimizing the target expectation of negative learned path log likelihood is equivalent to minimizing KL from the fixed target path law to the learned path law.
1456
-
1457
- ## A terminal potential need not be the terminal density
1458
-
1459
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u108_r0)
1460
-
1461
- The terminal tilt multiplies the reference terminal density by its potential.
1462
-
1463
- $$
1464
- P_1^*(x)=\frac{R_1(x)g(x)}Z
1465
- $$
1466
-
1467
- The tilted terminal density equals the reference terminal density times the terminal potential g divided by the normalizer, so the potential itself is generally not the resulting density.
1468
-
1469
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u108_r1)
1470
-
1471
- For a one-endpoint constraint, a density ratio calibrates the tilt to the desired terminal law.
1472
-
1473
- $$
1474
- g(x)=\frac{\pi_B(x)}{R_1(x)}\quad\Longrightarrow\quad P_1^*(x)=\pi_B(x)
1475
- $$
1476
-
1477
- For the one-endpoint construction, choosing g as the desired density divided by the reference terminal density cancels that reference factor and gives the desired terminal density.
1478
-
1479
- ## Importance weights transfer the target expectation
1480
-
1481
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u109_r0)
1482
-
1483
- Let Pᵛ be the process that actually generated the replay trajectories.
1484
-
1485
- $$
1486
- \widetilde w(\omega)=g(X_1)\frac{dR}{dP^v}(\omega),\qquad \mathbb E_{P^*}[F]=\frac{\mathbb E_{P^v}[\widetilde wF]}{\mathbb E_{P^v}[\widetilde w]}
1487
- $$
1488
-
1489
- The unnormalized importance weight multiplies the terminal potential by the reference-to-proposal path density ratio; dividing the proposal’s weighted expectation by its mean weight recovers the target expectation.
1490
-
1491
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u109_r1)
1492
-
1493
- A batch gives a self-normalized estimate of the cross-entropy objective.
1494
-
1495
- $$
1496
- \widehat{\mathcal L}_{\rm CE}=\sum_i\overline w_i[-\log p_\theta(\omega_i)],\qquad \overline w_i=\operatorname{softmax}_i(\log\widetilde w)
1497
- $$
1498
-
1499
- The batch cross-entropy estimate sums each negative learned path log likelihood times its normalized importance weight, with those weights obtained by a softmax over log unnormalized weights.
1500
-
1501
- ## The transition density gives a practical loss
1502
-
1503
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u110_r0)
1504
-
1505
- An Euler transition has a controlled mean and a known covariance.
1506
-
1507
- $$
1508
- Z_{k+1}\mid Z_k\sim\mathcal N\!\left(Z_k+[a_k+\sigma_k u_\theta]\Delta t,\,\sigma_k\sigma_k^\top\Delta t\right)
1509
- $$
1510
-
1511
- The Euler transition is Gaussian with mean equal to the present state plus controlled drift times the step size, and covariance equal to σ times its transpose times that step size.
1512
-
1513
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u110_r1)
1514
-
1515
- Whitening its residual leaves a squared term plus constants independent of θ.
1516
-
1517
- $$
1518
- -\log p_\theta(Z_{k+1}\mid Z_k)=\frac1{2\Delta t}\left\lVert\sigma_k^+\!\left[\Delta Z_k-a_k\Delta t-\sigma_ku_\theta\Delta t\right]\right\rVert^2+C
1519
- $$
1520
-
1521
- The negative transition log likelihood is one over twice the step size times the squared noise-whitened residual after subtracting reference and control drift increments, plus constants independent of θ.
1522
-
1523
- ## Motion and jumps share a probability evolution law
1524
-
1525
- [Equation reading 1](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_end02_r0)
1526
-
1527
- The generator describes how expected test functions change.
1528
-
1529
- $$
1530
- \frac{d}{dt}\mathbb{E}_{p_t}[f(X)]=\mathbb{E}_{p_t}[\mathcal L_t f(X)]
1531
- $$
1532
-
1533
- The time derivative of the expectation of a test function f equals the expectation of the generator applied to f, both evaluated under the current probability law.
1534
-
1535
- [Equation reading 2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_end02_r1)
1536
-
1537
- For continuous states, drift and noise define the generator.
1538
-
1539
- $$
1540
- \mathcal L_t f=b_t\!\cdot\!\nabla f+\tfrac12\operatorname{tr}(a_t\nabla^2 f),\qquad a_t=\sigma_t\sigma_t^{\mathsf T}
1541
- $$
1542
-
1543
- For continuous states, the generator is drift dotted with the gradient of f plus one half the trace of noise covariance times the Hessian of f.
1544
-
1545
- [Equation reading 3](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_end02_r2)
1546
-
1547
- For discrete states, rates weight the possible changes.
1548
-
1549
- $$
1550
- \mathcal L_t f(x)=\sum_{y\ne x}q_t(x,y)\,[f(y)-f(x)]
1551
- $$
1552
-
1553
- For discrete states, the generator sums over possible destinations the jump rate from x to y multiplied by the change in the test function from f(x) to f(y).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/EXERCISES.md DELETED
@@ -1,47 +0,0 @@
1
- # Lecture 7 · Short exercises and answers
2
-
3
- These extensions use the same numerical examples as the lecture.
4
-
5
- 1. **Check the transport certificate.** With a=(0.6,0.4), b=(0.3,0.7), and C=[[1,9],[1,1]], verify that f=(0,−8), g=(1,9) is dual-feasible. Which entries of the optimal plan can carry mass?
6
-
7
- **Answer.** fᵢ+gⱼ≤Cᵢⱼ entrywise, with equality at (0,0), (0,1), (1,1). The remaining entry is strictly slack. The plan [[0.3,0.3],[0,0.4]] has cost 3.4, equal to a·f+b·g. Equality of primal and dual values certifies optimality.
8
-
9
- 2. **Perform one Sinkhorn cycle.** Set ε=2, K=exp(−C/ε), and v=(1,1). Compute u=a/(Kv), then v=b/(Kᵀu). Which constraint holds after the column update?
10
-
11
- **Answer.** u≈(0.971440,0.329744) and v≈(0.380128,3.320813). The resulting plan has column sums (0.3,0.7), while its row sums are approximately (0.259812,0.740188). The next row scaling corrects the row constraint and can disturb the columns again.
12
-
13
- 3. **Recover a path bridge.** For A=[[0.8,0.2],[0.3,0.7]], a=(0.5,0.5), b=(0.2,0.8), and two transitions, use g=(1,6). Compute h₂, h₁, h₀ and the transformed matrices.
14
-
15
- **Answer.** h₂=(1,6), h₁=(2,4.5), h₀=(2.5,3.75). Q₀=[[0.64,0.36],[0.16,0.84]] and Q₁=[[0.4,0.6],[1/15,14/15]]. The intermediate marginal is (0.4,0.6), followed by (0.2,0.8). A compatible initial potential is f=(0.4,4/15).
16
-
17
- 4. **Separate endpoints from paths.** In `discrete_imf_example`, print the two endpoint marginals before the first projection. Why is the initial path KL still positive?
18
-
19
- **Answer.** The initialization already uses a coupling with the correct marginals. Its conditional reference bridges can retain history after the endpoints are mixed. The Markov and reciprocal projections correct path dependence while preserving the endpoints.
20
-
21
- 5. **Check the score correction.** Substitute the displayed conditional velocity and score into vᶜ+εsᶜ/2. What happens if the factor 1/2 in the velocity is omitted?
22
-
23
- **Answer.** The correct expression simplifies to (x₁−x)/(1−t), the Brownian conditional forward drift. Omitting the factor changes the conditional probability flow and breaks this identity. The executable check uses multiple times, endpoints, and noise values.
24
-
25
- 6. **Change the Gaussian reference noise.** Compute c=(√(ε²+4)−ε)/2 for ε=0.1, 1, 10. What are the limiting couplings?
26
-
27
- **Answer.** c≈0.951249, 0.618034, 0.099020. As ε→0, c→1 and the equal-variance Gaussian coupling approaches the deterministic OT relation X₁=X₀+2. As ε→∞, c→0 and endpoint dependence weakens.
28
-
29
- 7. **Check a reward tilt.** Starting from (0.5,0.3,0.2), use reward log(1,2,4) and α=1. Does the same global tilt preserve every possible initial distribution?
30
-
31
- **Answer.** The terminal law is (0.5,0.6,0.8)/1.9. A deterministic initial state is preserved. A random initial law generally changes by h₀(x)/Z; preserving it instead requires normalization conditional on X₀. A separate terminal constraint requires the full Schrödinger system.
32
-
33
- 8. **Inspect search weighting.** Compare the actual recorded search proposal with the model’s unmasking likelihood. Why can substituting the latter change the objective?
34
-
35
- **Answer.** Search selection depends on node values and visit counts as well as policy predictions. Its sampling probability therefore differs from an ordinary model rollout. Importance weights require the law that actually produced the samples. The toy implementation records a full-support selection law and retains all rollouts; heuristic curation would need an additional correction to retain the exact identity.
36
-
37
- 9. **Check mass conservation.** Differentiate w=(1−t,0.6t,0.4t). Can small sampled mass penalties guarantee nonnegative weights at every time?
38
-
39
- **Answer.** g=(−1,0.6,0.4), so the total derivative is zero and every analytic weight is nonnegative on [0,1]. A soft loss evaluated at sampled times provides only an approximate constraint. Inspect the small residuals in the learned example and compare with the exact construction.
40
-
41
- 10. **Test an oversized cone step.** Use d=(3,4) and b=(2.24,−0.68). What is the largest bias-only step justified by the squared-distance argument?
42
-
43
- **Answer.** The bound is 2d·b/||b||²=8/5.48≈1.45985. At Δt=0.1, squared distance falls from 25 to 24.2548. A larger step than the bound can increase distance even though d·b>0. Independent noise adds a positive covariance contribution to expected squared distance.
44
-
45
- 11. **Read a benchmark carefully.** Does a better terminal FID prove a better path-space SB approximation? Does a higher target-hit percentage prove lower physical transition energy?
46
-
47
- **Answer.** Neither implication holds. Terminal FID ignores intermediate dependence and the reference path law. Target-hit probability and transition energy measure different properties. The lecture retains these distinctions in the CSBM, BranchSBM, and EntangledSBM results.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/MATHEMATICS.md DELETED
@@ -1,5 +0,0 @@
1
- # Mathematical walkthrough
2
-
3
- [Teaching notes](lecture7_ot_sbm_notes.md) contain the complete derivation sequence, literal equation readings, intuition, proof assumptions, numerical examples, and source links. [Equation readings](EQUATION_READINGS.md) link directly to the new reveal stages. [Slide-to-code map](SLIDE_CODE_MAP.md) connects implementations to their native slides. [Exercises](EXERCISES.md) provide small extensions and answers.
4
-
5
- For a compact starting point, run `python lecture_7/numerical_examples.py --output lecture_7/outputs/numerical`, then `python -m unittest discover -s lecture_7/tests -v`. The LP dual certificate, Sinkhorn marginals, finite bridge probabilities, CTMC master equation, and score-to-drift factor are checked independently of the neural training reports.
 
 
 
 
 
 
lecture_7/README.md DELETED
@@ -1,103 +0,0 @@
1
- # Lecture 7 · Optimal Transport and Schrödinger Bridges
2
-
3
- [Native lecture](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit) · [Slide code map](SLIDE_CODE_MAP.md) · [Equation readings](EQUATION_READINGS.md) · [Teaching notes](lecture7_ot_sbm_notes.md) · [Primary sources](SOURCES.md)
4
-
5
- We first solve OT and Sinkhorn problems, then construct continuous and discrete Schrödinger bridges and train the matching methods. The final lecture closes the course by connecting local dynamics, finite maps, endpoint couplings, and reference path laws.
6
-
7
- ## Run, save, and generate
8
-
9
- From the repository root:
10
-
11
- ```bash
12
- python -m pip install -r lecture_7/requirements.txt
13
- python lecture_7/run.py --method sf2m --out lecture_7/outputs/sf2m
14
- python lecture_7/run.py --mode sample --out lecture_7/outputs/sf2m
15
- python lecture_7/run_all.py --quick
16
- python -m unittest discover -s lecture_7/tests -v
17
- ```
18
-
19
- The default `train-sample` mode solves or trains, saves `checkpoint.pt`, and generates samples. `--mode train` only solves/trains and saves. `--mode sample --out RUN` reloads the checkpoint and generates again. Runs write `config.json`, `report.json`, `losses.json`, `samples.json`, `samples.txt`, and `generation_report.json`; reloads write `resampled.json`, `resampled.txt`, and `sample_report.json`. Exact methods save their solved probability objects; learned methods save their fitted parameters.
20
-
21
- ## All method commands
22
-
23
- ```bash
24
- python lecture_7/run.py --method ot --out lecture_7/outputs/ot
25
- python lecture_7/run.py --method sinkhorn --out lecture_7/outputs/sinkhorn
26
- python lecture_7/run.py --method finite-sb --out lecture_7/outputs/finite-sb
27
- python lecture_7/run.py --method discrete-imf --out lecture_7/outputs/discrete-imf
28
- python lecture_7/run.py --method ctmc-sb --out lecture_7/outputs/ctmc-sb
29
- python lecture_7/run.py --method gaussian-sb --out lecture_7/outputs/gaussian-sb
30
- python lecture_7/run.py --method reward-tilt --out lecture_7/outputs/reward-tilt
31
- python lecture_7/run.py --method branch-mass --out lecture_7/outputs/branch-mass
32
- python lecture_7/run.py --method cone-geometry --out lecture_7/outputs/cone-geometry
33
- python lecture_7/run.py --method dsb --out lecture_7/outputs/dsb
34
- python lecture_7/run.py --method dsbm --out lecture_7/outputs/dsbm
35
- python lecture_7/run.py --method sf2m --out lecture_7/outputs/sf2m
36
- python lecture_7/run.py --method tr2d2 --out lecture_7/outputs/tr2d2
37
- python lecture_7/run.py --method branch --out lecture_7/outputs/branch
38
- python lecture_7/run.py --method entangled --out lecture_7/outputs/entangled
39
- python lecture_7/run.py --method ddsbm --out lecture_7/outputs/ddsbm
40
- python lecture_7/run.py --method csbm --out lecture_7/outputs/csbm
41
- ```
42
-
43
- The 17 numbered files in `examples/` are independent entry points for those same methods. For example, `python lecture_7/examples/12_sf2m.py --quick` uses the common runner. `lecture7_examples.ipynb` provides an interactive walkthrough. All examples use synthetic data and run on CPU. They require no network access after installing dependencies.
44
-
45
- ## Training and sampling settings
46
-
47
- Use `--samples N` for the number of generated samples and `--seed S` for reproducibility. Sampling uses seed S plus 100. `--train-steps` applies to SF2M, Branch, DDSBM, and CSBM; `--rounds` to DSB and DSBM; `--epochs` to TR2-D2 and Entangled; and `--searches` to TR2-D2 rollouts. `--batch-size` applies only where the selected training function accepts it. Inapplicable flags produce a clear error.
48
-
49
- `--sample-steps` changes the grid for samplers that support it. DSB and DSBM checkpoints retain their fitted 80-step grid; finite CSBM and the fixed-reveal TR2-D2 model also retain their trained discrete grids. The exact finite-state CTMC sampler uses matrix-exponential Doob transitions; learned DDSBM uses a finite midpoint grid. `--quick` checks execution with shorter training and is not a quality result.
50
-
51
- Run `python lecture_7/run_all.py` to reproduce full training and verify seeded checkpoint reloads for every method. [Verified examples](verified_examples/README.md) contain the actual run records. The mathematical test runs 24 independent checks, including duality, endpoint marginals, path conditioning, master equations, score/flow factors, importance weights, and finite-step cone geometry.
52
-
53
- ## What each implementation demonstrates
54
-
55
- | File or function | Computation | Scope |
56
- |---|---|---|
57
- | `transport_example` | LP solution, dual certificate, stable Sinkhorn | Exact 2×2 teaching problem |
58
- | `finite_bridge_example` | Schrödinger potentials, Doob transitions, all paths | Exact two-state finite chain |
59
- | `discrete_imf_example` | Markov and reciprocal projections | Enumerates all sixteen paths |
60
- | `ctmc_bridge_example` | Matrix exponentials and Doob rates | Exact finite-state continuous-time bridge |
61
- | `gaussian_example` | Analytic covariance, mean, variance, drift | Brownian Gaussian bridge |
62
- | `dsb` | Original reverse-regression targets and endpoint resets | Affine models; finite Gaussian reverse kernels |
63
- | `dsbm` | Conditional Brownian drift regression and alternating directions | Affine fields; Monte Carlo and Euler approximation |
64
- | `sf2m` | Joint conditional velocity and score matching | Small MLP; exact Gaussian endpoint coupling |
65
- | `fit_ddsbm` | Conditional jump-rate divergence loss | Neural Markov projection at a known small SB coupling |
66
- | `fit_csbm` | Categorical transition cross-entropy | Full transition tables; known finite path weights |
67
- | `tr2d2` | Tree selection, expansion, rollout, backup, replay, WDCE | Abstract tokens; recorded full-support search proposal |
68
- | `branch` | Interpolant energy, velocity matching, growth, joint refinement | Three branches; fixed coupling; soft mass penalties |
69
- | `entangled` | Coupled cone bias, Euler path likelihood, weighted CE | Interacting abstract particles in normalized units |
70
-
71
- These implementations preserve the displayed objectives and training operations while using small model classes and tractable examples. They do not reproduce the papers’ benchmark architectures, datasets, or reported results.
72
-
73
- ## Distinctions to retain
74
-
75
- - Sinkhorn finds an endpoint coupling. A path law additionally needs conditional reference dynamics.
76
- - DSB and DSBM use different projection constructions. The examples explicitly implement both directions and reset the appropriate endpoint.
77
- - DDSBM uses continuous time and discrete states. CSBM here uses discrete time and discrete states. The exact outer IMF iteration and its learned inner projections are separated so they can be checked independently.
78
- - The TR2-D2 teaching search keeps all rollouts, uses full-support softmax selection, and records its actual proposal likelihood. This makes importance weighting inspectable. It differs from heuristic curation of a paper-scale replay buffer. A pure model likelihood ratio alone does not undo search selection.
79
- - Branching uses a fixed endpoint pairing in the toy interpolant. Its soft penalties leave small measurable mass errors, recorded in `verified_examples`. A conditional path optimization is not a proof of global optimality over all couplings.
80
- - Entangled control is expressed in noise-normalized units. The geometric guarantee applies to the bias contribution. The synthetic CE example uses a terminal potential and a fixed sampled initial law; it does not claim to enforce an arbitrary pair of endpoint densities.
81
- - Original paper figures and benchmark values in the lecture are attributed results. Course-generated plots come from the included computations.
82
-
83
- ## Lecture map
84
-
85
- | Section | Slides |
86
- |---|---|
87
- | Choosing an optimal transport | 2–70 |
88
- | Transport along a probability path | 71–84 |
89
- | Computing transport with Sinkhorn | 85–120 |
90
- | From a coupling to a Schrödinger bridge | 121–186 |
91
- | Continuous bridges and stochastic control | 187–241 |
92
- | Diffusion Schrödinger Bridge | 242–271 |
93
- | Diffusion Schrödinger Bridge Matching | 272–305 |
94
- | Simulation-free score and flow matching | 306–328 |
95
- | Bridges on discrete spaces | 329–382 |
96
- | Categorical Schrödinger Bridge Matching | 383–411 |
97
- | Reward-guided discrete bridges with TR2-D2 | 412–475 |
98
- | Branching Schrödinger Bridge Matching | 476–535 |
99
- | Entangled Schrödinger Bridge Matching | 536–616 |
100
- | Putting the formulations together | 617–629 |
101
- | Course wrap-up | 630–651 |
102
-
103
- `lecture7_ot_sbm_notes.md` includes every derivation sequence, proof note, source, and direct link to its completed native slide. `EXERCISES.md` includes short extensions and answers. `verified_examples/` contains the runs used to validate this delivery.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/SLIDE_CODE_MAP.md DELETED
@@ -1,35 +0,0 @@
1
- # Lecture 7 slide-to-code map
2
-
3
- Native links use stable IDs, so additional reading reveals preserve these destinations. Each displayed equation is followed by a literal reading and then its intuition. [All equation readings](EQUATION_READINGS.md).
4
-
5
- | Code walkthrough | Slides | Implementation |
6
- | --- | --- | --- |
7
- | Log-space updates remain stable for large costs | [115–117](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u020_b0) | `ot_sbm_examples.sinkhorn, transport_example` |
8
- | We can build this bridge with a few matrix operations | [184–186](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u032_b0) | `ot_sbm_examples.finite_bridge_example` |
9
- | The rollout gives us a reverse-regression target | [266–268](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u046_b0) | `learned_bridges.dsb` |
10
- | We can form both targets in a single training batch | [323–325](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u057_b0) | `learned_bridges.sf2m, sf2m_targets` |
11
- | We can compute this small jump bridge exactly | [360–362](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u064_b0) | `discrete_learning.fit_ddsbm; ot_sbm_examples.ctmc_bridge_example` |
12
- | We can enumerate the paths and watch IMF converge | [400–402](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u072_b0) | `discrete_learning.fit_csbm; ot_sbm_examples.discrete_imf_example` |
13
- | Weighted denoising learns from completed candidates | [467–469](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u085_b0) | `learned_bridges.tr2d2` |
14
- | Joint refinement combines energy and mass losses | [524–526](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u096_b0) | `learned_bridges.branch` |
15
- | The update uses detached trajectory weights | [605–607](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u111_b0) | `learned_bridges.entangled` |
16
-
17
- ## Method sections
18
-
19
- | Section | Native slide | Implementation |
20
- | --- | --- | --- |
21
- | Choosing an optimal transport | [2](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u001_b0) | `ot_sbm_examples` |
22
- | Transport along a probability path | [71](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u012_b0) | `ot_sbm_examples` |
23
- | Computing transport with Sinkhorn | [85](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u014_b0) | `ot_sbm_examples.sinkhorn, transport_example` |
24
- | From a coupling to a Schrödinger bridge | [121](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u023_b0) | `ot_sbm_examples.finite_bridge_example` |
25
- | Continuous bridges and stochastic control | [187](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u033_b0) | `ot_sbm_examples.finite_bridge_example` |
26
- | Diffusion Schrödinger Bridge | [242](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u042_b0) | `learned_bridges.dsb` |
27
- | Diffusion Schrödinger Bridge Matching | [272](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u048_b0) | `learned_bridges.dsbm` |
28
- | Simulation-free score and flow matching | [306](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u054_b0) | `learned_bridges.sf2m, sf2m_targets` |
29
- | Bridges on discrete spaces | [329](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u059_b0) | `discrete_learning.fit_ddsbm; ot_sbm_examples.ctmc_bridge_example` |
30
- | Categorical Schrödinger Bridge Matching | [383](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u069_b0) | `discrete_learning.fit_csbm; ot_sbm_examples.discrete_imf_example` |
31
- | Reward-guided discrete bridges with TR2-D2 | [412](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u076_b0) | `learned_bridges.tr2d2` |
32
- | Branching Schrödinger Bridge Matching | [476](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u088_b0) | `learned_bridges.branch` |
33
- | Entangled Schrödinger Bridge Matching | [536](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u100_b0) | `learned_bridges.entangled` |
34
- | Putting the formulations together | [617](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_u115_b0) | `ot_sbm_examples.finite_bridge_example` |
35
- | Course wrap-up | [630](https://docs.google.com/presentation/d/1JPu2QcklkWp77Ie5ibB7aSz15Q7wWxjGD8kh285r0Kc/edit#slide=id.os7_end01_b0) | `ot_sbm_examples.finite_bridge_example` |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/SOURCES.md DELETED
@@ -1,41 +0,0 @@
1
- # Primary sources and original code
2
-
3
- The versions below match the downloaded PDFs used for the lecture. Original figure locations are recorded in `source_manifest.json`. Code below was consulted or linked as the authoritative full implementation; course code is an independent synthetic teaching implementation.
4
-
5
- | Reference | Paper | Original code |
6
-
7
- |---|---|---|
8
-
9
- | Computational Optimal Transport — Peyré and Cuturi | [Paper](https://arxiv.org/abs/1803.00567v4) | — |
10
-
11
- | A computational fluid mechanics solution to the Monge–Kantorovich mass transfer problem — Benamou and Brenier | [Paper](https://doi.org/10.1007/s002110050002) | — |
12
-
13
- | Sinkhorn Distances — Cuturi | [Paper](https://arxiv.org/abs/1306.0895v1) | — |
14
-
15
- | Foundations of Schrödinger Bridges for Generative Modeling — Tang | [Guide](https://arxiv.org/abs/2603.18992v1) | — |
16
-
17
- | Diffusion Schrödinger Bridge with Applications to Score-Based Generative Modeling | [Paper](https://arxiv.org/abs/2106.01357v5) | [Repository](https://github.com/JTT94/diffusion_schrodinger_bridge) |
18
-
19
- | Diffusion Schrödinger Bridge Matching | [Paper](https://arxiv.org/abs/2303.16852v3) | [Repository](https://github.com/yuyang-shi/dsbm-pytorch) |
20
-
21
- | Simulation-Free Schrödinger Bridges via Score and Flow Matching | [Paper](https://arxiv.org/abs/2307.03672v3) | [Repository](https://github.com/atong01/conditional-flow-matching) |
22
-
23
- | Discrete Diffusion Schrödinger Bridge Matching for Graph Transformation | [Paper](https://arxiv.org/abs/2410.01500v2) | [Repository](https://github.com/junhkim1226/DDSBM) |
24
-
25
- | Categorical Schrödinger Bridge Matching | [Paper](https://arxiv.org/abs/2502.01416v2) | [Repository](https://github.com/gregkseno/csbm) |
26
-
27
- | TR2-D2: Tree Search Guided Trajectory-Aware Fine-Tuning for Discrete Diffusion | [Paper](https://arxiv.org/abs/2509.25171v1) | [Repository](https://huggingface.co/ChatterjeeLab/TR2-D2) |
28
-
29
- | Branched Schrödinger Bridge Matching | [Paper](https://arxiv.org/abs/2506.09007v2) | [Repository](https://huggingface.co/ChatterjeeLab/BranchSBM) |
30
-
31
- | Entangled Schrödinger Bridge Matching | [Paper](https://arxiv.org/abs/2511.07406v1) | [Repository](https://huggingface.co/ChatterjeeLab/EntangledSBM) |
32
-
33
- | A survey of the Schrödinger problem and some of its connections with optimal transport — Léonard | [Paper](https://arxiv.org/abs/1308.0215v1) | — |
34
-
35
-
36
-
37
- Historical context: Schrödinger (1931), Fortet (1940), Beurling (1960), and Sinkhorn (1964) are discussed and referenced in the Léonard, Peyré–Cuturi, and Tang readings. The slides derive the finite marginal constraints, dual certificate, kernel scaling, path-KL chain rule, Doob transforms, control cost, and matching projections before using them in the recent methods.
38
-
39
-
40
-
41
- Reported benchmark comparisons retain their metric definitions and computational differences. In particular, CSBM’s time-step and representation choices differ from its baselines; BranchSBM’s intermediate-time results are mixed; EntangledSBM’s control variants differ in conditioning and loss.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/check_examples.py DELETED
@@ -1,53 +0,0 @@
1
- """Independent numerical checks of the lecture's identities and saved runs."""
2
- import argparse,json
3
- from pathlib import Path
4
- import numpy as np
5
- import torch
6
- from scipy.linalg import expm
7
- from ot_sbm_examples import *
8
- from learned_bridges import sf2m_targets
9
-
10
- def main():
11
- parser=argparse.ArgumentParser();parser.add_argument('--results',default='results');args=parser.parse_args();out=Path(args.results);out.mkdir(parents=True,exist_ok=True);checks={}
12
- def check(name,value):
13
- checks[name]=bool(value)
14
- if not value:raise AssertionError(name)
15
- ot=transport_example();check('independent LP and dual certificate',abs(ot['ot_cost']-ot['dual'])<1e-10 and abs(ot['dual']-3.4)<1e-10)
16
- check('Sinkhorn endpoint constraints',np.allclose(ot['entropic_plan'].sum(1),ot['a']) and np.allclose(ot['entropic_plan'].sum(0),ot['b']))
17
- br=finite_bridge_example();check('Doob transition normalization',all(np.allclose(q.sum(1),1) for q in br['Q']))
18
- check('bridge endpoint and path normalization',np.allclose(br['marginals'][-1],[.2,.8]) and abs(br['bridge'].sum()-1)<1e-10)
19
- # Conditional path laws are identical when the two endpoints are fixed.
20
- for a in [0,1]:
21
- for b in [0,1]:
22
- ix=(br['paths'][:,0]==a)&(br['paths'][:,-1]==b)
23
- check(f'reference conditional bridges {a}{b}',np.allclose(br['bridge'][ix]/br['bridge'][ix].sum(),br['reference'][ix]/br['reference'][ix].sum()))
24
- imf=discrete_imf_example();check('IMF converges to full path law',imf['final_path_l1']<1e-10)
25
- check('IMF path KL is nonincreasing',np.max(np.diff(imf['kl_to_bridge']))<1e-12)
26
- # Independently differentiate analytic marginals to check the master equation.
27
- G=np.array([[-2.,2.],[1.,-1.]]);a=np.array([.5,.5]);b=np.array([.2,.8]);pi,f,g,_=sinkhorn(a,b,np.log(a[:,None]*expm(G)))
28
- p=lambda t:((a*f)@expm(t*G))*(expm((1-t)*G)@g)
29
- h=expm(.5*G)@g;Q=G*h[None,:]/h[:,None];np.fill_diagonal(Q,0);np.fill_diagonal(Q,-Q.sum(1))
30
- check('CTMC rates satisfy the independent master equation',np.allclose((p(.500001)-p(.499999))/.000002,p(.5)@Q,atol=1e-8))
31
- t=torch.tensor([[.1],[.3],[.8]],dtype=torch.float64);x0=torch.tensor([[0.],[1.],[-1.]],dtype=torch.float64);x1=x0+2;z=torch.tensor([[.7],[-.4],[1.2]],dtype=torch.float64)
32
- x,v,s,sd=sf2m_targets(t,x0,x1,z)
33
- check('conditional velocity plus score equals bridge drift',torch.allclose(v+.5*s,(x1-x)/(1-t)))
34
- rw=reward_bridge_example();check('exact path importance identity',np.allclose(rw['weighted_paths'],rw['target_paths']))
35
- bg=branching_example();check('analytic branch allocation is positive and conserved',np.min(bg['weights'])>=0 and np.allclose(bg['total_mass'],1))
36
- geo=entangled_geometry_example();check('cone projection and finite-step bound',abs(geo['orthogonal']@geo['unit_direction'])<1e-12 and geo['distance2_after']<geo['distance2_before'])
37
- d=geo['direction'];v=geo['bias'];dt=geo['max_dt']*1.1
38
- check('oversized inward step can increase distance',(d-dt*v)@(d-dt*v)>d@d)
39
- for key in ['dsb','dsbm','sf2m','tr2d2','branch','entangled']:
40
- path=out/(key+'_learned.json')
41
- if not path.exists():continue
42
- r=json.load(open(path))
43
- if key=='dsb':q=r['history'][-1];check('learned DSB Gaussian endpoint',abs(q['terminal_mean']-2)<.1 and abs(q['terminal_variance']-1)<.15)
44
- if key=='dsbm':check('learned DSBM Gaussian endpoint',abs(r['terminal_mean']-2)<.1 and abs(r['terminal_variance']-1)<.15)
45
- if key=='sf2m':check('learned SF2M fields and endpoint',r['velocity_mse']<.05 and r['score_mse']<.05 and abs(r['terminal_variance']-1)<.15)
46
- if key=='tr2d2':check('full-support search WDCE improves reference reward',r['history'][-1]['reward']>r['reference_reward'] and r['history'][-1]['target_l1']<.5)
47
- if key=='branch':check('soft branch constraints have small residuals',r['max_mass_error']<.02 and r['minimum_weight']>-.002)
48
- if key=='entangled':check('learned cone bias retains local alignment',r['min_bias_alignment']>=-1e-6)
49
- path=out/'discrete_learned_results.json'
50
- if path.exists():
51
- r=json.load(open(path));check('learned DDSBM rate projection',r['ddsbm']['relative_mse']<.08);check('learned CSBM transition projection',r['csbm']['maximum_transition_error']<.001)
52
- (out/'checks.json').write_text(json.dumps(checks,indent=2));print(len(checks),'checks passed')
53
- if __name__=='__main__':main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/data/README.md DELETED
@@ -1,4 +0,0 @@
1
- # Teaching data
2
-
3
- The examples generate their synthetic inputs locally from the seed recorded in `config.json`.
4
- OT and finite bridges use explicit two-state probability vectors. Gaussian bridges use one-dimensional normal samples. TR2-D2 uses the abstract tokens `circle`, `square`, and `triangle`. Branch and Entangled examples use abstract coordinates with explicit potentials. No external model, sequence dataset, or network download is required after installing dependencies.
 
 
 
 
 
lecture_7/discrete_learning.py DELETED
@@ -1,67 +0,0 @@
1
- """Learn the discrete Markov projections used inside DDSBM and CSBM.
2
- Run: python discrete_learning.py --output results
3
- The outer exact IMF loop is in ot_sbm_examples.py; this file tests learned
4
- rate/transition fitting at its known small bridge solution.
5
- """
6
- import argparse,json,math
7
- from pathlib import Path
8
- import numpy as np
9
- import torch
10
- from torch import nn
11
- from torch.nn import functional as F
12
- from ot_sbm_examples import ctmc_bridge_example,finite_bridge_example
13
- from learned_bridges import save_artifact
14
-
15
- torch.set_num_threads(1)
16
- def kernel(dt):
17
- z=torch.exp(-3*dt)
18
- return torch.stack([1/3+2*z/3,2*(1-z)/3,(1-z)/3,2/3+z/3],-1).reshape(-1,2,2)
19
-
20
- def rate_model():
21
- return nn.Sequential(nn.Linear(3,32),nn.SiLU(),nn.Linear(32,32),nn.SiLU(),nn.Linear(32,1),nn.Softplus())
22
-
23
- def fit_ddsbm(seed=13,updates=1400,batch=512,checkpoint=None):
24
- torch.manual_seed(seed);exact=ctmc_bridge_example();pi=torch.tensor(exact['coupling'].reshape(-1),dtype=torch.float32)
25
- K=kernel(torch.tensor([1.]))[0];Goff=torch.tensor([2.,1.]);model=rate_model();opt=torch.optim.Adam(model.parameters(),lr=.002)
26
- for _ in range(updates):
27
- pair=torch.multinomial(pi,batch,replacement=True);a=pair//2;z=pair%2;t=.02+.96*torch.rand(batch)
28
- left=kernel(t);right=kernel(1-t);idx=torch.arange(batch)
29
- # P(X_t=x | X_0=a, X_1=z) under the reference bridge.
30
- bridge=left[idx,a,:]*right[idx,:,z]/K[a,z,None]
31
- x=torch.multinomial(bridge,1).squeeze(1);y=1-x
32
- target=Goff[x]*right[idx,y,z]/right[idx,x,z]
33
- q=model(torch.cat([t[:,None],F.one_hot(x,2).float()],1)).squeeze(1)
34
- loss=(q-target*q.clamp_min(1e-8).log()).mean()
35
- opt.zero_grad();loss.backward();opt.step()
36
- # Compare predicted rates with the independently computed Doob transform.
37
- truth=[];pred=[]
38
- with torch.no_grad():
39
- for row in exact['values']:
40
- t=float(row['t'])
41
- for x in [0,1]:
42
- pred.append(float(model(torch.tensor([[t,float(x==0),float(x==1)]]))))
43
- truth.append(float(row['rates'][x,1-x]))
44
- rel=np.mean(((np.array(pred)-truth)/truth)**2)
45
- save_artifact(checkpoint,method='ddsbm',model=model.state_dict(),steps=100)
46
- return dict(predicted_off_diagonal_rates=pred,exact_off_diagonal_rates=truth,relative_mse=float(rel),
47
- approximation='Neural Markov rate projection for a known finite-state SB coupling; outer IMF is separately enumerated exactly.')
48
-
49
- def fit_csbm(seed=14,updates=600,checkpoint=None):
50
- torch.manual_seed(seed);ex=finite_bridge_example(steps=2);paths=torch.tensor(ex['paths']);mass=torch.tensor(ex['bridge'],dtype=torch.float32)
51
- logits=nn.Parameter(torch.zeros(2,2,2));opt=torch.optim.Adam([logits],lr=.04)
52
- for _ in range(updates):
53
- loss=torch.tensor(0.)
54
- for k in range(2):
55
- logq=logits[k].log_softmax(-1)
56
- loss-=torch.sum(mass*logq[paths[:,k],paths[:,k+1]])
57
- opt.zero_grad();loss.backward();opt.step()
58
- q=logits.softmax(-1).detach().numpy();truth=np.array(ex['Q']);p=np.array([.5,.5])
59
- for transition in q:p=p@transition
60
- save_artifact(checkpoint,method='csbm',transitions=torch.tensor(q),steps=2)
61
- return dict(transitions=q.tolist(),maximum_transition_error=float(abs(q-truth).max()),terminal=p.tolist(),
62
- approximation='Exact path-weighted categorical cross-entropy with a fully expressive transition table; no sampling error in this fit.')
63
-
64
- def main():
65
- parser=argparse.ArgumentParser();parser.add_argument('--output',default='results');args=parser.parse_args();out=Path(args.output);out.mkdir(parents=True,exist_ok=True)
66
- result={'ddsbm':fit_ddsbm(),'csbm':fit_csbm()};(out/'discrete_learned_results.json').write_text(json.dumps(result,indent=2));print(json.dumps(result,indent=2))
67
- if __name__=='__main__':main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/examples/01_ot.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete ot teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','ot',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/02_sinkhorn.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete sinkhorn teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','sinkhorn',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/03_finite_sb.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete finite-sb teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','finite-sb',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/04_discrete_imf.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete discrete-imf teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','discrete-imf',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/05_ctmc_sb.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete ctmc-sb teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','ctmc-sb',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/06_gaussian_sb.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete gaussian-sb teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','gaussian-sb',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/07_reward_tilt.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete reward-tilt teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','reward-tilt',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/08_branch_mass.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete branch-mass teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','branch-mass',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/09_cone_geometry.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete cone-geometry teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','cone-geometry',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/10_dsb.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete dsb teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','dsb',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/11_dsbm.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete dsbm teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','dsbm',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/12_sf2m.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete sf2m teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','sf2m',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/13_tr2d2.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete tr2d2 teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','tr2d2',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/14_branch.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete branch teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','branch',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/15_entangled.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete entangled teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','entangled',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/16_ddsbm.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete ddsbm teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','ddsbm',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/examples/17_csbm.py DELETED
@@ -1,7 +0,0 @@
1
- """Run the complete csbm teaching example; accepts the common runner flags."""
2
- import sys
3
- from pathlib import Path
4
- sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
5
- from run import main
6
- if __name__ == '__main__':
7
- main(['--method','csbm',*sys.argv[1:]])
 
 
 
 
 
 
 
 
lecture_7/learned_bridges.py DELETED
@@ -1,276 +0,0 @@
1
- """Small, runnable learning examples for CIS 6270 Lecture 7.
2
-
3
- These are synthetic teaching implementations of the stated objectives, not
4
- reproductions of the papers' architectures or benchmark results. Run
5
- python learned_bridges.py --method all --output results
6
- CPU, no dataset download, fixed seeds. See README.md for each approximation.
7
- """
8
- import argparse,itertools,json,math
9
- from pathlib import Path
10
- import numpy as np
11
- import torch
12
- from torch import nn
13
- from torch.nn import functional as F
14
- from ot_sbm_examples import serial,gaussian_example,finite_bridge_example
15
-
16
- torch.set_num_threads(1)
17
-
18
- def mlp(din,dout,width=48):
19
- return nn.Sequential(nn.Linear(din,width),nn.SiLU(),nn.Linear(width,width),nn.SiLU(),nn.Linear(width,dout))
20
-
21
- def affine_fit(x,y):
22
- slope=np.mean((x-x.mean())*(y-y.mean()))/np.var(x)
23
- return np.array([slope,y.mean()-slope*x.mean()])
24
-
25
- def apply_affine(coeff,x):return coeff[0]*x+coeff[1]
26
-
27
- def save_artifact(path, **state):
28
- """Save only tensors and primitive metadata for weights_only checkpoint loading."""
29
- if path is not None:
30
- path=Path(path);path.parent.mkdir(parents=True,exist_ok=True)
31
- torch.save(dict(schema_version=1,**state),path)
32
-
33
- def dsb(seed=7,rounds=8,steps=80,batch=16000,checkpoint=None):
34
- """Algorithm-1 reverse regression, affine maps, noise variance 2 dt."""
35
- rng=np.random.default_rng(seed);dt=1/steps
36
- forward=np.tile([1.,0.],(steps,1));backward=forward.copy();history=[]
37
- def rollout(coeff,mean):
38
- xs=[rng.normal(mean,1,batch)]
39
- for c in coeff:xs.append(apply_affine(c,xs[-1])+np.sqrt(2*dt)*rng.normal(size=batch))
40
- return np.stack(xs,1)
41
- for epoch in range(rounds):
42
- xs=rollout(forward,0.)
43
- for k in range(steps):
44
- x,y=xs[:,k],xs[:,k+1]
45
- # Paper Eq. 12: y + F_k(x) - F_k(y).
46
- target=y+apply_affine(forward[k],x)-apply_affine(forward[k],y)
47
- backward[steps-1-k]=affine_fit(y,target)
48
- ys=rollout(backward,2.)
49
- for j in range(steps):
50
- y,x=ys[:,j],ys[:,j+1]
51
- target=x+apply_affine(backward[j],y)-apply_affine(backward[j],x)
52
- forward[steps-1-j]=affine_fit(x,target)
53
- z=rollout(forward,0.)
54
- history.append(dict(iteration=epoch+1,terminal_mean=float(z[:,-1].mean()),terminal_variance=float(z[:,-1].var()),endpoint_covariance=float(np.cov(z[:,0],z[:,-1])[0,1])))
55
- save_artifact(checkpoint,method='dsb',forward=forward.tolist(),backward=backward.tolist(),steps=steps,epsilon=2.)
56
- return dict(history=history,reference_epsilon=2.,analytic_endpoint_covariance=math.sqrt(2)-1,
57
- approximation='Affine regression and finite-step Gaussian reverse kernels; both endpoint resets are executed.')
58
-
59
- def dsbm(seed=8,rounds=8,steps=80,batch=16000,checkpoint=None):
60
- """Alternating Brownian bridge regression, affine fields at grid midpoints.
61
-
62
- Forward/reverse endpoint resets control approximation drift. No rank matching
63
- or hidden endpoint correction is applied to the generated samples.
64
- """
65
- rng=np.random.default_rng(seed);dt=1/steps;eps=1.
66
- x0=rng.normal(0,1,batch);x1=rng.normal(2,1,batch);history=[]
67
- def fit_and_sample(a,b,start_mean,reverse):
68
- coefs=[]
69
- for k in range(steps):
70
- s=(k+.5)/steps;t=1-s if reverse else s
71
- xt=(1-t)*a+t*b+np.sqrt(eps*t*(1-t))*rng.normal(size=batch)
72
- target=(a-xt)/t if reverse else (b-xt)/(1-t)
73
- coefs.append(affine_fit(xt,target))
74
- start=rng.normal(start_mean,1,batch);x=start.copy()
75
- for c in coefs:x+=dt*apply_affine(c,x)+np.sqrt(eps*dt)*rng.normal(size=batch)
76
- return start,x,coefs
77
- for epoch in range(rounds):
78
- x0,x1,_=fit_and_sample(x0,x1,0.,False)
79
- y1,y0,backward=fit_and_sample(x0,x1,2.,True)
80
- x0,x1=y0,y1
81
- history.append(dict(iteration=epoch+1,source_mean=float(x0.mean()),source_variance=float(x0.var()),endpoint_covariance=float(np.cov(x0,x1)[0,1])))
82
- a,b,forward=fit_and_sample(x0,x1,0.,False)
83
- save_artifact(checkpoint,method='dsbm',forward=np.asarray(forward).tolist(),backward=np.asarray(backward).tolist(),steps=steps,epsilon=eps)
84
- return dict(history=history,terminal_mean=float(b.mean()),terminal_variance=float(b.var()),analytic_endpoint_covariance=(math.sqrt(5)-1)/2,
85
- approximation='Gaussian affine drift regression, finite Monte Carlo batches, midpoint coefficients with Euler sampling.')
86
-
87
- def sf2m_targets(t,x0,x1,z,epsilon=1.):
88
- m=(1-t)*x0+t*x1;sigma=(epsilon*t*(1-t)).sqrt();x=m+sigma*z
89
- v=x1-x0+(1-2*t)/(2*t*(1-t))*(x-m)
90
- score=-(x-m)/(epsilon*t*(1-t))
91
- return x,v,score,sigma
92
-
93
- def sf2m(seed=9,updates=1800,batch=512,checkpoint=None):
94
- torch.manual_seed(seed);model=mlp(2,2);opt=torch.optim.Adam(model.parameters(),lr=.002)
95
- c=(math.sqrt(5)-1)/2;history=[]
96
- for i in range(updates):
97
- x0=torch.randn(batch,1);x1=2+c*x0+math.sqrt(1-c*c)*torch.randn_like(x0)
98
- t=.02+.96*torch.rand_like(x0);x,v,s,sigma=sf2m_targets(t,x0,x1,torch.randn_like(x0))
99
- vp,sp=model(torch.cat([t,x],1)).chunk(2,1)
100
- loss=((vp-v).square()+(sigma*(sp-s)).square()).mean()
101
- opt.zero_grad();loss.backward();opt.step()
102
- if i%300==0:history.append(float(loss.detach()))
103
- with torch.no_grad():
104
- t=.05+.9*torch.rand(5000,1);var=(1-t)**2+t*t+2*t*(1-t)*c+t*(1-t)
105
- x=2*t+var.sqrt()*torch.randn_like(t);vp,sp=model(torch.cat([t,x],1)).chunk(2,1)
106
- # Continuity equation of N(2t,var(t)).
107
- dvar=(-2+4*t)+(2*c+1)*(1-2*t)
108
- vt=2+.5*dvar/var*(x-2*t);st=-(x-2*t)/var
109
- errors=dict(velocity_mse=float((vp-vt).square().mean()),score_mse=float((sp-st).square().mean()))
110
- y=torch.randn(6000,1);dt=1/160
111
- for k in range(160):
112
- tt=torch.full_like(y,(k+.5)*dt);v,s=model(torch.cat([tt,y],1)).chunk(2,1)
113
- y+=(v+.5*s)*dt+math.sqrt(dt)*torch.randn_like(y)
114
- save_artifact(checkpoint,method='sf2m',model=model.state_dict(),steps=160,epsilon=1.)
115
- return dict(loss_samples=history,**errors,terminal_mean=float(y.mean()),terminal_variance=float(y.var()),target_mean=2.,target_variance=1.,
116
- approximation='Small neural velocity/score, exact Gaussian endpoint coupling, finite-step Euler SDE.')
117
-
118
- class MaskedModel(nn.Module):
119
- def __init__(self,length=4,vocab=3):
120
- super().__init__();self.length=length;self.vocab=vocab
121
- self.net=mlp(length*(vocab+1),length*vocab)
122
- with torch.no_grad():
123
- self.net[-1].weight.zero_();self.net[-1].bias.copy_(torch.tensor([.5,.3,.2]).log().repeat(length))
124
- def forward(self,x):
125
- z=F.one_hot(x,self.vocab+1).float().flatten(1)
126
- return self.net(z).reshape(-1,self.length,self.vocab)
127
-
128
- def token_reward(x):
129
- return .35*(x==2).sum(-1).float()+.25*(x[...,1:]==x[...,:-1]).sum(-1).float()
130
-
131
- def tr2d2(seed=10,epochs=5,searches=450,checkpoint=None):
132
- """Small search + replay + WDCE analogue on abstract tokens.
133
-
134
- The search uses a fixed next-position order, a restricted MDM schedule. The
135
- full-support softmax selection probabilities are recorded in the proposal law.
136
- An exact finite reward-tilt calculation lives in ot_sbm_examples.py.
137
- """
138
- torch.manual_seed(seed);rng=np.random.default_rng(seed);model=MaskedModel();opt=torch.optim.Adam(model.parameters(),lr=.004);L=4;V=3;alpha=.6
139
- base=torch.tensor([.5,.3,.2]);allx=torch.tensor(list(itertools.product(range(V),repeat=L)))
140
- reference=base[allx].prod(-1);target=reference*torch.exp(token_reward(allx)/alpha);target/=target.sum();history=[]
141
- def prior(prefix):
142
- x=torch.full((1,L),V,dtype=torch.long);x[0,:len(prefix)]=torch.tensor(prefix,dtype=torch.long)
143
- with torch.no_grad():return model(x)[0,len(prefix)].softmax(-1).numpy()
144
- def sample_buffer():
145
- # Full-support softmax search, k=V. Record the actual selection law.
146
- # All rollouts are retained so no unrecorded curation changes the proposal.
147
- nodes={():[0,0.]};completed=[]
148
- for _ in range(searches):
149
- prefix=();visited=[()];logq=0.
150
- while len(prefix)<L:
151
- p=prior(prefix);children=[prefix+(j,) for j in range(V)]
152
- n=max(nodes[prefix][0],1)
153
- values=[]
154
- for j,ch in enumerate(children):
155
- visits,total=nodes.get(ch,[0,0.])
156
- values.append(total/max(visits,1)+1.1*p[j]*math.sqrt(n)/(1+visits))
157
- prob=np.exp(np.array(values)-max(values));prob/=prob.sum()
158
- j=int(rng.choice(V,p=prob));logq+=math.log(prob[j]);child=children[j]
159
- new=child not in nodes
160
- if new:nodes[child]=[0,0.]
161
- prefix=child;visited.append(prefix)
162
- if new:break
163
- while len(prefix)<L:
164
- p=prior(prefix);j=int(rng.choice(V,p=p));logq+=math.log(max(p[j],1e-12));prefix+=(j,)
165
- seq=torch.tensor(prefix);reward=float(token_reward(seq))
166
- for node in visited:nodes[node][0]+=1;nodes[node][1]+=reward
167
- completed.append((seq,logq))
168
- return torch.stack([z[0] for z in completed]),torch.tensor([z[1] for z in completed])
169
- def law():
170
- p=torch.ones(len(allx))
171
- with torch.no_grad():
172
- for k in range(L):
173
- masked=allx.clone();masked[:,k:]=V
174
- p*=model(masked)[:,k].softmax(-1).gather(1,allx[:,k,None]).squeeze(1)
175
- return p/p.sum()
176
- for epoch in range(epochs):
177
- seq,logp=sample_buffer();logw=token_reward(seq)/alpha+base[seq].log().sum(-1)-logp
178
- w=logw.softmax(0).detach()
179
- for _ in range(100):
180
- mask=torch.rand(seq.shape)<.5
181
- empty=~mask.any(dim=1)
182
- mask[empty,torch.randint(L,(int(empty.sum()),))]=True
183
- masked=seq.masked_fill(mask,V)
184
- ce=F.cross_entropy(model(masked).transpose(1,2),seq,reduction='none')
185
- per=(ce*mask).sum(-1)/mask.sum(-1);loss=(w*per).sum()
186
- opt.zero_grad();loss.backward();opt.step()
187
- p=law();history.append(dict(epoch=epoch+1,reward=float(p@token_reward(allx)),base_kl=float((p*(p/reference).log()).sum()),target_l1=float((p-target).abs().sum()),effective_samples=float(1/w.square().sum())))
188
- save_artifact(checkpoint,method='tr2d2',model=model.state_dict(),length=L,vocab=V,alpha=alpha,steps=L)
189
- return dict(history=history,reference_reward=float(reference@token_reward(allx)),exact_tilt_reward=float(target@token_reward(allx)),
190
- approximation='Full-support MCTS with its recorded selection/rollout proposal, finite-batch self-normalized WDCE, fixed reveal order. This replaces the paper-scale curated replay heuristic with a tractable proposal.')
191
-
192
- def branch(seed=11,updates=350,checkpoint=None):
193
- """Four-stage BranchSBM teaching analogue with a fixed endpoint coupling."""
194
- torch.manual_seed(seed);phi=mlp(6,2);velocity=mlp(6,2);growth=nn.Parameter(torch.tensor([-.8,.45,.3]));target_w=torch.tensor([0.,.6,.4]);w0=torch.tensor([1.,0.,0.])
195
- def batch(n=192):
196
- t=torch.rand(n,1,requires_grad=True);k=torch.randint(3,(n,));one=F.one_hot(k,3).float()
197
- x0=.12*torch.randn(n,2);centers=torch.tensor([[1.,0.],[1.,1.],[1.,-1.]])
198
- x1=centers[k]+.12*torch.randn(n,2);return t,k,one,x0,x1
199
- def interpolant(t,one,x0,x1):
200
- ph=phi(torch.cat([t,one,x0],1));x=(1-t)*x0+t*x1+t*(1-t)*ph
201
- dx=torch.cat([torch.autograd.grad(x[:,j].sum(),t,create_graph=True,retain_graph=True)[0] for j in range(2)],1)
202
- return x,dx
203
- def cost(x):return .3*torch.exp(-((x-torch.tensor([.5,0.]))**2).sum(-1)/.08)
204
- opt=torch.optim.Adam(phi.parameters(),lr=.002)
205
- for _ in range(updates):
206
- t,k,one,x0,x1=batch();x,dx=interpolant(t,one,x0,x1);loss=(.5*dx.square().sum(-1)+cost(x)).mean()
207
- opt.zero_grad();loss.backward();opt.step()
208
- opt=torch.optim.Adam(velocity.parameters(),lr=.002)
209
- for _ in range(updates):
210
- t,k,one,x0,x1=batch();x,dx=interpolant(t,one,x0,x1)
211
- pred=velocity(torch.cat([t.detach(),one,x.detach()],1));loss=(pred-dx.detach()).square().mean()
212
- opt.zero_grad();loss.backward();opt.step()
213
- opt=torch.optim.Adam([growth],lr=.01)
214
- def massloss(t):
215
- w=w0+t*growth;term=(w0+growth-target_w).square().mean()
216
- return term+((w.sum(-1)-1)**2).mean()+(-w).clamp_min(0).mean()
217
- for _ in range(updates):
218
- loss=massloss(torch.rand(100,1));opt.zero_grad();loss.backward();opt.step()
219
- opt=torch.optim.Adam(list(phi.parameters())+list(velocity.parameters())+[growth],lr=.0003)
220
- for _ in range(updates):
221
- t,k,one,x0,x1=batch();x,dx=interpolant(t,one,x0,x1);v=velocity(torch.cat([t,one,x],1))
222
- w=w0+t*growth;wk=w.gather(1,k[:,None]).squeeze(1)
223
- energy=(wk*(.5*v.square().sum(-1)+cost(x))).mean()
224
- loss=energy+20*massloss(t)+10*(v-dx).square().mean()
225
- opt.zero_grad();loss.backward();opt.step()
226
- t,k,one,x0,x1=batch(1000);x,dx=interpolant(t,one,x0,x1);v=velocity(torch.cat([t,one,x],1));w=w0+t*growth
227
- save_artifact(checkpoint,method='branch',interpolant=phi.state_dict(),model=velocity.state_dict(),growth=growth.detach(),steps=100)
228
- return dict(terminal_weights=(w0+growth).detach().tolist(),target_weights=target_w.tolist(),velocity_fit_mse=float((v-dx).square().mean().detach()),max_mass_error=float((w.sum(-1)-1).abs().max().detach()),minimum_weight=float(w.min().detach()),
229
- approximation='Small MLP interpolants, fixed synthetic endpoint coupling, linear growth, sampled soft mass constraints.')
230
-
231
- class CoupledCone(nn.Module):
232
- def __init__(self):
233
- super().__init__();self.net=mlp(5,3,32)
234
- with torch.no_grad():self.net[-1].weight.mul_(.01);self.net[-1].bias.copy_(torch.tensor([-3.,0.,0.]))
235
- def forward(self,t,x):
236
- mean=x.mean(1,keepdim=True).expand_as(x);tt=torch.full_like(x[...,:1],float(t))
237
- raw=self.net(torch.cat([x,mean,tt],-1));s=1.-x;norm=s.norm(dim=-1,keepdim=True)
238
- shat=s/norm.clamp_min(1e-8);h=raw[...,1:]
239
- bias=F.softplus(raw[...,:1])*shat+h-(h*shat).sum(-1,keepdim=True)*shat
240
- return torch.where(norm>1e-8,bias,torch.zeros_like(bias))
241
-
242
- def entangled(seed=12,epochs=60,batch=512,steps=16,checkpoint=None):
243
- """Interacting normalized particles, terminal potential, Euler path CE."""
244
- torch.manual_seed(seed);model=CoupledCone();opt=torch.optim.Adam(model.parameters(),lr=.002);dt=1/steps;sigma=.6;history=[]
245
- def base(x):return -.12*x-.35*(x-x.mean(1,keepdim=True))
246
- for epoch in range(epochs):
247
- states=[];nexts=[];lr=[];x=.3*torch.randn(batch,3,2)
248
- with torch.no_grad():
249
- for k in range(steps):
250
- a=base(x);u=model(k*dt,x);mean=x+(a+sigma*u)*dt
251
- y=mean+sigma*math.sqrt(dt)*torch.randn_like(x)
252
- r_ref=(y-x-a*dt)/(sigma*math.sqrt(dt));r_pro=(y-mean)/(sigma*math.sqrt(dt))
253
- lr.append(-.5*(r_ref.square()-r_pro.square()).sum((1,2)));states.append(x);nexts.append(y);x=y
254
- # A terminal potential, not a separately enforced terminal density.
255
- logg=-.5*((x-1.)**2).sum((1,2))/1.5
256
- logw=logg+torch.stack(lr,1).sum(1);w=logw.softmax(0).detach()
257
- path_nll=torch.zeros(batch)
258
- for k,(x,y) in enumerate(zip(states,nexts)):
259
- mean=x+(base(x)+sigma*model(k*dt,x))*dt
260
- path_nll+=.5*((y-mean)/(sigma*math.sqrt(dt))).square().sum((1,2))
261
- loss=(w*path_nll).sum();opt.zero_grad();loss.backward();opt.step()
262
- if epoch%10==0:history.append(dict(epoch=epoch+1,weighted_nll=float(loss.detach()),effective_samples=float(1/w.square().sum()),terminal_mean=float(nexts[-1].mean())))
263
- x=torch.randn(400,3,2);u=model(.5,x);alignment=(u*(1-x)).sum(-1)
264
- save_artifact(checkpoint,method='entangled',model=model.state_dict(),steps=steps,sigma=sigma)
265
- return dict(history=history,min_bias_alignment=float(alignment.min().detach()),
266
- approximation='Mean-field coupled network, synthetic overdamped Euler chain, self-normalized CE, terminal potential rather than an enforced density.')
267
-
268
- METHODS=dict(dsb=dsb,dsbm=dsbm,sf2m=sf2m,tr2d2=tr2d2,branch=branch,entangled=entangled)
269
- def main():
270
- p=argparse.ArgumentParser();p.add_argument('--method',choices=['all',*METHODS],default='all');p.add_argument('--output',default='results');args=p.parse_args();out=Path(args.output);out.mkdir(parents=True,exist_ok=True)
271
- result={}
272
- for key,fn in METHODS.items():
273
- if args.method not in ['all',key]:continue
274
- result[key]=fn();(out/(key+'_learned.json')).write_text(json.dumps(serial(result[key]),indent=2));print(key,'complete',flush=True)
275
- (out/'learned_results.json').write_text(json.dumps(serial(result),indent=2))
276
- if __name__=='__main__':main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/lecture7_examples.ipynb DELETED
@@ -1,288 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "metadata": {},
6
- "source": [
7
- "# Lecture 7 \u00b7 OT and Schr\u00f6dinger bridges\n",
8
- "Run from the extracted companion directory. Each cell can be rerun independently. See README for mathematical scope and approximation notes."
9
- ]
10
- },
11
- {
12
- "cell_type": "code",
13
- "metadata": {},
14
- "execution_count": null,
15
- "outputs": [],
16
- "source": [
17
- "from ot_sbm_examples import *\n",
18
- "from learned_bridges import *\n",
19
- "from discrete_learning import fit_ddsbm, fit_csbm"
20
- ]
21
- },
22
- {
23
- "cell_type": "markdown",
24
- "metadata": {},
25
- "source": [
26
- "## Transport and Sinkhorn"
27
- ]
28
- },
29
- {
30
- "cell_type": "code",
31
- "metadata": {},
32
- "execution_count": null,
33
- "outputs": [],
34
- "source": [
35
- "transport_example()"
36
- ]
37
- },
38
- {
39
- "cell_type": "markdown",
40
- "metadata": {},
41
- "source": [
42
- "## An exact finite bridge"
43
- ]
44
- },
45
- {
46
- "cell_type": "code",
47
- "metadata": {},
48
- "execution_count": null,
49
- "outputs": [],
50
- "source": [
51
- "finite_bridge_example()"
52
- ]
53
- },
54
- {
55
- "cell_type": "markdown",
56
- "metadata": {},
57
- "source": [
58
- "## Full path convergence"
59
- ]
60
- },
61
- {
62
- "cell_type": "code",
63
- "metadata": {},
64
- "execution_count": null,
65
- "outputs": [],
66
- "source": [
67
- "discrete_imf_example()"
68
- ]
69
- },
70
- {
71
- "cell_type": "markdown",
72
- "metadata": {},
73
- "source": [
74
- "## Continuous-time jump rates"
75
- ]
76
- },
77
- {
78
- "cell_type": "code",
79
- "metadata": {},
80
- "execution_count": null,
81
- "outputs": [],
82
- "source": [
83
- "ctmc_bridge_example()"
84
- ]
85
- },
86
- {
87
- "cell_type": "markdown",
88
- "metadata": {},
89
- "source": [
90
- "## An analytic Gaussian bridge"
91
- ]
92
- },
93
- {
94
- "cell_type": "code",
95
- "metadata": {},
96
- "execution_count": null,
97
- "outputs": [],
98
- "source": [
99
- "gaussian_example()"
100
- ]
101
- },
102
- {
103
- "cell_type": "markdown",
104
- "metadata": {},
105
- "source": [
106
- "## Reward tilting and importance weights"
107
- ]
108
- },
109
- {
110
- "cell_type": "code",
111
- "metadata": {},
112
- "execution_count": null,
113
- "outputs": [],
114
- "source": [
115
- "reward_bridge_example()"
116
- ]
117
- },
118
- {
119
- "cell_type": "markdown",
120
- "metadata": {},
121
- "source": [
122
- "## Mass allocation"
123
- ]
124
- },
125
- {
126
- "cell_type": "code",
127
- "metadata": {},
128
- "execution_count": null,
129
- "outputs": [],
130
- "source": [
131
- "branching_example()"
132
- ]
133
- },
134
- {
135
- "cell_type": "markdown",
136
- "metadata": {},
137
- "source": [
138
- "## The cone and finite-step bound"
139
- ]
140
- },
141
- {
142
- "cell_type": "code",
143
- "metadata": {},
144
- "execution_count": null,
145
- "outputs": [],
146
- "source": [
147
- "entangled_geometry_example()"
148
- ]
149
- },
150
- {
151
- "cell_type": "markdown",
152
- "metadata": {},
153
- "source": [
154
- "## Learned demonstration \u00b7 dsb"
155
- ]
156
- },
157
- {
158
- "cell_type": "code",
159
- "metadata": {},
160
- "execution_count": null,
161
- "outputs": [],
162
- "source": [
163
- "dsb()"
164
- ]
165
- },
166
- {
167
- "cell_type": "markdown",
168
- "metadata": {},
169
- "source": [
170
- "## Learned demonstration \u00b7 dsbm"
171
- ]
172
- },
173
- {
174
- "cell_type": "code",
175
- "metadata": {},
176
- "execution_count": null,
177
- "outputs": [],
178
- "source": [
179
- "dsbm()"
180
- ]
181
- },
182
- {
183
- "cell_type": "markdown",
184
- "metadata": {},
185
- "source": [
186
- "## Learned demonstration \u00b7 sf2m"
187
- ]
188
- },
189
- {
190
- "cell_type": "code",
191
- "metadata": {},
192
- "execution_count": null,
193
- "outputs": [],
194
- "source": [
195
- "sf2m()"
196
- ]
197
- },
198
- {
199
- "cell_type": "markdown",
200
- "metadata": {},
201
- "source": [
202
- "## Learned demonstration \u00b7 tr2d2"
203
- ]
204
- },
205
- {
206
- "cell_type": "code",
207
- "metadata": {},
208
- "execution_count": null,
209
- "outputs": [],
210
- "source": [
211
- "tr2d2()"
212
- ]
213
- },
214
- {
215
- "cell_type": "markdown",
216
- "metadata": {},
217
- "source": [
218
- "## Learned demonstration \u00b7 branch"
219
- ]
220
- },
221
- {
222
- "cell_type": "code",
223
- "metadata": {},
224
- "execution_count": null,
225
- "outputs": [],
226
- "source": [
227
- "branch()"
228
- ]
229
- },
230
- {
231
- "cell_type": "markdown",
232
- "metadata": {},
233
- "source": [
234
- "## Learned demonstration \u00b7 entangled"
235
- ]
236
- },
237
- {
238
- "cell_type": "code",
239
- "metadata": {},
240
- "execution_count": null,
241
- "outputs": [],
242
- "source": [
243
- "entangled()"
244
- ]
245
- },
246
- {
247
- "cell_type": "markdown",
248
- "metadata": {},
249
- "source": [
250
- "## Learned demonstration \u00b7 fit_ddsbm"
251
- ]
252
- },
253
- {
254
- "cell_type": "code",
255
- "metadata": {},
256
- "execution_count": null,
257
- "outputs": [],
258
- "source": [
259
- "fit_ddsbm()"
260
- ]
261
- },
262
- {
263
- "cell_type": "markdown",
264
- "metadata": {},
265
- "source": [
266
- "## Learned demonstration \u00b7 fit_csbm"
267
- ]
268
- },
269
- {
270
- "cell_type": "code",
271
- "metadata": {},
272
- "execution_count": null,
273
- "outputs": [],
274
- "source": [
275
- "fit_csbm()"
276
- ]
277
- }
278
- ],
279
- "metadata": {
280
- "kernelspec": {
281
- "display_name": "Python 3",
282
- "language": "python",
283
- "name": "python3"
284
- }
285
- },
286
- "nbformat": 4,
287
- "nbformat_minor": 5
288
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/lecture7_ot_sbm_notes.md DELETED
The diff for this file is too large to render. See raw diff
 
lecture_7/lecture_core.py DELETED
@@ -1,4 +0,0 @@
1
- """Mathematical operations shared by the Lecture 7 examples."""
2
- from ot_sbm_examples import sinkhorn, transport_example, finite_bridge_example, discrete_imf_example, ctmc_bridge_example, gaussian_example, reward_bridge_example, branching_example, entangled_geometry_example
3
- from learned_bridges import sf2m_targets
4
- from sampling import generate
 
 
 
 
 
lecture_7/numerical_examples.py DELETED
@@ -1,4 +0,0 @@
1
- """Run the exact lecture calculations using the same CLI as ot_sbm_examples.py."""
2
- from ot_sbm_examples import *
3
- if __name__ == '__main__':
4
- main()
 
 
 
 
 
lecture_7/ot_sbm_examples.py DELETED
@@ -1,165 +0,0 @@
1
- """CIS 6270 Lecture 7. Small, executable OT and bridge calculations.
2
-
3
- Run: python ot_sbm_examples.py --output results
4
- The examples use synthetic distributions. Paper-scale benchmarks remain in
5
- original repositories. Every displayed numerical result is recomputed here.
6
- """
7
- from pathlib import Path
8
- import argparse,itertools,json
9
- import numpy as np
10
- from scipy.special import logsumexp
11
- from scipy.optimize import linprog
12
- from scipy.linalg import expm
13
-
14
-
15
- def sinkhorn(a,b,log_kernel,iterations=2000,tol=1e-12):
16
- """Scale a positive kernel to prescribed marginals in log space."""
17
- a,b=np.asarray(a,float),np.asarray(b,float)
18
- if np.any(a<=0) or np.any(b<=0):raise ValueError('Use positive marginals on the retained support.')
19
- if not np.isclose(a.sum(),b.sum()):raise ValueError('Marginals must have equal mass.')
20
- log_v=np.zeros_like(b);history=[]
21
- for k in range(iterations):
22
- log_u=np.log(a)-logsumexp(log_kernel+log_v[None,:],axis=1)
23
- log_v=np.log(b)-logsumexp(log_kernel+log_u[:,None],axis=0)
24
- pi=np.exp(log_u[:,None]+log_kernel+log_v[None,:])
25
- error=max(abs(pi.sum(1)-a).max(),abs(pi.sum(0)-b).max())
26
- history.append(float(error))
27
- if error<tol:break
28
- return pi,np.exp(log_u),np.exp(log_v),history
29
-
30
-
31
- def transport_example():
32
- a=np.array([.6,.4]);b=np.array([.3,.7]);C=np.array([[1.,9.],[1.,1.]])
33
- A=np.array([[1,1,0,0],[0,0,1,1],[1,0,1,0],[0,1,0,1]])
34
- fit=linprog(C.ravel(),A_eq=A,b_eq=np.r_[a,b],bounds=(0,None),method='highs')
35
- assert fit.success
36
- pi,u,v,history=sinkhorn(a,b,-C/2)
37
- K=np.exp(-C/2);u1=a/K.sum(1);v1=b/(K.T@u1)
38
- f=np.array([0.,-8.]);g=np.array([1.,9.])
39
- dual=float(a@f+b@g)
40
- return dict(a=a,b=b,cost=C,plan=fit.x.reshape(2,2),ot_cost=fit.fun,dual=dual,
41
- entropic_plan=pi,entropic_cost=float((pi*C).sum()),kernel=K,
42
- first_u=u1,first_v=v1,first_plan=u1[:,None]*K*v1[None,:],
43
- marginal_errors=history)
44
-
45
-
46
- def finite_bridge_example(steps=2):
47
- a=np.array([.5,.5]);b=np.array([.2,.8]);R=np.array([[.8,.2],[.3,.7]])
48
- K=np.linalg.matrix_power(R,steps)
49
- pi,u,v,_=sinkhorn(a,b,np.log(a[:,None]*K))
50
- h=[np.linalg.matrix_power(R,steps-k)@v for k in range(steps+1)]
51
- Q=[R*h[k+1][None,:]/h[k][:,None] for k in range(steps)]
52
- p=[a]
53
- for q in Q:p.append(p[-1]@q)
54
- paths=np.array(list(itertools.product(range(2),repeat=steps+1)))
55
- ref=np.array([a[x[0]]*np.prod([R[x[k],x[k+1]] for k in range(steps)]) for x in paths])
56
- star=np.array([ref[i]*u[x[0]]*v[x[-1]] for i,x in enumerate(paths)])
57
- kl=float(np.sum(star*np.log(star/ref)))
58
- return dict(R=R,K=K,pi=pi,u=u,v=v,h=h,Q=Q,marginals=p,paths=paths,reference=ref,bridge=star,kl=kl)
59
-
60
-
61
- def discrete_imf_example(steps=3,iterations=80):
62
- """Exact Markovian and reciprocal projections on a 16-path space."""
63
- a=np.array([.5,.5]);b=np.array([.2,.8]);R=np.array([[.8,.2],[.3,.7]])
64
- paths=np.array(list(itertools.product(range(2),repeat=steps+1)))
65
- ref=np.array([a[x[0]]*np.prod([R[x[k],x[k+1]] for k in range(steps)]) for x in paths])
66
- joint=a[:,None]*np.linalg.matrix_power(R,steps)
67
- pi,_,_,_=sinkhorn(a,b,np.log(joint))
68
- star=np.array([ref[i]*pi[x[0],x[-1]]/joint[x[0],x[-1]] for i,x in enumerate(paths)])
69
- p=np.array([ref[i]*a[x[0]]*b[x[-1]]/joint[x[0],x[-1]] for i,x in enumerate(paths)])
70
- hist=[]
71
- for it in range(iterations):
72
- qs=[]
73
- for k in range(steps):
74
- J=np.zeros((2,2))
75
- for mass,x in zip(p,paths):J[x[k],x[k+1]]+=mass
76
- qs.append(J/J.sum(1,keepdims=True))
77
- m=np.array([a[x[0]]*np.prod([qs[k][x[k],x[k+1]] for k in range(steps)]) for x in paths])
78
- end=np.zeros((2,2))
79
- for mass,x in zip(m,paths):end[x[0],x[-1]]+=mass
80
- p=np.array([ref[i]*end[x[0],x[-1]]/joint[x[0],x[-1]] for i,x in enumerate(paths)])
81
- hist.append(float(np.sum(p*np.log(p/star))))
82
- return dict(kl_to_bridge=hist,final_path_l1=float(abs(p-star).sum()),paths=paths,bridge=star,final=p)
83
-
84
-
85
- def ctmc_bridge_example():
86
- """Doob rates and exact marginal verification with matrix exponentials."""
87
- a=np.array([.5,.5]);b=np.array([.2,.8]);G=np.array([[-2.,2.],[1.,-1.]])
88
- K=expm(G);pi,u,v,_=sinkhorn(a,b,np.log(a[:,None]*K))
89
- values=[]
90
- for t in [0,.25,.5,.75,1]:
91
- h=expm((1-t)*G)@v
92
- forward=(a*u)@expm(t*G)
93
- p=forward*h
94
- rate=G*h[None,:]/h[:,None]
95
- np.fill_diagonal(rate,0);np.fill_diagonal(rate,-rate.sum(1))
96
- values.append(dict(t=t,h=h,p=p,rates=rate))
97
- return dict(generator=G,transition=K,coupling=pi,values=values)
98
-
99
-
100
- def gaussian_example(epsilon=1.):
101
- """Brownian reference dX=sqrt(epsilon)dW, N(0,1) to N(2,1)."""
102
- covariance=(np.sqrt(epsilon**2+4)-epsilon)/2
103
- t=np.linspace(0,1,101)
104
- variance=(1-t)**2+t*t+2*t*(1-t)*covariance+epsilon*t*(1-t)
105
- # Forward Markov drift beta=(y-x)/(1-t) averaged conditionally on X_t.
106
- cov_yx=(1-t)*covariance+t
107
- slope=(cov_yx/variance-1)/np.maximum(1-t,1e-10)
108
- slope[-1]=1-covariance-epsilon
109
- intercept=2-slope*(2*t)
110
- return dict(t=t,mean=2*t,variance=variance,covariance=covariance,slope=slope,intercept=intercept)
111
-
112
-
113
- def reward_bridge_example():
114
- """A fully masked root has one initial state, so terminal tilting preserves it."""
115
- base=np.array([.5,.3,.2]);reward=np.log(np.array([1.,2.,4.]));alpha=1.
116
- target=base*np.exp(reward/alpha);target/=target.sum()
117
- ref_path=np.array([.3,.2,.18,.12,.12,.08])
118
- terminal=np.array([0,0,1,1,2,2])
119
- tilted=ref_path*np.exp(reward[terminal]);tilted/=tilted.sum()
120
- proposal=np.array([.1,.1,.15,.15,.2,.3])
121
- log_weight=reward[terminal]+np.log(ref_path)-np.log(proposal)
122
- exact=np.sum(proposal*np.exp(log_weight))
123
- weighted=proposal*np.exp(log_weight)/exact
124
- return dict(base=base,reward=reward,target=target,reference_paths=ref_path,
125
- target_paths=tilted,proposal=proposal,log_weight=log_weight,weighted_paths=weighted,
126
- kl=float(np.sum(target*np.log(target/base))))
127
-
128
-
129
- def branching_example():
130
- """Exact illustrative mass transfer; neural four-stage version is separate."""
131
- t=np.linspace(0,1,101);w=np.stack([1-t,.6*t,.4*t],1)
132
- growth=np.tile([-1.,.6,.4],(len(t),1))
133
- x=np.stack([t,.7*t+1.2*t*t,.7*t-1.2*t*t],1)
134
- return dict(t=t,weights=w,growth=growth,positions=x,total_mass=w.sum(1),midpoint_weights=w[50])
135
-
136
-
137
- def entangled_geometry_example():
138
- """Check the cone guarantee for the bias increment, separately from noise."""
139
- s=np.array([3.,4.]);shat=s/np.linalg.norm(s);h=np.array([2.,-1.]);alpha=.8
140
- orthogonal=h-shat*(shat@h);bias=alpha*shat+orthogonal
141
- max_dt=2*(s@bias)/(bias@bias)
142
- dt=.1;before=s@s;after=(s-dt*bias)@(s-dt*bias)
143
- return dict(direction=s,unit_direction=shat,orthogonal=orthogonal,bias=bias,
144
- alignment=float(s@bias),max_dt=float(max_dt),dt=dt,distance2_before=float(before),distance2_after=float(after))
145
-
146
-
147
- def serial(x):
148
- if isinstance(x,np.ndarray):return x.tolist()
149
- if isinstance(x,np.generic):return x.item()
150
- if isinstance(x,dict):return {k:serial(v) for k,v in x.items()}
151
- if isinstance(x,(tuple,list)):return [serial(v) for v in x]
152
- return x
153
-
154
-
155
- def main():
156
- parser=argparse.ArgumentParser();parser.add_argument('--output',default='results');args=parser.parse_args()
157
- out=Path(args.output);out.mkdir(parents=True,exist_ok=True)
158
- results={k:f() for k,f in [('transport',transport_example),('finite_bridge',finite_bridge_example),
159
- ('discrete_imf',discrete_imf_example),('ctmc',ctmc_bridge_example),('gaussian',gaussian_example),
160
- ('reward',reward_bridge_example),('branch',branching_example),('entangled',entangled_geometry_example)]}
161
- (out/'results.json').write_text(json.dumps(serial(results),indent=2))
162
- for k,v in results.items():print(k,'complete')
163
- print('OT cost',results['transport']['ot_cost'],'bridge terminal',results['finite_bridge']['marginals'][-1],
164
- 'IMF path L1',results['discrete_imf']['final_path_l1'])
165
- if __name__=='__main__':main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/paper_manifest.json DELETED
@@ -1,84 +0,0 @@
1
- [
2
- {
3
- "key": "ot",
4
- "id": "1803.00567",
5
- "pages": 209,
6
- "bytes": 42429657,
7
- "sha256": "5292a1fc53631ac28fdbcccecc060de8e072b3008fb8d36c22d963a8f6a06bac"
8
- },
9
- {
10
- "key": "leonard",
11
- "id": "1308.0215",
12
- "pages": 40,
13
- "bytes": 563944,
14
- "sha256": "984cf900e88f24d0ac66b9b5470fba809e7c1f53f60088c606718b186f820383"
15
- },
16
- {
17
- "key": "sinkhorn",
18
- "id": "1306.0895",
19
- "pages": 13,
20
- "bytes": 1004298,
21
- "sha256": "f666b9bce6bbe0111fbaa49d550c7c58a53da11f5e62bdb547b422b83414f20f"
22
- },
23
- {
24
- "key": "dsb",
25
- "id": "2106.01357",
26
- "pages": 59,
27
- "bytes": 7837737,
28
- "sha256": "9114b8cccb39e43929e11f4c3c62e970b8f3ac9b22cfd356ab98618d952ecb13"
29
- },
30
- {
31
- "key": "dsbm",
32
- "id": "2303.16852",
33
- "pages": 41,
34
- "bytes": 19927420,
35
- "sha256": "fc6ccc41bbfd488bd4f466843d062e0c26290989f55c2820ff448482b752e50d"
36
- },
37
- {
38
- "key": "sf2m",
39
- "id": "2307.03672",
40
- "pages": 29,
41
- "bytes": 8637684,
42
- "sha256": "4b492b1d7b03f377e04c91d672578a4708b5bb908a7a7cc1bd311e5de2750a55"
43
- },
44
- {
45
- "key": "ddsbm",
46
- "id": "2410.01500",
47
- "pages": 47,
48
- "bytes": 19051444,
49
- "sha256": "1c1be11bca4d5c41fda6fca33406dbdb62c03789543066d576aac206e632cac9"
50
- },
51
- {
52
- "key": "csbm",
53
- "id": "2502.01416v2",
54
- "pages": 25,
55
- "bytes": 16138848,
56
- "sha256": "79900c0ae062f85de7e69f00940d4138d4643b32901816fed3f4d27af7d8e842"
57
- },
58
- {
59
- "key": "tr2d2",
60
- "id": "2509.25171v1",
61
- "pages": 43,
62
- "bytes": 18367267,
63
- "sha256": "1cc5491662165722260dcd15e51a4d538e10139fa2a3c711d70e01905097fb66"
64
- },
65
- {
66
- "key": "branch",
67
- "id": "2506.09007v2",
68
- "pages": 44,
69
- "bytes": 24469143,
70
- "sha256": "356636912b02109cf4c7244f861e52f6af3ec7623ee7d30623e31995a3f7f2d2"
71
- },
72
- {
73
- "key": "entangled",
74
- "id": "2511.07406v1",
75
- "pages": 33,
76
- "bytes": 34098755,
77
- "sha256": "60666c6e75c9a8ecc58444822423b17e4861a7979ef18494827ac1eb79078884"
78
- },
79
- {
80
- "key": "foundations",
81
- "id": "2603.18992v1",
82
- "pages": 220
83
- }
84
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/requirements.txt DELETED
@@ -1,3 +0,0 @@
1
- torch==2.9.1
2
- numpy>=1.24
3
- scipy>=1.10
 
 
 
 
lecture_7/run.py DELETED
@@ -1,110 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Solve or train, save, reload, and sample the Lecture 7 methods."""
3
- import argparse
4
- import inspect
5
- import json
6
- import platform
7
- import time
8
- from pathlib import Path
9
- import torch
10
- import numpy as np
11
- from ot_sbm_examples import (serial, transport_example, finite_bridge_example,
12
- discrete_imf_example, ctmc_bridge_example, gaussian_example,
13
- reward_bridge_example, branching_example, entangled_geometry_example)
14
- from learned_bridges import METHODS as LEARNED, save_artifact
15
- from discrete_learning import fit_ddsbm, fit_csbm
16
- from sampling import generate
17
-
18
- ROOT = Path(__file__).resolve().parent
19
- EXACT = {'ot': transport_example, 'sinkhorn': transport_example,
20
- 'finite-sb': finite_bridge_example, 'discrete-imf': discrete_imf_example,
21
- 'ctmc-sb': ctmc_bridge_example, 'gaussian-sb': gaussian_example,
22
- 'reward-tilt': reward_bridge_example, 'branch-mass': branching_example,
23
- 'cone-geometry': entangled_geometry_example}
24
- LEARNED = {**LEARNED, 'ddsbm': fit_ddsbm, 'csbm': fit_csbm}
25
- METHODS = list(EXACT) + list(LEARNED)
26
- SEEDS = dict(dsb=7, dsbm=8, sf2m=9, tr2d2=10, branch=11, entangled=12, ddsbm=13, csbm=14)
27
-
28
- def write_json(path, value):
29
- Path(path).write_text(json.dumps(serial(value), indent=2, allow_nan=False)+'\n')
30
-
31
- def parser():
32
- p = argparse.ArgumentParser(description=__doc__)
33
- p.add_argument('--method', choices=METHODS)
34
- p.add_argument('--mode', choices=['train-sample', 'train', 'sample'], default='train-sample')
35
- p.add_argument('--out', help='Run directory, default lecture_7/outputs/METHOD')
36
- p.add_argument('--seed', type=int, help='Training seed; sampling uses this seed plus 100')
37
- p.add_argument('--samples', type=int, default=256)
38
- p.add_argument('--sample-steps', type=int, help='Override the inference grid when the sampler supports it')
39
- p.add_argument('--train-steps', type=int, help='Gradient updates for sf2m, branch, ddsbm, or csbm')
40
- p.add_argument('--rounds', type=int, help='Forward/reverse fitting cycles for dsb or dsbm')
41
- p.add_argument('--epochs', type=int, help='Replay/CE epochs for tr2d2 or entangled')
42
- p.add_argument('--batch-size', type=int, help='Training batch size for methods with a batch argument')
43
- p.add_argument('--searches', type=int, help='MCTS rollouts per TR2-D2 epoch')
44
- p.add_argument('--quick', action='store_true', help='Short execution check; not a quality experiment')
45
- return p
46
-
47
- def main(argv=None):
48
- p = parser()
49
- args = p.parse_args(argv)
50
- for name in ['samples','sample_steps','train_steps','rounds','epochs','batch_size','searches']:
51
- value = getattr(args, name)
52
- if value is not None and value < 1:
53
- p.error(name.replace('_','-')+' must be positive')
54
- if args.mode == 'sample' and args.out is None:
55
- p.error('Sample mode requires --out for its checkpoint.')
56
- if args.mode != 'sample' and args.method is None:
57
- args.method = 'sinkhorn'
58
- out = Path(args.out) if args.out else ROOT/'outputs'/args.method
59
- out.mkdir(parents=True, exist_ok=True)
60
- began = time.perf_counter()
61
- if args.mode == 'sample':
62
- state = torch.load(out/'checkpoint.pt', map_location='cpu', weights_only=True)
63
- if args.method is not None and args.method != state['method']:
64
- p.error('The requested method differs from the saved checkpoint.')
65
- seed = args.seed if args.seed is not None else json.loads((out/'config.json').read_text())['seed']
66
- else:
67
- seed = args.seed if args.seed is not None else SEEDS.get(args.method, 6270)
68
- config = {'method': args.method, 'seed': seed, 'mode': args.mode,
69
- 'quick': args.quick, 'device': 'cpu', 'python': platform.python_version(),
70
- 'torch': torch.__version__, 'numpy': np.__version__}
71
- if args.method in EXACT:
72
- if any(x is not None for x in [args.train_steps,args.rounds,args.epochs,args.batch_size,args.searches]):
73
- p.error('This method is a numerical solver; it has no neural training parameters.')
74
- report = EXACT[args.method]()
75
- steps = 2 if args.method == 'finite-sb' else 100
76
- save_artifact(out/'checkpoint.pt', method=args.method, result=serial(report), steps=steps)
77
- config['training'] = 'Exact or explicitly enumerated numerical calculation'
78
- else:
79
- fn = LEARNED[args.method]
80
- signature = inspect.signature(fn).parameters
81
- settings = {'seed': seed, 'checkpoint': out/'checkpoint.pt'}
82
- if args.quick:
83
- for name, value in dict(updates=20, rounds=2, epochs=1, batch=256, searches=40).items():
84
- if name in signature:
85
- settings[name] = value
86
- for arg, param in [('train_steps','updates'),('rounds','rounds'),('epochs','epochs'),('batch_size','batch'),('searches','searches')]:
87
- value = getattr(args, arg)
88
- if value is not None:
89
- if param not in signature:
90
- p.error('--'+arg.replace('_','-')+' does not apply to '+args.method)
91
- settings[param] = value
92
- config['training'] = {k: settings.get(k, v.default) for k,v in signature.items() if k != 'checkpoint'}
93
- report = fn(**settings)
94
- write_json(out/'config.json', config)
95
- write_json(out/'report.json', report)
96
- write_json(out/'losses.json', report.get('loss_samples', report.get('history', [])))
97
- state = torch.load(out/'checkpoint.pt', map_location='cpu', weights_only=True)
98
- if args.mode == 'train':
99
- print(json.dumps({'method': args.method, 'mode': args.mode, 'out': str(out), 'seconds': time.perf_counter()-began}))
100
- return report
101
- output = generate(state, args.samples, seed+100, args.sample_steps)
102
- stem = 'resampled' if args.mode == 'sample' else 'samples'
103
- write_json(out/(stem+'.json'), output)
104
- (out/(stem+'.txt')).write_text('\n'.join(json.dumps(row) for row in output['values'])+'\n')
105
- write_json(out/('sample_report.json' if args.mode == 'sample' else 'generation_report.json'), output['report'])
106
- print(json.dumps({'method':state['method'],'mode':args.mode,'out':str(out),'seconds':round(time.perf_counter()-began,3)}),flush=True)
107
- return output
108
-
109
- if __name__ == '__main__':
110
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/run_all.py DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Run every example and verify exact seeded checkpoint reloads."""
3
- import argparse
4
- from pathlib import Path
5
- from run import main as run, METHODS, ROOT, write_json
6
-
7
- def main():
8
- p=argparse.ArgumentParser(description=__doc__)
9
- p.add_argument('--quick',action='store_true')
10
- p.add_argument('--out',default=str(ROOT/'outputs'))
11
- p.add_argument('--samples',type=int,default=128)
12
- args=p.parse_args()
13
- receipts=[]
14
- for method in METHODS:
15
- out=Path(args.out)/method
16
- first=run(['--method',method,'--out',str(out),'--samples',str(args.samples)]+(['--quick'] if args.quick else []))
17
- second=run(['--mode','sample','--out',str(out),'--samples',str(args.samples)])
18
- if first != second:
19
- raise AssertionError('Seeded checkpoint reload differs for '+method)
20
- receipts.append({'method':method,'checkpoint_reload_equal':True,
21
- 'finite_values':first['report']['finite_values']})
22
- write_json(Path(args.out)/'run_all_report.json',{'quick':args.quick,'methods':receipts})
23
- print(str(len(receipts))+' examples passed checkpoint reload verification.')
24
-
25
- if __name__=='__main__':
26
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/sampling.py DELETED
@@ -1,218 +0,0 @@
1
- """Seeded samplers for the saved Lecture 7 teaching models."""
2
- import math
3
- import numpy as np
4
- import torch
5
- from torch.nn import functional as F
6
- from scipy.linalg import expm
7
- from learned_bridges import mlp, MaskedModel, CoupledCone, token_reward
8
- from discrete_learning import rate_model
9
-
10
-
11
- def generate(state, samples=256, seed=107, sample_steps=None):
12
- if samples < 1 or (sample_steps is not None and sample_steps < 1):
13
- raise ValueError('Sample counts and step counts must be positive.')
14
- torch.manual_seed(seed)
15
- rng = np.random.default_rng(seed)
16
- method = state['method']
17
- steps = sample_steps or state.get('steps', 100)
18
- traces = []
19
- report = {'method': method, 'sampling_seed': seed, 'samples': samples}
20
- result = state.get('result', {})
21
-
22
- if method in ['dsb', 'dsbm']:
23
- coeffs = np.asarray(state['forward'])
24
- if steps != len(coeffs):
25
- raise ValueError('This saved affine model uses its fixed training grid; omit --sample-steps.')
26
- dt = 1/steps
27
- x = rng.normal(size=samples)
28
- start = x.copy()
29
- traces.append(x[:16].tolist())
30
- for slope, intercept in coeffs:
31
- drift = slope*x + intercept
32
- x = drift if method == 'dsb' else x + dt*drift
33
- x = x + math.sqrt(state['epsilon']*dt)*rng.normal(size=samples)
34
- traces.append(x[:16].tolist())
35
- values = x[:, None]
36
- report.update(mean=float(x.mean()), variance=float(x.var()),
37
- endpoint_covariance=float(np.mean((start-start.mean())*(x-x.mean()))))
38
-
39
- elif method == 'sf2m':
40
- model = mlp(2, 2)
41
- model.load_state_dict(state['model'])
42
- model.eval()
43
- x = torch.randn(samples, 1)
44
- dt = 1/steps
45
- traces.append(x[:16, 0].tolist())
46
- with torch.no_grad():
47
- for k in range(steps):
48
- t = torch.full_like(x, (k+.5)*dt)
49
- velocity, score = model(torch.cat([t, x], 1)).chunk(2, 1)
50
- x = x + (velocity + .5*score)*dt + math.sqrt(dt)*torch.randn_like(x)
51
- traces.append(x[:16, 0].tolist())
52
- values = x.numpy()
53
- report.update(mean=float(x.mean()), variance=float(x.var(unbiased=False)),
54
- approximation='Euler SDE; boundary times extrapolate beyond the training interval [0.02,0.98].')
55
-
56
- elif method == 'tr2d2':
57
- length, vocab = state['length'], state['vocab']
58
- if steps != length:
59
- raise ValueError('The abstract-token example reveals one of four positions per step.')
60
- model = MaskedModel(length, vocab)
61
- model.load_state_dict(state['model'])
62
- model.eval()
63
- x = torch.full((samples, length), vocab, dtype=torch.long)
64
- with torch.no_grad():
65
- for k in range(length):
66
- x[:, k] = torch.multinomial(model(x)[:, k].softmax(-1), 1).squeeze(1)
67
- traces.append(x[:16].tolist())
68
- values = x.numpy()
69
- report.update(mean_reward=float(token_reward(x).mean()),
70
- vocabulary=['circle', 'square', 'triangle'],
71
- sampler='Learned denoiser with fixed left-to-right reveal order; no search at inference.')
72
-
73
- elif method == 'branch':
74
- model = mlp(6, 2)
75
- model.load_state_dict(state['model'])
76
- model.eval()
77
- x0 = .12*torch.randn(samples, 2)
78
- x = x0[:, None, :].expand(-1, 3, -1).clone().reshape(-1, 2)
79
- branch = F.one_hot(torch.arange(3), 3).float().repeat(samples, 1)
80
- dt = 1/steps
81
- traces.append(x.reshape(samples, 3, 2)[:16].tolist())
82
- with torch.no_grad():
83
- for k in range(steps):
84
- # Midpoint integration of the learned branch-specific velocity.
85
- t = torch.full((len(x), 1), k*dt)
86
- v = model(torch.cat([t, branch, x], 1))
87
- vm = model(torch.cat([t+dt/2, branch, x+dt*v/2], 1))
88
- x = x + dt*vm
89
- traces.append(x.reshape(samples, 3, 2)[:16].tolist())
90
- values = x.reshape(samples, 3, 2).numpy()
91
- weights = np.array([1., 0., 0.]) + state['growth'].numpy()
92
- report.update(terminal_branch_weights=weights.tolist(), total_mass=float(weights.sum()),
93
- minimum_weight=float(weights.min()), branch_means=values.mean(0).tolist(),
94
- approximation='Learned velocity integration; soft growth constraints. Raw branch weights are retained, including negative residuals.')
95
-
96
- elif method == 'entangled':
97
- model = CoupledCone()
98
- model.load_state_dict(state['model'])
99
- model.eval()
100
- sigma = state['sigma']
101
- dt = 1/steps
102
- x = .3*torch.randn(samples, 3, 2)
103
- alignment = float('inf')
104
- traces.append(x[:16].tolist())
105
- with torch.no_grad():
106
- for k in range(steps):
107
- control = model(k*dt, x)
108
- alignment = min(alignment, float((control*(1-x)).sum(-1).min()))
109
- reference = -.12*x - .35*(x-x.mean(1, keepdim=True))
110
- x = x + (reference+sigma*control)*dt + sigma*math.sqrt(dt)*torch.randn_like(x)
111
- traces.append(x[:16].tolist())
112
- values = x.numpy()
113
- report.update(mean=float(x.mean()), minimum_bias_alignment=alignment,
114
- terminal_potential_mean=float(torch.exp(-.5*((x-1)**2).sum((1,2))/1.5).mean()),
115
- approximation='Overdamped interacting-particle Euler chain; terminal potential, not an enforced target marginal.')
116
-
117
- elif method == 'ddsbm':
118
- model = rate_model()
119
- model.load_state_dict(state['model'])
120
- model.eval()
121
- x = rng.integers(0, 2, samples)
122
- traces.append(x[:16].tolist())
123
- with torch.no_grad():
124
- for k in range(steps):
125
- t = (k+.5)/steps
126
- q = model(torch.tensor([[t, 1., 0.], [t, 0., 1.]])).ravel().numpy()
127
- total = float(q.sum())
128
- factor = -math.expm1(-total/steps)/total
129
- flip = factor*q[x]
130
- x = np.where(rng.random(samples) < flip, 1-x, x)
131
- traces.append(x[:16].tolist())
132
- values = x[:, None]
133
- report.update(terminal_frequencies=np.bincount(x, minlength=2).tolist(),
134
- terminal_probability_one=float(x.mean()), target_probability_one=.8,
135
- approximation='Exact two-state transitions for rates frozen at each grid midpoint; finite-time approximation to the learned inhomogeneous CTMC.')
136
-
137
- elif method in ['csbm', 'finite-sb']:
138
- Q = np.asarray(state['transitions'] if method == 'csbm' else result['Q'])
139
- if sample_steps is not None and sample_steps != len(Q):
140
- raise ValueError('This finite-chain checkpoint has two transitions.')
141
- x = rng.integers(0, 2, samples)
142
- paths = [x.copy()]
143
- for q in Q:
144
- x = (rng.random(samples) < q[x, 1]).astype(int)
145
- paths.append(x.copy())
146
- values = np.stack(paths, 1)
147
- report.update(terminal_probability_one=float(x.mean()), target_probability_one=.8)
148
-
149
- elif method in ['ot', 'sinkhorn']:
150
- name = 'plan' if method == 'ot' else 'entropic_plan'
151
- pi = np.asarray(result[name])
152
- pair = rng.choice(4, samples, p=pi.ravel()/pi.sum())
153
- values = np.stack([pair//2, pair%2], 1)
154
- cost = np.asarray(result['cost'])
155
- report.update(coupling=name, exact_expected_cost=float((pi*cost).sum()),
156
- sampled_average_cost=float(cost[values[:, 0], values[:, 1]].mean()))
157
-
158
- elif method == 'discrete-imf':
159
- prob = np.asarray(result['final'])
160
- values = np.asarray(result['paths'])[rng.choice(len(prob), samples, p=prob/prob.sum())]
161
- report.update(terminal_probability_one=float(values[:, -1].mean()),
162
- path_l1_to_exact_bridge=result['final_path_l1'])
163
-
164
- elif method == 'ctmc-sb':
165
- G = np.asarray(result['generator'])
166
- g = np.asarray(result['values'][-1]['h'])
167
- x = rng.integers(0, 2, samples)
168
- paths = [x.copy()]
169
- K = expm(G/steps)
170
- for k in range(steps):
171
- hs = expm((1-k/steps)*G)@g
172
- ht = expm((1-(k+1)/steps)*G)@g
173
- Q = K*ht[None, :]/hs[:, None]
174
- if not np.allclose(Q.sum(1), 1):
175
- raise ArithmeticError('The Doob transition failed to normalize.')
176
- x = (rng.random(samples) < Q[x, 1]).astype(int)
177
- paths.append(x.copy())
178
- values = np.stack(paths, 1)
179
- report.update(terminal_probability_one=float(x.mean()),
180
- sampler='Exact reference-bridge transitions between observation times, up to matrix-exponential precision.')
181
-
182
- elif method == 'gaussian-sb':
183
- c = result['covariance']
184
- t = np.linspace(0, 1, steps+1)
185
- x0 = rng.normal(size=(samples, 1))
186
- x1 = 2+c*x0+math.sqrt(1-c*c)*rng.normal(size=(samples, 1))
187
- W = np.c_[np.zeros(samples), np.cumsum(rng.normal(size=(samples, steps))/math.sqrt(steps), axis=1)]
188
- paths = (1-t)*x0+t*x1+W-t*W[:, -1, None]
189
- values = paths[:, -1, None]
190
- traces = paths[:16].T.tolist()
191
- report.update(mean=float(values.mean()), variance=float(values.var()),
192
- sampler='Exact Gaussian endpoint coupling plus Brownian conditional bridges on the grid.')
193
-
194
- elif method == 'reward-tilt':
195
- values = rng.choice(3, samples, p=result['target'])[:, None]
196
- report.update(empirical_probabilities=(np.bincount(values[:, 0], minlength=3)/samples).tolist(),
197
- target_probabilities=result['target'])
198
-
199
- elif method == 'branch-mass':
200
- k = rng.choice(3, samples, p=result['weights'][-1])
201
- x = np.asarray(result['positions'])[-1, k]
202
- values = np.stack([k, x], 1)
203
- report.update(exact_terminal_weights=result['weights'][-1],
204
- interpretation='Draw endpoints from the explicitly specified analytic branch mixture.')
205
-
206
- elif method == 'cone-geometry':
207
- d = np.asarray(result['direction'])
208
- bias = np.asarray(result['bias'])
209
- values = np.stack([d, bias, d-result['dt']*bias])
210
- report.update(samples=3, row_meanings=['target displacement', 'bias', 'displacement after the step'],
211
- interpretation='A deterministic geometry calculation; these rows are not random samples.')
212
- else:
213
- raise ValueError('Unsupported checkpoint method: '+method)
214
-
215
- if not np.isfinite(values).all():
216
- raise FloatingPointError('Generated values are not finite.')
217
- report['finite_values'] = True
218
- return {'values': values.tolist(), 'trajectory_prefix': traces, 'report': report}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/source_manifest.json DELETED
@@ -1,339 +0,0 @@
1
- {
2
- "dsb_results": {
3
- "paper": "dsb",
4
- "page": 10,
5
- "crop": [
6
- 107,
7
- 120,
8
- 505,
9
- 216
10
- ],
11
- "type": "original paper crop"
12
- },
13
- "dsbm_results": {
14
- "paper": "dsbm",
15
- "page": 9,
16
- "crop": [
17
- 108,
18
- 70,
19
- 505,
20
- 150
21
- ],
22
- "type": "original paper crop"
23
- },
24
- "ddsbm_results": {
25
- "paper": "ddsbm",
26
- "page": 9,
27
- "crop": [
28
- 105,
29
- 147,
30
- 507,
31
- 215
32
- ],
33
- "type": "original paper crop"
34
- },
35
- "csbm_images": {
36
- "paper": "csbm",
37
- "page": 9,
38
- "crop": [
39
- 53,
40
- 63,
41
- 546,
42
- 379
43
- ],
44
- "type": "original paper crop"
45
- },
46
- "csbm_table": {
47
- "paper": "csbm",
48
- "page": 9,
49
- "crop": [
50
- 306,
51
- 530,
52
- 545,
53
- 598
54
- ],
55
- "type": "original paper crop"
56
- },
57
- "sf2m_table3": {
58
- "paper": "sf2m",
59
- "page": 8,
60
- "crop": [
61
- 62,
62
- 123,
63
- 298,
64
- 171
65
- ],
66
- "type": "original paper crop"
67
- },
68
- "sf2m_table4": {
69
- "paper": "sf2m",
70
- "page": 8,
71
- "crop": [
72
- 62,
73
- 248,
74
- 298,
75
- 358
76
- ],
77
- "type": "original paper crop"
78
- },
79
- "sf2m_table5": {
80
- "paper": "sf2m",
81
- "page": 8,
82
- "crop": [
83
- 315,
84
- 123,
85
- 548,
86
- 179
87
- ],
88
- "type": "original paper crop"
89
- },
90
- "tr2d2_framework": {
91
- "paper": "tr2d2",
92
- "page": 3,
93
- "crop": [
94
- 107,
95
- 82,
96
- 507,
97
- 253
98
- ],
99
- "type": "original paper crop"
100
- },
101
- "tr2d2_results": {
102
- "paper": "tr2d2",
103
- "page": 8,
104
- "crop": [
105
- 108,
106
- 122,
107
- 505,
108
- 243
109
- ],
110
- "type": "original paper crop"
111
- },
112
- "branch_framework": {
113
- "paper": "branch",
114
- "page": 3,
115
- "crop": [
116
- 108,
117
- 84,
118
- 505,
119
- 231
120
- ],
121
- "type": "original paper crop"
122
- },
123
- "branch_lidar": {
124
- "paper": "branch",
125
- "page": 7,
126
- "crop": [
127
- 107,
128
- 246,
129
- 506,
130
- 329
131
- ],
132
- "type": "original paper crop"
133
- },
134
- "branch_table1": {
135
- "paper": "branch",
136
- "page": 7,
137
- "crop": [
138
- 368,
139
- 206,
140
- 508,
141
- 239
142
- ],
143
- "type": "original paper crop"
144
- },
145
- "branch_table3": {
146
- "paper": "branch",
147
- "page": 8,
148
- "crop": [
149
- 250,
150
- 563,
151
- 508,
152
- 622
153
- ],
154
- "type": "original paper crop"
155
- },
156
- "branch_mixed_results": {
157
- "paper": "branch",
158
- "page": 8,
159
- "crop": [
160
- 107,
161
- 328,
162
- 506,
163
- 383
164
- ],
165
- "type": "original paper crop"
166
- },
167
- "entangled_framework": {
168
- "paper": "entangled",
169
- "page": 3,
170
- "crop": [
171
- 105,
172
- 62,
173
- 507,
174
- 225
175
- ],
176
- "type": "original paper crop"
177
- },
178
- "entangled_results": {
179
- "paper": "entangled",
180
- "page": 9,
181
- "crop": [
182
- 108,
183
- 168,
184
- 505,
185
- 282
186
- ],
187
- "type": "original paper crop"
188
- },
189
- "entangled_tradeoffs": {
190
- "paper": "entangled",
191
- "page": 10,
192
- "crop": [
193
- 108,
194
- 315,
195
- 505,
196
- 481
197
- ],
198
- "type": "original paper crop"
199
- },
200
- "sf2m_results": {
201
- "paper": "sf2m",
202
- "page": 8,
203
- "crop": [
204
- 62,
205
- 123,
206
- 298,
207
- 171
208
- ],
209
- "type": "original paper crop"
210
- },
211
- "csbm_results": {
212
- "components": [
213
- "csbm_images",
214
- "Original Figure 4",
215
- "csbm_table",
216
- "Original Table 2"
217
- ],
218
- "type": "original regions arranged side by side"
219
- },
220
- "branch_results": {
221
- "components": [
222
- "branch_lidar",
223
- "Original Figure 3",
224
- "branch_table3",
225
- "Original Table 3"
226
- ],
227
- "type": "original regions arranged side by side"
228
- },
229
- "sinkhorn_title": {
230
- "paper": "sinkhorn",
231
- "page": 1,
232
- "crop": [
233
- 125,
234
- 145,
235
- 485,
236
- 212
237
- ],
238
- "type": "original paper header"
239
- },
240
- "foundations_title": {
241
- "paper": "foundations",
242
- "page": 1,
243
- "crop": [
244
- 55,
245
- 91,
246
- 557.0,
247
- 192
248
- ],
249
- "type": "original paper header"
250
- },
251
- "dsb_title": {
252
- "paper": "dsb",
253
- "page": 1,
254
- "crop": [
255
- 105,
256
- 94.8338394165039,
257
- 507,
258
- 284.55413818359375
259
- ],
260
- "type": "original paper header"
261
- },
262
- "dsbm_title": {
263
- "paper": "dsbm",
264
- "page": 1,
265
- "crop": [
266
- 105,
267
- 94.8338394165039,
268
- 507,
269
- 206.55914306640625
270
- ],
271
- "type": "original paper header"
272
- },
273
- "sf2m_title": {
274
- "paper": "sf2m",
275
- "page": 1,
276
- "crop": [
277
- 55,
278
- 87.68718719482422,
279
- 557.0,
280
- 322.50830078125
281
- ],
282
- "type": "original paper header"
283
- },
284
- "ddsbm_title": {
285
- "paper": "ddsbm",
286
- "page": 1,
287
- "crop": [
288
- 105,
289
- 74.53105926513672,
290
- 507,
291
- 214.30726623535156
292
- ],
293
- "type": "original paper header"
294
- },
295
- "csbm_title": {
296
- "paper": "csbm",
297
- "page": 1,
298
- "crop": [
299
- 55,
300
- 84.739990234375,
301
- 557.0,
302
- 168.0601806640625
303
- ],
304
- "type": "original paper header"
305
- },
306
- "tr2d2_title": {
307
- "paper": "tr2d2",
308
- "page": 1,
309
- "crop": [
310
- 105,
311
- 75.52323913574219,
312
- 507,
313
- 247.40626525878906
314
- ],
315
- "type": "original paper header"
316
- },
317
- "branch_title": {
318
- "paper": "branch",
319
- "page": 1,
320
- "crop": [
321
- 105,
322
- 75.39202117919922,
323
- 507,
324
- 216.5222930908203
325
- ],
326
- "type": "original paper header"
327
- },
328
- "entangled_title": {
329
- "paper": "entangled",
330
- "page": 1,
331
- "crop": [
332
- 105,
333
- 75.39202117919922,
334
- 507,
335
- 216.5222930908203
336
- ],
337
- "type": "original paper header"
338
- }
339
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/tests/test_mathematics.py DELETED
@@ -1,15 +0,0 @@
1
- """Independent identities and diagnostics for the completed seeded runs."""
2
- import json,shutil,subprocess,sys,tempfile,unittest
3
- from pathlib import Path
4
- ROOT=Path(__file__).resolve().parents[1]
5
- class Mathematics(unittest.TestCase):
6
- def test_identities_and_recorded_training(self):
7
- with tempfile.TemporaryDirectory() as tmp:
8
- for file in (ROOT/'verified_examples/mathematics').glob('*.json'):
9
- shutil.copy(file,Path(tmp)/file.name)
10
- subprocess.run([sys.executable,str(ROOT/'check_examples.py'),'--results',tmp],check=True)
11
- checks=json.loads((Path(tmp)/'checks.json').read_text())
12
- self.assertEqual(len(checks),24)
13
- self.assertTrue(all(checks.values()))
14
- if __name__ == '__main__':
15
- unittest.main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/README.md DELETED
@@ -1,7 +0,0 @@
1
- # Recorded execution
2
-
3
- These are actual seeded CPU runs of all 17 methods at their default training settings. Each run saves a checkpoint, reloads it, and checks that the same sampling seed produces exactly the same generated values. `config.json` records the Python, PyTorch, NumPy, seed, and training settings. `run_all_report.json` records every reload check.
4
-
5
- The reports include approximation residuals rather than replacing them with analytic targets. In particular, the soft Branch constraints leave small negative weights and a small mass residual; these are reported. The cone example is a deterministic geometry calculation. Neural examples use small synthetic problems; these results are separate from the attributed paper benchmarks in the lecture.
6
-
7
- `mathematics/` supplies learned-run diagnostics to the independent mathematical tests. Checkpoints are created by the runner and are not bundled in the repository update. Reproduce with `python lecture_7/run_all.py`.
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch-mass/config.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "method": "branch-mass",
3
- "seed": 6270,
4
- "mode": "train-sample",
5
- "quick": false,
6
- "device": "cpu",
7
- "python": "3.12.14",
8
- "torch": "2.9.1+cpu",
9
- "numpy": "2.5.3",
10
- "training": "Exact or explicitly enumerated numerical calculation"
11
- }
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch-mass/generation_report.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "method": "branch-mass",
3
- "sampling_seed": 6370,
4
- "samples": 128,
5
- "exact_terminal_weights": [
6
- 0.0,
7
- 0.6,
8
- 0.4
9
- ],
10
- "interpretation": "Draw endpoints from the explicitly specified analytic branch mixture.",
11
- "finite_values": true
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch-mass/losses.json DELETED
@@ -1 +0,0 @@
1
- []
 
 
lecture_7/verified_examples/branch-mass/report.json DELETED
@@ -1,1734 +0,0 @@
1
- {
2
- "t": [
3
- 0.0,
4
- 0.01,
5
- 0.02,
6
- 0.03,
7
- 0.04,
8
- 0.05,
9
- 0.06,
10
- 0.07,
11
- 0.08,
12
- 0.09,
13
- 0.1,
14
- 0.11,
15
- 0.12,
16
- 0.13,
17
- 0.14,
18
- 0.15,
19
- 0.16,
20
- 0.17,
21
- 0.18,
22
- 0.19,
23
- 0.2,
24
- 0.21,
25
- 0.22,
26
- 0.23,
27
- 0.24,
28
- 0.25,
29
- 0.26,
30
- 0.27,
31
- 0.28,
32
- 0.29,
33
- 0.3,
34
- 0.31,
35
- 0.32,
36
- 0.33,
37
- 0.34,
38
- 0.35000000000000003,
39
- 0.36,
40
- 0.37,
41
- 0.38,
42
- 0.39,
43
- 0.4,
44
- 0.41000000000000003,
45
- 0.42,
46
- 0.43,
47
- 0.44,
48
- 0.45,
49
- 0.46,
50
- 0.47000000000000003,
51
- 0.48,
52
- 0.49,
53
- 0.5,
54
- 0.51,
55
- 0.52,
56
- 0.53,
57
- 0.54,
58
- 0.55,
59
- 0.56,
60
- 0.5700000000000001,
61
- 0.58,
62
- 0.59,
63
- 0.6,
64
- 0.61,
65
- 0.62,
66
- 0.63,
67
- 0.64,
68
- 0.65,
69
- 0.66,
70
- 0.67,
71
- 0.68,
72
- 0.6900000000000001,
73
- 0.7000000000000001,
74
- 0.71,
75
- 0.72,
76
- 0.73,
77
- 0.74,
78
- 0.75,
79
- 0.76,
80
- 0.77,
81
- 0.78,
82
- 0.79,
83
- 0.8,
84
- 0.81,
85
- 0.8200000000000001,
86
- 0.8300000000000001,
87
- 0.84,
88
- 0.85,
89
- 0.86,
90
- 0.87,
91
- 0.88,
92
- 0.89,
93
- 0.9,
94
- 0.91,
95
- 0.92,
96
- 0.93,
97
- 0.9400000000000001,
98
- 0.9500000000000001,
99
- 0.96,
100
- 0.97,
101
- 0.98,
102
- 0.99,
103
- 1.0
104
- ],
105
- "weights": [
106
- [
107
- 1.0,
108
- 0.0,
109
- 0.0
110
- ],
111
- [
112
- 0.99,
113
- 0.006,
114
- 0.004
115
- ],
116
- [
117
- 0.98,
118
- 0.012,
119
- 0.008
120
- ],
121
- [
122
- 0.97,
123
- 0.018,
124
- 0.012
125
- ],
126
- [
127
- 0.96,
128
- 0.024,
129
- 0.016
130
- ],
131
- [
132
- 0.95,
133
- 0.03,
134
- 0.020000000000000004
135
- ],
136
- [
137
- 0.94,
138
- 0.036,
139
- 0.024
140
- ],
141
- [
142
- 0.9299999999999999,
143
- 0.042,
144
- 0.028000000000000004
145
- ],
146
- [
147
- 0.92,
148
- 0.048,
149
- 0.032
150
- ],
151
- [
152
- 0.91,
153
- 0.054,
154
- 0.036
155
- ],
156
- [
157
- 0.9,
158
- 0.06,
159
- 0.04000000000000001
160
- ],
161
- [
162
- 0.89,
163
- 0.066,
164
- 0.044000000000000004
165
- ],
166
- [
167
- 0.88,
168
- 0.072,
169
- 0.048
170
- ],
171
- [
172
- 0.87,
173
- 0.078,
174
- 0.052000000000000005
175
- ],
176
- [
177
- 0.86,
178
- 0.084,
179
- 0.05600000000000001
180
- ],
181
- [
182
- 0.85,
183
- 0.09,
184
- 0.06
185
- ],
186
- [
187
- 0.84,
188
- 0.096,
189
- 0.064
190
- ],
191
- [
192
- 0.83,
193
- 0.10200000000000001,
194
- 0.068
195
- ],
196
- [
197
- 0.8200000000000001,
198
- 0.108,
199
- 0.072
200
- ],
201
- [
202
- 0.81,
203
- 0.11399999999999999,
204
- 0.07600000000000001
205
- ],
206
- [
207
- 0.8,
208
- 0.12,
209
- 0.08000000000000002
210
- ],
211
- [
212
- 0.79,
213
- 0.126,
214
- 0.084
215
- ],
216
- [
217
- 0.78,
218
- 0.132,
219
- 0.08800000000000001
220
- ],
221
- [
222
- 0.77,
223
- 0.138,
224
- 0.09200000000000001
225
- ],
226
- [
227
- 0.76,
228
- 0.144,
229
- 0.096
230
- ],
231
- [
232
- 0.75,
233
- 0.15,
234
- 0.1
235
- ],
236
- [
237
- 0.74,
238
- 0.156,
239
- 0.10400000000000001
240
- ],
241
- [
242
- 0.73,
243
- 0.162,
244
- 0.10800000000000001
245
- ],
246
- [
247
- 0.72,
248
- 0.168,
249
- 0.11200000000000002
250
- ],
251
- [
252
- 0.71,
253
- 0.174,
254
- 0.11599999999999999
255
- ],
256
- [
257
- 0.7,
258
- 0.18,
259
- 0.12
260
- ],
261
- [
262
- 0.69,
263
- 0.186,
264
- 0.124
265
- ],
266
- [
267
- 0.6799999999999999,
268
- 0.192,
269
- 0.128
270
- ],
271
- [
272
- 0.6699999999999999,
273
- 0.198,
274
- 0.132
275
- ],
276
- [
277
- 0.6599999999999999,
278
- 0.20400000000000001,
279
- 0.136
280
- ],
281
- [
282
- 0.6499999999999999,
283
- 0.21000000000000002,
284
- 0.14
285
- ],
286
- [
287
- 0.64,
288
- 0.216,
289
- 0.144
290
- ],
291
- [
292
- 0.63,
293
- 0.222,
294
- 0.148
295
- ],
296
- [
297
- 0.62,
298
- 0.22799999999999998,
299
- 0.15200000000000002
300
- ],
301
- [
302
- 0.61,
303
- 0.23399999999999999,
304
- 0.15600000000000003
305
- ],
306
- [
307
- 0.6,
308
- 0.24,
309
- 0.16000000000000003
310
- ],
311
- [
312
- 0.59,
313
- 0.246,
314
- 0.16400000000000003
315
- ],
316
- [
317
- 0.5800000000000001,
318
- 0.252,
319
- 0.168
320
- ],
321
- [
322
- 0.5700000000000001,
323
- 0.258,
324
- 0.17200000000000001
325
- ],
326
- [
327
- 0.56,
328
- 0.264,
329
- 0.17600000000000002
330
- ],
331
- [
332
- 0.55,
333
- 0.27,
334
- 0.18000000000000002
335
- ],
336
- [
337
- 0.54,
338
- 0.276,
339
- 0.18400000000000002
340
- ],
341
- [
342
- 0.53,
343
- 0.28200000000000003,
344
- 0.18800000000000003
345
- ],
346
- [
347
- 0.52,
348
- 0.288,
349
- 0.192
350
- ],
351
- [
352
- 0.51,
353
- 0.294,
354
- 0.196
355
- ],
356
- [
357
- 0.5,
358
- 0.3,
359
- 0.2
360
- ],
361
- [
362
- 0.49,
363
- 0.306,
364
- 0.20400000000000001
365
- ],
366
- [
367
- 0.48,
368
- 0.312,
369
- 0.20800000000000002
370
- ],
371
- [
372
- 0.47,
373
- 0.318,
374
- 0.21200000000000002
375
- ],
376
- [
377
- 0.45999999999999996,
378
- 0.324,
379
- 0.21600000000000003
380
- ],
381
- [
382
- 0.44999999999999996,
383
- 0.33,
384
- 0.22000000000000003
385
- ],
386
- [
387
- 0.43999999999999995,
388
- 0.336,
389
- 0.22400000000000003
390
- ],
391
- [
392
- 0.42999999999999994,
393
- 0.342,
394
- 0.22800000000000004
395
- ],
396
- [
397
- 0.42000000000000004,
398
- 0.348,
399
- 0.23199999999999998
400
- ],
401
- [
402
- 0.41000000000000003,
403
- 0.354,
404
- 0.236
405
- ],
406
- [
407
- 0.4,
408
- 0.36,
409
- 0.24
410
- ],
411
- [
412
- 0.39,
413
- 0.366,
414
- 0.244
415
- ],
416
- [
417
- 0.38,
418
- 0.372,
419
- 0.248
420
- ],
421
- [
422
- 0.37,
423
- 0.378,
424
- 0.252
425
- ],
426
- [
427
- 0.36,
428
- 0.384,
429
- 0.256
430
- ],
431
- [
432
- 0.35,
433
- 0.39,
434
- 0.26
435
- ],
436
- [
437
- 0.33999999999999997,
438
- 0.396,
439
- 0.264
440
- ],
441
- [
442
- 0.32999999999999996,
443
- 0.402,
444
- 0.268
445
- ],
446
- [
447
- 0.31999999999999995,
448
- 0.40800000000000003,
449
- 0.272
450
- ],
451
- [
452
- 0.30999999999999994,
453
- 0.41400000000000003,
454
- 0.276
455
- ],
456
- [
457
- 0.29999999999999993,
458
- 0.42000000000000004,
459
- 0.28
460
- ],
461
- [
462
- 0.29000000000000004,
463
- 0.426,
464
- 0.284
465
- ],
466
- [
467
- 0.28,
468
- 0.432,
469
- 0.288
470
- ],
471
- [
472
- 0.27,
473
- 0.438,
474
- 0.292
475
- ],
476
- [
477
- 0.26,
478
- 0.444,
479
- 0.296
480
- ],
481
- [
482
- 0.25,
483
- 0.44999999999999996,
484
- 0.30000000000000004
485
- ],
486
- [
487
- 0.24,
488
- 0.45599999999999996,
489
- 0.30400000000000005
490
- ],
491
- [
492
- 0.22999999999999998,
493
- 0.46199999999999997,
494
- 0.30800000000000005
495
- ],
496
- [
497
- 0.21999999999999997,
498
- 0.46799999999999997,
499
- 0.31200000000000006
500
- ],
501
- [
502
- 0.20999999999999996,
503
- 0.474,
504
- 0.31600000000000006
505
- ],
506
- [
507
- 0.19999999999999996,
508
- 0.48,
509
- 0.32000000000000006
510
- ],
511
- [
512
- 0.18999999999999995,
513
- 0.486,
514
- 0.32400000000000007
515
- ],
516
- [
517
- 0.17999999999999994,
518
- 0.492,
519
- 0.32800000000000007
520
- ],
521
- [
522
- 0.16999999999999993,
523
- 0.498,
524
- 0.3320000000000001
525
- ],
526
- [
527
- 0.16000000000000003,
528
- 0.504,
529
- 0.336
530
- ],
531
- [
532
- 0.15000000000000002,
533
- 0.51,
534
- 0.34
535
- ],
536
- [
537
- 0.14,
538
- 0.516,
539
- 0.34400000000000003
540
- ],
541
- [
542
- 0.13,
543
- 0.522,
544
- 0.34800000000000003
545
- ],
546
- [
547
- 0.12,
548
- 0.528,
549
- 0.35200000000000004
550
- ],
551
- [
552
- 0.10999999999999999,
553
- 0.534,
554
- 0.35600000000000004
555
- ],
556
- [
557
- 0.09999999999999998,
558
- 0.54,
559
- 0.36000000000000004
560
- ],
561
- [
562
- 0.08999999999999997,
563
- 0.546,
564
- 0.36400000000000005
565
- ],
566
- [
567
- 0.07999999999999996,
568
- 0.552,
569
- 0.36800000000000005
570
- ],
571
- [
572
- 0.06999999999999995,
573
- 0.558,
574
- 0.37200000000000005
575
- ],
576
- [
577
- 0.05999999999999994,
578
- 0.5640000000000001,
579
- 0.37600000000000006
580
- ],
581
- [
582
- 0.04999999999999993,
583
- 0.5700000000000001,
584
- 0.38000000000000006
585
- ],
586
- [
587
- 0.040000000000000036,
588
- 0.576,
589
- 0.384
590
- ],
591
- [
592
- 0.030000000000000027,
593
- 0.582,
594
- 0.388
595
- ],
596
- [
597
- 0.020000000000000018,
598
- 0.588,
599
- 0.392
600
- ],
601
- [
602
- 0.010000000000000009,
603
- 0.594,
604
- 0.396
605
- ],
606
- [
607
- 0.0,
608
- 0.6,
609
- 0.4
610
- ]
611
- ],
612
- "growth": [
613
- [
614
- -1.0,
615
- 0.6,
616
- 0.4
617
- ],
618
- [
619
- -1.0,
620
- 0.6,
621
- 0.4
622
- ],
623
- [
624
- -1.0,
625
- 0.6,
626
- 0.4
627
- ],
628
- [
629
- -1.0,
630
- 0.6,
631
- 0.4
632
- ],
633
- [
634
- -1.0,
635
- 0.6,
636
- 0.4
637
- ],
638
- [
639
- -1.0,
640
- 0.6,
641
- 0.4
642
- ],
643
- [
644
- -1.0,
645
- 0.6,
646
- 0.4
647
- ],
648
- [
649
- -1.0,
650
- 0.6,
651
- 0.4
652
- ],
653
- [
654
- -1.0,
655
- 0.6,
656
- 0.4
657
- ],
658
- [
659
- -1.0,
660
- 0.6,
661
- 0.4
662
- ],
663
- [
664
- -1.0,
665
- 0.6,
666
- 0.4
667
- ],
668
- [
669
- -1.0,
670
- 0.6,
671
- 0.4
672
- ],
673
- [
674
- -1.0,
675
- 0.6,
676
- 0.4
677
- ],
678
- [
679
- -1.0,
680
- 0.6,
681
- 0.4
682
- ],
683
- [
684
- -1.0,
685
- 0.6,
686
- 0.4
687
- ],
688
- [
689
- -1.0,
690
- 0.6,
691
- 0.4
692
- ],
693
- [
694
- -1.0,
695
- 0.6,
696
- 0.4
697
- ],
698
- [
699
- -1.0,
700
- 0.6,
701
- 0.4
702
- ],
703
- [
704
- -1.0,
705
- 0.6,
706
- 0.4
707
- ],
708
- [
709
- -1.0,
710
- 0.6,
711
- 0.4
712
- ],
713
- [
714
- -1.0,
715
- 0.6,
716
- 0.4
717
- ],
718
- [
719
- -1.0,
720
- 0.6,
721
- 0.4
722
- ],
723
- [
724
- -1.0,
725
- 0.6,
726
- 0.4
727
- ],
728
- [
729
- -1.0,
730
- 0.6,
731
- 0.4
732
- ],
733
- [
734
- -1.0,
735
- 0.6,
736
- 0.4
737
- ],
738
- [
739
- -1.0,
740
- 0.6,
741
- 0.4
742
- ],
743
- [
744
- -1.0,
745
- 0.6,
746
- 0.4
747
- ],
748
- [
749
- -1.0,
750
- 0.6,
751
- 0.4
752
- ],
753
- [
754
- -1.0,
755
- 0.6,
756
- 0.4
757
- ],
758
- [
759
- -1.0,
760
- 0.6,
761
- 0.4
762
- ],
763
- [
764
- -1.0,
765
- 0.6,
766
- 0.4
767
- ],
768
- [
769
- -1.0,
770
- 0.6,
771
- 0.4
772
- ],
773
- [
774
- -1.0,
775
- 0.6,
776
- 0.4
777
- ],
778
- [
779
- -1.0,
780
- 0.6,
781
- 0.4
782
- ],
783
- [
784
- -1.0,
785
- 0.6,
786
- 0.4
787
- ],
788
- [
789
- -1.0,
790
- 0.6,
791
- 0.4
792
- ],
793
- [
794
- -1.0,
795
- 0.6,
796
- 0.4
797
- ],
798
- [
799
- -1.0,
800
- 0.6,
801
- 0.4
802
- ],
803
- [
804
- -1.0,
805
- 0.6,
806
- 0.4
807
- ],
808
- [
809
- -1.0,
810
- 0.6,
811
- 0.4
812
- ],
813
- [
814
- -1.0,
815
- 0.6,
816
- 0.4
817
- ],
818
- [
819
- -1.0,
820
- 0.6,
821
- 0.4
822
- ],
823
- [
824
- -1.0,
825
- 0.6,
826
- 0.4
827
- ],
828
- [
829
- -1.0,
830
- 0.6,
831
- 0.4
832
- ],
833
- [
834
- -1.0,
835
- 0.6,
836
- 0.4
837
- ],
838
- [
839
- -1.0,
840
- 0.6,
841
- 0.4
842
- ],
843
- [
844
- -1.0,
845
- 0.6,
846
- 0.4
847
- ],
848
- [
849
- -1.0,
850
- 0.6,
851
- 0.4
852
- ],
853
- [
854
- -1.0,
855
- 0.6,
856
- 0.4
857
- ],
858
- [
859
- -1.0,
860
- 0.6,
861
- 0.4
862
- ],
863
- [
864
- -1.0,
865
- 0.6,
866
- 0.4
867
- ],
868
- [
869
- -1.0,
870
- 0.6,
871
- 0.4
872
- ],
873
- [
874
- -1.0,
875
- 0.6,
876
- 0.4
877
- ],
878
- [
879
- -1.0,
880
- 0.6,
881
- 0.4
882
- ],
883
- [
884
- -1.0,
885
- 0.6,
886
- 0.4
887
- ],
888
- [
889
- -1.0,
890
- 0.6,
891
- 0.4
892
- ],
893
- [
894
- -1.0,
895
- 0.6,
896
- 0.4
897
- ],
898
- [
899
- -1.0,
900
- 0.6,
901
- 0.4
902
- ],
903
- [
904
- -1.0,
905
- 0.6,
906
- 0.4
907
- ],
908
- [
909
- -1.0,
910
- 0.6,
911
- 0.4
912
- ],
913
- [
914
- -1.0,
915
- 0.6,
916
- 0.4
917
- ],
918
- [
919
- -1.0,
920
- 0.6,
921
- 0.4
922
- ],
923
- [
924
- -1.0,
925
- 0.6,
926
- 0.4
927
- ],
928
- [
929
- -1.0,
930
- 0.6,
931
- 0.4
932
- ],
933
- [
934
- -1.0,
935
- 0.6,
936
- 0.4
937
- ],
938
- [
939
- -1.0,
940
- 0.6,
941
- 0.4
942
- ],
943
- [
944
- -1.0,
945
- 0.6,
946
- 0.4
947
- ],
948
- [
949
- -1.0,
950
- 0.6,
951
- 0.4
952
- ],
953
- [
954
- -1.0,
955
- 0.6,
956
- 0.4
957
- ],
958
- [
959
- -1.0,
960
- 0.6,
961
- 0.4
962
- ],
963
- [
964
- -1.0,
965
- 0.6,
966
- 0.4
967
- ],
968
- [
969
- -1.0,
970
- 0.6,
971
- 0.4
972
- ],
973
- [
974
- -1.0,
975
- 0.6,
976
- 0.4
977
- ],
978
- [
979
- -1.0,
980
- 0.6,
981
- 0.4
982
- ],
983
- [
984
- -1.0,
985
- 0.6,
986
- 0.4
987
- ],
988
- [
989
- -1.0,
990
- 0.6,
991
- 0.4
992
- ],
993
- [
994
- -1.0,
995
- 0.6,
996
- 0.4
997
- ],
998
- [
999
- -1.0,
1000
- 0.6,
1001
- 0.4
1002
- ],
1003
- [
1004
- -1.0,
1005
- 0.6,
1006
- 0.4
1007
- ],
1008
- [
1009
- -1.0,
1010
- 0.6,
1011
- 0.4
1012
- ],
1013
- [
1014
- -1.0,
1015
- 0.6,
1016
- 0.4
1017
- ],
1018
- [
1019
- -1.0,
1020
- 0.6,
1021
- 0.4
1022
- ],
1023
- [
1024
- -1.0,
1025
- 0.6,
1026
- 0.4
1027
- ],
1028
- [
1029
- -1.0,
1030
- 0.6,
1031
- 0.4
1032
- ],
1033
- [
1034
- -1.0,
1035
- 0.6,
1036
- 0.4
1037
- ],
1038
- [
1039
- -1.0,
1040
- 0.6,
1041
- 0.4
1042
- ],
1043
- [
1044
- -1.0,
1045
- 0.6,
1046
- 0.4
1047
- ],
1048
- [
1049
- -1.0,
1050
- 0.6,
1051
- 0.4
1052
- ],
1053
- [
1054
- -1.0,
1055
- 0.6,
1056
- 0.4
1057
- ],
1058
- [
1059
- -1.0,
1060
- 0.6,
1061
- 0.4
1062
- ],
1063
- [
1064
- -1.0,
1065
- 0.6,
1066
- 0.4
1067
- ],
1068
- [
1069
- -1.0,
1070
- 0.6,
1071
- 0.4
1072
- ],
1073
- [
1074
- -1.0,
1075
- 0.6,
1076
- 0.4
1077
- ],
1078
- [
1079
- -1.0,
1080
- 0.6,
1081
- 0.4
1082
- ],
1083
- [
1084
- -1.0,
1085
- 0.6,
1086
- 0.4
1087
- ],
1088
- [
1089
- -1.0,
1090
- 0.6,
1091
- 0.4
1092
- ],
1093
- [
1094
- -1.0,
1095
- 0.6,
1096
- 0.4
1097
- ],
1098
- [
1099
- -1.0,
1100
- 0.6,
1101
- 0.4
1102
- ],
1103
- [
1104
- -1.0,
1105
- 0.6,
1106
- 0.4
1107
- ],
1108
- [
1109
- -1.0,
1110
- 0.6,
1111
- 0.4
1112
- ],
1113
- [
1114
- -1.0,
1115
- 0.6,
1116
- 0.4
1117
- ]
1118
- ],
1119
- "positions": [
1120
- [
1121
- 0.0,
1122
- 0.0,
1123
- 0.0
1124
- ],
1125
- [
1126
- 0.01,
1127
- 0.00712,
1128
- 0.006879999999999999
1129
- ],
1130
- [
1131
- 0.02,
1132
- 0.014479999999999998,
1133
- 0.013519999999999999
1134
- ],
1135
- [
1136
- 0.03,
1137
- 0.02208,
1138
- 0.019919999999999997
1139
- ],
1140
- [
1141
- 0.04,
1142
- 0.02992,
1143
- 0.026079999999999996
1144
- ],
1145
- [
1146
- 0.05,
1147
- 0.038,
1148
- 0.031999999999999994
1149
- ],
1150
- [
1151
- 0.06,
1152
- 0.04631999999999999,
1153
- 0.03768
1154
- ],
1155
- [
1156
- 0.07,
1157
- 0.054880000000000005,
1158
- 0.04312
1159
- ],
1160
- [
1161
- 0.08,
1162
- 0.06368,
1163
- 0.048319999999999995
1164
- ],
1165
- [
1166
- 0.09,
1167
- 0.07272,
1168
- 0.05328
1169
- ],
1170
- [
1171
- 0.1,
1172
- 0.08199999999999999,
1173
- 0.057999999999999996
1174
- ],
1175
- [
1176
- 0.11,
1177
- 0.09152,
1178
- 0.06248
1179
- ],
1180
- [
1181
- 0.12,
1182
- 0.10127999999999998,
1183
- 0.06672
1184
- ],
1185
- [
1186
- 0.13,
1187
- 0.11127999999999999,
1188
- 0.07072
1189
- ],
1190
- [
1191
- 0.14,
1192
- 0.12152,
1193
- 0.07448
1194
- ],
1195
- [
1196
- 0.15,
1197
- 0.132,
1198
- 0.078
1199
- ],
1200
- [
1201
- 0.16,
1202
- 0.14271999999999999,
1203
- 0.08127999999999999
1204
- ],
1205
- [
1206
- 0.17,
1207
- 0.15367999999999998,
1208
- 0.08431999999999999
1209
- ],
1210
- [
1211
- 0.18,
1212
- 0.16488,
1213
- 0.08712
1214
- ],
1215
- [
1216
- 0.19,
1217
- 0.17631999999999998,
1218
- 0.08967999999999998
1219
- ],
1220
- [
1221
- 0.2,
1222
- 0.188,
1223
- 0.09199999999999998
1224
- ],
1225
- [
1226
- 0.21,
1227
- 0.19992,
1228
- 0.09408
1229
- ],
1230
- [
1231
- 0.22,
1232
- 0.21208,
1233
- 0.09592
1234
- ],
1235
- [
1236
- 0.23,
1237
- 0.22448,
1238
- 0.09752
1239
- ],
1240
- [
1241
- 0.24,
1242
- 0.23711999999999997,
1243
- 0.09888
1244
- ],
1245
- [
1246
- 0.25,
1247
- 0.25,
1248
- 0.09999999999999999
1249
- ],
1250
- [
1251
- 0.26,
1252
- 0.26312,
1253
- 0.10088
1254
- ],
1255
- [
1256
- 0.27,
1257
- 0.27648,
1258
- 0.10152
1259
- ],
1260
- [
1261
- 0.28,
1262
- 0.29008,
1263
- 0.10192
1264
- ],
1265
- [
1266
- 0.29,
1267
- 0.30391999999999997,
1268
- 0.10208
1269
- ],
1270
- [
1271
- 0.3,
1272
- 0.318,
1273
- 0.102
1274
- ],
1275
- [
1276
- 0.31,
1277
- 0.33232,
1278
- 0.10168
1279
- ],
1280
- [
1281
- 0.32,
1282
- 0.34687999999999997,
1283
- 0.10111999999999997
1284
- ],
1285
- [
1286
- 0.33,
1287
- 0.36168,
1288
- 0.10031999999999996
1289
- ],
1290
- [
1291
- 0.34,
1292
- 0.37672,
1293
- 0.09927999999999998
1294
- ],
1295
- [
1296
- 0.35000000000000003,
1297
- 0.392,
1298
- 0.09799999999999998
1299
- ],
1300
- [
1301
- 0.36,
1302
- 0.40752,
1303
- 0.09648000000000001
1304
- ],
1305
- [
1306
- 0.37,
1307
- 0.42328,
1308
- 0.09472
1309
- ],
1310
- [
1311
- 0.38,
1312
- 0.43927999999999995,
1313
- 0.09271999999999997
1314
- ],
1315
- [
1316
- 0.39,
1317
- 0.4555199999999999,
1318
- 0.09047999999999998
1319
- ],
1320
- [
1321
- 0.4,
1322
- 0.472,
1323
- 0.08799999999999997
1324
- ],
1325
- [
1326
- 0.41000000000000003,
1327
- 0.48872,
1328
- 0.08527999999999997
1329
- ],
1330
- [
1331
- 0.42,
1332
- 0.50568,
1333
- 0.08231999999999998
1334
- ],
1335
- [
1336
- 0.43,
1337
- 0.52288,
1338
- 0.07912
1339
- ],
1340
- [
1341
- 0.44,
1342
- 0.54032,
1343
- 0.07568
1344
- ],
1345
- [
1346
- 0.45,
1347
- 0.558,
1348
- 0.07199999999999998
1349
- ],
1350
- [
1351
- 0.46,
1352
- 0.57592,
1353
- 0.06807999999999997
1354
- ],
1355
- [
1356
- 0.47000000000000003,
1357
- 0.59408,
1358
- 0.06391999999999998
1359
- ],
1360
- [
1361
- 0.48,
1362
- 0.6124799999999999,
1363
- 0.05952000000000002
1364
- ],
1365
- [
1366
- 0.49,
1367
- 0.6311199999999999,
1368
- 0.054879999999999984
1369
- ],
1370
- [
1371
- 0.5,
1372
- 0.6499999999999999,
1373
- 0.04999999999999999
1374
- ],
1375
- [
1376
- 0.51,
1377
- 0.6691199999999999,
1378
- 0.044879999999999975
1379
- ],
1380
- [
1381
- 0.52,
1382
- 0.68848,
1383
- 0.03952
1384
- ],
1385
- [
1386
- 0.53,
1387
- 0.70808,
1388
- 0.03391999999999995
1389
- ],
1390
- [
1391
- 0.54,
1392
- 0.72792,
1393
- 0.028079999999999994
1394
- ],
1395
- [
1396
- 0.55,
1397
- 0.748,
1398
- 0.021999999999999964
1399
- ],
1400
- [
1401
- 0.56,
1402
- 0.7683200000000001,
1403
- 0.015679999999999972
1404
- ],
1405
- [
1406
- 0.5700000000000001,
1407
- 0.78888,
1408
- 0.009119999999999961
1409
- ],
1410
- [
1411
- 0.58,
1412
- 0.80968,
1413
- 0.0023200000000000442
1414
- ],
1415
- [
1416
- 0.59,
1417
- 0.8307199999999999,
1418
- -0.004720000000000002
1419
- ],
1420
- [
1421
- 0.6,
1422
- 0.852,
1423
- -0.01200000000000001
1424
- ],
1425
- [
1426
- 0.61,
1427
- 0.87352,
1428
- -0.019519999999999982
1429
- ],
1430
- [
1431
- 0.62,
1432
- 0.89528,
1433
- -0.02727999999999997
1434
- ],
1435
- [
1436
- 0.63,
1437
- 0.9172799999999999,
1438
- -0.035280000000000034
1439
- ],
1440
- [
1441
- 0.64,
1442
- 0.9395199999999999,
1443
- -0.04352000000000006
1444
- ],
1445
- [
1446
- 0.65,
1447
- 0.962,
1448
- -0.052000000000000046
1449
- ],
1450
- [
1451
- 0.66,
1452
- 0.98472,
1453
- -0.06072000000000011
1454
- ],
1455
- [
1456
- 0.67,
1457
- 1.0076800000000001,
1458
- -0.06968000000000008
1459
- ],
1460
- [
1461
- 0.68,
1462
- 1.03088,
1463
- -0.07888000000000006
1464
- ],
1465
- [
1466
- 0.6900000000000001,
1467
- 1.0543200000000001,
1468
- -0.08832000000000007
1469
- ],
1470
- [
1471
- 0.7000000000000001,
1472
- 1.078,
1473
- -0.09800000000000009
1474
- ],
1475
- [
1476
- 0.71,
1477
- 1.1019199999999998,
1478
- -0.10791999999999996
1479
- ],
1480
- [
1481
- 0.72,
1482
- 1.12608,
1483
- -0.11807999999999996
1484
- ],
1485
- [
1486
- 0.73,
1487
- 1.15048,
1488
- -0.12847999999999993
1489
- ],
1490
- [
1491
- 0.74,
1492
- 1.1751200000000002,
1493
- -0.13912000000000002
1494
- ],
1495
- [
1496
- 0.75,
1497
- 1.1999999999999997,
1498
- -0.15000000000000002
1499
- ],
1500
- [
1501
- 0.76,
1502
- 1.22512,
1503
- -0.16112000000000004
1504
- ],
1505
- [
1506
- 0.77,
1507
- 1.25048,
1508
- -0.17248000000000008
1509
- ],
1510
- [
1511
- 0.78,
1512
- 1.2760799999999999,
1513
- -0.18408000000000002
1514
- ],
1515
- [
1516
- 0.79,
1517
- 1.30192,
1518
- -0.1959200000000001
1519
- ],
1520
- [
1521
- 0.8,
1522
- 1.3279999999999998,
1523
- -0.20800000000000007
1524
- ],
1525
- [
1526
- 0.81,
1527
- 1.35432,
1528
- -0.22032000000000007
1529
- ],
1530
- [
1531
- 0.8200000000000001,
1532
- 1.3808799999999999,
1533
- -0.2328800000000001
1534
- ],
1535
- [
1536
- 0.8300000000000001,
1537
- 1.40768,
1538
- -0.24568000000000012
1539
- ],
1540
- [
1541
- 0.84,
1542
- 1.43472,
1543
- -0.25872000000000006
1544
- ],
1545
- [
1546
- 0.85,
1547
- 1.462,
1548
- -0.272
1549
- ],
1550
- [
1551
- 0.86,
1552
- 1.48952,
1553
- -0.28552
1554
- ],
1555
- [
1556
- 0.87,
1557
- 1.51728,
1558
- -0.29928
1559
- ],
1560
- [
1561
- 0.88,
1562
- 1.54528,
1563
- -0.31328
1564
- ],
1565
- [
1566
- 0.89,
1567
- 1.57352,
1568
- -0.32752000000000003
1569
- ],
1570
- [
1571
- 0.9,
1572
- 1.602,
1573
- -0.3420000000000001
1574
- ],
1575
- [
1576
- 0.91,
1577
- 1.6307200000000002,
1578
- -0.35672000000000015
1579
- ],
1580
- [
1581
- 0.92,
1582
- 1.6596800000000003,
1583
- -0.3716800000000001
1584
- ],
1585
- [
1586
- 0.93,
1587
- 1.6888800000000002,
1588
- -0.3868800000000001
1589
- ],
1590
- [
1591
- 0.9400000000000001,
1592
- 1.7183200000000003,
1593
- -0.4023200000000001
1594
- ],
1595
- [
1596
- 0.9500000000000001,
1597
- 1.7480000000000002,
1598
- -0.41800000000000015
1599
- ],
1600
- [
1601
- 0.96,
1602
- 1.7779199999999997,
1603
- -0.43391999999999986
1604
- ],
1605
- [
1606
- 0.97,
1607
- 1.80808,
1608
- -0.4500799999999999
1609
- ],
1610
- [
1611
- 0.98,
1612
- 1.83848,
1613
- -0.46648
1614
- ],
1615
- [
1616
- 0.99,
1617
- 1.8691199999999997,
1618
- -0.4831199999999999
1619
- ],
1620
- [
1621
- 1.0,
1622
- 1.9,
1623
- -0.5
1624
- ]
1625
- ],
1626
- "total_mass": [
1627
- 1.0,
1628
- 1.0,
1629
- 1.0,
1630
- 1.0,
1631
- 1.0,
1632
- 1.0,
1633
- 1.0,
1634
- 1.0,
1635
- 1.0,
1636
- 1.0,
1637
- 1.0,
1638
- 1.0,
1639
- 1.0,
1640
- 1.0,
1641
- 1.0,
1642
- 1.0,
1643
- 1.0,
1644
- 1.0,
1645
- 1.0,
1646
- 1.0,
1647
- 1.0,
1648
- 1.0,
1649
- 1.0,
1650
- 1.0,
1651
- 1.0,
1652
- 1.0,
1653
- 1.0,
1654
- 1.0,
1655
- 1.0,
1656
- 0.9999999999999999,
1657
- 0.9999999999999999,
1658
- 0.9999999999999999,
1659
- 0.9999999999999999,
1660
- 0.9999999999999999,
1661
- 0.9999999999999999,
1662
- 0.9999999999999999,
1663
- 1.0,
1664
- 1.0,
1665
- 1.0,
1666
- 1.0,
1667
- 1.0,
1668
- 1.0,
1669
- 1.0,
1670
- 1.0,
1671
- 1.0,
1672
- 1.0,
1673
- 1.0,
1674
- 1.0,
1675
- 1.0,
1676
- 1.0,
1677
- 1.0,
1678
- 1.0,
1679
- 1.0,
1680
- 1.0,
1681
- 1.0,
1682
- 1.0,
1683
- 1.0,
1684
- 1.0,
1685
- 1.0,
1686
- 1.0,
1687
- 1.0,
1688
- 1.0,
1689
- 1.0,
1690
- 1.0,
1691
- 1.0,
1692
- 1.0,
1693
- 1.0,
1694
- 1.0,
1695
- 1.0,
1696
- 1.0,
1697
- 1.0,
1698
- 1.0,
1699
- 1.0,
1700
- 1.0,
1701
- 1.0,
1702
- 1.0,
1703
- 1.0,
1704
- 1.0,
1705
- 1.0,
1706
- 1.0,
1707
- 1.0,
1708
- 1.0,
1709
- 1.0,
1710
- 1.0,
1711
- 1.0,
1712
- 1.0,
1713
- 1.0,
1714
- 1.0,
1715
- 1.0,
1716
- 1.0,
1717
- 1.0,
1718
- 1.0,
1719
- 1.0,
1720
- 1.0,
1721
- 1.0,
1722
- 1.0,
1723
- 1.0,
1724
- 1.0,
1725
- 1.0,
1726
- 1.0,
1727
- 1.0
1728
- ],
1729
- "midpoint_weights": [
1730
- 0.5,
1731
- 0.3,
1732
- 0.2
1733
- ]
1734
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch-mass/sample_report.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "method": "branch-mass",
3
- "sampling_seed": 6370,
4
- "samples": 128,
5
- "exact_terminal_weights": [
6
- 0.0,
7
- 0.6,
8
- 0.4
9
- ],
10
- "interpretation": "Draw endpoints from the explicitly specified analytic branch mixture.",
11
- "finite_values": true
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch-mass/samples.json DELETED
@@ -1,529 +0,0 @@
1
- {
2
- "values": [
3
- [
4
- 2.0,
5
- -0.5
6
- ],
7
- [
8
- 1.0,
9
- 1.9
10
- ],
11
- [
12
- 1.0,
13
- 1.9
14
- ],
15
- [
16
- 1.0,
17
- 1.9
18
- ],
19
- [
20
- 1.0,
21
- 1.9
22
- ],
23
- [
24
- 1.0,
25
- 1.9
26
- ],
27
- [
28
- 2.0,
29
- -0.5
30
- ],
31
- [
32
- 2.0,
33
- -0.5
34
- ],
35
- [
36
- 2.0,
37
- -0.5
38
- ],
39
- [
40
- 2.0,
41
- -0.5
42
- ],
43
- [
44
- 1.0,
45
- 1.9
46
- ],
47
- [
48
- 1.0,
49
- 1.9
50
- ],
51
- [
52
- 2.0,
53
- -0.5
54
- ],
55
- [
56
- 2.0,
57
- -0.5
58
- ],
59
- [
60
- 1.0,
61
- 1.9
62
- ],
63
- [
64
- 1.0,
65
- 1.9
66
- ],
67
- [
68
- 1.0,
69
- 1.9
70
- ],
71
- [
72
- 2.0,
73
- -0.5
74
- ],
75
- [
76
- 2.0,
77
- -0.5
78
- ],
79
- [
80
- 2.0,
81
- -0.5
82
- ],
83
- [
84
- 1.0,
85
- 1.9
86
- ],
87
- [
88
- 1.0,
89
- 1.9
90
- ],
91
- [
92
- 1.0,
93
- 1.9
94
- ],
95
- [
96
- 1.0,
97
- 1.9
98
- ],
99
- [
100
- 2.0,
101
- -0.5
102
- ],
103
- [
104
- 1.0,
105
- 1.9
106
- ],
107
- [
108
- 2.0,
109
- -0.5
110
- ],
111
- [
112
- 1.0,
113
- 1.9
114
- ],
115
- [
116
- 2.0,
117
- -0.5
118
- ],
119
- [
120
- 1.0,
121
- 1.9
122
- ],
123
- [
124
- 1.0,
125
- 1.9
126
- ],
127
- [
128
- 1.0,
129
- 1.9
130
- ],
131
- [
132
- 1.0,
133
- 1.9
134
- ],
135
- [
136
- 2.0,
137
- -0.5
138
- ],
139
- [
140
- 1.0,
141
- 1.9
142
- ],
143
- [
144
- 1.0,
145
- 1.9
146
- ],
147
- [
148
- 1.0,
149
- 1.9
150
- ],
151
- [
152
- 1.0,
153
- 1.9
154
- ],
155
- [
156
- 2.0,
157
- -0.5
158
- ],
159
- [
160
- 1.0,
161
- 1.9
162
- ],
163
- [
164
- 2.0,
165
- -0.5
166
- ],
167
- [
168
- 1.0,
169
- 1.9
170
- ],
171
- [
172
- 1.0,
173
- 1.9
174
- ],
175
- [
176
- 1.0,
177
- 1.9
178
- ],
179
- [
180
- 1.0,
181
- 1.9
182
- ],
183
- [
184
- 1.0,
185
- 1.9
186
- ],
187
- [
188
- 1.0,
189
- 1.9
190
- ],
191
- [
192
- 2.0,
193
- -0.5
194
- ],
195
- [
196
- 2.0,
197
- -0.5
198
- ],
199
- [
200
- 2.0,
201
- -0.5
202
- ],
203
- [
204
- 2.0,
205
- -0.5
206
- ],
207
- [
208
- 2.0,
209
- -0.5
210
- ],
211
- [
212
- 1.0,
213
- 1.9
214
- ],
215
- [
216
- 2.0,
217
- -0.5
218
- ],
219
- [
220
- 2.0,
221
- -0.5
222
- ],
223
- [
224
- 2.0,
225
- -0.5
226
- ],
227
- [
228
- 2.0,
229
- -0.5
230
- ],
231
- [
232
- 1.0,
233
- 1.9
234
- ],
235
- [
236
- 1.0,
237
- 1.9
238
- ],
239
- [
240
- 1.0,
241
- 1.9
242
- ],
243
- [
244
- 1.0,
245
- 1.9
246
- ],
247
- [
248
- 1.0,
249
- 1.9
250
- ],
251
- [
252
- 1.0,
253
- 1.9
254
- ],
255
- [
256
- 1.0,
257
- 1.9
258
- ],
259
- [
260
- 1.0,
261
- 1.9
262
- ],
263
- [
264
- 1.0,
265
- 1.9
266
- ],
267
- [
268
- 2.0,
269
- -0.5
270
- ],
271
- [
272
- 1.0,
273
- 1.9
274
- ],
275
- [
276
- 1.0,
277
- 1.9
278
- ],
279
- [
280
- 1.0,
281
- 1.9
282
- ],
283
- [
284
- 2.0,
285
- -0.5
286
- ],
287
- [
288
- 2.0,
289
- -0.5
290
- ],
291
- [
292
- 1.0,
293
- 1.9
294
- ],
295
- [
296
- 2.0,
297
- -0.5
298
- ],
299
- [
300
- 1.0,
301
- 1.9
302
- ],
303
- [
304
- 2.0,
305
- -0.5
306
- ],
307
- [
308
- 2.0,
309
- -0.5
310
- ],
311
- [
312
- 1.0,
313
- 1.9
314
- ],
315
- [
316
- 1.0,
317
- 1.9
318
- ],
319
- [
320
- 2.0,
321
- -0.5
322
- ],
323
- [
324
- 1.0,
325
- 1.9
326
- ],
327
- [
328
- 1.0,
329
- 1.9
330
- ],
331
- [
332
- 2.0,
333
- -0.5
334
- ],
335
- [
336
- 1.0,
337
- 1.9
338
- ],
339
- [
340
- 1.0,
341
- 1.9
342
- ],
343
- [
344
- 1.0,
345
- 1.9
346
- ],
347
- [
348
- 2.0,
349
- -0.5
350
- ],
351
- [
352
- 2.0,
353
- -0.5
354
- ],
355
- [
356
- 1.0,
357
- 1.9
358
- ],
359
- [
360
- 1.0,
361
- 1.9
362
- ],
363
- [
364
- 2.0,
365
- -0.5
366
- ],
367
- [
368
- 2.0,
369
- -0.5
370
- ],
371
- [
372
- 1.0,
373
- 1.9
374
- ],
375
- [
376
- 1.0,
377
- 1.9
378
- ],
379
- [
380
- 1.0,
381
- 1.9
382
- ],
383
- [
384
- 2.0,
385
- -0.5
386
- ],
387
- [
388
- 1.0,
389
- 1.9
390
- ],
391
- [
392
- 2.0,
393
- -0.5
394
- ],
395
- [
396
- 2.0,
397
- -0.5
398
- ],
399
- [
400
- 2.0,
401
- -0.5
402
- ],
403
- [
404
- 1.0,
405
- 1.9
406
- ],
407
- [
408
- 1.0,
409
- 1.9
410
- ],
411
- [
412
- 2.0,
413
- -0.5
414
- ],
415
- [
416
- 1.0,
417
- 1.9
418
- ],
419
- [
420
- 1.0,
421
- 1.9
422
- ],
423
- [
424
- 1.0,
425
- 1.9
426
- ],
427
- [
428
- 2.0,
429
- -0.5
430
- ],
431
- [
432
- 1.0,
433
- 1.9
434
- ],
435
- [
436
- 2.0,
437
- -0.5
438
- ],
439
- [
440
- 2.0,
441
- -0.5
442
- ],
443
- [
444
- 1.0,
445
- 1.9
446
- ],
447
- [
448
- 1.0,
449
- 1.9
450
- ],
451
- [
452
- 1.0,
453
- 1.9
454
- ],
455
- [
456
- 1.0,
457
- 1.9
458
- ],
459
- [
460
- 1.0,
461
- 1.9
462
- ],
463
- [
464
- 1.0,
465
- 1.9
466
- ],
467
- [
468
- 1.0,
469
- 1.9
470
- ],
471
- [
472
- 2.0,
473
- -0.5
474
- ],
475
- [
476
- 1.0,
477
- 1.9
478
- ],
479
- [
480
- 1.0,
481
- 1.9
482
- ],
483
- [
484
- 2.0,
485
- -0.5
486
- ],
487
- [
488
- 1.0,
489
- 1.9
490
- ],
491
- [
492
- 1.0,
493
- 1.9
494
- ],
495
- [
496
- 2.0,
497
- -0.5
498
- ],
499
- [
500
- 2.0,
501
- -0.5
502
- ],
503
- [
504
- 1.0,
505
- 1.9
506
- ],
507
- [
508
- 1.0,
509
- 1.9
510
- ],
511
- [
512
- 2.0,
513
- -0.5
514
- ]
515
- ],
516
- "trajectory_prefix": [],
517
- "report": {
518
- "method": "branch-mass",
519
- "sampling_seed": 6370,
520
- "samples": 128,
521
- "exact_terminal_weights": [
522
- 0.0,
523
- 0.6,
524
- 0.4
525
- ],
526
- "interpretation": "Draw endpoints from the explicitly specified analytic branch mixture.",
527
- "finite_values": true
528
- }
529
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch-mass/samples.txt DELETED
@@ -1,128 +0,0 @@
1
- [2.0, -0.5]
2
- [1.0, 1.9]
3
- [1.0, 1.9]
4
- [1.0, 1.9]
5
- [1.0, 1.9]
6
- [1.0, 1.9]
7
- [2.0, -0.5]
8
- [2.0, -0.5]
9
- [2.0, -0.5]
10
- [2.0, -0.5]
11
- [1.0, 1.9]
12
- [1.0, 1.9]
13
- [2.0, -0.5]
14
- [2.0, -0.5]
15
- [1.0, 1.9]
16
- [1.0, 1.9]
17
- [1.0, 1.9]
18
- [2.0, -0.5]
19
- [2.0, -0.5]
20
- [2.0, -0.5]
21
- [1.0, 1.9]
22
- [1.0, 1.9]
23
- [1.0, 1.9]
24
- [1.0, 1.9]
25
- [2.0, -0.5]
26
- [1.0, 1.9]
27
- [2.0, -0.5]
28
- [1.0, 1.9]
29
- [2.0, -0.5]
30
- [1.0, 1.9]
31
- [1.0, 1.9]
32
- [1.0, 1.9]
33
- [1.0, 1.9]
34
- [2.0, -0.5]
35
- [1.0, 1.9]
36
- [1.0, 1.9]
37
- [1.0, 1.9]
38
- [1.0, 1.9]
39
- [2.0, -0.5]
40
- [1.0, 1.9]
41
- [2.0, -0.5]
42
- [1.0, 1.9]
43
- [1.0, 1.9]
44
- [1.0, 1.9]
45
- [1.0, 1.9]
46
- [1.0, 1.9]
47
- [1.0, 1.9]
48
- [2.0, -0.5]
49
- [2.0, -0.5]
50
- [2.0, -0.5]
51
- [2.0, -0.5]
52
- [2.0, -0.5]
53
- [1.0, 1.9]
54
- [2.0, -0.5]
55
- [2.0, -0.5]
56
- [2.0, -0.5]
57
- [2.0, -0.5]
58
- [1.0, 1.9]
59
- [1.0, 1.9]
60
- [1.0, 1.9]
61
- [1.0, 1.9]
62
- [1.0, 1.9]
63
- [1.0, 1.9]
64
- [1.0, 1.9]
65
- [1.0, 1.9]
66
- [1.0, 1.9]
67
- [2.0, -0.5]
68
- [1.0, 1.9]
69
- [1.0, 1.9]
70
- [1.0, 1.9]
71
- [2.0, -0.5]
72
- [2.0, -0.5]
73
- [1.0, 1.9]
74
- [2.0, -0.5]
75
- [1.0, 1.9]
76
- [2.0, -0.5]
77
- [2.0, -0.5]
78
- [1.0, 1.9]
79
- [1.0, 1.9]
80
- [2.0, -0.5]
81
- [1.0, 1.9]
82
- [1.0, 1.9]
83
- [2.0, -0.5]
84
- [1.0, 1.9]
85
- [1.0, 1.9]
86
- [1.0, 1.9]
87
- [2.0, -0.5]
88
- [2.0, -0.5]
89
- [1.0, 1.9]
90
- [1.0, 1.9]
91
- [2.0, -0.5]
92
- [2.0, -0.5]
93
- [1.0, 1.9]
94
- [1.0, 1.9]
95
- [1.0, 1.9]
96
- [2.0, -0.5]
97
- [1.0, 1.9]
98
- [2.0, -0.5]
99
- [2.0, -0.5]
100
- [2.0, -0.5]
101
- [1.0, 1.9]
102
- [1.0, 1.9]
103
- [2.0, -0.5]
104
- [1.0, 1.9]
105
- [1.0, 1.9]
106
- [1.0, 1.9]
107
- [2.0, -0.5]
108
- [1.0, 1.9]
109
- [2.0, -0.5]
110
- [2.0, -0.5]
111
- [1.0, 1.9]
112
- [1.0, 1.9]
113
- [1.0, 1.9]
114
- [1.0, 1.9]
115
- [1.0, 1.9]
116
- [1.0, 1.9]
117
- [1.0, 1.9]
118
- [2.0, -0.5]
119
- [1.0, 1.9]
120
- [1.0, 1.9]
121
- [2.0, -0.5]
122
- [1.0, 1.9]
123
- [1.0, 1.9]
124
- [2.0, -0.5]
125
- [2.0, -0.5]
126
- [1.0, 1.9]
127
- [1.0, 1.9]
128
- [2.0, -0.5]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch/config.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "method": "branch",
3
- "seed": 11,
4
- "mode": "train-sample",
5
- "quick": false,
6
- "device": "cpu",
7
- "python": "3.12.14",
8
- "torch": "2.9.1+cpu",
9
- "numpy": "2.5.3",
10
- "training": {
11
- "seed": 11,
12
- "updates": 350
13
- }
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch/generation_report.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "method": "branch",
3
- "sampling_seed": 111,
4
- "samples": 128,
5
- "terminal_branch_weights": [
6
- -0.0003769397735595703,
7
- 0.5967718958854675,
8
- 0.396018922328949
9
- ],
10
- "total_mass": 0.9924138784408569,
11
- "minimum_weight": -0.0003769397735595703,
12
- "branch_means": [
13
- [
14
- 0.9262207746505737,
15
- 0.011590571142733097
16
- ],
17
- [
18
- 0.9548583030700684,
19
- 0.9947662353515625
20
- ],
21
- [
22
- 0.945267379283905,
23
- -0.9763807654380798
24
- ]
25
- ],
26
- "approximation": "Learned velocity integration; soft growth constraints. Raw branch weights are retained, including negative residuals.",
27
- "finite_values": true
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lecture_7/verified_examples/branch/losses.json DELETED
@@ -1 +0,0 @@
1
- []