pranamanam commited on
Commit
da3babb
·
verified ·
1 Parent(s): c8293a4

Add Lecture 6 flow maps with tested training, sampling, and course navigation

Browse files

Add 16 complete Lecture 6 method examples, mathematical tests, paper/code provenance, slide mappings, and actual seeded verification records. Update the course README and preserve earlier lecture files.

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. README.md +31 -2
  2. lecture_6/.gitignore +4 -0
  3. lecture_6/MATHEMATICS.md +225 -0
  4. lecture_6/README.md +225 -0
  5. lecture_6/SLIDE_CODE_MAP.md +36 -0
  6. lecture_6/SOURCES.md +97 -0
  7. lecture_6/categorical.py +145 -0
  8. lecture_6/common.py +207 -0
  9. lecture_6/continuous.py +183 -0
  10. lecture_6/data/README.md +34 -0
  11. lecture_6/data/phrases.txt +640 -0
  12. lecture_6/data/variable_text.txt +640 -0
  13. lecture_6/examples/categorical.py +8 -0
  14. lecture_6/examples/consistency.py +8 -0
  15. lecture_6/examples/diamond.py +8 -0
  16. lecture_6/examples/discrete_esd.py +8 -0
  17. lecture_6/examples/discrete_lsd.py +8 -0
  18. lecture_6/examples/expanding.py +8 -0
  19. lecture_6/examples/flow_matching.py +8 -0
  20. lecture_6/examples/fmlm.py +8 -0
  21. lecture_6/examples/fmm_eulerian.py +8 -0
  22. lecture_6/examples/fmm_lagrangian.py +8 -0
  23. lecture_6/examples/latent.py +8 -0
  24. lecture_6/examples/meanflow.py +8 -0
  25. lecture_6/examples/meta.py +8 -0
  26. lecture_6/examples/self_distill.py +8 -0
  27. lecture_6/examples/shortcut.py +8 -0
  28. lecture_6/examples/ssfm.py +8 -0
  29. lecture_6/expanding.py +192 -0
  30. lecture_6/lecture_core.py +14 -0
  31. lecture_6/numerical_examples.py +187 -0
  32. lecture_6/posterior.py +179 -0
  33. lecture_6/requirements.txt +3 -0
  34. lecture_6/run.py +245 -0
  35. lecture_6/run_all.py +32 -0
  36. lecture_6/source_manifest.json +132 -0
  37. lecture_6/stochastic.py +110 -0
  38. lecture_6/tests/test_mathematics.py +189 -0
  39. lecture_6/verified_examples/README.md +76 -0
  40. lecture_6/verified_examples/categorical/config.json +21 -0
  41. lecture_6/verified_examples/categorical/losses.json +0 -0
  42. lecture_6/verified_examples/categorical/report.json +19 -0
  43. lecture_6/verified_examples/categorical/samples.txt +128 -0
  44. lecture_6/verified_examples/consistency/config.json +21 -0
  45. lecture_6/verified_examples/consistency/losses.json +0 -0
  46. lecture_6/verified_examples/consistency/report.json +23 -0
  47. lecture_6/verified_examples/consistency/samples.txt +128 -0
  48. lecture_6/verified_examples/consistency/teacher_losses.json +4002 -0
  49. lecture_6/verified_examples/diamond/config.json +21 -0
  50. lecture_6/verified_examples/diamond/losses.json +0 -0
README.md CHANGED
@@ -34,6 +34,7 @@ and implementation notes; additional directories will accompany later lectures.
34
  | 3 | Flow matching, diffusion, and guidance for ESM-2 residue embeddings | [Guide](lecture_3/README.md) · [Flow matching](lecture_3/esm2_flow_guidance.py) · [Diffusion](lecture_3/esm2_diffusion_guidance.py) |
35
  | 4 | Discrete diffusion, masked and uniform corruption, block generation, and guidance | [Guide](lecture_4/README.md) · [Training and generation](lecture_4/run.py) · [Slide code map](lecture_4/SLIDE_CODE_MAP.md) |
36
  | 5 | Discrete flow matching, Dirichlet and Fisher paths, Gumbel-Softmax, rectification, and multi-objective generation | [Guide](lecture_5/README.md) · [Training and generation](lecture_5/run.py) · [Slide code map](lecture_5/SLIDE_CODE_MAP.md) |
 
37
 
38
  ## Installation
39
 
@@ -41,7 +42,7 @@ Use Python 3.11, or another compatible Python version at least 3.10, in a new
41
  virtual environment. The shared `requirements.txt` pins PyTorch 2.9.1,
42
  TorchVision 0.24.1, and Transformers 4.57.6. Lecture 2 uses PyTorch and
43
  TorchVision; Lecture 3 also uses Transformers. Lectures 4 and 5 use PyTorch,
44
- NumPy, and SciPy. Their lecture folders also provide minimal requirements.
45
 
46
  ```bash
47
  git clone https://huggingface.co/ChatterjeeLab/CIS6270
@@ -144,6 +145,29 @@ Both folders include numerical examples, mathematical tests, and saved results
144
  from seeded CPU runs. The guides explain finite endpoint approximations and
145
  classroom simplifications for each method.
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  ## Repository organization
148
 
149
  | Location | Contents |
@@ -153,6 +177,7 @@ classroom simplifications for each method.
153
  | [`lecture_3/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_3) | ESM-2 flow and diffusion guidance scripts, sequence data, guide, and mathematical notes |
154
  | [`lecture_4/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_4) | Seven discrete diffusion and guidance examples, synthetic DNA, slide code map, and verified outputs |
155
  | [`lecture_5/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_5) | Eight discrete and simplex flow examples, synthetic DNA, slide code map, and verified outputs |
 
156
  | [`tests/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/tests) | Offline checks for the Lecture 3 examples |
157
 
158
  Installation instructions and the lecture index are maintained at the
@@ -165,6 +190,7 @@ references accompany the corresponding code.
165
  python -m unittest discover -s tests -v
166
  python -m unittest discover -s lecture_4/tests -v
167
  python -m unittest discover -s lecture_5/tests -v
 
168
  ```
169
 
170
  The Lecture 3 unit tests cover property annotations, scalarization weights, reward
@@ -172,7 +198,10 @@ gradients, DDPM schedule indexing, and constrained decoding.
172
 
173
  Lecture 4 tests check reverse KL losses and guidance calculations. Lecture 5
174
  tests check the master equation, Fisher geometry, Gumbel path derivatives, and
175
- MH detailed balance. Run a short end-to-end check of every method from its
 
 
 
176
  lecture folder with `python run_all.py --quick`.
177
 
178
  ## License
 
34
  | 3 | Flow matching, diffusion, and guidance for ESM-2 residue embeddings | [Guide](lecture_3/README.md) · [Flow matching](lecture_3/esm2_flow_guidance.py) · [Diffusion](lecture_3/esm2_diffusion_guidance.py) |
35
  | 4 | Discrete diffusion, masked and uniform corruption, block generation, and guidance | [Guide](lecture_4/README.md) · [Training and generation](lecture_4/run.py) · [Slide code map](lecture_4/SLIDE_CODE_MAP.md) |
36
  | 5 | Discrete flow matching, Dirichlet and Fisher paths, Gumbel-Softmax, rectification, and multi-objective generation | [Guide](lecture_5/README.md) · [Training and generation](lecture_5/run.py) · [Slide code map](lecture_5/SLIDE_CODE_MAP.md) |
37
+ | 6 | Continuous, latent, categorical, posterior, expanding, and strong stochastic flow maps | [Guide](lecture_6/README.md) · [Training and generation](lecture_6/run.py) · [Slide code map](lecture_6/SLIDE_CODE_MAP.md) |
38
 
39
  ## Installation
40
 
 
42
  virtual environment. The shared `requirements.txt` pins PyTorch 2.9.1,
43
  TorchVision 0.24.1, and Transformers 4.57.6. Lecture 2 uses PyTorch and
44
  TorchVision; Lecture 3 also uses Transformers. Lectures 4 and 5 use PyTorch,
45
+ NumPy, and SciPy. Lecture 6 uses PyTorch and NumPy. These lecture folders also provide minimal requirements.
46
 
47
  ```bash
48
  git clone https://huggingface.co/ChatterjeeLab/CIS6270
 
145
  from seeded CPU runs. The guides explain finite endpoint approximations and
146
  classroom simplifications for each method.
147
 
148
+ ## Lecture 6 - Flow Maps
149
+
150
+ Learn finite-time motion after the local flows from Lecture 5. The new folder
151
+ contains 16 complete examples covering flow-map matching and self-distillation,
152
+ consistency, Shortcut, MeanFlow, learned latent representations, Flow Map
153
+ Language Models, Categorical and Discrete Flow Maps, Diamond Maps, Meta Flow
154
+ Maps, Expanding Flow Maps, and Strong Stochastic Flow Maps.
155
+
156
+ ```bash
157
+ python lecture_6/run.py --method self-distill --out lecture_6/outputs/self-distill
158
+ python lecture_6/run.py --mode sample --out lecture_6/outputs/self-distill --sample-steps 1
159
+ python lecture_6/run_all.py --quick
160
+ ```
161
+
162
+ The [Lecture 6 guide](lecture_6/README.md) includes all method commands,
163
+ training objectives, data formats, and numerical assumptions. The
164
+ [slide code map](lecture_6/SLIDE_CODE_MAP.md) links implementations to the
165
+ [Flow Maps presentation](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit).
166
+ [Source notes](lecture_6/SOURCES.md) identify the exact papers and inspected
167
+ author-code revisions, including differences between paper pseudocode and
168
+ released implementations. [Verified examples](lecture_6/verified_examples/README.md)
169
+ contain actual training logs, generated samples, and checkpoint-reload checks.
170
+
171
  ## Repository organization
172
 
173
  | Location | Contents |
 
177
  | [`lecture_3/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_3) | ESM-2 flow and diffusion guidance scripts, sequence data, guide, and mathematical notes |
178
  | [`lecture_4/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_4) | Seven discrete diffusion and guidance examples, synthetic DNA, slide code map, and verified outputs |
179
  | [`lecture_5/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_5) | Eight discrete and simplex flow examples, synthetic DNA, slide code map, and verified outputs |
180
+ | [`lecture_6/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/lecture_6) | Sixteen flow-map implementations, text data, mathematical notes, slide links, and verified outputs |
181
  | [`tests/`](https://huggingface.co/ChatterjeeLab/CIS6270/tree/main/tests) | Offline checks for the Lecture 3 examples |
182
 
183
  Installation instructions and the lecture index are maintained at the
 
190
  python -m unittest discover -s tests -v
191
  python -m unittest discover -s lecture_4/tests -v
192
  python -m unittest discover -s lecture_5/tests -v
193
+ python -m unittest discover -s lecture_6/tests -v
194
  ```
195
 
196
  The Lecture 3 unit tests cover property annotations, scalarization weights, reward
 
198
 
199
  Lecture 4 tests check reverse KL losses and guidance calculations. Lecture 5
200
  tests check the master equation, Fisher geometry, Gumbel path derivatives, and
201
+ MH detailed balance. Lecture 6 checks map identities and JVPs, categorical
202
+ teachers, GLASS conditioning, reward gradients, insertion clocks, and Brownian
203
+ composition. Its end-to-end runner also verifies checkpoint reloads.
204
+ Run a short end-to-end check of every method from its
205
  lecture folder with `python run_all.py --quick`.
206
 
207
  ## License
lecture_6/.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ __pycache__/
2
+ .venv/
3
+ outputs/
4
+ *.pt
lecture_6/MATHEMATICS.md ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # From the lecture equations to the running code
2
+
3
+ The [slide code map](SLIDE_CODE_MAP.md) supplies the corresponding slide links.
4
+ Unless stated otherwise, time zero denotes Gaussian noise and time one denotes
5
+ data. All expectations below are population quantities; the training code uses
6
+ finite minibatches and learned approximations.
7
+
8
+ ## We first learn the motion at one time
9
+
10
+ For a noise sample $X_0$ and a data sample $X_1$, construct
11
+
12
+ $$I_t=(1-t)X_0+tX_1,\qquad \dot I_t=X_1-X_0.$$
13
+
14
+ Here $I_t$ is the sampled interpolant and $t$ is its progress from noise to data.
15
+ Regressing the displacement against the noisy state learns
16
+
17
+ $$b_t(x)=\mathbb E[X_1-X_0\mid I_t=x].$$
18
+
19
+ `interpolate` constructs the pair; `diagonal_loss` performs the regression.
20
+ The conditional-mean field transports the same one-time marginals as the
21
+ interpolant. Individual interpolant lines generally differ from its ODE paths.
22
+
23
+ ## Now predict the destination over an interval
24
+
25
+ $$F_{s,t}(x)=x+(t-s)v_{s,t}(x).$$
26
+
27
+ $s$ is the start, $t$ is the arrival time, and $v_{s,t}$ is the average velocity
28
+ along that ODE trajectory. `finite_map` uses this residual parameterization,
29
+ which gives $F_{s,s}(x)=x$ exactly. The diagonal average $v_{s,s}$ must still be
30
+ trained to equal $b_s$.
31
+
32
+ For $\dot x=x$, the exact map is $e^{t-s}x$. From $x=1$ over a unit interval,
33
+ the average velocity is $e-1\approx1.71828$. The residual update reaches
34
+ $2.71828$, while one Euler step using the initial velocity reaches only $2$.
35
+ `numerical_examples.py` trains this scalar map and reports its actual error.
36
+
37
+ ## The ODE supplies three finite-interval identities
38
+
39
+ $$\partial_t F_{s,t}(x)=b_t(F_{s,t}(x)),$$
40
+
41
+ $$\partial_sF_{s,t}(x)+J_xF_{s,t}(x)b_s(x)=0,$$
42
+
43
+ $$F_{s,t}(x)=F_{u,t}(F_{s,u}(x)).$$
44
+
45
+ The first changes the destination time. The second advances the start along the
46
+ same path, leaving the destination fixed. The third splits the interval at an
47
+ intermediate time $u$. `lagrangian_residual` and `eulerian_residual` use JVPs;
48
+ `semigroup_loss` evaluates the direct and split paths.
49
+
50
+ The identity map satisfies composition for every interval but has zero velocity.
51
+ This is why composition needs the diagonal anchor. A detached target also
52
+ changes the optimization: only the student branch receives its gradient.
53
+
54
+ ## Shortcut and MeanFlow choose particular targets
55
+
56
+ Shortcut learns a velocity for a longer interval from two shorter intervals:
57
+
58
+ $$v_{s,s+2d}(x)\approx\operatorname{sg}\left[
59
+ \tfrac12 v_{s,s+d}(x)+\tfrac12 v_{s+d,s+2d}(x+d\,v_{s,s+d}(x))\right].$$
60
+
61
+ $d$ is the half-step length. The second prediction receives the moved state.
62
+ `shortcut_loss` samples dyadic lengths and builds that detached target.
63
+
64
+ MeanFlow uses the opposite clock. Its $z_t=(1-t)X_{\rm data}+tX_{\rm noise}$
65
+ has data at zero and noise at one. For $r\leq t$,
66
+
67
+ $$z_r=z_t-(t-r)u(z_t,r,t),$$
68
+
69
+ $$u=v-(t-r)(\partial_tu+J_zu\,v).$$
70
+
71
+ $v=X_{\rm noise}-X_{\rm data}$ is the conditional training velocity.
72
+ `meanflow_loss` evaluates the JVP in direction $(v,0,1)$ for inputs $(z,r,t)$,
73
+ then detaches the complete right-hand target. The sampler retains the minus sign.
74
+
75
+ ## A latent representation changes the coordinates
76
+
77
+ For encoder $E$, decoder $D$, and data distribution $p$, fit a map to $E_\#p$.
78
+ Generation is $D(F_{0,1}(Z_0))$. The code first trains an autoencoder and freezes
79
+ it; a stored mean and standard deviation normalize its latent coordinates.
80
+ `train_latent` saves the encoder, decoder, normalization, and map together.
81
+
82
+ For an $L_D$-Lipschitz decoder, the distributional error is bounded by latent
83
+ transport error multiplied by $L_D$, plus reconstruction error. The code
84
+ reports reconstruction MSE separately; it does not assert a measured global
85
+ Lipschitz constant or equate that MSE with a Wasserstein distance.
86
+
87
+ ## Categorical maps constrain their predictions
88
+
89
+ For one-hot endpoints, the posterior mean denoiser $D_s(x)$ lies on the
90
+ probability simplex. The noisy state $x$ may lie outside it. The finite map is
91
+
92
+ $$F_{s,t}(x)=\frac{1-t}{1-s}x+\frac{t-s}{1-s}\psi_{s,t}(x),$$
93
+
94
+ where $\psi_{s,t}$ is the two-time softmax prediction. `categorical_map` implements
95
+ this expression. At $s=.25,t=.75$, state $(-.2,.6,1.1)$ and prediction
96
+ $(.1,.7,.2)$ produce $(0,2/3,.5)$; the intermediate state is not normalized.
97
+
98
+ Composition induces
99
+
100
+ $$q=\gamma\psi_{s,u}(x)+(1-\gamma)\psi_{u,t}(F_{s,u}(x)),\qquad
101
+ \gamma=\frac{(1-t)(u-s)}{(1-u)(t-s)}.$$
102
+
103
+ At $(s,u,t)=(0,.5,.75)$, the weight is $1/3$. Combining predictions $(.8,.2)$
104
+ and $(.2,.8)$ gives $(.4,.6)$. `composition_target` builds this probability-valued
105
+ target; a detached KL objective has logit gradient $p_{\rm student}-q$.
106
+
107
+ The decoding clock is $\tau(t)=1-\frac{V}{V-1}P_e(t)$, with vocabulary size $V$
108
+ and single-token corruption error $P_e$. `DecodingClock` numerically inverts it.
109
+ Endpoint enforcement prevents floating-point accuracy saturation from stopping
110
+ the sampler before physical time one.
111
+
112
+ ## Categorical and discrete consistency constrain different residuals
113
+
114
+ Categorical ECLD combines endpoint agreement with the time derivative of the
115
+ finite denoiser. With $\eta=(t-s)/(1-s)$, the scaled Lagrangian residual is
116
+
117
+ $$r=\psi_{s,t}-\psi_{t,t}(F_{s,t})+(1-t)\eta\partial_t\psi_{s,t}.$$
118
+
119
+ The endpoint term can vanish while the derivative term remains nonzero. The
120
+ implementation includes both and follows the released code's finite weights.
121
+
122
+ For Discrete Flow Maps, write $\psi=\operatorname{softmax}(z)$ and center the
123
+ arrival-time logit derivative:
124
+
125
+ $$\delta_k=\partial_tz_k-\sum_j\psi_j\partial_tz_j,\qquad
126
+ c=\frac{(t-s)(1-t)}{1-s}.$$
127
+
128
+ The Lagrangian teacher is
129
+
130
+ $$T_{\rm LSD}=\operatorname{softmax}\left[z_{t,t}(F_{s,t})-\log(1+c\delta)\right].$$
131
+
132
+ For the Eulerian teacher, replace the derivative with
133
+ $D_sz=\partial_sz+J_xz\,b_s$, center it in the same way, and use
134
+
135
+ $$T_{\rm ESD}=\operatorname{softmax}\left[z_{s,s}-
136
+ \log\left(1-\frac{(1-s)(t-s)}{1-t}\delta\right)\right].$$
137
+
138
+ `corrected_logit_teacher` computes both versions. Log arguments must be positive;
139
+ the code records its stabilization frequency so that violations remain visible.
140
+
141
+ ## Posterior maps need a second noise draw
142
+
143
+ Meta training constructs
144
+
145
+ $$I_t=(1-t)X_0+tX_1,\qquad \bar I_s=(1-s)\bar X_0+sX_1,$$
146
+
147
+ with independent $X_0,\bar X_0$. The outer observation $(t,I_t)$ stays fixed
148
+ while the inner map advances from $s$ to its target time. At that fixed context,
149
+ the shared $X_1$ has exactly the desired posterior distribution.
150
+
151
+ Diamond distillation obtains the corresponding conditional velocity through
152
+ GLASS. For two independent observations, the likelihood precisions add:
153
+
154
+ $$\Lambda=\frac{s^2}{(1-s)^2}+\frac{t^2}{(1-t)^2},\qquad
155
+ S=\Lambda^{-1}\left[\frac{s\bar x}{(1-s)^2}+\frac{tx}{(1-t)^2}\right].$$
156
+
157
+ The equivalent linear-interpolant time is
158
+ $t^*=\sqrt\Lambda/(1+\sqrt\Lambda)$. Evaluating the original denoiser at
159
+ $(t^*,t^*S)$ supplies the posterior mean conditioned on both observations.
160
+ `glass_denoiser` is checked against an independent Gaussian conditioning formula.
161
+
162
+ ## Posterior samples make reward averages computable
163
+
164
+ For reward $r$ and conditional samples $Z_k$,
165
+
166
+ $$\widehat V_t(x)=\log\left(\frac1K\sum_{k=1}^K e^{r(Z_k)}\right),\qquad
167
+ \widehat D_t^r(x)=\sum_k\operatorname{softmax}(r(Z))_k Z_k.$$
168
+
169
+ `posterior_value` differentiates through the learned conditional samples.
170
+ `guided_samples` uses $(\widehat D_t^r(x)-x)/(1-t)$ as the guided velocity.
171
+ The ratio is biased at finite $K$, even with an exact conditional sampler.
172
+
173
+ For Meta fine-tuning, let $d=b_{\rm student}-b_{\rm base}$, $w=e^{r(Z)}$, and
174
+ $a=g_t^2/2$. The detached surrogate is
175
+
176
+ $$\ell=\left\|d+(w-1)\operatorname{sg}(d)-a\operatorname{sg}(\nabla_xw)\right\|^2.$$
177
+
178
+ Its expected gradient in $d$ is $2\mathbb E[wd-a\nabla_xw]$. Squaring $wd-a\nabla w$
179
+ without that stop-gradient placement introduces an extra weight. The test suite
180
+ checks this distinction directly. For the linear path, $a=(1-t)/t$; the optional
181
+ training demonstration therefore excludes the singular initial time.
182
+
183
+ ## Expansion gives each new token its own clock
184
+
185
+ A token born at $b_i$ has local time
186
+
187
+ $$\tau_i(t)=\max\left(0,\frac{t-b_i}{1-b_i}\right),\qquad
188
+ \frac{d\tau_i}{dt}=\frac1{1-b_i}\quad(t>b_i).$$
189
+
190
+ `local_clock` and `local_map` preserve this information during transport.
191
+ `insert_tokens` keeps token order, inserted noise, and birth metadata aligned.
192
+ The linear insertion CDF gives conditional birth fraction
193
+ $\rho_{s,t}=(t-s)/(1-s)$. Predicted remaining gap means are converted into
194
+ interval means using this factor.
195
+
196
+ The count divergence is
197
+
198
+ $$\phi(a,b)=b-a+a\log(a/b),\qquad b>0,$$
199
+
200
+ where $a$ is a realized count and $b$ is the predicted mean. Its population
201
+ minimum is $b=\mathbb E[a]$. The zero-count branch is implemented with a finite
202
+ autodiff expression. Sampling uses bounded binomial proposals and reports
203
+ counts removed by global budget capping.
204
+
205
+ ## Strong maps must retain the same driving path
206
+
207
+ For an interval of length $h$, the first two Brownian integrals satisfy
208
+
209
+ $$I_0\sim\mathcal N(0,h),\qquad I_1\sim\mathcal N(0,h/3),\qquad I_0\perp I_1.$$
210
+
211
+ For left/right subintervals of lengths $h_L,h_R$, Chen composition is
212
+
213
+ $$I_0=I_0^L+I_0^R,$$
214
+
215
+ $$I_1=\frac{h_LI_1^L+h_RI_1^R-h_RI_0^L+h_LI_0^R}{h_L+h_R}.$$
216
+
217
+ With equal halves, $(I_0^L,I_1^L)=(.2,.04)$ and
218
+ $(I_0^R,I_1^R)=(-.1,-.02)$ combine into $(.1,-.14)$.
219
+ `chen_two` and `aggregate_tree` ensure the direct and split maps refer to that
220
+ same history. Independent coarse noise would compare different sample paths.
221
+
222
+ The SSFM objective combines a short stochastic matching step with same-noise
223
+ composition. The reported strong error compares the learned result to a fine
224
+ Euler-Maruyama trajectory using the same increments. Terminal variance checks
225
+ the marginal separately; matching variance cannot establish pathwise accuracy.
lecture_6/README.md ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CIS 6270 - Lecture 6 - Flow Maps
2
+
3
+ Course hub: [ChatterjeeLab/CIS6270](https://huggingface.co/ChatterjeeLab/CIS6270).
4
+ Slides: [Lecture 6 - Flow Maps](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit).
5
+ Previous lecture: [Discrete Flow Matching](../lecture_5/README.md).
6
+
7
+ Lecture 5 learned how a distribution moves locally. Here we learn the motion over
8
+ an entire time interval. The examples progress from continuous flow maps to
9
+ latent representations, categorical text, posterior maps, expanding states,
10
+ and maps driven by a shared Brownian path.
11
+
12
+ This folder contains **16 complete training and generation examples**, with
13
+ checkpoint loading, data, mathematical checks, and saved execution results.
14
+ The code uses small PyTorch networks and inspectable datasets. Each method's
15
+ objective and sampler are implemented here; the large image and language
16
+ benchmark runs from the papers require their original architectures, datasets,
17
+ and training budgets. [SOURCES.md](SOURCES.md) records the exact papers, inspected
18
+ author-code revisions, and differences from those implementations.
19
+
20
+ ## Train a velocity, then learn a finite map
21
+
22
+ Use Python 3.11 or later. The minimal requirements retain the course's PyTorch
23
+ 2.9.1 baseline. All examples run on CPU; `--device cuda` selects an available GPU.
24
+ The data require no downloads.
25
+
26
+ From the course repository root:
27
+
28
+ ```bash
29
+ cd lecture_6
30
+ python -m venv .venv
31
+ source .venv/bin/activate
32
+ python -m pip install -r requirements.txt
33
+
34
+ python run.py --method flow-matching --sample-steps 32 --out outputs/flow-matching
35
+ python run.py --method self-distill --out outputs/self-distill
36
+ python run.py --mode sample --out outputs/self-distill --sample-steps 1
37
+ ```
38
+
39
+ The first command fits the conditional-mean velocity and integrates it with
40
+ Heun's method. The second trains a two-time map using a diagonal velocity loss
41
+ and a detached composition target. The third loads its checkpoint and generates
42
+ in one map evaluation. The baseline uses two velocity evaluations per Heun step;
43
+ finite maps use one evaluation per step.
44
+
45
+ Training writes `checkpoint.pt`, `config.json`, `losses.json`, `report.json`, and
46
+ `samples.txt`. A teacher or autoencoder stage also writes `teacher_losses.json`.
47
+ Generation-only mode reads model architecture and vocabulary from the checkpoint
48
+ and writes `resampled.txt` and `sample_report.json`, preserving training records.
49
+ The checkpoint contains the inference state, not optimizer state for resuming
50
+ training. `--mode train` saves training records without generating samples.
51
+
52
+ ## Run every method in the same structure as Lectures 4 and 5
53
+
54
+ ```bash
55
+ python run_all.py --quick
56
+ python run_all.py
57
+ python -m unittest discover -s tests -v
58
+ python numerical_examples.py --output outputs/numerical
59
+ ```
60
+
61
+ `--quick` performs 20 optimization steps per method and verifies execution and
62
+ checkpoint reloading. The regular command uses 1,000 steps per training stage.
63
+ Both run every method and require seeded generated samples to agree exactly
64
+ after checkpoint reload. The quick run measures execution correctness; inspect
65
+ the longer run's losses and sample metrics when discussing learned behavior.
66
+
67
+ | Method | Training | Generation |
68
+ | --- | --- | --- |
69
+ | `flow-matching` | Conditional displacement regression on a linear interpolant | Heun integration of the learned diagonal velocity |
70
+ | `fmm-lagrangian` | Train a velocity teacher, then match the map's arrival-time derivative to the teacher | Residual finite-time maps |
71
+ | `fmm-eulerian` | Train a velocity teacher, then match the start-time directional derivative to zero | Residual finite-time maps |
72
+ | `self-distill` | Diagonal flow matching and EMA two-subinterval composition targets | One or more direct map updates |
73
+ | `consistency` | Endpoint consistency along short Heun-solved teacher intervals, with the diagonal anchor | One endpoint prediction |
74
+ | `shortcut` | Conditional flow matching and two-half-step average-velocity targets on dyadic intervals | One or more shortcuts |
75
+ | `meanflow` | Backward average-velocity target with a directional JVP and detached adaptive weights | Backward updates from noise at time one to data at zero |
76
+ | `latent` | Train a 3D-to-2D autoencoder, freeze it, standardize its encodings, then train a flow map | Latent map followed by the saved decoder |
77
+ | `fmlm` | Diagonal token CE and weighted progressive denoiser consistency | Warped-time affine categorical maps, followed by argmax |
78
+ | `categorical` | Diagonal CE and endpoint consistency plus temporal-derivative energy | The same categorical map parameterization |
79
+ | `discrete-lsd` | Diagonal CE and Lagrangian logit-corrected KL teacher | Categorical finite-time maps |
80
+ | `discrete-esd` | Diagonal CE and Eulerian directional-JVP logit teacher | Categorical finite-time maps |
81
+ | `diamond` | Distill a GLASS posterior velocity built from an analytic Gaussian-mixture denoiser | Conditional posterior samples, differentiable value estimates, and reward steering |
82
+ | `meta` | Independent inner and outer noise with a shared data endpoint, diagonal regression, and conditional composition | Posterior samples and reward-weighted posterior-mean steering |
83
+ | `expanding` | Local-clock token CE, compatible-canvas composition, and remaining/interval gap-count losses | Learned binomial gap insertion, budget capping, and local-clock transport |
84
+ | `ssfm` | OU drift anchoring, small-step stochastic matching, and same-noise composition | Strong maps using consistently aggregated Brownian coefficients |
85
+
86
+ Each method also has its own entry point:
87
+
88
+ ```bash
89
+ python examples/fmm_lagrangian.py
90
+ python examples/fmm_eulerian.py
91
+ python examples/consistency.py
92
+ python examples/shortcut.py
93
+ python examples/meanflow.py --sample-steps 1
94
+ python examples/latent.py --teacher-steps 2000
95
+ python examples/fmlm.py --sample-steps 1
96
+ python examples/categorical.py
97
+ python examples/discrete_lsd.py
98
+ python examples/discrete_esd.py
99
+ python examples/diamond.py --posterior-steps 4 --particles 64
100
+ python examples/meta.py --finetune-steps 300
101
+ python examples/expanding.py --sample-steps 4
102
+ python examples/ssfm.py --sample-steps 4
103
+ python examples/ssfm.py --ssfm-target paper --lr 0.0001 --train-steps 2000 --out outputs/ssfm-paper
104
+ ```
105
+
106
+ The common options are `--train-steps`, `--teacher-steps`, `--batch-size`,
107
+ `--width`, `--lr`, `--seed`, `--samples`, `--sample-steps`, and `--out`.
108
+ `--teacher-steps` controls the teacher or autoencoder stage where one exists.
109
+ Run `python run.py --help` for the remaining options. The `consistency` example
110
+ always makes one endpoint prediction. SSFM requires a power-of-two sampling
111
+ step count so its finite Brownian tree supports every requested partition.
112
+
113
+ ## Change one component at a time
114
+
115
+ `lecture_core.py` exposes the functions used in the slide walkthroughs.
116
+ `common.py` contains networks, data handling, optimization, and reference
117
+ distributions. Each method family has a separate implementation file.
118
+
119
+ | File | Responsibility |
120
+ | --- | --- |
121
+ | `continuous.py` | Diagonal, Lagrangian, Eulerian, semigroup, Shortcut, MeanFlow, and latent training |
122
+ | `categorical.py` | Affine probability-valued maps, inverse decoding clock, ECLD, and logit teachers |
123
+ | `posterior.py` | GLASS fusion, conditional map training, posterior values, importance correction, and reward fine-tuning |
124
+ | `expanding.py` | Birth times, compaction, gap labels, count losses, and expansion/transport sampling |
125
+ | `stochastic.py` | Brownian integrals, Chen composition, OU training, and strong-error evaluation |
126
+ | `numerical_examples.py` | The lecture's numerical examples, including the trained exponential-flow example |
127
+ | `SLIDE_CODE_MAP.md` | Stable links from every code slide and major method to the implementation |
128
+ | `MATHEMATICS.md` | Equations, variable definitions, and the meaning of each loss |
129
+ | `verified_examples/` | Actual seeded training logs, generated samples, and verification reports |
130
+
131
+ The small sequence MLP receives the entire sequence. Its per-position output
132
+ can therefore depend on every input position. The variable-length network also
133
+ receives padding masks and birth-time metadata. Replacing these backbones with
134
+ transformers does not require changing the displayed map identities.
135
+
136
+ ## Data and evaluation
137
+
138
+ The continuous examples use four 2D Gaussians with known centers and variance.
139
+ Reports include nearest-center distance, mode fractions, mode entropy, and exact
140
+ target log density. These metrics describe different aspects of the samples;
141
+ high mode entropy alone does not establish sample fidelity.
142
+
143
+ `data/phrases.txt` contains correlated four-token phrases such as `red circle
144
+ moves left`. `data/variable_text.txt` contains two-, four-, and five-token
145
+ versions. Reports record token entropy, unique fraction, training-support
146
+ fraction, and lengths. These tiny-data statistics are not LM1B/OWT perplexity or
147
+ large-language-model evaluations. The split is a seeded 80/20 split of examples;
148
+ the small grammar intentionally appears in both splits.
149
+
150
+ Custom fixed-length text can be supplied with `--data my_phrases.txt`.
151
+ The expanding example also accepts variable-length lines, up to 32 tokens.
152
+ Continuous methods accept `--data points.csv`, with two finite numeric columns
153
+ and no header. Diamond, Meta, and SSFM retain their specified reference
154
+ distributions so their analytic diagnostics remain valid. See [data/README.md](data/README.md).
155
+
156
+ ## Numerical and theorem boundaries
157
+
158
+ - **Continuous maps.** The diagonal is exactly the identity as a map, while its
159
+ predicted average velocity is trained by flow matching. Interpolant samples
160
+ are not individual ODE trajectories. Diagonal regression has an irreducible
161
+ conditional-variance floor, so raw training loss need not approach zero.
162
+ - **Teacher distillation.** The finite-map teachers are learned in a separate
163
+ first stage. This retains teacher approximation error. The fixed MLP, bounded
164
+ interval sampling, and loss weights are classroom choices.
165
+ - **Consistency and Shortcut.** Endpoint consistency is a compact
166
+ flow-matching-clock teaching implementation. Shortcut uses dyadic interval
167
+ lengths, a continuous start-time sample, EMA targets, and a separate diagonal
168
+ loss. The authors' large-image code has additional schedules and clipping.
169
+ - **MeanFlow.** Data are at time zero and noise at one. The directional JVP uses
170
+ the conditional training velocity, and the entire corrected target is
171
+ detached. Seventy-five percent of training examples use equal times. Uniform
172
+ time sampling replaces the author's default logit-normal schedule.
173
+ - **Latent maps.** This section demonstrates a learned representation and
174
+ decoder. It does not claim a separate canonical paper named Latent Flow Maps.
175
+ Reconstruction error and latent transport error are reported separately.
176
+ - **Categorical maps.** Only the predicted denoiser lies on the simplex during
177
+ the trajectory. The final step reaches time one exactly; argmax is an explicit
178
+ decoding approximation for an imperfect model. We use Gaussian quadrature
179
+ for the decoding clock. Categorical ECLD uses the released code's bounded
180
+ endpoint-plus-time-energy objective, with an EMA endpoint target. Detached KL
181
+ and CE have the same student gradient; they log different scalar values.
182
+ - **Discrete logit teachers.** The logarithmic correction requires positive
183
+ denominators. The implementation clamps them at 0.05 and logs the affected
184
+ fraction. This changes the teacher away from the exact solution; softmax
185
+ alone cannot repair an invalid logarithm. Differential objectives stay below
186
+ terminal time 0.97. No unreported gradient surgery is applied.
187
+ - **Diamond and Meta.** The two noises are independent and share a clean
188
+ endpoint. Diamond uses an exact, evaluable mixture denoiser as its GLASS
189
+ teacher; Meta learns directly from samples. Posterior diagnostics compare
190
+ both means and variances. Finite importance estimates and reward-weighted
191
+ posterior means have self-normalization bias. The weighted-Diamond companion
192
+ uses an explicit full-support Gaussian proposal with a known density.
193
+ - **Meta fine-tuning.** `--finetune-steps` runs and saves the detached surrogate
194
+ from Equation 43. It uses a bounded coordinate reward and the analytic base
195
+ mixture drift. Training is restricted to outer times 0.05 through 0.85;
196
+ extending the learned drift outside that interval is extrapolation.
197
+ - **Expanding maps.** The data use a linear birth CDF. The network predicts
198
+ remaining gap means and interval means through the conditional insertion
199
+ factor. Binomial proposals and global budget capping approximate a joint count
200
+ law; a mean alone does not identify that law. A finite sampling jump introduces
201
+ new coordinates at its start, then transports them. Training compares routes
202
+ on a shared destination canvas with compatible noise and local clocks.
203
+ These are explicit finite-step choices, not a proof of exact conditional-law
204
+ recovery by the fitted network. Empty generated sequences remain visible in
205
+ the reports; the sampler does not silently replace them.
206
+ - **Strong stochastic maps.** The example is an additive-noise OU SDE with a
207
+ known diffusion coefficient. It uses the first two Legendre integrals and a
208
+ learned average drift. Default `official-code` targets detach an EMA split
209
+ prediction; `--ssfm-target paper` detaches the direct prediction, as in the
210
+ lecture's pseudocode. Both reuse exactly the same Brownian history. The
211
+ reference is a fine Euler-Maruyama solve on that history, so its residual
212
+ discretization error is retained. No claim is made for multiplicative noise
213
+ or exact pathwise recovery with only two coefficients. The optional paper
214
+ orientation remained inaccurate in the recorded experiments, including the
215
+ lower-learning-rate recipe above; see the explicit sensitivity results in
216
+ `verified_examples/README.md`. Use the default released-code orientation for
217
+ the successful OU demonstration.
218
+
219
+ ## Read the saved results with the implementation
220
+
221
+ [verified_examples/README.md](verified_examples/README.md) records the executed
222
+ environment, commands, and metrics. Checkpoints are generated locally and are
223
+ excluded from this folder's Git history, matching Lectures 4 and 5. The saved
224
+ text/JSON records let students inspect a complete run before training their own
225
+ models. The [slide code map](SLIDE_CODE_MAP.md) connects that run to the lecture.
lecture_6/SLIDE_CODE_MAP.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Lecture 6 slide-to-code map
2
+
3
+ These links use stable native slide identifiers. Each code slide connects to the same functions used by the training runner.
4
+
5
+ | Code walkthrough | Slide | Implementation |
6
+ | --- | --- | --- |
7
+ | The map takes the state and both times as inputs | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u038_b0) | `common.finite_map`, `continuous.diagonal_loss`, `continuous.semigroup_loss`, `numerical_examples.train_scalar` |
8
+ | The two losses connect local motion to a longer move | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u039_b0) | `common.finite_map`, `continuous.diagonal_loss`, `continuous.semigroup_loss`, `numerical_examples.train_scalar` |
9
+ | A JVP computes that correction without forming a Jacobian | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u051_b0) | `continuous.meanflow_loss` |
10
+ | Softmax constrains the prediction before the map is applied | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u080_b0) | `categorical.categorical_map`, `categorical.composition_target`, `categorical.probability_kl` |
11
+ | The target combines probabilities from two different states | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u081_b0) | `categorical.categorical_map`, `categorical.composition_target`, `categorical.probability_kl` |
12
+ | We can differentiate through the posterior samples | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u122_b0) | `posterior.posterior_samples`, `posterior.posterior_value` |
13
+ | The stop-gradient placement is essential in this fine-tuning loss | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u139_b0) | `posterior.fine_tune_surrogate`, `posterior.train_reward_drift` |
14
+ | Keep the count, noise, and clock updates together | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u168_b0) | `expanding.bounded_counts`, `expanding.insert_tokens`, `expanding.local_clock` |
15
+ | Sampling and combining two coefficients is only a few lines | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u198_b0) | `stochastic.sample_coefficients`, `stochastic.chen_two`, `stochastic.train_stochastic` |
16
+ | The consistency update compares those two routes | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u199_b0) | `stochastic.sample_coefficients`, `stochastic.chen_two`, `stochastic.train_stochastic` |
17
+
18
+ ## Method sections
19
+
20
+ | Lecture section | First slide | Code |
21
+ | --- | --- | --- |
22
+ | From velocities to finite motion | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u001_b0) | [continuous.py](continuous.py) |
23
+ | Learning the identities | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u025_b0) | [continuous.py](continuous.py) |
24
+ | Related finite-step formulations | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u041_b0) | [continuous.py](continuous.py) |
25
+ | MeanFlow and the direction of time | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u047_b0) | [continuous.py](continuous.py) |
26
+ | Flow maps in learned latent spaces | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u054_b0) | [posterior.py](posterior.py) |
27
+ | Flow Map Language Models | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u060_b0) | [categorical.py](categorical.py) |
28
+ | Categorical Flow Maps | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u083_b0) | [categorical.py](categorical.py) |
29
+ | Discrete Flow Maps and logit consistency | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u093_b0) | [categorical.py](categorical.py) |
30
+ | Diamond Maps and posterior lookahead | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u103_b0) | [posterior.py](posterior.py) |
31
+ | Meta Flow Maps | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u125_b0) | [posterior.py](posterior.py) |
32
+ | Expanding Flow Maps | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u143_b0) | [expanding.py](expanding.py) |
33
+ | Strong Stochastic Flow Maps | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u173_b0) | [stochastic.py](stochastic.py) |
34
+ | Connecting the formulations | [Open](https://docs.google.com/presentation/d/1wfLAazqYveMoyvdy0y5ILeionp7eUjcPgxu-5QFlWwI/edit#slide=id.fm6_u206_b0) | [stochastic.py](stochastic.py) |
35
+
36
+ The exponential-flow code slides use the exact scalar drift `b(x)=x`; the generative runners use learned fields on a Gaussian mixture. The scalar training experiment remains in `numerical_examples.py`. The SSFM consistency code slide corresponds to `--ssfm-target paper`; the default follows the released code orientation, described in `SOURCES.md`.
lecture_6/SOURCES.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Primary papers and author-code checks
2
+
3
+ The teaching implementations were written for this course. Upstream training files were inspected to check objectives and conventions; their code is not vendored here. Small networks, synthetic data, and explicit numerical choices make the methods runnable on CPU. Inspection date: 2026-09-13.
4
+
5
+ ## Flow Map Matching
6
+
7
+ [Paper](https://arxiv.org/abs/2406.07507v2). Class methods: `fmm-lagrangian, fmm-eulerian`.
8
+
9
+ [Inspected author source](https://github.com/nmboffi/flow-maps/blob/2f115a07fa9073553193e4b265dfc303827af2b0/py/common/losses.py), revision `2f115a07fa90`.
10
+
11
+ Frozen learned velocity teachers; residual-map JVPs; small MLP and bounded time range.
12
+
13
+ ## How to build a consistency model: Learning flow maps via self-distillation
14
+
15
+ [Paper](https://arxiv.org/abs/2505.18825v2). Class methods: `self-distill`.
16
+
17
+ [Inspected author source](https://github.com/nmboffi/flow-maps/blob/2f115a07fa9073553193e4b265dfc303827af2b0/py/common/losses.py), revision `2f115a07fa90`.
18
+
19
+ Diagonal regression plus an EMA progressive target, normalized by a floored interval length. Learned uncertainty weights are omitted.
20
+
21
+ ## One Step Diffusion via Shortcut Models
22
+
23
+ [Paper](https://arxiv.org/abs/2410.12557v3). Class methods: `shortcut`.
24
+
25
+ [Inspected author source](https://github.com/kvfrans/shortcut-models/blob/601004348667094e1b71f30942199759412d4432/targets_shortcut.py), revision `601004348667`.
26
+
27
+ Two half-step average target and dyadic intervals retained. Continuous start-time sampling and small MLP replace image-specific schedules and clipping.
28
+
29
+ ## Mean Flows for One-step Generative Modeling
30
+
31
+ [Paper](https://arxiv.org/abs/2505.13447). Class methods: `meanflow`.
32
+
33
+ [Inspected author source](https://github.com/Gsunshine/meanflow/blob/d70cb55d298ee03c53bf6da67bec281082e4e2d9/meanflow.py), revision `d70cb55d298e`.
34
+
35
+ Backward clock, conditional-velocity JVP, detached target, adaptive loss, and 75% diagonal proportion retained. Uniform time sampling; no class guidance.
36
+
37
+ ## Flow Map Language Models: One-step Language Modeling via Continuous Denoising
38
+
39
+ [Paper](https://arxiv.org/abs/2602.16813v3). Class methods: `fmlm`.
40
+
41
+ [Inspected author source](https://github.com/david3684/flm/blob/a1918d5164e5038e37d0b7a4fb2010ce75b863b3/algo.py), revision `a1918d5164e5`.
42
+
43
+ PSD denoiser target and Gaussian decoding clock retained. Independent clean-data diagonal supervision; EMA targets; quadrature lookup and MLP replace full language architecture.
44
+
45
+ ## Categorical Flow Maps
46
+
47
+ [Paper](https://arxiv.org/abs/2602.12233v1). Class methods: `categorical`.
48
+
49
+ [Inspected author source](https://github.com/olsdavis/semicat/blob/558602a0fa722514e4a6012f5c46a8ae178b3068/semicat/models/semicat.py), revision `558602a0fa72`.
50
+
51
+ Released ECLD endpoint CE plus sum-of-squares time energy. Detached-target KL has identical student gradient. EMA target replaces the current network target.
52
+
53
+ ## Discrete Flow Maps
54
+
55
+ [Paper](https://arxiv.org/abs/2604.09784v1). Class methods: `discrete-lsd, discrete-esd`.
56
+
57
+ Derived from the paper. The linked project page has a placeholder Code link, so no author implementation was verified. Positive log denominators are explicitly clamped and counted; no gradient surgery.
58
+
59
+ ## Diamond Maps: Stochastic Flow Maps
60
+
61
+ [Paper](https://arxiv.org/abs/2602.05993). Class methods: `diamond`.
62
+
63
+ [Inspected author source](https://github.com/PeterHolderrieth/diamond_maps/blob/d30f65c75a169a2ed624f146b2770aeef882543a/posterior_diamond_maps/py/common/losses.py), revision `d30f65c75a16`.
64
+
65
+ GLASS conditional velocity and Lagrangian posterior distillation. Exact Gaussian-mixture denoiser replaces a pretrained image teacher. Weighted posterior recovery uses an explicit Gaussian proposal with a known density.
66
+
67
+ ## Meta Flow Maps enable scalable reward alignment
68
+
69
+ [Paper](https://arxiv.org/abs/2601.14430v2). Class methods: `meta`.
70
+
71
+ [Inspected author source](https://github.com/adh1s/mfm/blob/53c0f60db695cad88bbace8fb26469614e9e7d7d/src/mfm/losses/losses.py), revision `53c0f60db695`.
72
+
73
+ Data training with independent inner/outer noises and a shared endpoint; conditional semigroup objective. Optional Equation 43 fine-tuning also checked against src/mfm/losses/finetune.py.
74
+
75
+ ## Expanding Flow Maps
76
+
77
+ [Paper](https://arxiv.org/abs/2607.21585v1). Class methods: `expanding`.
78
+
79
+ [Inspected author source](https://github.com/sophtang/ExpandingFlowMaps/blob/4defc1ff168d12526d85b551bea78150b9aec605/README.md), revision `4defc1ff168d`.
80
+
81
+ Paper Algorithms 2-4 and local-clock equations. The inspected repository contains README and artwork only. Classroom implementation includes a shared lifted canvas, remaining/interval count heads, explicit local clocks, and budget-capped binomial insertions.
82
+
83
+ ## Strong Stochastic Flow Maps
84
+
85
+ [Paper](https://arxiv.org/abs/2606.01086v1). Class methods: `ssfm`.
86
+
87
+ [Inspected author source](https://github.com/sammccallum/ssfm/blob/24b563620a8ee61c683d791fe802b56668f98f9b/ssfm/losses.py), revision `24b563620a8e`.
88
+
89
+ First two Legendre integrals, Chen composition, known diffusion, small-step matching. The released loss detaches an EMA split target; paper Algorithm 1 detaches the direct target. Both orientations are selectable. OU replaces image/molecular experiments; no learned uncertainty weights.
90
+
91
+ ## Supporting lecture demonstrations
92
+
93
+ `flow-matching` supplies the local velocity baseline. `consistency` demonstrates endpoint consistency on a learned flow teacher using the forward clock and a residual endpoint parameterization; it is not a reproduction of the original EDM consistency training system. `latent` demonstrates the encoder/map/decoder construction and does not attribute it to a separate paper called Latent Flow Maps. `numerical_examples.py` retains the lecture’s scalar ODE experiment and exact arithmetic checks.
94
+
95
+ ## Version and result scope
96
+
97
+ Paper links retain the lecture versions when supplied. Author repositories may have advanced after those paper versions. The source revision above records exactly what was inspected. The lecture’s paper figures and benchmark values remain in the slide deck; the files under `verified_examples/` contain newly executed course examples, with their own data, compute settings, and metrics. No reported FID, generative perplexity, or biological benchmark is reproduced by these CPU teaching runs.
lecture_6/categorical.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Simplex-valued mean denoisers for Flow Map Language Models and discrete maps.
2
+
3
+ The state is Gaussian-noised one-hot text and can be outside the simplex.
4
+ Only the softmax endpoint prediction is a probability vector.
5
+ """
6
+ import math
7
+
8
+ import torch
9
+ from torch.nn import functional as F
10
+
11
+ from common import SequenceNet, draw_batch, ema_copy, interpolate, optimize, time_like
12
+
13
+
14
+ def categorical_map(model, x, s, t):
15
+ s, t = time_like(s, x), time_like(t, x)
16
+ probability = model(x, s, t).softmax(-1)
17
+ h = ((t - s) / (1 - s)).unsqueeze(-1)
18
+ return x + h * (probability - x), probability
19
+
20
+
21
+ def composition_target(model, x, s, u, t):
22
+ mid, p1 = categorical_map(model, x, s, u)
23
+ _, p2 = categorical_map(model, mid, u, t)
24
+ gamma = ((1 - t) * (u - s) / ((1 - u) * (t - s))).unsqueeze(-1)
25
+ return gamma * p1 + (1 - gamma) * p2
26
+
27
+
28
+ def probability_kl(logits, target):
29
+ return F.kl_div(logits.log_softmax(-1), target, reduction='none').sum(-1).mean()
30
+
31
+
32
+ class DecodingClock:
33
+ """Inverse of the FMLM decoding-accuracy clock for isotropic Gaussian noise.
34
+
35
+ P(correct) = E_Z[Phi(Z + t/(1-t))^(V-1)]. Gaussian quadrature gives a
36
+ deterministic lookup. Endpoint values are exact. No empirical vocabulary
37
+ frequency estimate is mixed into this corruption-only clock.
38
+ """
39
+ def __init__(self, vocab, device='cpu'):
40
+ import numpy as np
41
+ nodes, weights = np.polynomial.hermite.hermgauss(64)
42
+ self.t = torch.linspace(0, .999, 1001, device=device)
43
+ z = torch.as_tensor(nodes * math.sqrt(2), device=device, dtype=torch.float64)
44
+ w = torch.as_tensor(weights / math.sqrt(math.pi), device=device, dtype=torch.float64)
45
+ snr = (self.t / (1 - self.t)).double()
46
+ cdf = .5 * (1 + torch.erf((z[None] + snr[:, None]) / math.sqrt(2)))
47
+ accuracy = (cdf.pow(vocab - 1) * w).sum(-1)
48
+ tau = ((vocab * accuracy - 1) / (vocab - 1)).clamp(0, 1).float()
49
+ self.tau = torch.cummax(tau, 0).values
50
+ self.tau[0], self.tau[-1], self.t[-1] = 0., 1., 1.
51
+
52
+ def inverse(self, tau):
53
+ indices = torch.searchsorted(self.tau, tau.contiguous()).clamp(1, len(self.tau)-1)
54
+ low, high = self.tau[indices-1], self.tau[indices]
55
+ alpha = (tau-low) / (high-low).clamp_min(1e-7)
56
+ result = self.t[indices-1] + alpha * (self.t[indices]-self.t[indices-1])
57
+ # Finite precision can saturate the lookup before t=1. Enforce the
58
+ # mathematical endpoint so generation actually reaches the simplex.
59
+ return torch.where(tau>=1,torch.ones_like(result),torch.where(tau<=0,torch.zeros_like(result),result))
60
+
61
+
62
+ def corrected_logit_teacher(model, teacher, x, s, t, kind, floor=.05):
63
+ """Lagrangian/Eulerian logit teachers and explicit domain stabilization.
64
+
65
+ At an exact solution the denominators are positive. Unconverged networks
66
+ can violate that domain. We clamp to floor and report the changed fraction.
67
+ These clamped off-solution targets are an explicit numerical approximation.
68
+ """
69
+ if kind == 'discrete-lsd':
70
+ logits, dz = torch.func.jvp(lambda end: model(x, s, end),
71
+ (t,), (torch.ones_like(t),))
72
+ p = logits.softmax(-1)
73
+ delta = dz - (p * dz).sum(-1, keepdim=True)
74
+ coefficient = ((t-s) * (1-t) / (1-s)).unsqueeze(-1)
75
+ denominator = 1 + coefficient * delta
76
+ with torch.no_grad():
77
+ y, _ = categorical_map(teacher, x, s, t)
78
+ base_logits = teacher(y, t, t)
79
+ else:
80
+ with torch.no_grad():
81
+ p0 = teacher(x, s, s).softmax(-1)
82
+ velocity = (p0 - x) / (1-s).unsqueeze(-1)
83
+ base_logits = teacher(x, s, s)
84
+ logits, dz = torch.func.jvp(lambda z, start: model(z, start, t),
85
+ (x, s), (velocity, torch.ones_like(s)))
86
+ p = logits.softmax(-1)
87
+ delta = dz - (p * dz).sum(-1, keepdim=True)
88
+ coefficient = ((1-s)*(t-s)/(1-t)).unsqueeze(-1)
89
+ denominator = 1 - coefficient * delta
90
+ target = (base_logits - denominator.clamp_min(floor).log()).softmax(-1).detach()
91
+ return logits, target, (denominator.detach() < floor).float().mean()
92
+
93
+
94
+ def train_categorical(method, ids, vocab, args):
95
+ model = SequenceNet(ids.shape[1], len(vocab), args.width).to(ids.device)
96
+ teacher = ema_copy(model)
97
+ clock = DecodingClock(len(vocab), ids.device)
98
+
99
+ def objective(step):
100
+ batch = draw_batch(ids, args.batch_size)
101
+ clean = F.one_hot(batch, len(vocab)).float()
102
+ ordered = clock.inverse(torch.rand(len(batch), 2, device=ids.device)).sort(-1).values
103
+ # Stay away from singular coefficients in differential teacher targets.
104
+ s, t = (.97 * ordered).split(1, -1)
105
+ t = torch.maximum(t, s + 1e-4)
106
+ x, _ = interpolate(clean, s)
107
+ diagonal = F.cross_entropy(model(x, s, s).flatten(0, 1), batch.flatten())
108
+ logits = model(x, s, t)
109
+ extra = {}
110
+ if method == 'fmlm':
111
+ with torch.no_grad():
112
+ target = composition_target(teacher, x, s, (s+t)/2, t)
113
+ finite = probability_kl(logits, target)
114
+ elif method == 'categorical':
115
+ y, _ = categorical_map(model, x, s, t)
116
+ with torch.no_grad():
117
+ endpoint = teacher(y.detach(), t, t).softmax(-1)
118
+ ec = probability_kl(logits, endpoint)
119
+ _, dt = torch.func.jvp(lambda end: model(x, s, end).softmax(-1),
120
+ (t,), (torch.ones_like(t),))
121
+ eta = ((t-s)/(1-s)).unsqueeze(-1)
122
+ temporal = (eta * dt).square().flatten(1).sum(-1).mean()
123
+ # Released ECLD implementation: CE + sum-of-squares time energy.
124
+ # Detached-target KL has the same student gradient as its CE term.
125
+ finite = ec + temporal
126
+ extra = {'endpoint_kl': ec, 'temporal_derivative': temporal}
127
+ else:
128
+ logits, target, fraction = corrected_logit_teacher(model, teacher, x, s, t, method)
129
+ finite = probability_kl(logits, target)
130
+ extra = {'denominator_clamp_fraction': fraction}
131
+ weight = min(1., (step + 1) / max(1, args.train_steps // 4))
132
+ return diagonal + weight * finite, {'diagonal_ce': diagonal, 'finite': finite, **extra}
133
+
134
+ logs = optimize(model, objective, args.train_steps, args.lr, teacher)
135
+ return model, {'model': model.state_dict(), 'length': ids.shape[1], 'vocab': vocab}, logs
136
+
137
+
138
+ @torch.no_grad()
139
+ def sample_categorical(model, count, steps, device):
140
+ clock = DecodingClock(model.vocab, device)
141
+ grid = clock.inverse(torch.linspace(0, 1, steps+1, device=device))
142
+ x = torch.randn(count, model.length, model.vocab, device=device)
143
+ for s, t in zip(grid[:-1], grid[1:]):
144
+ x, _ = categorical_map(model, x, s, t)
145
+ return x.argmax(-1)
lecture_6/common.py ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared networks, data, and optimization for CIS 6270 Lecture 6.
2
+
3
+ The small MLPs keep time derivatives and all training steps visible. Sequence
4
+ networks receive the whole padded sequence, so predictions can depend on other
5
+ positions. No pretrained checkpoint or dataset download is required.
6
+ """
7
+ import copy
8
+ import json
9
+ import math
10
+ import random
11
+ from pathlib import Path
12
+
13
+ import numpy as np
14
+ import torch
15
+ from torch import nn
16
+ from torch.nn import functional as F
17
+
18
+
19
+ def seed_all(seed, threads=1):
20
+ random.seed(seed)
21
+ np.random.seed(seed)
22
+ torch.manual_seed(seed)
23
+ torch.set_num_threads(threads)
24
+
25
+
26
+ def mlp(inputs, outputs, width):
27
+ return nn.Sequential(nn.Linear(inputs, width), nn.SiLU(),
28
+ nn.Linear(width, width), nn.SiLU(),
29
+ nn.Linear(width, outputs))
30
+
31
+
32
+ def time_like(t, x):
33
+ """One scalar time per batch member, shape [B,1]."""
34
+ t = torch.as_tensor(t, dtype=x.dtype, device=x.device)
35
+ if t.numel() == 1:
36
+ return t.expand(len(x), 1)
37
+ return t.reshape(len(x), 1)
38
+
39
+
40
+ class MapNet(nn.Module):
41
+ def __init__(self, dim=2, width=64, context_dim=0):
42
+ super().__init__()
43
+ self.net = mlp(dim + 2 + context_dim, dim, width)
44
+
45
+ def forward(self, x, s, t, context=None):
46
+ inputs = [x, time_like(s, x), time_like(t, x)]
47
+ if context is not None:
48
+ inputs.append(context)
49
+ return self.net(torch.cat(inputs, -1))
50
+
51
+
52
+ class SequenceNet(nn.Module):
53
+ def __init__(self, length, vocab, width=64):
54
+ super().__init__()
55
+ self.length, self.vocab = length, vocab
56
+ self.net = mlp(length * vocab + 2, length * vocab, width)
57
+
58
+ def forward(self, x, s, t):
59
+ inputs = torch.cat([x.flatten(1), time_like(s, x), time_like(t, x)], -1)
60
+ return self.net(inputs).reshape(-1, self.length, self.vocab)
61
+
62
+
63
+ def finite_map(model, x, s, t, context=None):
64
+ """F(s,t,x) = x + (t-s) v(s,t,x), including exact F(s,s,x)=x."""
65
+ s, t = time_like(s, x), time_like(t, x)
66
+ return x + (t - s) * model(x, s, t, context)
67
+
68
+
69
+ def ordered_times(x, ceiling=.98):
70
+ times = ceiling * torch.rand(len(x), 2, device=x.device, dtype=x.dtype)
71
+ s, t = times.sort(-1).values.split(1, -1)
72
+ return s, t, (s + t) / 2
73
+
74
+
75
+ def draw_batch(data, count):
76
+ return data[torch.randint(len(data), (count,), device=data.device)]
77
+
78
+
79
+ def interpolate(data, time, noise=None):
80
+ noise = torch.randn_like(data) if noise is None else noise
81
+ t = time.reshape(len(data), *([1] * (data.ndim - 1)))
82
+ return (1 - t) * noise + t * data, data - noise
83
+
84
+
85
+ def ema_copy(model):
86
+ result = copy.deepcopy(model).eval()
87
+ result.requires_grad_(False)
88
+ return result
89
+
90
+
91
+ @torch.no_grad()
92
+ def update_ema(ema, model, decay=.99):
93
+ for p, q in zip(ema.parameters(), model.parameters()):
94
+ p.lerp_(q, 1 - decay)
95
+
96
+
97
+ def optimize(model, objective, steps, lr=1e-3, ema=None):
98
+ optimizer = torch.optim.Adam(model.parameters(), lr=lr)
99
+ logs = []
100
+ for step in range(steps):
101
+ loss, details = objective(step)
102
+ if not torch.isfinite(loss):
103
+ raise FloatingPointError(f'Nonfinite loss at step {step}: {details}')
104
+ optimizer.zero_grad(set_to_none=True)
105
+ loss.backward()
106
+ norm = torch.nn.utils.clip_grad_norm_(model.parameters(), 10.)
107
+ if not torch.isfinite(norm):
108
+ raise FloatingPointError(f'Nonfinite gradient at step {step}')
109
+ optimizer.step()
110
+ if ema is not None:
111
+ update_ema(ema, model)
112
+ logs.append({'step': step, 'loss': float(loss.detach()),
113
+ **{k: float(torch.as_tensor(v).detach()) for k, v in details.items()}})
114
+ return logs
115
+
116
+
117
+ CENTERS = torch.tensor([[-1.5, -1.5], [-1.5, 1.5], [1.5, -1.5], [1.5, 1.5]])
118
+ DATA_STD = .22
119
+
120
+
121
+ def mixture_data(n, generator=None):
122
+ ids = torch.randint(4, (n,), generator=generator)
123
+ return CENTERS[ids] + DATA_STD * torch.randn(n, 2, generator=generator)
124
+
125
+
126
+ def mixture_posterior(x, t):
127
+ """Exact p(X1 | (1-t)X0+tX1=x) for the four Gaussian mixture.
128
+
129
+ Return component probabilities, conditional means, scalar variances.
130
+ This analytic oracle is used for diagnostics and the GLASS example.
131
+ """
132
+ t = time_like(t, x)
133
+ a = 1 - t
134
+ variance = a.square() + (t * DATA_STD).square()
135
+ centers = CENTERS.to(x)
136
+ delta = x[:, None, :] - t[:, None, :] * centers
137
+ logits = -delta.square().sum(-1) / (2 * variance)
138
+ prob = logits.softmax(-1)
139
+ gain = t * DATA_STD**2 / variance
140
+ means = centers + gain[:, None, :] * delta
141
+ posterior_variance = DATA_STD**2 * a.square() / variance
142
+ return prob, means, posterior_variance
143
+
144
+
145
+ def exact_denoiser(x, t):
146
+ p, means, _ = mixture_posterior(x, t)
147
+ return (p[..., None] * means).sum(1)
148
+
149
+
150
+ def exact_velocity(x, t):
151
+ t = time_like(t, x)
152
+ # Direct conditional velocity avoids cancellation at t=1.
153
+ a = 1 - t
154
+ variance = a.square() + (t * DATA_STD).square()
155
+ centers = CENTERS.to(x)
156
+ delta = x[:, None] - t[:, None] * centers
157
+ weights = (-delta.square().sum(-1) / (2 * variance)).softmax(-1)
158
+ component_velocity = centers + ((t * DATA_STD**2 - a) / variance)[:, None] * delta
159
+ return (weights[..., None] * component_velocity).sum(1)
160
+
161
+
162
+ def mixture_metrics(samples):
163
+ x = samples.detach().cpu()
164
+ distances = (x[:, None] - CENTERS).square().sum(-1)
165
+ counts = torch.bincount(distances.argmin(-1), minlength=4).float()
166
+ p = counts / len(x)
167
+ logp = torch.logsumexp(-distances / (2 * DATA_STD**2), -1)
168
+ logp -= math.log(4 * 2 * math.pi * DATA_STD**2)
169
+ return {'finite_samples': bool(torch.isfinite(x).all()),
170
+ 'mean_distance_to_center': float(distances.min(-1).values.sqrt().mean()),
171
+ 'mode_fractions': p.tolist(), 'mode_entropy': float(-(p * p.clamp_min(1e-12).log()).sum()),
172
+ 'mean_target_log_density': float(logp.mean())}
173
+
174
+
175
+ def load_text(path, variable=False):
176
+ lines = [x.strip().split() for x in Path(path).read_text().splitlines() if x.strip()]
177
+ if len(lines) < 2:
178
+ raise ValueError('Text data need at least two nonempty lines.')
179
+ vocab = sorted(set(word for line in lines for word in line))
180
+ lengths = torch.tensor([len(x) for x in lines])
181
+ if not variable and len(set(lengths.tolist())) != 1:
182
+ raise ValueError('Fixed-length methods require equal tokens per line; use expanding otherwise.')
183
+ if lengths.max() > 32:
184
+ raise ValueError('Teaching MLP supports up to 32 positions.')
185
+ ids = {word: i for i, word in enumerate(vocab)}
186
+ encoded = torch.zeros(len(lines), int(lengths.max()), dtype=torch.long)
187
+ for i, line in enumerate(lines):
188
+ encoded[i, :len(line)] = torch.tensor([ids[word] for word in line])
189
+ return encoded, lengths, vocab
190
+
191
+
192
+ def text_metrics(ids, vocab, lengths=None, reference=None):
193
+ lengths = [ids.shape[1]] * len(ids) if lengths is None else lengths.tolist()
194
+ texts = [' '.join(vocab[j] for j in row[:length]) for row, length in zip(ids.tolist(), lengths)]
195
+ flat = [j for row, length in zip(ids.tolist(), lengths) for j in row[:length]]
196
+ counts = torch.bincount(torch.tensor(flat, dtype=torch.long), minlength=len(vocab)).float()
197
+ p = counts / counts.sum().clamp_min(1)
198
+ metrics = {'unique_fraction': len(set(texts)) / len(texts),
199
+ 'token_entropy': float(-(p * p.clamp_min(1e-12).log()).sum()),
200
+ 'mean_length': sum(lengths) / len(lengths), 'empty_fraction': lengths.count(0) / len(lengths)}
201
+ if reference is not None:
202
+ metrics['training_support_fraction'] = sum(x in reference for x in texts) / len(texts)
203
+ return texts, metrics
204
+
205
+
206
+ def write_json(path, value):
207
+ Path(path).write_text(json.dumps(value, indent=2, allow_nan=False) + '\n')
lecture_6/continuous.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Flow matching, finite-map identities, Shortcut, MeanFlow, and latent maps.
2
+
3
+ # %% 1. Learn local motion before learning an interval.
4
+ All times run noise -> data except MeanFlow, whose original backward clock
5
+ r <= t runs data at zero -> noise at one during training.
6
+ """
7
+ import torch
8
+ from torch import nn
9
+ from torch.nn import functional as F
10
+
11
+ from common import (MapNet, draw_batch, ema_copy, finite_map, interpolate, mlp,
12
+ optimize, ordered_times, time_like)
13
+
14
+
15
+ def diagonal_loss(model, data):
16
+ t = torch.rand(len(data), 1, device=data.device)
17
+ x, displacement = interpolate(data, t)
18
+ return F.mse_loss(model(x, t, t), displacement)
19
+
20
+
21
+ def lagrangian_residual(model, velocity, x, s, t):
22
+ # d_t F(s,t,x) = b(t,F(s,t,x)). JVP differentiates only arrival time.
23
+ y, dt = torch.func.jvp(lambda end: finite_map(model, x, s, end),
24
+ (t,), (torch.ones_like(t),))
25
+ return dt - velocity(y.detach(), t).detach()
26
+
27
+
28
+ def eulerian_residual(model, velocity, x, s, t):
29
+ # (d_s + b_s dot grad_x)F = 0. No full Jacobian is materialized.
30
+ direction = velocity(x, s).detach()
31
+ _, residual = torch.func.jvp(lambda z, start: finite_map(model, z, start, t),
32
+ (x, s), (direction, torch.ones_like(s)))
33
+ return residual
34
+
35
+
36
+ def semigroup_loss(model, teacher, x, s, t, context=None):
37
+ u = (s + t) / 2
38
+ with torch.no_grad():
39
+ mid = finite_map(teacher, x, s, u, context)
40
+ target = finite_map(teacher, mid, u, t, context)
41
+ prediction = finite_map(model, x, s, t, context)
42
+ return ((prediction - target) / (t - s).clamp_min(.05)).square().mean()
43
+
44
+
45
+ def meanflow_loss(model, data):
46
+ # %% 2. Average backward velocity satisfies u = v - (t-r) D_t u.
47
+ noise = torch.randn_like(data)
48
+ r, t, _ = ordered_times(data, 1.)
49
+ # Include diagonal examples with nonzero probability, as in the paper.
50
+ r = torch.where(torch.rand_like(r) < .75, t, r)
51
+ z = (1 - t) * data + t * noise
52
+ v = noise - data
53
+ average, derivative = torch.func.jvp(model, (z, r, t),
54
+ (v, torch.zeros_like(r), torch.ones_like(t)))
55
+ target = (v - (t - r) * derivative).detach()
56
+ residual = (average - target).square().mean(-1)
57
+ # Detached adaptive weighting controls large self-distillation residuals.
58
+ weight = (residual.detach() + .01).pow(-.5)
59
+ return (weight * residual).mean(), {'mse': residual.mean()}
60
+
61
+
62
+ def shortcut_loss(model, teacher, data):
63
+ t = torch.rand(len(data), 1, device=data.device)
64
+ x, v = interpolate(data, t)
65
+ diag = F.mse_loss(model(x, t, t), v)
66
+ # d is the half-step. Learn the 2d shortcut from two d shortcuts.
67
+ powers = torch.randint(1, 6, (len(data), 1), device=data.device)
68
+ d = 2. ** (-powers)
69
+ start = torch.rand_like(d) * (1 - 2 * d)
70
+ x, _ = interpolate(data, start)
71
+ with torch.no_grad():
72
+ first = teacher(x, start, start + d)
73
+ second = teacher(x + d * first, start + d, start + 2 * d)
74
+ target = .5 * (first + second)
75
+ finite = F.mse_loss(model(x, start, start + 2 * d), target)
76
+ return diag + finite, {'diagonal': diag, 'shortcut': finite}
77
+
78
+
79
+ def train_continuous(method, data, args):
80
+ model = MapNet(data.shape[1], args.width).to(data)
81
+ teacher_logs = []
82
+ teacher = None
83
+ if method in {'fmm-lagrangian', 'fmm-eulerian', 'consistency'}:
84
+ teacher = MapNet(data.shape[1], args.width).to(data)
85
+ teacher_logs = optimize(teacher, lambda _: (diagonal_loss(teacher, draw_batch(data, args.batch_size)), {}),
86
+ args.teacher_steps, args.lr)
87
+ teacher.requires_grad_(False)
88
+ model.load_state_dict(teacher.state_dict())
89
+ ema = ema_copy(model)
90
+
91
+ def objective(step):
92
+ batch = draw_batch(data, args.batch_size)
93
+ if method == 'meanflow':
94
+ return meanflow_loss(model, batch)
95
+ if method == 'shortcut':
96
+ return shortcut_loss(model, ema, batch)
97
+ diag = diagonal_loss(model, batch)
98
+ if method == 'flow-matching':
99
+ return diag, {'diagonal': diag}
100
+ s, t, _ = ordered_times(batch)
101
+ x, _ = interpolate(batch, s)
102
+ if method == 'fmm-lagrangian':
103
+ finite = lagrangian_residual(model, lambda z, a: teacher(z, a, a), x, s, t).square().mean()
104
+ elif method == 'fmm-eulerian':
105
+ finite = eulerian_residual(model, lambda z, a: teacher(z, a, a), x, s, t).square().mean()
106
+ elif method == 'consistency':
107
+ # Endpoint consistency distillation on teacher-solved short intervals.
108
+ # At t=1 the residual endpoint parametrization is exactly identity.
109
+ t = (s + .1).clamp_max(1.)
110
+ with torch.no_grad():
111
+ y = integrate_velocity(lambda z, a: teacher(z, a, a), x, s, t, 4)
112
+ target = finite_map(ema, y, t, torch.ones_like(t))
113
+ finite = F.mse_loss(finite_map(model, x, s, torch.ones_like(s)), target)
114
+ else:
115
+ finite = semigroup_loss(model, ema, x, s, t)
116
+ weight = min(1., (step + 1) / max(1, args.train_steps // 5))
117
+ return diag + weight * finite, {'diagonal': diag, 'finite': finite}
118
+
119
+ logs = optimize(model, objective, args.train_steps, args.lr, ema)
120
+ # Use the trained student; EMA supplies fixed bootstrap targets during training.
121
+ state = {'model': model.state_dict(), 'dim': data.shape[1]}
122
+ if teacher is not None:
123
+ state['teacher'] = teacher.state_dict()
124
+ return model, state, logs, teacher_logs
125
+
126
+
127
+ @torch.no_grad()
128
+ def integrate_velocity(velocity, x, s, t, steps):
129
+ """Heun integration of a velocity, also supports batch-specific time bounds."""
130
+ s, t = time_like(s, x), time_like(t, x)
131
+ h = (t - s) / steps
132
+ for i in range(steps):
133
+ a = s + i * h
134
+ k1 = velocity(x, a)
135
+ k2 = velocity(x + h * k1, a + h)
136
+ x = x + h * .5 * (k1 + k2)
137
+ return x
138
+
139
+
140
+ @torch.no_grad()
141
+ def sample_continuous(model, method, noise, steps):
142
+ if method == 'flow-matching':
143
+ return integrate_velocity(lambda z, a: model(z, a, a), noise, 0., 1., steps)
144
+ if method == 'consistency':
145
+ return finite_map(model, noise, 0., 1.)
146
+ x = noise
147
+ for i in range(steps):
148
+ if method == 'meanflow':
149
+ t, r = 1 - i / steps, 1 - (i + 1) / steps
150
+ x = x - (t - r) * model(x, r, t)
151
+ else:
152
+ x = finite_map(model, x, i / steps, (i + 1) / steps)
153
+ return x
154
+
155
+
156
+ class Autoencoder(nn.Module):
157
+ def __init__(self, width):
158
+ super().__init__()
159
+ self.encoder = mlp(3, 2, width)
160
+ self.decoder = mlp(2, 3, width)
161
+
162
+
163
+ def embed_surface(x):
164
+ return torch.cat([x, .3 * (x[:, :1].square() - x[:, 1:].square())], -1)
165
+
166
+
167
+ def train_latent(data, args):
168
+ # %% 3. First fit the representation, then freeze it while fitting its flow.
169
+ surface = embed_surface(data)
170
+ ae = Autoencoder(args.width).to(data)
171
+ def objective(_):
172
+ batch = draw_batch(surface, args.batch_size)
173
+ reconstruction = ae.decoder(ae.encoder(batch))
174
+ return F.mse_loss(reconstruction, batch), {}
175
+ ae_logs = optimize(ae, objective, args.teacher_steps, args.lr)
176
+ ae.requires_grad_(False)
177
+ with torch.no_grad():
178
+ z = ae.encoder(surface)
179
+ mean, std = z.mean(0), z.std(0).clamp_min(.05)
180
+ z = (z - mean) / std
181
+ model, state, logs, _ = train_continuous('self-distill', z, args)
182
+ state.update({'autoencoder': ae.state_dict(), 'latent_mean': mean, 'latent_std': std})
183
+ return model, ae, state, logs, ae_logs
lecture_6/data/README.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Data for Lecture 6
2
+
3
+ `phrases.txt` and `variable_text.txt` were generated deterministically with Python
4
+ `random.Random(6270)`. Each contains 640 examples. Their vocabulary describes
5
+ colored shapes and directions; no external dataset is needed.
6
+
7
+ | Color | Shape | Direction |
8
+ | --- | --- | --- |
9
+ | red | circle | left |
10
+ | blue | square | right |
11
+ | green | triangle | up |
12
+ | gold | star | down |
13
+
14
+ The fixed-length corpus has four tokens per line. The variable-length corpus
15
+ uses `COLOR SHAPE`, `COLOR SHAPE moves DIRECTION`, or the latter followed by
16
+ `slowly` or `twice`. The color, shape, and direction remain correlated. This
17
+ makes invalid independent combinations easy to inspect.
18
+
19
+ Training uses a seeded shuffle and 80/20 example split. The grammar has a small
20
+ support, so examples repeat and both partitions contain the same grammar.
21
+ Training-support fraction measures membership in this small support; it is
22
+ not a test of open-ended language generalization.
23
+
24
+ For a custom corpus, supply a UTF-8 text file with one whitespace-tokenized
25
+ sequence per line. Fixed-length methods require equal token counts. The
26
+ expanding method accepts variable lengths up to 32. Vocabulary and maximum
27
+ length are saved in the checkpoint, so sampling does not need the original file.
28
+
29
+ The continuous dataset is sampled from four equally weighted Gaussians centered
30
+ at `(−1.5,−1.5)`, `(−1.5,1.5)`, `(1.5,−1.5)`, and `(1.5,1.5)`, with coordinate
31
+ standard deviation 0.22. The latent example embeds these points on
32
+ `(x, y, 0.3(x²−y²))` before learning its autoencoder. SSFM uses analytic
33
+ Ornstein-Uhlenbeck marginals with initial variance one, drift `−x`, and diffusion
34
+ coefficient 0.7.
lecture_6/data/phrases.txt ADDED
@@ -0,0 +1,640 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ green triangle moves up
2
+ gold star moves down
3
+ green triangle moves up
4
+ gold star moves down
5
+ blue square moves right
6
+ gold star moves down
7
+ green triangle moves up
8
+ red circle moves left
9
+ blue square moves right
10
+ green triangle moves up
11
+ gold star moves down
12
+ gold star moves down
13
+ red circle moves left
14
+ blue square moves right
15
+ blue square moves right
16
+ red circle moves left
17
+ gold star moves down
18
+ blue square moves right
19
+ red circle moves left
20
+ gold star moves down
21
+ green triangle moves up
22
+ red circle moves left
23
+ red circle moves left
24
+ green triangle moves up
25
+ green triangle moves up
26
+ green triangle moves up
27
+ red circle moves left
28
+ red circle moves left
29
+ green triangle moves up
30
+ green triangle moves up
31
+ red circle moves left
32
+ gold star moves down
33
+ red circle moves left
34
+ red circle moves left
35
+ gold star moves down
36
+ gold star moves down
37
+ red circle moves left
38
+ red circle moves left
39
+ red circle moves left
40
+ blue square moves right
41
+ red circle moves left
42
+ blue square moves right
43
+ gold star moves down
44
+ blue square moves right
45
+ red circle moves left
46
+ gold star moves down
47
+ blue square moves right
48
+ blue square moves right
49
+ green triangle moves up
50
+ red circle moves left
51
+ green triangle moves up
52
+ blue square moves right
53
+ red circle moves left
54
+ green triangle moves up
55
+ red circle moves left
56
+ blue square moves right
57
+ green triangle moves up
58
+ green triangle moves up
59
+ green triangle moves up
60
+ red circle moves left
61
+ red circle moves left
62
+ red circle moves left
63
+ gold star moves down
64
+ gold star moves down
65
+ red circle moves left
66
+ gold star moves down
67
+ blue square moves right
68
+ blue square moves right
69
+ red circle moves left
70
+ red circle moves left
71
+ blue square moves right
72
+ green triangle moves up
73
+ blue square moves right
74
+ blue square moves right
75
+ gold star moves down
76
+ green triangle moves up
77
+ red circle moves left
78
+ green triangle moves up
79
+ gold star moves down
80
+ gold star moves down
81
+ gold star moves down
82
+ gold star moves down
83
+ blue square moves right
84
+ gold star moves down
85
+ red circle moves left
86
+ red circle moves left
87
+ green triangle moves up
88
+ gold star moves down
89
+ blue square moves right
90
+ gold star moves down
91
+ red circle moves left
92
+ red circle moves left
93
+ red circle moves left
94
+ green triangle moves up
95
+ blue square moves right
96
+ red circle moves left
97
+ blue square moves right
98
+ gold star moves down
99
+ gold star moves down
100
+ red circle moves left
101
+ green triangle moves up
102
+ green triangle moves up
103
+ gold star moves down
104
+ red circle moves left
105
+ green triangle moves up
106
+ green triangle moves up
107
+ blue square moves right
108
+ green triangle moves up
109
+ gold star moves down
110
+ green triangle moves up
111
+ green triangle moves up
112
+ blue square moves right
113
+ red circle moves left
114
+ blue square moves right
115
+ gold star moves down
116
+ blue square moves right
117
+ blue square moves right
118
+ blue square moves right
119
+ red circle moves left
120
+ blue square moves right
121
+ blue square moves right
122
+ blue square moves right
123
+ gold star moves down
124
+ red circle moves left
125
+ green triangle moves up
126
+ gold star moves down
127
+ red circle moves left
128
+ green triangle moves up
129
+ red circle moves left
130
+ green triangle moves up
131
+ gold star moves down
132
+ blue square moves right
133
+ red circle moves left
134
+ green triangle moves up
135
+ red circle moves left
136
+ blue square moves right
137
+ green triangle moves up
138
+ gold star moves down
139
+ gold star moves down
140
+ gold star moves down
141
+ green triangle moves up
142
+ gold star moves down
143
+ blue square moves right
144
+ blue square moves right
145
+ blue square moves right
146
+ red circle moves left
147
+ gold star moves down
148
+ green triangle moves up
149
+ green triangle moves up
150
+ red circle moves left
151
+ blue square moves right
152
+ gold star moves down
153
+ gold star moves down
154
+ gold star moves down
155
+ gold star moves down
156
+ gold star moves down
157
+ gold star moves down
158
+ red circle moves left
159
+ red circle moves left
160
+ blue square moves right
161
+ blue square moves right
162
+ blue square moves right
163
+ gold star moves down
164
+ blue square moves right
165
+ red circle moves left
166
+ blue square moves right
167
+ gold star moves down
168
+ green triangle moves up
169
+ blue square moves right
170
+ green triangle moves up
171
+ gold star moves down
172
+ blue square moves right
173
+ green triangle moves up
174
+ red circle moves left
175
+ blue square moves right
176
+ green triangle moves up
177
+ gold star moves down
178
+ gold star moves down
179
+ green triangle moves up
180
+ blue square moves right
181
+ red circle moves left
182
+ gold star moves down
183
+ gold star moves down
184
+ red circle moves left
185
+ red circle moves left
186
+ green triangle moves up
187
+ blue square moves right
188
+ gold star moves down
189
+ gold star moves down
190
+ green triangle moves up
191
+ red circle moves left
192
+ green triangle moves up
193
+ green triangle moves up
194
+ red circle moves left
195
+ red circle moves left
196
+ gold star moves down
197
+ red circle moves left
198
+ red circle moves left
199
+ green triangle moves up
200
+ blue square moves right
201
+ green triangle moves up
202
+ blue square moves right
203
+ red circle moves left
204
+ gold star moves down
205
+ blue square moves right
206
+ green triangle moves up
207
+ red circle moves left
208
+ red circle moves left
209
+ gold star moves down
210
+ green triangle moves up
211
+ blue square moves right
212
+ red circle moves left
213
+ gold star moves down
214
+ green triangle moves up
215
+ gold star moves down
216
+ red circle moves left
217
+ blue square moves right
218
+ red circle moves left
219
+ blue square moves right
220
+ green triangle moves up
221
+ blue square moves right
222
+ green triangle moves up
223
+ green triangle moves up
224
+ gold star moves down
225
+ blue square moves right
226
+ blue square moves right
227
+ blue square moves right
228
+ green triangle moves up
229
+ blue square moves right
230
+ blue square moves right
231
+ blue square moves right
232
+ green triangle moves up
233
+ blue square moves right
234
+ green triangle moves up
235
+ red circle moves left
236
+ blue square moves right
237
+ green triangle moves up
238
+ red circle moves left
239
+ blue square moves right
240
+ gold star moves down
241
+ gold star moves down
242
+ red circle moves left
243
+ red circle moves left
244
+ blue square moves right
245
+ red circle moves left
246
+ red circle moves left
247
+ gold star moves down
248
+ gold star moves down
249
+ green triangle moves up
250
+ red circle moves left
251
+ gold star moves down
252
+ red circle moves left
253
+ red circle moves left
254
+ gold star moves down
255
+ gold star moves down
256
+ gold star moves down
257
+ red circle moves left
258
+ green triangle moves up
259
+ gold star moves down
260
+ green triangle moves up
261
+ blue square moves right
262
+ gold star moves down
263
+ green triangle moves up
264
+ red circle moves left
265
+ green triangle moves up
266
+ red circle moves left
267
+ green triangle moves up
268
+ green triangle moves up
269
+ blue square moves right
270
+ red circle moves left
271
+ blue square moves right
272
+ gold star moves down
273
+ gold star moves down
274
+ blue square moves right
275
+ blue square moves right
276
+ red circle moves left
277
+ red circle moves left
278
+ blue square moves right
279
+ green triangle moves up
280
+ green triangle moves up
281
+ blue square moves right
282
+ red circle moves left
283
+ green triangle moves up
284
+ blue square moves right
285
+ red circle moves left
286
+ green triangle moves up
287
+ gold star moves down
288
+ red circle moves left
289
+ red circle moves left
290
+ blue square moves right
291
+ gold star moves down
292
+ red circle moves left
293
+ red circle moves left
294
+ blue square moves right
295
+ red circle moves left
296
+ gold star moves down
297
+ red circle moves left
298
+ blue square moves right
299
+ red circle moves left
300
+ gold star moves down
301
+ green triangle moves up
302
+ blue square moves right
303
+ gold star moves down
304
+ gold star moves down
305
+ gold star moves down
306
+ green triangle moves up
307
+ gold star moves down
308
+ red circle moves left
309
+ gold star moves down
310
+ blue square moves right
311
+ red circle moves left
312
+ green triangle moves up
313
+ green triangle moves up
314
+ gold star moves down
315
+ green triangle moves up
316
+ gold star moves down
317
+ green triangle moves up
318
+ red circle moves left
319
+ blue square moves right
320
+ red circle moves left
321
+ red circle moves left
322
+ blue square moves right
323
+ green triangle moves up
324
+ red circle moves left
325
+ red circle moves left
326
+ gold star moves down
327
+ green triangle moves up
328
+ gold star moves down
329
+ green triangle moves up
330
+ green triangle moves up
331
+ gold star moves down
332
+ red circle moves left
333
+ red circle moves left
334
+ green triangle moves up
335
+ red circle moves left
336
+ green triangle moves up
337
+ blue square moves right
338
+ blue square moves right
339
+ green triangle moves up
340
+ red circle moves left
341
+ green triangle moves up
342
+ green triangle moves up
343
+ blue square moves right
344
+ green triangle moves up
345
+ gold star moves down
346
+ blue square moves right
347
+ green triangle moves up
348
+ green triangle moves up
349
+ blue square moves right
350
+ red circle moves left
351
+ gold star moves down
352
+ red circle moves left
353
+ red circle moves left
354
+ gold star moves down
355
+ blue square moves right
356
+ green triangle moves up
357
+ red circle moves left
358
+ green triangle moves up
359
+ green triangle moves up
360
+ green triangle moves up
361
+ gold star moves down
362
+ green triangle moves up
363
+ gold star moves down
364
+ blue square moves right
365
+ blue square moves right
366
+ green triangle moves up
367
+ green triangle moves up
368
+ blue square moves right
369
+ red circle moves left
370
+ red circle moves left
371
+ blue square moves right
372
+ blue square moves right
373
+ red circle moves left
374
+ red circle moves left
375
+ red circle moves left
376
+ red circle moves left
377
+ blue square moves right
378
+ green triangle moves up
379
+ blue square moves right
380
+ gold star moves down
381
+ blue square moves right
382
+ blue square moves right
383
+ blue square moves right
384
+ green triangle moves up
385
+ red circle moves left
386
+ blue square moves right
387
+ gold star moves down
388
+ green triangle moves up
389
+ gold star moves down
390
+ gold star moves down
391
+ blue square moves right
392
+ gold star moves down
393
+ blue square moves right
394
+ gold star moves down
395
+ gold star moves down
396
+ gold star moves down
397
+ blue square moves right
398
+ gold star moves down
399
+ green triangle moves up
400
+ gold star moves down
401
+ blue square moves right
402
+ gold star moves down
403
+ blue square moves right
404
+ red circle moves left
405
+ gold star moves down
406
+ green triangle moves up
407
+ green triangle moves up
408
+ green triangle moves up
409
+ red circle moves left
410
+ green triangle moves up
411
+ blue square moves right
412
+ blue square moves right
413
+ green triangle moves up
414
+ gold star moves down
415
+ green triangle moves up
416
+ red circle moves left
417
+ gold star moves down
418
+ gold star moves down
419
+ blue square moves right
420
+ red circle moves left
421
+ red circle moves left
422
+ blue square moves right
423
+ blue square moves right
424
+ gold star moves down
425
+ gold star moves down
426
+ blue square moves right
427
+ blue square moves right
428
+ gold star moves down
429
+ blue square moves right
430
+ gold star moves down
431
+ gold star moves down
432
+ red circle moves left
433
+ red circle moves left
434
+ blue square moves right
435
+ blue square moves right
436
+ green triangle moves up
437
+ green triangle moves up
438
+ gold star moves down
439
+ green triangle moves up
440
+ green triangle moves up
441
+ green triangle moves up
442
+ blue square moves right
443
+ green triangle moves up
444
+ gold star moves down
445
+ red circle moves left
446
+ red circle moves left
447
+ gold star moves down
448
+ gold star moves down
449
+ gold star moves down
450
+ blue square moves right
451
+ blue square moves right
452
+ green triangle moves up
453
+ gold star moves down
454
+ blue square moves right
455
+ green triangle moves up
456
+ gold star moves down
457
+ gold star moves down
458
+ blue square moves right
459
+ blue square moves right
460
+ blue square moves right
461
+ gold star moves down
462
+ red circle moves left
463
+ blue square moves right
464
+ green triangle moves up
465
+ green triangle moves up
466
+ green triangle moves up
467
+ blue square moves right
468
+ gold star moves down
469
+ blue square moves right
470
+ gold star moves down
471
+ red circle moves left
472
+ blue square moves right
473
+ green triangle moves up
474
+ green triangle moves up
475
+ green triangle moves up
476
+ green triangle moves up
477
+ gold star moves down
478
+ blue square moves right
479
+ red circle moves left
480
+ green triangle moves up
481
+ blue square moves right
482
+ blue square moves right
483
+ green triangle moves up
484
+ green triangle moves up
485
+ red circle moves left
486
+ blue square moves right
487
+ green triangle moves up
488
+ red circle moves left
489
+ blue square moves right
490
+ gold star moves down
491
+ gold star moves down
492
+ blue square moves right
493
+ blue square moves right
494
+ red circle moves left
495
+ gold star moves down
496
+ blue square moves right
497
+ green triangle moves up
498
+ blue square moves right
499
+ green triangle moves up
500
+ gold star moves down
501
+ green triangle moves up
502
+ green triangle moves up
503
+ green triangle moves up
504
+ blue square moves right
505
+ gold star moves down
506
+ green triangle moves up
507
+ gold star moves down
508
+ red circle moves left
509
+ blue square moves right
510
+ gold star moves down
511
+ gold star moves down
512
+ red circle moves left
513
+ gold star moves down
514
+ green triangle moves up
515
+ gold star moves down
516
+ red circle moves left
517
+ red circle moves left
518
+ blue square moves right
519
+ gold star moves down
520
+ green triangle moves up
521
+ blue square moves right
522
+ red circle moves left
523
+ green triangle moves up
524
+ red circle moves left
525
+ green triangle moves up
526
+ blue square moves right
527
+ red circle moves left
528
+ green triangle moves up
529
+ gold star moves down
530
+ green triangle moves up
531
+ green triangle moves up
532
+ gold star moves down
533
+ green triangle moves up
534
+ blue square moves right
535
+ green triangle moves up
536
+ red circle moves left
537
+ green triangle moves up
538
+ green triangle moves up
539
+ gold star moves down
540
+ red circle moves left
541
+ green triangle moves up
542
+ green triangle moves up
543
+ gold star moves down
544
+ green triangle moves up
545
+ blue square moves right
546
+ green triangle moves up
547
+ green triangle moves up
548
+ green triangle moves up
549
+ blue square moves right
550
+ red circle moves left
551
+ blue square moves right
552
+ red circle moves left
553
+ green triangle moves up
554
+ green triangle moves up
555
+ red circle moves left
556
+ green triangle moves up
557
+ blue square moves right
558
+ red circle moves left
559
+ red circle moves left
560
+ green triangle moves up
561
+ gold star moves down
562
+ blue square moves right
563
+ blue square moves right
564
+ red circle moves left
565
+ green triangle moves up
566
+ red circle moves left
567
+ green triangle moves up
568
+ red circle moves left
569
+ red circle moves left
570
+ blue square moves right
571
+ red circle moves left
572
+ red circle moves left
573
+ red circle moves left
574
+ gold star moves down
575
+ red circle moves left
576
+ green triangle moves up
577
+ green triangle moves up
578
+ green triangle moves up
579
+ red circle moves left
580
+ gold star moves down
581
+ gold star moves down
582
+ gold star moves down
583
+ red circle moves left
584
+ gold star moves down
585
+ green triangle moves up
586
+ green triangle moves up
587
+ blue square moves right
588
+ green triangle moves up
589
+ gold star moves down
590
+ gold star moves down
591
+ green triangle moves up
592
+ gold star moves down
593
+ red circle moves left
594
+ gold star moves down
595
+ green triangle moves up
596
+ blue square moves right
597
+ red circle moves left
598
+ green triangle moves up
599
+ green triangle moves up
600
+ red circle moves left
601
+ green triangle moves up
602
+ green triangle moves up
603
+ red circle moves left
604
+ red circle moves left
605
+ gold star moves down
606
+ blue square moves right
607
+ red circle moves left
608
+ gold star moves down
609
+ gold star moves down
610
+ blue square moves right
611
+ red circle moves left
612
+ blue square moves right
613
+ blue square moves right
614
+ blue square moves right
615
+ red circle moves left
616
+ blue square moves right
617
+ blue square moves right
618
+ green triangle moves up
619
+ blue square moves right
620
+ green triangle moves up
621
+ blue square moves right
622
+ gold star moves down
623
+ gold star moves down
624
+ blue square moves right
625
+ red circle moves left
626
+ red circle moves left
627
+ blue square moves right
628
+ red circle moves left
629
+ green triangle moves up
630
+ red circle moves left
631
+ red circle moves left
632
+ red circle moves left
633
+ gold star moves down
634
+ green triangle moves up
635
+ gold star moves down
636
+ red circle moves left
637
+ blue square moves right
638
+ red circle moves left
639
+ green triangle moves up
640
+ green triangle moves up
lecture_6/data/variable_text.txt ADDED
@@ -0,0 +1,640 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ green triangle moves up
2
+ gold star moves down twice
3
+ green triangle moves up
4
+ gold star
5
+ blue square moves right
6
+ gold star
7
+ green triangle
8
+ red circle moves left twice
9
+ blue square
10
+ green triangle moves up slowly
11
+ gold star moves down twice
12
+ gold star moves down slowly
13
+ red circle moves left
14
+ blue square moves right slowly
15
+ blue square moves right twice
16
+ red circle moves left
17
+ gold star moves down slowly
18
+ blue square moves right twice
19
+ red circle
20
+ gold star moves down
21
+ green triangle
22
+ red circle
23
+ red circle moves left twice
24
+ green triangle moves up twice
25
+ green triangle moves up
26
+ green triangle moves up slowly
27
+ red circle
28
+ red circle moves left slowly
29
+ green triangle
30
+ green triangle
31
+ red circle moves left twice
32
+ gold star moves down twice
33
+ red circle moves left twice
34
+ red circle
35
+ gold star moves down
36
+ gold star moves down
37
+ red circle
38
+ red circle moves left slowly
39
+ red circle moves left
40
+ blue square moves right twice
41
+ red circle moves left slowly
42
+ blue square
43
+ gold star
44
+ blue square moves right twice
45
+ red circle moves left
46
+ gold star moves down
47
+ blue square moves right
48
+ blue square moves right
49
+ green triangle
50
+ red circle
51
+ green triangle moves up slowly
52
+ blue square moves right
53
+ red circle
54
+ green triangle moves up slowly
55
+ red circle moves left
56
+ blue square moves right slowly
57
+ green triangle
58
+ green triangle moves up slowly
59
+ green triangle moves up slowly
60
+ red circle moves left slowly
61
+ red circle moves left slowly
62
+ red circle moves left slowly
63
+ gold star moves down
64
+ gold star
65
+ red circle moves left
66
+ gold star moves down
67
+ blue square moves right slowly
68
+ blue square moves right
69
+ red circle moves left
70
+ red circle
71
+ blue square moves right twice
72
+ green triangle moves up slowly
73
+ blue square moves right slowly
74
+ blue square
75
+ gold star moves down
76
+ green triangle moves up slowly
77
+ red circle moves left
78
+ green triangle
79
+ gold star
80
+ gold star moves down
81
+ gold star moves down slowly
82
+ gold star moves down twice
83
+ blue square moves right
84
+ gold star moves down
85
+ red circle moves left
86
+ red circle
87
+ green triangle
88
+ gold star moves down
89
+ blue square moves right slowly
90
+ gold star
91
+ red circle moves left
92
+ red circle moves left slowly
93
+ red circle
94
+ green triangle moves up slowly
95
+ blue square moves right
96
+ red circle moves left twice
97
+ blue square moves right twice
98
+ gold star moves down
99
+ gold star moves down twice
100
+ red circle moves left twice
101
+ green triangle moves up slowly
102
+ green triangle
103
+ gold star moves down twice
104
+ red circle moves left
105
+ green triangle moves up slowly
106
+ green triangle moves up
107
+ blue square
108
+ green triangle
109
+ gold star moves down
110
+ green triangle moves up twice
111
+ green triangle moves up slowly
112
+ blue square
113
+ red circle moves left slowly
114
+ blue square moves right twice
115
+ gold star
116
+ blue square moves right
117
+ blue square
118
+ blue square
119
+ red circle
120
+ blue square moves right
121
+ blue square moves right
122
+ blue square moves right slowly
123
+ gold star moves down
124
+ red circle
125
+ green triangle moves up slowly
126
+ gold star moves down
127
+ red circle moves left
128
+ green triangle moves up
129
+ red circle moves left
130
+ green triangle moves up
131
+ gold star
132
+ blue square moves right
133
+ red circle
134
+ green triangle moves up
135
+ red circle moves left twice
136
+ blue square
137
+ green triangle
138
+ gold star
139
+ gold star moves down twice
140
+ gold star
141
+ green triangle moves up
142
+ gold star
143
+ blue square moves right slowly
144
+ blue square
145
+ blue square
146
+ red circle
147
+ gold star moves down slowly
148
+ green triangle moves up
149
+ green triangle
150
+ red circle moves left
151
+ blue square moves right slowly
152
+ gold star moves down
153
+ gold star
154
+ gold star moves down twice
155
+ gold star moves down slowly
156
+ gold star moves down slowly
157
+ gold star moves down
158
+ red circle moves left
159
+ red circle
160
+ blue square moves right
161
+ blue square moves right slowly
162
+ blue square
163
+ gold star
164
+ blue square
165
+ red circle
166
+ blue square moves right
167
+ gold star moves down slowly
168
+ green triangle moves up
169
+ blue square moves right
170
+ green triangle moves up
171
+ gold star
172
+ blue square moves right slowly
173
+ green triangle moves up twice
174
+ red circle moves left slowly
175
+ blue square moves right slowly
176
+ green triangle moves up twice
177
+ gold star moves down
178
+ gold star
179
+ green triangle moves up slowly
180
+ blue square
181
+ red circle moves left slowly
182
+ gold star
183
+ gold star moves down
184
+ red circle moves left
185
+ red circle moves left
186
+ green triangle moves up
187
+ blue square
188
+ gold star moves down
189
+ gold star moves down
190
+ green triangle moves up twice
191
+ red circle moves left
192
+ green triangle
193
+ green triangle
194
+ red circle moves left slowly
195
+ red circle moves left
196
+ gold star moves down slowly
197
+ red circle moves left
198
+ red circle moves left twice
199
+ green triangle moves up slowly
200
+ blue square moves right
201
+ green triangle moves up slowly
202
+ blue square
203
+ red circle moves left twice
204
+ gold star
205
+ blue square
206
+ green triangle
207
+ red circle moves left slowly
208
+ red circle
209
+ gold star moves down slowly
210
+ green triangle
211
+ blue square moves right
212
+ red circle
213
+ gold star
214
+ green triangle moves up twice
215
+ gold star moves down twice
216
+ red circle
217
+ blue square moves right slowly
218
+ red circle moves left slowly
219
+ blue square
220
+ green triangle
221
+ blue square moves right
222
+ green triangle moves up twice
223
+ green triangle moves up slowly
224
+ gold star moves down
225
+ blue square
226
+ blue square moves right
227
+ blue square moves right
228
+ green triangle
229
+ blue square moves right slowly
230
+ blue square moves right slowly
231
+ blue square
232
+ green triangle moves up slowly
233
+ blue square moves right
234
+ green triangle moves up
235
+ red circle moves left slowly
236
+ blue square moves right slowly
237
+ green triangle
238
+ red circle
239
+ blue square moves right
240
+ gold star moves down twice
241
+ gold star moves down
242
+ red circle moves left
243
+ red circle moves left slowly
244
+ blue square moves right slowly
245
+ red circle
246
+ red circle moves left
247
+ gold star
248
+ gold star moves down slowly
249
+ green triangle moves up
250
+ red circle moves left
251
+ gold star moves down twice
252
+ red circle moves left
253
+ red circle moves left slowly
254
+ gold star moves down
255
+ gold star moves down slowly
256
+ gold star
257
+ red circle moves left twice
258
+ green triangle
259
+ gold star moves down slowly
260
+ green triangle
261
+ blue square moves right
262
+ gold star moves down slowly
263
+ green triangle moves up twice
264
+ red circle
265
+ green triangle
266
+ red circle moves left twice
267
+ green triangle
268
+ green triangle moves up slowly
269
+ blue square moves right
270
+ red circle
271
+ blue square
272
+ gold star moves down
273
+ gold star
274
+ blue square
275
+ blue square moves right slowly
276
+ red circle moves left
277
+ red circle moves left slowly
278
+ blue square moves right
279
+ green triangle moves up
280
+ green triangle moves up
281
+ blue square moves right
282
+ red circle moves left twice
283
+ green triangle moves up
284
+ blue square moves right twice
285
+ red circle
286
+ green triangle
287
+ gold star moves down twice
288
+ red circle
289
+ red circle moves left
290
+ blue square moves right
291
+ gold star moves down twice
292
+ red circle moves left slowly
293
+ red circle moves left slowly
294
+ blue square moves right
295
+ red circle moves left
296
+ gold star moves down
297
+ red circle moves left slowly
298
+ blue square
299
+ red circle moves left twice
300
+ gold star moves down
301
+ green triangle
302
+ blue square
303
+ gold star moves down
304
+ gold star moves down
305
+ gold star
306
+ green triangle moves up
307
+ gold star moves down
308
+ red circle moves left
309
+ gold star moves down
310
+ blue square
311
+ red circle
312
+ green triangle
313
+ green triangle moves up
314
+ gold star moves down
315
+ green triangle moves up slowly
316
+ gold star moves down
317
+ green triangle moves up twice
318
+ red circle
319
+ blue square
320
+ red circle moves left twice
321
+ red circle moves left slowly
322
+ blue square moves right
323
+ green triangle moves up
324
+ red circle moves left
325
+ red circle
326
+ gold star moves down
327
+ green triangle moves up slowly
328
+ gold star
329
+ green triangle moves up
330
+ green triangle moves up
331
+ gold star moves down slowly
332
+ red circle
333
+ red circle moves left
334
+ green triangle moves up twice
335
+ red circle
336
+ green triangle moves up
337
+ blue square moves right
338
+ blue square moves right slowly
339
+ green triangle moves up slowly
340
+ red circle moves left
341
+ green triangle moves up twice
342
+ green triangle moves up slowly
343
+ blue square moves right slowly
344
+ green triangle moves up slowly
345
+ gold star moves down twice
346
+ blue square
347
+ green triangle moves up
348
+ green triangle moves up slowly
349
+ blue square moves right twice
350
+ red circle moves left slowly
351
+ gold star moves down
352
+ red circle moves left twice
353
+ red circle moves left slowly
354
+ gold star moves down twice
355
+ blue square moves right
356
+ green triangle moves up
357
+ red circle moves left
358
+ green triangle moves up
359
+ green triangle
360
+ green triangle
361
+ gold star
362
+ green triangle moves up
363
+ gold star moves down
364
+ blue square moves right twice
365
+ blue square moves right slowly
366
+ green triangle
367
+ green triangle moves up slowly
368
+ blue square moves right twice
369
+ red circle
370
+ red circle moves left slowly
371
+ blue square moves right twice
372
+ blue square
373
+ red circle
374
+ red circle moves left
375
+ red circle moves left
376
+ red circle moves left
377
+ blue square moves right twice
378
+ green triangle moves up slowly
379
+ blue square moves right slowly
380
+ gold star moves down slowly
381
+ blue square moves right
382
+ blue square
383
+ blue square moves right slowly
384
+ green triangle moves up
385
+ red circle moves left
386
+ blue square moves right slowly
387
+ gold star
388
+ green triangle moves up
389
+ gold star moves down slowly
390
+ gold star moves down
391
+ blue square
392
+ gold star moves down
393
+ blue square moves right slowly
394
+ gold star moves down twice
395
+ gold star moves down twice
396
+ gold star moves down slowly
397
+ blue square
398
+ gold star moves down
399
+ green triangle
400
+ gold star moves down twice
401
+ blue square moves right slowly
402
+ gold star moves down
403
+ blue square moves right
404
+ red circle moves left twice
405
+ gold star moves down
406
+ green triangle
407
+ green triangle
408
+ green triangle
409
+ red circle
410
+ green triangle
411
+ blue square
412
+ blue square moves right
413
+ green triangle moves up slowly
414
+ gold star moves down
415
+ green triangle moves up
416
+ red circle
417
+ gold star
418
+ gold star moves down
419
+ blue square moves right twice
420
+ red circle moves left
421
+ red circle
422
+ blue square moves right
423
+ blue square moves right twice
424
+ gold star moves down
425
+ gold star moves down twice
426
+ blue square moves right
427
+ blue square moves right twice
428
+ gold star
429
+ blue square
430
+ gold star moves down slowly
431
+ gold star moves down slowly
432
+ red circle moves left
433
+ red circle moves left
434
+ blue square moves right
435
+ blue square moves right
436
+ green triangle moves up twice
437
+ green triangle moves up
438
+ gold star moves down
439
+ green triangle moves up
440
+ green triangle moves up
441
+ green triangle
442
+ blue square moves right slowly
443
+ green triangle moves up slowly
444
+ gold star moves down
445
+ red circle
446
+ red circle moves left twice
447
+ gold star moves down twice
448
+ gold star
449
+ gold star
450
+ blue square moves right twice
451
+ blue square moves right twice
452
+ green triangle moves up
453
+ gold star moves down
454
+ blue square moves right twice
455
+ green triangle moves up slowly
456
+ gold star moves down slowly
457
+ gold star moves down
458
+ blue square moves right twice
459
+ blue square moves right
460
+ blue square moves right slowly
461
+ gold star moves down twice
462
+ red circle moves left twice
463
+ blue square
464
+ green triangle moves up twice
465
+ green triangle
466
+ green triangle
467
+ blue square moves right
468
+ gold star moves down twice
469
+ blue square moves right
470
+ gold star
471
+ red circle moves left twice
472
+ blue square moves right
473
+ green triangle moves up
474
+ green triangle
475
+ green triangle moves up
476
+ green triangle moves up
477
+ gold star
478
+ blue square moves right
479
+ red circle
480
+ green triangle moves up
481
+ blue square moves right twice
482
+ blue square moves right slowly
483
+ green triangle moves up
484
+ green triangle
485
+ red circle
486
+ blue square
487
+ green triangle moves up
488
+ red circle moves left
489
+ blue square
490
+ gold star
491
+ gold star
492
+ blue square moves right
493
+ blue square moves right slowly
494
+ red circle
495
+ gold star
496
+ blue square
497
+ green triangle
498
+ blue square moves right
499
+ green triangle moves up
500
+ gold star moves down twice
501
+ green triangle moves up
502
+ green triangle moves up slowly
503
+ green triangle
504
+ blue square moves right
505
+ gold star moves down slowly
506
+ green triangle
507
+ gold star
508
+ red circle moves left
509
+ blue square moves right
510
+ gold star moves down
511
+ gold star
512
+ red circle moves left twice
513
+ gold star moves down twice
514
+ green triangle moves up slowly
515
+ gold star moves down
516
+ red circle moves left
517
+ red circle moves left slowly
518
+ blue square moves right twice
519
+ gold star moves down
520
+ green triangle moves up slowly
521
+ blue square
522
+ red circle moves left twice
523
+ green triangle moves up twice
524
+ red circle moves left
525
+ green triangle
526
+ blue square
527
+ red circle
528
+ green triangle
529
+ gold star moves down twice
530
+ green triangle moves up twice
531
+ green triangle
532
+ gold star moves down
533
+ green triangle moves up
534
+ blue square moves right twice
535
+ green triangle
536
+ red circle
537
+ green triangle moves up twice
538
+ green triangle moves up
539
+ gold star moves down
540
+ red circle moves left
541
+ green triangle moves up twice
542
+ green triangle
543
+ gold star
544
+ green triangle moves up twice
545
+ blue square moves right slowly
546
+ green triangle
547
+ green triangle moves up
548
+ green triangle moves up
549
+ blue square
550
+ red circle moves left
551
+ blue square moves right twice
552
+ red circle
553
+ green triangle
554
+ green triangle moves up
555
+ red circle
556
+ green triangle moves up twice
557
+ blue square moves right slowly
558
+ red circle moves left slowly
559
+ red circle moves left twice
560
+ green triangle moves up slowly
561
+ gold star moves down slowly
562
+ blue square moves right
563
+ blue square moves right twice
564
+ red circle
565
+ green triangle moves up slowly
566
+ red circle
567
+ green triangle
568
+ red circle moves left slowly
569
+ red circle
570
+ blue square moves right slowly
571
+ red circle moves left slowly
572
+ red circle
573
+ red circle moves left twice
574
+ gold star
575
+ red circle moves left twice
576
+ green triangle moves up twice
577
+ green triangle moves up
578
+ green triangle moves up
579
+ red circle
580
+ gold star moves down slowly
581
+ gold star
582
+ gold star
583
+ red circle
584
+ gold star moves down twice
585
+ green triangle moves up
586
+ green triangle
587
+ blue square
588
+ green triangle moves up slowly
589
+ gold star moves down
590
+ gold star
591
+ green triangle
592
+ gold star
593
+ red circle moves left
594
+ gold star moves down
595
+ green triangle
596
+ blue square moves right slowly
597
+ red circle moves left
598
+ green triangle moves up
599
+ green triangle moves up slowly
600
+ red circle moves left
601
+ green triangle moves up twice
602
+ green triangle moves up
603
+ red circle moves left twice
604
+ red circle moves left
605
+ gold star moves down twice
606
+ blue square moves right
607
+ red circle moves left twice
608
+ gold star
609
+ gold star
610
+ blue square
611
+ red circle
612
+ blue square
613
+ blue square
614
+ blue square moves right twice
615
+ red circle moves left
616
+ blue square moves right slowly
617
+ blue square moves right slowly
618
+ green triangle
619
+ blue square moves right slowly
620
+ green triangle moves up twice
621
+ blue square
622
+ gold star moves down
623
+ gold star moves down twice
624
+ blue square moves right
625
+ red circle
626
+ red circle moves left twice
627
+ blue square moves right twice
628
+ red circle moves left
629
+ green triangle moves up slowly
630
+ red circle
631
+ red circle moves left
632
+ red circle moves left twice
633
+ gold star moves down slowly
634
+ green triangle moves up twice
635
+ gold star moves down
636
+ red circle
637
+ blue square
638
+ red circle
639
+ green triangle
640
+ green triangle
lecture_6/examples/categorical.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete categorical training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'categorical', *sys.argv[1:]])
lecture_6/examples/consistency.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete consistency training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'consistency', *sys.argv[1:]])
lecture_6/examples/diamond.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete diamond training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'diamond', *sys.argv[1:]])
lecture_6/examples/discrete_esd.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete discrete-esd training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'discrete-esd', *sys.argv[1:]])
lecture_6/examples/discrete_lsd.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete discrete-lsd training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'discrete-lsd', *sys.argv[1:]])
lecture_6/examples/expanding.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete expanding training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'expanding', *sys.argv[1:]])
lecture_6/examples/flow_matching.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete flow-matching training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'flow-matching', *sys.argv[1:]])
lecture_6/examples/fmlm.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete fmlm training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'fmlm', *sys.argv[1:]])
lecture_6/examples/fmm_eulerian.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete fmm-eulerian training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'fmm-eulerian', *sys.argv[1:]])
lecture_6/examples/fmm_lagrangian.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete fmm-lagrangian training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'fmm-lagrangian', *sys.argv[1:]])
lecture_6/examples/latent.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete latent training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'latent', *sys.argv[1:]])
lecture_6/examples/meanflow.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete meanflow training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'meanflow', *sys.argv[1:]])
lecture_6/examples/meta.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete meta training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'meta', *sys.argv[1:]])
lecture_6/examples/self_distill.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete self-distill training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'self-distill', *sys.argv[1:]])
lecture_6/examples/shortcut.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete shortcut training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'shortcut', *sys.argv[1:]])
lecture_6/examples/ssfm.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the complete ssfm training and sampling example."""
3
+ import sys
4
+ from pathlib import Path
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from run import main
7
+ if __name__ == '__main__':
8
+ main(['--method', 'ssfm', *sys.argv[1:]])
lecture_6/expanding.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Expanding Flow Maps on variable-length text with learned gap insertions.
2
+
3
+ Based on paper Algorithms 2-4. The state carries birth times alongside token
4
+ coordinates. Finite transport uses local clocks on a shared destination canvas.
5
+ The insertion head learns both remaining-count and interval-count expectations.
6
+ """
7
+ import torch
8
+ from torch import nn
9
+ from torch.nn import functional as F
10
+
11
+ from common import ema_copy, mlp, optimize
12
+
13
+
14
+ class ExpandingNet(nn.Module):
15
+ def __init__(self, length, vocab, width):
16
+ super().__init__()
17
+ self.length, self.vocab = length, vocab
18
+ # Every token contributes state, two local clocks, birth, and active mask.
19
+ self.denoiser = mlp(length * (vocab+4), length*vocab, width)
20
+ self.insertion = mlp(length*(vocab+2)+2, length+1, width)
21
+
22
+ def predict(self, x, local_s, local_t, births, mask):
23
+ features = torch.cat([x, local_s[..., None], local_t[..., None],
24
+ births[..., None], mask[..., None].to(x)], -1)
25
+ return self.denoiser(features.flatten(1)).reshape(-1, self.length, self.vocab)
26
+
27
+ def counts(self, x, births, mask, s, t, diagonal=False):
28
+ features = torch.cat([x, births[..., None], mask[..., None].to(x)], -1).flatten(1)
29
+ features = torch.cat([features, s, t], -1)
30
+ remaining = F.softplus(self.insertion(features)) + 1e-5
31
+ # Linear birth CDF: rho=(t-s)/(1-s). The diagonal predicts the
32
+ # remaining count; off-diagonal predictions include the interval factor.
33
+ return remaining if diagonal else (t-s)/(1-s)*remaining
34
+
35
+
36
+ def local_clock(t, births):
37
+ return ((t-births)/(1-births)).clamp(0, 1)
38
+
39
+
40
+ def local_map(model, x, a, b, births, mask):
41
+ p = model.predict(x, a, b, births, mask).softmax(-1)
42
+ eta = ((b-a)/(1-a).clamp_min(1e-6))[..., None]
43
+ y = (x + eta*(p-x)) * mask[..., None]
44
+ return y, p
45
+
46
+
47
+ def gap_counts(active_indices, born_indices, length):
48
+ """Assign each missing index to a gap while retaining original token order."""
49
+ result = torch.zeros(len(active_indices)+1, device=active_indices.device)
50
+ if len(born_indices):
51
+ gap = torch.searchsorted(active_indices, born_indices)
52
+ result.scatter_add_(0, gap, torch.ones_like(gap, dtype=result.dtype))
53
+ return result
54
+
55
+
56
+ def compact(full, births, selected, max_length):
57
+ x = full.new_zeros(max_length, full.shape[-1])
58
+ b = births.new_zeros(max_length)
59
+ mask = torch.zeros(max_length, dtype=torch.bool, device=full.device)
60
+ n = len(selected)
61
+ x[:n], b[:n], mask[:n] = full[selected], births[selected], True
62
+ return x, b, mask
63
+
64
+
65
+ def count_divergence(target, mean):
66
+ # Poisson NLL up to target-only constants. Finite at target=0.
67
+ # Avoid xlogy(0,0)'s undefined intermediate derivative in autodiff.
68
+ return mean - target + target * (target.clamp_min(1e-12).log()-mean.log())
69
+
70
+
71
+ def expansion_batch(ids, lengths, vocab, batch_size):
72
+ index = torch.randint(len(ids), (batch_size,), device=ids.device)
73
+ fields = {k: [] for k in ['xs','bs','ms','xe','be','me','ys','ye','missing','interval','gapmask']}
74
+ pairs = (.96*torch.rand(batch_size, 2, device=ids.device)).sort(-1).values
75
+ s, t = pairs[:, :1], pairs[:, 1:]
76
+ t = torch.maximum(t, s+1e-4)
77
+ L = ids.shape[1]
78
+ for j, row in enumerate(index):
79
+ n = int(lengths[row])
80
+ clean = F.one_hot(ids[row, :n], vocab).float()
81
+ births = .999*torch.rand(n, device=ids.device)
82
+ noise = torch.randn_like(clean)
83
+ clock = local_clock(s[j], births)
84
+ full = (1-clock[:, None])*noise+clock[:, None]*clean
85
+ active = torch.where(births <= s[j])[0]
86
+ later = torch.where(births <= t[j])[0]
87
+ xs, bs, ms = compact(full, births, active, L)
88
+ xe, be, me = compact(full, births, later, L)
89
+ ys, _, _ = compact(clean, births, active, L)
90
+ ye, _, _ = compact(clean, births, later, L)
91
+ missing = full.new_zeros(L+1)
92
+ interval = full.new_zeros(L+1)
93
+ gm = torch.arange(L+1, device=ids.device) <= len(active)
94
+ missing[gm] = gap_counts(active, torch.where(births>s[j])[0], n)
95
+ interval[gm] = gap_counts(active, torch.where((births>s[j]) & (births<=t[j]))[0], n)
96
+ for k, value in zip(fields, [xs,bs,ms,xe,be,me,ys,ye,missing,interval,gm]):
97
+ fields[k].append(value)
98
+ return {k: torch.stack(v) for k,v in fields.items()}, s, t
99
+
100
+
101
+ def train_expanding(ids, lengths, vocab, args):
102
+ model = ExpandingNet(ids.shape[1], len(vocab), args.width).to(ids.device)
103
+ teacher = ema_copy(model)
104
+ def objective(step):
105
+ b, s, t = expansion_batch(ids, lengths, len(vocab), args.batch_size)
106
+ a = local_clock(s, b['bs'])
107
+ logits = model.predict(b['xs'], a, a, b['bs'], b['ms'])
108
+ ce = -(b['ys']*logits.log_softmax(-1)).sum(-1)
109
+ diagonal = (ce*b['ms']).sum()/b['ms'].sum().clamp_min(1)
110
+ # Lift both paths to the same destination canvas, with the same noise.
111
+ la, lb = local_clock(s,b['be']), local_clock(t,b['be'])
112
+ lu = local_clock((s+t)/2,b['be'])
113
+ with torch.no_grad():
114
+ middle, p1 = local_map(teacher,b['xe'],la,lu,b['be'],b['me'])
115
+ _, p2 = local_map(teacher,middle,lu,lb,b['be'],b['me'])
116
+ gamma = ((1-lb)*(lu-la)/((1-lu)*(lb-la)).clamp_min(1e-6)).clamp(0,1)
117
+ target = gamma[...,None]*p1+(1-gamma[...,None])*p2
118
+ logits = model.predict(b['xe'],la,lb,b['be'],b['me'])
119
+ kl = F.kl_div(logits.log_softmax(-1),target,reduction='none').sum(-1)
120
+ finite = (kl*b['me']).sum()/b['me'].sum().clamp_min(1)
121
+ m = model.counts(b['xs'],b['bs'],b['ms'],s,s,diagonal=True)
122
+ interval = model.counts(b['xs'],b['bs'],b['ms'],s,t)
123
+ count = count_divergence(b['missing'],m)+count_divergence(b['interval'],interval)
124
+ insertion = (count*b['gapmask']).sum()/b['gapmask'].sum()
125
+ ramp = min(1.,(step+1)/max(1,args.train_steps//4))
126
+ return diagonal+ramp*finite+insertion, {'diagonal_ce':diagonal,'finite':finite,'insertion':insertion}
127
+ logs = optimize(model,objective,args.train_steps,args.lr,teacher)
128
+ return model, {'model':model.state_dict(),'length':ids.shape[1],'vocab':vocab}, logs
129
+
130
+
131
+ def bounded_counts(means, budget):
132
+ """Independent binomial proposals, then left-to-right joint budget capping.
133
+
134
+ Before capping, each proposal has its predicted mean after [0,budget]
135
+ clipping. Conditional means alone do not determine the joint count law.
136
+ """
137
+ if budget == 0:
138
+ return torch.zeros_like(means, dtype=torch.long), 0
139
+ raw = torch.distributions.Binomial(budget, probs=means.clamp(0,budget)/budget).sample().long()
140
+ kept = raw.clone()
141
+ remaining = budget
142
+ for i in range(len(kept)):
143
+ kept[i] = min(int(kept[i]),remaining)
144
+ remaining -= int(kept[i])
145
+ return kept, int((raw-kept).sum())
146
+
147
+
148
+ def insert_tokens(state, births, counts, noise, birth_time):
149
+ pieces, times, offset = [], [], 0
150
+ for gap, count in enumerate(counts.tolist()):
151
+ if count:
152
+ pieces.append(noise[offset:offset+count])
153
+ times.append(births.new_full((count,),birth_time))
154
+ offset += count
155
+ if gap < len(state):
156
+ pieces.append(state[gap:gap+1]); times.append(births[gap:gap+1])
157
+ if offset != len(noise):
158
+ raise ValueError('Noise rows must match insertion counts.')
159
+ if not pieces:
160
+ return state, births
161
+ return torch.cat(pieces),torch.cat(times)
162
+
163
+
164
+ @torch.no_grad()
165
+ def sample_expanding(model,count,steps,device):
166
+ result = torch.zeros(count,model.length,dtype=torch.long,device=device)
167
+ lengths = torch.zeros(count,dtype=torch.long,device=device)
168
+ capped = 0
169
+ traces = []
170
+ for j in range(count):
171
+ x = torch.zeros(0,model.vocab,device=device)
172
+ births = torch.zeros(0,device=device)
173
+ trace = [0]
174
+ for k in range(steps):
175
+ s,t = k/steps,(k+1)/steps
176
+ padded,bt,mask = compact(x,births,torch.arange(len(x),device=device),model.length)
177
+ start,end = torch.tensor([[s]],device=device),torch.tensor([[t]],device=device)
178
+ means = model.counts(padded[None],bt[None],mask[None],start,end)[0,:len(x)+1]
179
+ counts,discarded = bounded_counts(means,model.length-len(x));capped+=discarded
180
+ noise = torch.randn(int(counts.sum()),model.vocab,device=device)
181
+ # Finite expand-then-transport convention: new coordinates enter at s.
182
+ x,births = insert_tokens(x,births,counts,noise,s)
183
+ if len(x):
184
+ padded,bt,mask=compact(x,births,torch.arange(len(x),device=device),model.length)
185
+ y,_=local_map(model,padded[None],local_clock(start,bt[None]),
186
+ local_clock(end,bt[None]),bt[None],mask[None])
187
+ x=y[0,:len(x)]
188
+ trace.append(len(x))
189
+ lengths[j]=len(x)
190
+ if len(x):result[j,:len(x)]=x.argmax(-1)
191
+ traces.append(trace)
192
+ return result,lengths,{'capped_proposed_insertions':capped,'length_trajectories':traces}
lecture_6/lecture_core.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stable imports connecting the lecture's code walkthroughs to full methods.
2
+
3
+ Implementation lives in the named modules so training and sampling use the
4
+ same functions demonstrated on the slides. See SLIDE_CODE_MAP.md.
5
+ """
6
+ from common import finite_map
7
+ from continuous import (diagonal_loss,lagrangian_residual,eulerian_residual,
8
+ semigroup_loss,meanflow_loss,shortcut_loss)
9
+ from categorical import (categorical_map,composition_target,corrected_logit_teacher,
10
+ probability_kl,DecodingClock)
11
+ from posterior import (glass_denoiser,posterior_samples,posterior_value,
12
+ fine_tune_surrogate,weighted_diamond_samples)
13
+ from expanding import (local_clock,local_map,count_divergence,bounded_counts,insert_tokens)
14
+ from stochastic import chen_two,sample_coefficients
lecture_6/numerical_examples.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """CIS 6270 Lecture 6. Small, reproducible flow-map teaching experiments.
2
+
3
+ Run: python numerical_examples.py --output outputs/numerical
4
+ Dependencies: Python 3.11+, numpy, torch.
5
+ The toy experiments validate the lecture mathematics. They do not reproduce
6
+ the large-scale training or benchmark claims of the cited papers.
7
+ """
8
+ import argparse, json, math, pathlib
9
+ import numpy as np
10
+ import torch
11
+ from torch import nn
12
+ from torch.nn import functional as F
13
+
14
+ def flow(model, x, s, t):
15
+ """Residual map with an exactly identity diagonal."""
16
+ return x + (t-s)*model(torch.cat([x,s,t],dim=-1))
17
+
18
+ def train_scalar(output, iterations=6000):
19
+ """Self-distill the flow of dx/dt=x, using diagonal and composition only."""
20
+ torch.manual_seed(6270)
21
+ torch.set_num_threads(2)
22
+ model=nn.Sequential(nn.Linear(3,64),nn.SiLU(),nn.Linear(64,64),nn.SiLU(),nn.Linear(64,1))
23
+ opt=torch.optim.Adam(model.parameters(),lr=1e-3)
24
+ history=[]
25
+ for step in range(iterations):
26
+ # Broad state coverage includes states reached by the split map.
27
+ x=6*torch.rand(256,1)-3
28
+ times=torch.rand(256,2).sort(dim=-1).values
29
+ s,t=times[:,:1],times[:,1:]
30
+ u=s+(t-s)*torch.rand_like(s)
31
+ diagonal=model(torch.cat([x,s,s],dim=-1))
32
+ diag_loss=(diagonal-x).square().mean()
33
+ with torch.no_grad():
34
+ target=flow(model,flow(model,x,s,u),u,t)
35
+ prediction=flow(model,x,s,t)
36
+ # Normalize the interval residual to prevent tiny intervals dominating
37
+ # the count of nearly zero-error examples. Keep a finite floor.
38
+ cons_loss=((prediction-target)/(t-s).clamp_min(0.1)).square().mean()
39
+ loss=diag_loss + (0 if step<500 else 1)*cons_loss
40
+ opt.zero_grad();loss.backward();opt.step()
41
+ if step%500==0:history.append({'step':step,'diagonal':diag_loss.item(),'composition':cons_loss.item()})
42
+ with torch.no_grad():
43
+ x=torch.linspace(-1.5,1.5,501)[:,None]
44
+ s=torch.zeros_like(x);t=torch.ones_like(x);u=0.5*t
45
+ pred=flow(model,x,s,t);truth=x*math.e
46
+ split=flow(model,flow(model,x,s,u),u,t)
47
+ rmse=(pred-truth).square().mean().sqrt().item()
48
+ composition_rmse=(pred-split).square().mean().sqrt().item()
49
+ np.savez(output/'scalar_predictions.npz',x=x.numpy().ravel(),pred=pred.numpy().ravel(),truth=truth.numpy().ravel())
50
+ torch.save(model.state_dict(),output/'scalar_map_weights.pt')
51
+ return {'endpoint_rmse':rmse,'composition_rmse':composition_rmse,'iterations':iterations,'history':history}
52
+
53
+ def categorical_map(net,x,s,t):
54
+ psi=net(x,s,t).softmax(dim=-1)
55
+ h=(t-s)/(1-s)
56
+ return (1-h)*x+h*psi,psi
57
+
58
+ def check_categorical():
59
+ x=torch.tensor([-.2,.6,1.1],dtype=torch.float64)
60
+ psi=torch.tensor([.1,.7,.2],dtype=torch.float64)
61
+ y=(1/3)*x+(2/3)*psi
62
+ assert torch.allclose(y,torch.tensor([0,2/3,.5],dtype=torch.float64))
63
+ target=(1/3)*torch.tensor([.8,.2])+(2/3)*torch.tensor([.2,.8])
64
+ assert torch.allclose(target,torch.tensor([.4,.6]))
65
+ logits=torch.tensor([.2,-.1],requires_grad=True)
66
+ loss=F.kl_div(logits.log_softmax(-1),target,reduction='sum')
67
+ loss.backward()
68
+ assert torch.allclose(logits.grad,logits.softmax(-1)-target,atol=1e-7)
69
+ return {'mapped_state':y.tolist(),'state_sum':y.sum().item(),'target':target.tolist()}
70
+
71
+ def check_meanflow_jvp():
72
+ # Exact backward average for dz/dt=z. Stay off diagonal for this check.
73
+ def exact_average(z,r,t):
74
+ h=t-r
75
+ return z*(-torch.expm1(-h))/h
76
+ z=torch.tensor([[1.7]],dtype=torch.float64)
77
+ r=torch.tensor([[.2]],dtype=torch.float64)
78
+ t=torch.tensor([[.8]],dtype=torch.float64)
79
+ value,derivative=torch.func.jvp(exact_average,(z,r,t),(z,torch.zeros_like(r),torch.ones_like(t)))
80
+ target=z-(t-r)*derivative
81
+ assert torch.allclose(value,target,atol=1e-10)
82
+ return {'average':value.item(),'identity_residual':(value-target).abs().item()}
83
+
84
+ def posterior_value_demo():
85
+ # Prior Z~N(0,1), observation x=beta*Z+alpha*eps.
86
+ # Reward r(Z)=c*Z gives an analytic log moment-generating function.
87
+ torch.manual_seed(13)
88
+ alpha,beta,c=.7,.6,.4
89
+ x=torch.tensor(.3,dtype=torch.float64,requires_grad=True)
90
+ gain=beta/(alpha**2+beta**2)
91
+ variance=alpha**2/(alpha**2+beta**2)
92
+ eps=torch.randn(100000,dtype=torch.float64)
93
+ z=gain*x+math.sqrt(variance)*eps
94
+ logw=c*z
95
+ estimate=torch.logsumexp(logw,0)-math.log(len(eps))
96
+ gradient=torch.autograd.grad(estimate,x)[0]
97
+ exact=c*gain*x.detach()+.5*c*c*variance
98
+ exact_gradient=c*gain
99
+ assert abs(gradient.item()-exact_gradient)<1e-10
100
+ assert abs(estimate.item()-exact.item())<.006
101
+ return {'estimated_value':estimate.item(),'exact_value':exact.item(),'gradient':gradient.item(),'exact_gradient':exact_gradient}
102
+
103
+ def sample_gap_counts(means,remaining_budget):
104
+ """Paper-style bounded proposals followed by left-to-right budget capping.
105
+
106
+ These proposals match the per-gap means before joint truncation. They are
107
+ not asserted to identify the full conditional count law from means alone.
108
+ """
109
+ counts=[];remaining=int(remaining_budget)
110
+ for mean in means:
111
+ if remaining_budget==0:count=0
112
+ else:
113
+ prob=float(torch.as_tensor(mean).clamp(0,remaining_budget))/remaining_budget
114
+ count=int(torch.distributions.Binomial(remaining_budget,probs=prob).sample())
115
+ count=min(count,remaining);counts.append(count);remaining-=count
116
+ return torch.tensor(counts,dtype=torch.long)
117
+
118
+ def insert_by_gap(state,old_birth_times,counts,new_noise,birth_time):
119
+ """Insert ordered noise rows into the n+1 gaps and preserve clock alignment."""
120
+ assert len(counts)==len(state)+1
121
+ pieces=[];clocks=[];offset=0
122
+ for gap,count in enumerate(counts.tolist()):
123
+ if count:
124
+ pieces.append(new_noise[offset:offset+count]);offset+=count
125
+ clocks.append(torch.full((count,),float(birth_time)))
126
+ if gap<len(state):
127
+ pieces.append(state[gap:gap+1]);clocks.append(old_birth_times[gap:gap+1])
128
+ assert offset==len(new_noise)
129
+ return torch.cat(pieces),torch.cat(clocks)
130
+
131
+ def check_expansion():
132
+ state=torch.tensor([[1.,0.],[0.,1.]])
133
+ births=torch.tensor([0.,.2]);counts=torch.tensor([1,0,1])
134
+ noise=torch.tensor([[-.2,.4],[.3,-.1]])
135
+ expanded,bt=insert_by_gap(state,births,counts,noise,.5)
136
+ local=(.75-bt)/(1-bt)
137
+ assert expanded.shape==(4,2)
138
+ assert torch.allclose(bt,torch.tensor([.5,0.,.2,.5]))
139
+ assert torch.allclose(local,torch.tensor([.5,.75,.6875,.5]))
140
+ return {'birth_times':bt.tolist(),'local_times':local.tolist(),'expected_insertions':((.75-.25)/(1-.25))*3}
141
+
142
+ def chen_two(left,right,hL,hR):
143
+ h=hL+hR
144
+ return torch.stack([left[...,0]+right[...,0],
145
+ (hL*left[...,1]+hR*right[...,1]-hR*left[...,0]+hL*right[...,0])/h],dim=-1)
146
+
147
+ def check_brownian():
148
+ left=torch.tensor([.2,.04]);right=torch.tensor([-.1,-.02])
149
+ coarse=chen_two(left,right,.5,.5)
150
+ assert torch.allclose(coarse,torch.tensor([.1,-.14]))
151
+ direct=1+.5+.8*coarse[0]
152
+ split=(1+.25+.8*left[0])+.25+.8*right[0]
153
+ assert torch.allclose(direct,split)
154
+ torch.manual_seed(17)
155
+ scale=torch.tensor([.5,1/6]).sqrt()
156
+ L=torch.randn(200000,2)*scale;R=torch.randn(200000,2)*scale
157
+ C=chen_two(L,R,.5,.5)
158
+ covariance=torch.cov(C.T)
159
+ assert torch.allclose(covariance,torch.diag(torch.tensor([1.,1/3])),atol=.012)
160
+ # Exact polynomial restriction identities, tested over unequal intervals.
161
+ hL,hR=.3,.7
162
+ q=torch.linspace(0,1,100,dtype=torch.float64)
163
+ global_left=2*(hL*q)/(hL+hR)-1
164
+ local_left=(hL/(hL+hR))*(2*q-1)-hR/(hL+hR)
165
+ assert torch.allclose(global_left,local_left,atol=1e-12)
166
+ return {'coarse_coefficients':coarse.tolist(),'same_noise_endpoint':direct.item(),'empirical_covariance':covariance.tolist()}
167
+
168
+ def check_meta_gradient():
169
+ d=torch.tensor(.3,requires_grad=True)
170
+ w=torch.tensor([1.,4.]);grad_w=torch.tensor([.2,.8]);a=.5
171
+ residual=d+(w-1)*d.detach()-a*grad_w
172
+ residual.square().mean().backward()
173
+ expected=2*(w*d.detach()-a*grad_w).mean()
174
+ assert torch.allclose(d.grad,expected)
175
+ return {'surrogate_gradient':d.grad.item(),'estimating_equation_gradient':expected.item()}
176
+
177
+ def main():
178
+ parser=argparse.ArgumentParser();parser.add_argument('--output',default='results');parser.add_argument('--iterations',type=int,default=6000)
179
+ args=parser.parse_args();out=pathlib.Path(args.output);out.mkdir(parents=True,exist_ok=True)
180
+ results={'torch_version':torch.__version__,'categorical':check_categorical(),'meanflow_jvp':check_meanflow_jvp(),
181
+ 'posterior_value':posterior_value_demo(),'expansion':check_expansion(),'brownian':check_brownian(),'meta_gradient':check_meta_gradient()}
182
+ results['scalar_training']=train_scalar(out,args.iterations)
183
+ (out/'checks.json').write_text(json.dumps(results,indent=2))
184
+ print(json.dumps({k:v for k,v in results.items() if k!='scalar_training'},indent=2))
185
+ print('Scalar endpoint RMSE',results['scalar_training']['endpoint_rmse'])
186
+ print('Scalar composition RMSE',results['scalar_training']['composition_rmse'])
187
+ if __name__=='__main__':main()
lecture_6/posterior.py ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Posterior Diamond Maps, data-trained Meta Flow Maps, and reward steering.
2
+
3
+ There are two independent noise draws and a shared clean endpoint. The inner
4
+ time evolves while the outer observation and outer time remain fixed.
5
+ """
6
+ import math
7
+
8
+ import torch
9
+ from torch.nn import functional as F
10
+
11
+ from common import (MapNet, draw_batch, ema_copy, exact_denoiser, exact_velocity,
12
+ finite_map, interpolate, mixture_posterior, optimize,
13
+ ordered_times, time_like)
14
+ from continuous import semigroup_loss
15
+
16
+
17
+ def glass_denoiser(inner, s, outer, t):
18
+ """Fuse independent Gaussian observations by adding their precisions.
19
+
20
+ inner=s*X1+(1-s)*eps, outer=t*X1+(1-t)*eps'. The sufficient
21
+ statistic S has noise variance 1/precision. Convert it to the original
22
+ linear schedule t*=sqrt(precision)/(1+sqrt(precision)), then denoise.
23
+ """
24
+ precision = (s / (1-s)).square() + (t / (1-t)).square()
25
+ safe = precision.clamp_min(1e-12)
26
+ statistic = (s * inner / (1-s).square() + t * outer / (1-t).square()) / safe
27
+ ratio = safe.sqrt()
28
+ effective_time = ratio / (1 + ratio)
29
+ value = exact_denoiser(effective_time * statistic, effective_time)
30
+ return torch.where(precision > 1e-12, value, torch.zeros_like(value))
31
+
32
+
33
+ def glass_velocity(inner, s, outer, t):
34
+ return (glass_denoiser(inner, s, outer, t) - inner) / (1-s)
35
+
36
+
37
+ def posterior_context(outer, t):
38
+ return torch.cat([outer, time_like(t, outer)], -1)
39
+
40
+
41
+ def train_posterior(method, data, args):
42
+ model = MapNet(2, args.width, context_dim=3).to(data)
43
+ teacher = ema_copy(model)
44
+
45
+ def objective(step):
46
+ clean = draw_batch(data, args.batch_size)
47
+ outer_t = .94 * torch.rand(len(clean), 1, device=data.device)
48
+ outer, _ = interpolate(clean, outer_t)
49
+ context = posterior_context(outer, outer_t)
50
+ s, t, _ = ordered_times(clean, .97)
51
+ # Independent inner noise; reusing the outer noise changes the posterior.
52
+ inner, displacement = interpolate(clean, s)
53
+ if method == 'diamond':
54
+ diagonal_target = glass_velocity(inner, s, outer, outer_t).detach()
55
+ else:
56
+ diagonal_target = displacement
57
+ diagonal = F.mse_loss(model(inner, s, s, context), diagonal_target)
58
+ if method == 'diamond':
59
+ y, derivative = torch.func.jvp(lambda end: finite_map(model, inner, s, end, context),
60
+ (t,), (torch.ones_like(t),))
61
+ target = glass_velocity(y.detach(), t, outer, outer_t).detach()
62
+ finite = F.mse_loss(derivative, target)
63
+ else:
64
+ finite = semigroup_loss(model, teacher, inner, s, t, context)
65
+ weight = min(1., (step+1) / max(1, args.train_steps//4))
66
+ return diagonal + weight * finite, {'diagonal': diagonal, 'finite': finite}
67
+
68
+ logs = optimize(model, objective, args.train_steps, args.lr, teacher)
69
+ return model, {'model': model.state_dict(), 'dim': 2}, logs
70
+
71
+
72
+ def posterior_samples(model, outer, t, count, steps=1, noise=None):
73
+ context = posterior_context(outer, t)
74
+ context = context[:, None].expand(-1, count, -1).reshape(-1, 3)
75
+ x = torch.randn(len(outer)*count, 2, device=outer.device) if noise is None else noise.reshape(-1, 2)
76
+ for i in range(steps):
77
+ x = finite_map(model, x, i/steps, (i+1)/steps, context)
78
+ return x.reshape(len(outer), count, 2)
79
+
80
+
81
+ def reward(x, strength=1.):
82
+ """Bounded differentiable preference for positive first coordinates."""
83
+ return strength * torch.tanh(x[..., 0])
84
+
85
+
86
+ def posterior_value(model, x, t, particles=32, strength=1., steps=1):
87
+ samples = posterior_samples(model, x, t, particles, steps)
88
+ log_weights = reward(samples, strength)
89
+ value = torch.logsumexp(log_weights, -1) - math.log(particles)
90
+ weighted_mean = (log_weights.softmax(-1)[..., None] * samples).sum(1)
91
+ return value, weighted_mean, samples
92
+
93
+
94
+ def fine_tune_surrogate(delta, weights, grad_weights, coefficient):
95
+ """Equation 43 of Meta Flow Maps. Both Monte Carlo terms are detached.
96
+
97
+ d/d(delta) E[loss] = 2 E[w*delta - coefficient*grad(w)].
98
+ Differentiating (w*delta - coefficient*grad(w))^2 instead adds a wrong w.
99
+ """
100
+ residual = delta + (weights.detach()-1) * delta.detach() - coefficient * grad_weights.detach()
101
+ return residual.square().mean()
102
+
103
+
104
+ def train_reward_drift(posterior, data, args):
105
+ posterior.requires_grad_(False)
106
+ drift = MapNet(2, args.width).to(data)
107
+ def objective(_):
108
+ clean = draw_batch(data, args.batch_size)
109
+ t = .05 + .8 * torch.rand(len(clean), 1, device=data.device)
110
+ x, _ = interpolate(clean, t)
111
+ x.requires_grad_(True)
112
+ endpoint = posterior_samples(posterior, x, t, 1, args.posterior_steps)[:, 0]
113
+ w = reward(endpoint, args.reward_strength).exp().unsqueeze(-1)
114
+ grad_w = torch.autograd.grad(w.sum(), x)[0]
115
+ baseline = exact_velocity(x, t).detach()
116
+ delta = drift(x.detach(), t, t) - baseline
117
+ # Linear interpolant's compatible probability-flow correction g^2/2=(1-t)/t.
118
+ # Use t>=.05 to avoid singular coefficients in this demonstration.
119
+ coefficient = (1-t) / t
120
+ loss = fine_tune_surrogate(delta, w, grad_w, coefficient)
121
+ return loss, {'mean_weight': w.mean()}
122
+ logs = optimize(drift, objective, args.finetune_steps, args.lr)
123
+ return drift, logs
124
+
125
+
126
+ @torch.no_grad()
127
+ def guided_samples(model, count, steps, particles, strength, posterior_steps=1):
128
+ """Derivative-free reward-weighted posterior mean in the linear flow drift.
129
+
130
+ v*(x,t)=(E_reward[X1|x,t]-x)/(1-t). It equals the compatible
131
+ probability-flow correction for an exact posterior. Finite learned maps
132
+ and self-normalized Monte Carlo introduce approximation and ratio bias.
133
+ """
134
+ x = torch.randn(count, 2, device=next(model.parameters()).device)
135
+ h = 1/steps
136
+ for i in range(steps):
137
+ t = torch.full((count, 1), i/steps, device=x.device)
138
+ _, mean, _ = posterior_value(model, x, t, particles, strength, posterior_steps)
139
+ x = x + h * (mean-x) / (1-t)
140
+ return x
141
+
142
+
143
+ def weighted_diamond_samples(outer, t, particles=128):
144
+ """Exact tractable demonstration of weighted Diamond proposal correction.
145
+
146
+ Proposal q=N(0,4I) has evaluable density and full support. Reweight with
147
+ p1(z)*p_t(outer|z)/q(z), then resample. This supplies an independent
148
+ check of posterior recovery without assuming an arbitrary learned map's
149
+ Jacobian density is known. Finite self-normalized importance sampling is biased.
150
+ """
151
+ from common import CENTERS, DATA_STD
152
+ t = time_like(t, outer)
153
+ z = 2 * torch.randn(len(outer), particles, 2, device=outer.device)
154
+ delta = z[:, :, None] - CENTERS.to(z)
155
+ lp = torch.logsumexp(-delta.square().sum(-1)/(2*DATA_STD**2), -1)
156
+ lp -= math.log(4 * 2 * math.pi * DATA_STD**2)
157
+ noise = (outer[:, None]-t[:, None]*z)/(1-t[:, None])
158
+ likelihood = -.5*noise.square().sum(-1) - 2*(1-t).log()
159
+ lq = -z.square().sum(-1)/8 - math.log(8*math.pi)
160
+ weights = (lp + likelihood - lq).softmax(-1)
161
+ mean = (weights[..., None]*z).sum(1)
162
+ indices = torch.multinomial(weights, 1)
163
+ selected = z.gather(1, indices[..., None].expand(-1, -1, 2))[:, 0]
164
+ return selected, mean, 1/weights.square().sum(-1)
165
+
166
+
167
+ @torch.no_grad()
168
+ def posterior_diagnostics(model, steps=1):
169
+ device = next(model.parameters()).device
170
+ x = torch.tensor([[0., 0.], [1., -.5], [-1., 1.]], device=device)
171
+ t = torch.tensor([[.15], [.5], [.8]], device=device)
172
+ p, means, var = mixture_posterior(x, t)
173
+ exact_mean = (p[..., None]*means).sum(1)
174
+ exact_variance = (p[..., None]*(var[:, None]+means.square())).sum(1)-exact_mean.square()
175
+ samples = posterior_samples(model, x, t, 512, steps)
176
+ mean, variance = samples.mean(1), samples.var(1)
177
+ return {'posterior_mean_rmse': float((mean-exact_mean).square().mean().sqrt()),
178
+ 'posterior_variance_rmse': float((variance-exact_variance).square().mean().sqrt()),
179
+ 'posterior_reference_mean': exact_mean.tolist(), 'posterior_estimated_mean': mean.tolist()}
lecture_6/requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Match the course's PyTorch baseline; torch.func.jvp is required.
2
+ torch==2.9.1
3
+ numpy>=1.24,<3
lecture_6/run.py ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Train, save, reload, and sample the Lecture 6 flow-map methods."""
3
+ import argparse
4
+ import json
5
+ import platform
6
+ import time
7
+ from pathlib import Path
8
+
9
+ import torch
10
+ from torch.nn import functional as F
11
+
12
+ from common import (MapNet, SequenceNet, interpolate, load_text, mixture_data,
13
+ mixture_metrics, seed_all, text_metrics, write_json)
14
+ from continuous import (Autoencoder, embed_surface, integrate_velocity, sample_continuous,
15
+ train_continuous, train_latent)
16
+ from categorical import sample_categorical, train_categorical
17
+ from posterior import (guided_samples, posterior_diagnostics, posterior_samples,
18
+ posterior_value, reward, train_posterior, train_reward_drift,
19
+ weighted_diamond_samples)
20
+ from expanding import ExpandingNet, sample_expanding, train_expanding
21
+ from stochastic import StrongMap, evaluate_stochastic, train_stochastic
22
+
23
+ ROOT = Path(__file__).resolve().parent
24
+ CONTINUOUS = ['flow-matching','fmm-lagrangian','fmm-eulerian','self-distill',
25
+ 'consistency','shortcut','meanflow','latent']
26
+ CATEGORICAL = ['fmlm','categorical','discrete-lsd','discrete-esd']
27
+ METHODS = CONTINUOUS+CATEGORICAL+['diamond','meta','expanding','ssfm']
28
+
29
+
30
+ def parser():
31
+ p=argparse.ArgumentParser(description=__doc__)
32
+ p.add_argument('--method',choices=METHODS)
33
+ p.add_argument('--mode',choices=['train-sample','train','sample'],default='train-sample')
34
+ p.add_argument('--train-steps',type=int,default=1000)
35
+ p.add_argument('--teacher-steps',type=int,default=1000)
36
+ p.add_argument('--finetune-steps',type=int,default=0,help='Optional Meta reward-drift fine-tuning')
37
+ p.add_argument('--sample-steps',type=int,default=8)
38
+ p.add_argument('--posterior-steps',type=int,default=4)
39
+ p.add_argument('--particles',type=int,default=32)
40
+ p.add_argument('--reward-strength',type=float,default=1.)
41
+ p.add_argument('--ssfm-target',choices=['official-code','paper'],default='official-code')
42
+ p.add_argument('--batch-size',type=int,default=64)
43
+ p.add_argument('--samples',type=int,default=128)
44
+ p.add_argument('--width',type=int,default=64)
45
+ p.add_argument('--lr',type=float,default=1e-3)
46
+ p.add_argument('--seed',type=int,default=6270)
47
+ p.add_argument('--threads',type=int,default=1)
48
+ p.add_argument('--device',choices=['cpu','cuda'],default='cpu')
49
+ p.add_argument('--data',help='Whitespace-separated text, one sequence per line; or continuous CSV with two numeric columns')
50
+ p.add_argument('--out',help='Run directory; defaults to lecture_6/outputs/METHOD')
51
+ return p
52
+
53
+
54
+ def restore_model(checkpoint,device):
55
+ method=checkpoint['method'];width=checkpoint['width']
56
+ if method in CATEGORICAL:
57
+ model=SequenceNet(checkpoint['length'],len(checkpoint['vocab']),width)
58
+ elif method=='expanding':
59
+ model=ExpandingNet(checkpoint['length'],len(checkpoint['vocab']),width)
60
+ elif method=='ssfm':
61
+ model=StrongMap(width,checkpoint['sigma'])
62
+ else:
63
+ model=MapNet(checkpoint['dim'],width,3 if method in ['diamond','meta'] else 0)
64
+ model.load_state_dict(checkpoint['model'])
65
+ model=model.to(device).eval()
66
+ return model
67
+
68
+
69
+ def generate(model,state,args):
70
+ """All metrics use fresh, seeded samples; no training examples stand in for output."""
71
+ seed_all(args.seed+100,args.threads)
72
+ method=state['method'];device=args.device
73
+ report={'method':method,'sample_steps':args.sample_steps,'samples':args.samples,
74
+ 'sampling_seed':args.seed+100}
75
+ if method in CATEGORICAL:
76
+ ids=sample_categorical(model,args.samples,args.sample_steps,device).cpu()
77
+ texts,metrics=text_metrics(ids,state['vocab'],reference=set(state['reference_text']))
78
+ report.update(metrics)
79
+ return texts,report
80
+ if method=='expanding':
81
+ ids,lengths,extra=sample_expanding(model,args.samples,args.sample_steps,device)
82
+ texts,metrics=text_metrics(ids.cpu(),state['vocab'],lengths.cpu(),set(state['reference_text']))
83
+ report.update(metrics);report.update(extra)
84
+ return texts,report
85
+ if method=='ssfm':
86
+ x,extra=evaluate_stochastic(model,args.samples,args.sample_steps,device)
87
+ report.update(extra)
88
+ elif method in ['diamond','meta']:
89
+ with torch.no_grad():
90
+ outer=torch.randn(args.samples,2,device=device)
91
+ t=torch.zeros(args.samples,1,device=device)
92
+ x=posterior_samples(model,outer,t,1,args.posterior_steps)[:,0]
93
+ guided=guided_samples(model,args.samples,args.sample_steps,args.particles,
94
+ args.reward_strength,args.posterior_steps)
95
+ report.update(posterior_diagnostics(model,args.posterior_steps))
96
+ report['unconditional_mean_reward']=float(reward(x,args.reward_strength).mean())
97
+ report['guided_mean_reward']=float(reward(guided,args.reward_strength).mean())
98
+ report['guided_distribution']=mixture_metrics(guided)
99
+ report['posterior_steps']=args.posterior_steps
100
+ report['particles']=args.particles
101
+ observation=torch.tensor([[.5,-.3]],device=device)
102
+ _,estimate,ess=weighted_diamond_samples(observation,.5,4096)
103
+ report['importance_posterior_mean']=estimate.tolist()
104
+ report['importance_effective_sample_size']=ess.tolist()
105
+ # Verify differentiability through the learned posterior's context.
106
+ observation=observation.detach().requires_grad_(True)
107
+ value,_,_=posterior_value(model,observation,.5,args.particles,args.reward_strength,args.posterior_steps)
108
+ gradient=torch.autograd.grad(value.sum(),observation)[0]
109
+ report['posterior_value_context_gradient']=gradient.tolist()
110
+ report['finite_value_gradient']=bool(torch.isfinite(gradient).all())
111
+ report['guided_samples']=guided.detach().cpu().tolist()
112
+ if 'reward_drift' in state:
113
+ drift=MapNet(2,state['width']).to(device)
114
+ drift.load_state_dict(state['reward_drift'])
115
+ # A complete sampler for the fitted drift; boundary-time queries
116
+ # extrapolate beyond the [.05,.85] fine-tuning interval.
117
+ aligned=integrate_velocity(lambda z,a:drift(z,a,a),outer,0.,1.,args.sample_steps)
118
+ report['finetuned_mean_reward']=float(reward(aligned,args.reward_strength).mean())
119
+ report['finetuned_finite_samples']=bool(torch.isfinite(aligned).all())
120
+ report['finetuned_samples']=aligned.detach().cpu().tolist()
121
+ report['finetuned_sampling_note']='Full-interval Heun integration; boundary times extrapolate beyond fine-tuning support.'
122
+ else:
123
+ noise=torch.randn(args.samples,state['dim'],device=device)
124
+ x=sample_continuous(model,method,noise,args.sample_steps)
125
+ if method=='latent':
126
+ ae=Autoencoder(state['width']).to(device)
127
+ ae.load_state_dict(state['autoencoder'])
128
+ with torch.no_grad():
129
+ x=ae.decoder(x*state['latent_std'].to(device)+state['latent_mean'].to(device))
130
+ heldout=state['heldout_data'].to(device)
131
+ reconstruction=ae.decoder(ae.encoder(embed_surface(heldout)))
132
+ report['heldout_reconstruction_mse']=float((reconstruction-embed_surface(heldout)).square().mean())
133
+ report['surface_residual_rmse']=float((x[:,2:]-.3*(x[:,:1].square()-x[:,1:2].square())).square().mean().sqrt())
134
+ if method not in ['consistency','meanflow','flow-matching']:
135
+ from common import finite_map
136
+ with torch.no_grad():
137
+ direct=finite_map(model,noise,0.,1.)
138
+ split=finite_map(model,finite_map(model,noise,0.,.5),.5,1.)
139
+ report['composition_rmse']=float((direct-split).square().mean().sqrt())
140
+ report['finite_samples']=bool(torch.isfinite(x).all())
141
+ if not report['finite_samples']:raise FloatingPointError('Sampling produced nonfinite coordinates.')
142
+ if x.shape[1]>=2 and state['data_kind']=='four-gaussian-mixture':
143
+ report.update(mixture_metrics(x[:,:2]))
144
+ rows=[' '.join(f'{value:.7f}' for value in row) for row in x.detach().cpu().tolist()]
145
+ return rows,report
146
+
147
+
148
+ def main(argv=None):
149
+ p=parser();args=p.parse_args(argv)
150
+ if min(args.train_steps,args.teacher_steps,args.sample_steps,args.posterior_steps,
151
+ args.particles,args.batch_size,args.samples,args.width,args.threads)<1 or args.finetune_steps<0:
152
+ p.error('Step counts, sizes, and width must be positive; finetune steps must be nonnegative.')
153
+ if args.lr<=0:p.error('Learning rate must be positive.')
154
+ if args.device=='cuda' and not torch.cuda.is_available():p.error('CUDA is unavailable; select cpu.')
155
+ if args.mode=='sample' and args.out is None:p.error('Sample mode requires --out for its checkpoint.')
156
+ if args.mode!='sample' and args.method is None:args.method='flow-matching'
157
+ out=Path(args.out) if args.out else ROOT/'outputs'/args.method
158
+ out.mkdir(parents=True,exist_ok=True)
159
+ seed_all(args.seed,args.threads)
160
+ start=time.perf_counter()
161
+ if args.mode=='sample':
162
+ state=torch.load(out/'checkpoint.pt',map_location=args.device,weights_only=True)
163
+ if args.method is not None and args.method!=state['method']:
164
+ p.error('Requested method differs from the saved checkpoint.')
165
+ args.method=state['method']
166
+ if args.method=='ssfm' and args.sample_steps & (args.sample_steps-1):
167
+ p.error('SSFM sample steps must be a power of two.')
168
+ model=restore_model(state,args.device)
169
+ rows,report=generate(model,state,args)
170
+ (out/'resampled.txt').write_text('\n'.join(rows)+'\n')
171
+ write_json(out/'sample_report.json',report)
172
+ print(json.dumps({'method':args.method,'mode':'sample','out':str(out),'seconds':time.perf_counter()-start}))
173
+ return report
174
+ if args.method=='ssfm' and args.sample_steps & (args.sample_steps-1):
175
+ p.error('SSFM sample steps must be a power of two.')
176
+ if args.finetune_steps and args.method!='meta':p.error('--finetune-steps applies to meta.')
177
+ if args.data and args.method in ['diamond','meta','ssfm']:
178
+ p.error('Analytic posterior/OU examples use their specified reference distributions.')
179
+ stage_logs=[]
180
+ if args.method in CATEGORICAL+['expanding']:
181
+ default='variable_text.txt' if args.method=='expanding' else 'phrases.txt'
182
+ data_path=Path(args.data) if args.data else ROOT/'data'/default
183
+ ids,lengths,vocab=load_text(data_path,args.method=='expanding')
184
+ perm=torch.randperm(len(ids));ids,lengths=ids[perm],lengths[perm]
185
+ split=max(1,int(.8*len(ids)))
186
+ training=ids[:split].to(args.device)
187
+ if args.method=='expanding':
188
+ model,state,logs=train_expanding(training,lengths[:split].to(args.device),vocab,args)
189
+ else:
190
+ model,state,logs=train_categorical(args.method,training,vocab,args)
191
+ reference,_=text_metrics(ids[:split],vocab,lengths[:split])
192
+ state.update({'reference_text':reference,'data_kind':'synthetic-text' if args.data is None else 'custom-text'})
193
+ with torch.no_grad():
194
+ if args.method in CATEGORICAL:
195
+ heldout=ids[split:].to(args.device)
196
+ clean=F.one_hot(heldout,len(vocab)).float();t=torch.full((len(clean),1),.5,device=args.device)
197
+ x,_=interpolate(clean,t)
198
+ state['validation_ce']=float(F.cross_entropy(model(x,t,t).flatten(0,1),heldout.flatten()))
199
+ elif args.method=='ssfm':
200
+ model,state,logs=train_stochastic(args,args.device)
201
+ state['data_kind']='ornstein-uhlenbeck'
202
+ else:
203
+ if args.data:
204
+ import numpy as np
205
+ data=torch.tensor(np.loadtxt(args.data,delimiter=','),dtype=torch.float32)
206
+ if data.ndim!=2 or data.shape[1]!=2 or len(data)<8 or not torch.isfinite(data).all():
207
+ p.error('Continuous CSV needs at least eight finite rows and exactly two columns, without a header.')
208
+ data=data[torch.randperm(len(data))];kind='custom-continuous'
209
+ else:
210
+ data=mixture_data(4096);kind='four-gaussian-mixture'
211
+ split=int(.8*len(data));train=data[:split].to(args.device)
212
+ if args.method=='latent':
213
+ model,_,state,logs,stage_logs=train_latent(train,args)
214
+ elif args.method in ['diamond','meta']:
215
+ model,state,logs=train_posterior(args.method,train,args)
216
+ if args.finetune_steps:
217
+ drift,finetune_logs=train_reward_drift(model,train,args)
218
+ state['reward_drift']=drift.state_dict()
219
+ write_json(out/'finetune_losses.json',finetune_logs)
220
+ else:
221
+ model,state,logs,stage_logs=train_continuous(args.method,train,args)
222
+ state.update({'data_kind':kind,'heldout_data':data[split:]})
223
+ state.update({'format_version':1,'method':args.method,'width':args.width,'seed':args.seed})
224
+ torch.save(state,out/'checkpoint.pt')
225
+ write_json(out/'config.json',vars(args))
226
+ write_json(out/'losses.json',logs)
227
+ if stage_logs:write_json(out/'teacher_losses.json',stage_logs)
228
+ report={'method':args.method,'data_kind':state['data_kind'],
229
+ 'train_loss_first_20_mean':sum(x['loss'] for x in logs[:20])/len(logs[:20]),
230
+ 'train_loss_last_20_mean':sum(x['loss'] for x in logs[-20:])/len(logs[-20:]),
231
+ 'training_steps':args.train_steps,'python':platform.python_version(),'torch':str(torch.__version__)}
232
+ if 'validation_ce' in state:report['heldout_diagonal_ce_at_half_time']=state['validation_ce']
233
+ if args.mode=='train-sample':
234
+ model.eval()
235
+ rows,metrics=generate(model,state,args)
236
+ (out/'samples.txt').write_text('\n'.join(rows)+'\n')
237
+ report.update(metrics)
238
+ report['elapsed_seconds']=time.perf_counter()-start
239
+ write_json(out/'report.json',report)
240
+ print(json.dumps({'method':args.method,'out':str(out),'loss':report['train_loss_last_20_mean'],
241
+ 'seconds':report['elapsed_seconds']}),flush=True)
242
+ return report
243
+
244
+
245
+ if __name__=='__main__':main()
lecture_6/run_all.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run every method, then verify generation from each saved checkpoint."""
3
+ import argparse
4
+ from pathlib import Path
5
+
6
+ from run import METHODS, ROOT, main
7
+
8
+
9
+ def run_all():
10
+ parser=argparse.ArgumentParser(description=__doc__)
11
+ parser.add_argument('--quick',action='store_true',help='20-step execution check; not a quality benchmark')
12
+ parser.add_argument('--out',default=str(ROOT/'outputs'))
13
+ parser.add_argument('--train-steps',type=int,default=1000)
14
+ args=parser.parse_args()
15
+ for method in METHODS:
16
+ out=Path(args.out)/method
17
+ command=['--method',method,'--out',str(out)]
18
+ if args.quick:
19
+ command+=['--train-steps','20','--teacher-steps','20','--batch-size','8',
20
+ '--samples','8','--width','32','--sample-steps','4','--posterior-steps','2','--particles','4']
21
+ else:command+=['--train-steps',str(args.train_steps),'--teacher-steps',str(args.train_steps)]
22
+ main(command)
23
+ sample_args=['--mode','sample','--out',str(out)]
24
+ if args.quick:
25
+ sample_args+=['--samples','8','--sample-steps','4','--posterior-steps','2','--particles','4']
26
+ main(sample_args)
27
+ if (out/'samples.txt').read_bytes()!=(out/'resampled.txt').read_bytes():
28
+ raise AssertionError(f'{method}: seeded generation changed after checkpoint reload')
29
+ print(f'All {len(METHODS)} methods trained, sampled, and reproduced samples after checkpoint reload.')
30
+
31
+
32
+ if __name__=='__main__':run_all()
lecture_6/source_manifest.json ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "paper_title": "Flow Map Matching",
4
+ "paper_url": "https://arxiv.org/abs/2406.07507v2",
5
+ "methods": [
6
+ "fmm-lagrangian",
7
+ "fmm-eulerian"
8
+ ],
9
+ "scope": "Frozen learned velocity teachers; residual-map JVPs; small MLP and bounded time range.",
10
+ "repository": "nmboffi/flow-maps",
11
+ "commit": "2f115a07fa9073553193e4b265dfc303827af2b0",
12
+ "inspected_file": "py/common/losses.py",
13
+ "inspected_file_sha256": "55d5a6cd2b7602afc93f848bda687aa4a287bfb7d1a4095d5071c7df59334d59"
14
+ },
15
+ {
16
+ "paper_title": "How to build a consistency model: Learning flow maps via self-distillation",
17
+ "paper_url": "https://arxiv.org/abs/2505.18825v2",
18
+ "methods": [
19
+ "self-distill"
20
+ ],
21
+ "scope": "Diagonal regression plus an EMA progressive target, normalized by a floored interval length. Learned uncertainty weights are omitted.",
22
+ "repository": "nmboffi/flow-maps",
23
+ "commit": "2f115a07fa9073553193e4b265dfc303827af2b0",
24
+ "inspected_file": "py/common/losses.py",
25
+ "inspected_file_sha256": "55d5a6cd2b7602afc93f848bda687aa4a287bfb7d1a4095d5071c7df59334d59"
26
+ },
27
+ {
28
+ "paper_title": "One Step Diffusion via Shortcut Models",
29
+ "paper_url": "https://arxiv.org/abs/2410.12557v3",
30
+ "methods": [
31
+ "shortcut"
32
+ ],
33
+ "scope": "Two half-step average target and dyadic intervals retained. Continuous start-time sampling and small MLP replace image-specific schedules and clipping.",
34
+ "repository": "kvfrans/shortcut-models",
35
+ "commit": "601004348667094e1b71f30942199759412d4432",
36
+ "inspected_file": "targets_shortcut.py",
37
+ "inspected_file_sha256": "adb2ac83febc1de012a7cdb713b9117d53616473ccd38f1104fd2475d8b1abc3"
38
+ },
39
+ {
40
+ "paper_title": "Mean Flows for One-step Generative Modeling",
41
+ "paper_url": "https://arxiv.org/abs/2505.13447",
42
+ "methods": [
43
+ "meanflow"
44
+ ],
45
+ "scope": "Backward clock, conditional-velocity JVP, detached target, adaptive loss, and 75% diagonal proportion retained. Uniform time sampling; no class guidance.",
46
+ "repository": "Gsunshine/meanflow",
47
+ "commit": "d70cb55d298ee03c53bf6da67bec281082e4e2d9",
48
+ "inspected_file": "meanflow.py",
49
+ "inspected_file_sha256": "b8dcee1033e6ba01de0019d14fad846a399d356d67e549ee311a5e19d2a7c3a4"
50
+ },
51
+ {
52
+ "paper_title": "Flow Map Language Models: One-step Language Modeling via Continuous Denoising",
53
+ "paper_url": "https://arxiv.org/abs/2602.16813v3",
54
+ "methods": [
55
+ "fmlm"
56
+ ],
57
+ "scope": "PSD denoiser target and Gaussian decoding clock retained. Independent clean-data diagonal supervision; EMA targets; quadrature lookup and MLP replace full language architecture.",
58
+ "repository": "david3684/flm",
59
+ "commit": "a1918d5164e5038e37d0b7a4fb2010ce75b863b3",
60
+ "inspected_file": "algo.py",
61
+ "inspected_file_sha256": "65206adc72013bb9b09b68fd847239b3193dd65fd59669bbdee42e061583d76a"
62
+ },
63
+ {
64
+ "paper_title": "Categorical Flow Maps",
65
+ "paper_url": "https://arxiv.org/abs/2602.12233v1",
66
+ "methods": [
67
+ "categorical"
68
+ ],
69
+ "scope": "Released ECLD endpoint CE plus sum-of-squares time energy. Detached-target KL has identical student gradient. EMA target replaces the current network target.",
70
+ "repository": "olsdavis/semicat",
71
+ "commit": "558602a0fa722514e4a6012f5c46a8ae178b3068",
72
+ "inspected_file": "semicat/models/semicat.py",
73
+ "inspected_file_sha256": "82f4bf2cab2fcfa78ccfc59d9094e6c3132f5c2933c1cd7e61ff0b644ac71425"
74
+ },
75
+ {
76
+ "paper_title": "Discrete Flow Maps",
77
+ "paper_url": "https://arxiv.org/abs/2604.09784v1",
78
+ "methods": [
79
+ "discrete-lsd",
80
+ "discrete-esd"
81
+ ],
82
+ "scope": "Derived from the paper. The linked project page has a placeholder Code link, so no author implementation was verified. Positive log denominators are explicitly clamped and counted; no gradient surgery."
83
+ },
84
+ {
85
+ "paper_title": "Diamond Maps: Stochastic Flow Maps",
86
+ "paper_url": "https://arxiv.org/abs/2602.05993",
87
+ "methods": [
88
+ "diamond"
89
+ ],
90
+ "scope": "GLASS conditional velocity and Lagrangian posterior distillation. Exact Gaussian-mixture denoiser replaces a pretrained image teacher. Weighted posterior recovery uses an explicit Gaussian proposal with a known density.",
91
+ "repository": "PeterHolderrieth/diamond_maps",
92
+ "commit": "d30f65c75a169a2ed624f146b2770aeef882543a",
93
+ "inspected_file": "posterior_diamond_maps/py/common/losses.py",
94
+ "inspected_file_sha256": "acb26f1e717e43a648661c1641cadd4a573ed2672b53210ad1ddb207c6a6ac1e"
95
+ },
96
+ {
97
+ "paper_title": "Meta Flow Maps enable scalable reward alignment",
98
+ "paper_url": "https://arxiv.org/abs/2601.14430v2",
99
+ "methods": [
100
+ "meta"
101
+ ],
102
+ "scope": "Data training with independent inner/outer noises and a shared endpoint; conditional semigroup objective. Optional Equation 43 fine-tuning also checked against src/mfm/losses/finetune.py.",
103
+ "repository": "adh1s/mfm",
104
+ "commit": "53c0f60db695cad88bbace8fb26469614e9e7d7d",
105
+ "inspected_file": "src/mfm/losses/losses.py",
106
+ "inspected_file_sha256": "52b99238199f5d6ac691c15566463d52725a6f7ebcdef1e252b2d28da5eb1df2"
107
+ },
108
+ {
109
+ "paper_title": "Expanding Flow Maps",
110
+ "paper_url": "https://arxiv.org/abs/2607.21585v1",
111
+ "methods": [
112
+ "expanding"
113
+ ],
114
+ "scope": "Paper Algorithms 2-4 and local-clock equations. The inspected repository contains README and artwork only. Classroom implementation includes a shared lifted canvas, remaining/interval count heads, explicit local clocks, and budget-capped binomial insertions.",
115
+ "repository": "sophtang/ExpandingFlowMaps",
116
+ "commit": "4defc1ff168d12526d85b551bea78150b9aec605",
117
+ "inspected_file": "README.md",
118
+ "inspected_file_sha256": "d2a55e221a909f7282609cc661e49c07a241570dcd1dab7b55c6df207f821f4a"
119
+ },
120
+ {
121
+ "paper_title": "Strong Stochastic Flow Maps",
122
+ "paper_url": "https://arxiv.org/abs/2606.01086v1",
123
+ "methods": [
124
+ "ssfm"
125
+ ],
126
+ "scope": "First two Legendre integrals, Chen composition, known diffusion, small-step matching. The released loss detaches an EMA split target; paper Algorithm 1 detaches the direct target. Both orientations are selectable. OU replaces image/molecular experiments; no learned uncertainty weights.",
127
+ "repository": "sammccallum/ssfm",
128
+ "commit": "24b563620a8ee61c683d791fe802b56668f98f9b",
129
+ "inspected_file": "ssfm/losses.py",
130
+ "inspected_file_sha256": "3c4414ffb29c906272831e3642827131582c4741fb2457cb71d122564da29233"
131
+ }
132
+ ]
lecture_6/stochastic.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Strong stochastic flow maps for dX=-X dt + sigma dW.
2
+
3
+ The first two shifted-Legendre Brownian integrals have variances h and h/3.
4
+ Chen composition makes coarse and fine evaluations use the same path.
5
+ """
6
+ import math
7
+
8
+ import torch
9
+ from torch import nn
10
+ from torch.nn import functional as F
11
+
12
+ from common import ema_copy, mlp, optimize, time_like
13
+
14
+
15
+ def sample_coefficients(h, count=None):
16
+ h = torch.as_tensor(h)
17
+ if h.ndim == 0:
18
+ if count is None: raise ValueError('count is required for scalar h')
19
+ h = h.expand(count,1)
20
+ scale = torch.cat([h.sqrt(),(h/3).sqrt()],-1)
21
+ return torch.randn_like(scale)*scale
22
+
23
+
24
+ def chen_two(left,right,h_left,h_right):
25
+ h=h_left+h_right
26
+ return torch.stack([left[...,0]+right[...,0],
27
+ (h_left*left[...,1]+h_right*right[...,1]-h_right*left[...,0]+h_left*right[...,0])/h],-1)
28
+
29
+
30
+ class StrongMap(nn.Module):
31
+ def __init__(self,width=64,sigma=.7):
32
+ super().__init__()
33
+ self.net=mlp(5,1,width)
34
+ self.sigma=sigma
35
+
36
+ def average_drift(self,x,s,t,coefficients):
37
+ return self.net(torch.cat([x,time_like(s,x),time_like(t,x),coefficients],-1))
38
+
39
+ def forward(self,x,s,t,coefficients):
40
+ s,t=time_like(s,x),time_like(t,x)
41
+ return x+(t-s)*self.average_drift(x,s,t,coefficients)+self.sigma*coefficients[:,:1]
42
+
43
+
44
+ def train_stochastic(args,device):
45
+ model=StrongMap(args.width).to(device)
46
+ teacher=ema_copy(model)
47
+ def objective(step):
48
+ B=args.batch_size
49
+ s=.9*torch.rand(B,1,device=device)
50
+ # Exact one-time OU marginals with X0~N(0,1), not simulated trajectories.
51
+ variance=torch.exp(-2*s)+model.sigma**2/2*(1-torch.exp(-2*s))
52
+ x=variance.sqrt()*torch.randn(B,1,device=device)
53
+ h=.001+.019*torch.rand_like(s)
54
+ c=sample_coefficients(h)
55
+ target=x-h*x+model.sigma*c[:,:1]
56
+ matching=((model(x,s,s+h,c)-target).square()/h).mean()
57
+ diagonal=F.mse_loss(model.average_drift(x,s,s,torch.zeros_like(c)),-x)
58
+ t=s+.025+(1-s-.025)*torch.rand_like(s)
59
+ u=(s+t)/2
60
+ L,R=sample_coefficients(u-s),sample_coefficients(t-u)
61
+ C=chen_two(L,R,(u-s).squeeze(-1),(t-u).squeeze(-1))
62
+ if args.ssfm_target=='paper':
63
+ # Paper Algorithm 1: EMA direct target; differentiate both splits.
64
+ with torch.no_grad():direct=teacher(x,s,t,C)
65
+ split=model(model(x,s,u,L),u,t,R)
66
+ else:
67
+ # Released code: EMA split target; differentiate the direct map.
68
+ with torch.no_grad():split=teacher(teacher(x,s,u,L),u,t,R)
69
+ direct=model(x,s,t,C)
70
+ consistency=((split-direct).square()/(t-s)).mean()
71
+ ramp=min(1.,(step+1)/max(1,args.train_steps//4))
72
+ return diagonal+matching+ramp*consistency,{'drift':diagonal,'small_step':matching,'strong_consistency':consistency}
73
+ logs=optimize(model,objective,args.train_steps,args.lr,teacher)
74
+ return model,{'model':model.state_dict(),'sigma':model.sigma},logs
75
+
76
+
77
+ def aggregate_tree(coefficients):
78
+ """Coefficients are [B,leaves,2], with uniform leaf lengths."""
79
+ c=coefficients
80
+ h=1/c.shape[1]
81
+ while c.shape[1]>1:
82
+ c=chen_two(c[:,::2],c[:,1::2],h,h)
83
+ h*=2
84
+ return c[:,0]
85
+
86
+
87
+ @torch.no_grad()
88
+ def evaluate_stochastic(model,count,steps,device):
89
+ if steps & (steps-1):raise ValueError('SSFM sample steps must be a power of two.')
90
+ leaves=max(512,steps)
91
+ c=sample_coefficients(torch.tensor(1/leaves,device=device),count*leaves).reshape(count,leaves,2)
92
+ x0=torch.randn(count,1,device=device)
93
+ reference=x0.clone()
94
+ for i in range(leaves):reference=reference-reference/leaves+model.sigma*c[:,i,:1]
95
+ all_coeff=aggregate_tree(c)
96
+ direct=model(x0,0.,1.,all_coeff)
97
+ x=x0.clone()
98
+ block=leaves//steps
99
+ for i in range(steps):
100
+ # aggregate_tree assumes total duration one; equal-half Chen weights are
101
+ # scale invariant, so its output is valid for these smaller blocks too.
102
+ ci=aggregate_tree(c[:,i*block:(i+1)*block])
103
+ x=model(x,i/steps,(i+1)/steps,ci)
104
+ exact_variance=math.exp(-2)+model.sigma**2/2*(1-math.exp(-2))
105
+ return x,{'same_noise_reference_rmse':float((x-reference).square().mean().sqrt()),
106
+ 'direct_vs_split_rmse':float((direct-x).square().mean().sqrt()),
107
+ 'one_step_reference_rmse':float((direct-reference).square().mean().sqrt()),
108
+ 'reference_em_steps':leaves,'sample_variance':float(x.var()),
109
+ 'exact_terminal_variance':exact_variance,
110
+ 'reference_note':'Same Brownian increments; EM reference retains finite discretization error.'}
lecture_6/tests/test_mathematics.py ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Independent mathematical checks, including failure cases from the lecture."""
2
+ import math
3
+ import sys
4
+ import unittest
5
+ from pathlib import Path
6
+
7
+ import torch
8
+ from torch import nn
9
+ from torch.nn import functional as F
10
+
11
+ sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
12
+ from common import (MapNet, SequenceNet, finite_map, exact_denoiser, exact_velocity,
13
+ mixture_posterior, seed_all, DATA_STD, CENTERS)
14
+ from continuous import lagrangian_residual, eulerian_residual, semigroup_loss
15
+ from categorical import (DecodingClock, categorical_map, composition_target,
16
+ corrected_logit_teacher, probability_kl)
17
+ from posterior import glass_denoiser, fine_tune_surrogate, weighted_diamond_samples
18
+ from expanding import (ExpandingNet, local_clock, local_map, gap_counts,
19
+ bounded_counts, insert_tokens, count_divergence)
20
+ from stochastic import sample_coefficients, chen_two, aggregate_tree
21
+
22
+
23
+ class ExactExponential(nn.Module):
24
+ def forward(self,x,s,t,context=None):
25
+ h=t-s
26
+ # Stable at h=0 while keeping the exact off-diagonal expression.
27
+ safe=h.clamp_min(1e-12)
28
+ ratio=torch.where(h.abs()<1e-8,1+h/2+h.square()/6,torch.expm1(h)/safe)
29
+ return x*ratio
30
+
31
+
32
+ class ConstantLogits(nn.Module):
33
+ def forward(self,x,s,t):
34
+ return torch.zeros_like(x)+torch.tensor([.2,-.1],dtype=x.dtype,device=x.device)
35
+
36
+
37
+ class MathematicsTests(unittest.TestCase):
38
+ def setUp(self):seed_all(6270)
39
+
40
+ def test_exact_identity_and_semigroup(self):
41
+ model=ExactExponential();x=torch.tensor([[1.2],[-.4]],dtype=torch.float64)
42
+ s=torch.zeros_like(x);u=s+.3;t=s+.9
43
+ torch.testing.assert_close(finite_map(model,x,s,s),x)
44
+ expected=x*math.exp(.9)
45
+ torch.testing.assert_close(finite_map(model,x,s,t),expected)
46
+ torch.testing.assert_close(finite_map(model,finite_map(model,x,s,u),u,t),expected)
47
+
48
+ def test_lagrangian_and_eulerian_jvp(self):
49
+ x=torch.tensor([[1.7]],dtype=torch.float64);s=x*0+.2;t=x*0+.8
50
+ for residual in [lagrangian_residual,eulerian_residual]:
51
+ value=residual(ExactExponential(),lambda z,a:z,x,s,t)
52
+ self.assertLess(float(value.abs().max()),1e-10)
53
+
54
+ def test_jvp_losses_reach_parameters(self):
55
+ for residual in [lagrangian_residual,eulerian_residual]:
56
+ m=MapNet(2,16);x=torch.randn(8,2);s=torch.rand(8,1)*.3;t=s+.5
57
+ loss=residual(m,lambda z,a:z,x,s,t).square().mean();loss.backward()
58
+ self.assertTrue(all(p.grad is not None and torch.isfinite(p.grad).all() for p in m.parameters()))
59
+ self.assertGreater(sum(float(p.grad.abs().sum()) for p in m.parameters()),0)
60
+
61
+ def test_composition_alone_does_not_identify_motion(self):
62
+ m=MapNet(2,8)
63
+ for p in m.parameters():p.data.zero_()
64
+ x=torch.randn(8,2);s=torch.zeros(8,1);t=s+1
65
+ self.assertEqual(float(semigroup_loss(m,m,x,s,t)),0.)
66
+ self.assertGreater(float((m(x,s,s)-x).square().mean()),0.)
67
+
68
+ def test_meanflow_backward_identity(self):
69
+ def average(z,r,t):return z*(-torch.expm1(-(t-r)))/(t-r)
70
+ z=torch.tensor([[1.7]],dtype=torch.float64);r=z*0+.2;t=z*0+.8
71
+ u,du=torch.func.jvp(average,(z,r,t),(z,torch.zeros_like(r),torch.ones_like(t)))
72
+ torch.testing.assert_close(u,z-(t-r)*du,atol=1e-11,rtol=1e-11)
73
+
74
+ def test_analytic_mixture_velocity(self):
75
+ x=torch.randn(20,2,dtype=torch.float64);t=torch.rand(20,1,dtype=torch.float64)*.9
76
+ torch.testing.assert_close(exact_velocity(x,t),(exact_denoiser(x,t)-x)/(1-t),atol=1e-10,rtol=1e-10)
77
+
78
+ def test_categorical_numerical_step(self):
79
+ class Net(nn.Module):
80
+ def forward(self,x,s,t):return torch.tensor([.1,.7,.2]).log().expand_as(x)
81
+ x=torch.tensor([[[-.2,.6,1.1]]]);y,p=categorical_map(Net(),x,.25,.75)
82
+ torch.testing.assert_close(y,torch.tensor([[[0.,2/3,.5]]]),atol=1e-7,rtol=1e-6)
83
+ self.assertGreater(float(y.sum()),1.1)
84
+ torch.testing.assert_close(p.sum(-1),torch.ones(1,1))
85
+
86
+ def test_weighted_probability_composition_matches_maps(self):
87
+ net=SequenceNet(3,4,12);x=torch.randn(6,3,4)
88
+ s=torch.zeros(6,1);u=s+.5;t=s+.75
89
+ q=composition_target(net,x,s,u,t)
90
+ mid,_=categorical_map(net,x,s,u);split,_=categorical_map(net,mid,u,t)
91
+ direct=(1-t[...,None])*x+t[...,None]*q
92
+ torch.testing.assert_close(direct,split)
93
+ torch.testing.assert_close(q.sum(-1),torch.ones(6,3))
94
+
95
+ def test_detached_kl_gradient(self):
96
+ logits=torch.tensor([.2,-.1],requires_grad=True);p=torch.tensor([.4,.6])
97
+ probability_kl(logits,p).backward()
98
+ torch.testing.assert_close(logits.grad,logits.softmax(-1)-p)
99
+
100
+ def test_discrete_teachers_with_zero_derivative(self):
101
+ x=torch.randn(5,3,2);s=torch.zeros(5,1)+.2;t=s+.5;net=ConstantLogits()
102
+ for kind in ['discrete-lsd','discrete-esd']:
103
+ logits,target,clipped=corrected_logit_teacher(net,net,x,s,t,kind)
104
+ torch.testing.assert_close(target,logits.softmax(-1))
105
+ self.assertEqual(float(clipped),0.)
106
+
107
+ def test_endpoint_match_does_not_remove_temporal_residual(self):
108
+ dt=torch.tensor([.2,-.2]);residual=.5*.5*dt
109
+ self.assertAlmostEqual(float(residual.square().sum()),.005,places=7)
110
+
111
+ def test_decoding_clock_inverse(self):
112
+ clock=DecodingClock(13);tau=torch.linspace(0,1,101)
113
+ time=clock.inverse(tau)
114
+ self.assertTrue((time[1:]>=time[:-1]).all())
115
+ self.assertEqual(float(time[0]),0.);self.assertEqual(float(time[-1]),1.)
116
+
117
+ def test_glass_matches_two_observation_bayes_rule(self):
118
+ inner=torch.tensor([[.3,-.2]],dtype=torch.float64);outer=inner+.4
119
+ s=torch.tensor([[.35]],dtype=torch.float64);t=s+.2
120
+ # Independent derivation by conditioning each Gaussian component twice.
121
+ variance=1/(1/DATA_STD**2+(s/(1-s))**2+(t/(1-t))**2)
122
+ means=variance[:,None]*(CENTERS.double()/DATA_STD**2+s[:,None]*inner[:,None]/(1-s[:,None])**2+t[:,None]*outer[:,None]/(1-t[:,None])**2)
123
+ covariance=torch.tensor([[float((1-s)**2+s**2*DATA_STD**2),float(s*t*DATA_STD**2)],
124
+ [float(s*t*DATA_STD**2),float((1-t)**2+t**2*DATA_STD**2)]],dtype=torch.float64)
125
+ residual=torch.stack([inner[:,None]-s[:,None]*CENTERS,outer[:,None]-t[:,None]*CENTERS],-1)
126
+ logits=-.5*torch.einsum('bkdi,ij,bkdj->bk',residual,torch.linalg.inv(covariance),residual)
127
+ expected=(logits.softmax(-1)[...,None]*means).sum(1)
128
+ torch.testing.assert_close(glass_denoiser(inner,s,outer,t),expected,atol=1e-9,rtol=1e-9)
129
+
130
+ def test_glass_no_inner_observation(self):
131
+ outer=torch.randn(5,2);t=torch.full((5,1),.4)
132
+ torch.testing.assert_close(glass_denoiser(torch.randn(5,2),torch.zeros_like(t),outer,t),exact_denoiser(outer,t))
133
+
134
+ def test_meta_surrogate_gradient(self):
135
+ delta=torch.tensor([[.3]],requires_grad=True)
136
+ w=torch.tensor([[1.],[4.]]);gw=torch.tensor([[.2],[.8]])
137
+ loss=fine_tune_surrogate(delta,w,gw,.5);loss.backward()
138
+ torch.testing.assert_close(delta.grad,2*(w*delta.detach()-.5*gw).mean().reshape(1,1))
139
+
140
+ def test_importance_weights_recover_posterior_mean(self):
141
+ x=torch.tensor([[.5,-.3]])
142
+ _,mean,ess=weighted_diamond_samples(x,.5,50000)
143
+ self.assertLess(float((mean-exact_denoiser(x,.5)).abs().max()),.2)
144
+ self.assertGreater(float(ess),100)
145
+
146
+ def test_insertion_preserves_order_and_clocks(self):
147
+ x=torch.tensor([[1.,0.],[0.,1.]]);b=torch.tensor([0.,.2]);counts=torch.tensor([1,0,1])
148
+ noise=torch.tensor([[-.2,.4],[.3,-.1]])
149
+ y,bt=insert_tokens(x,b,counts,noise,.5)
150
+ torch.testing.assert_close(y[1:3],x)
151
+ torch.testing.assert_close(bt,torch.tensor([.5,0.,.2,.5]))
152
+ torch.testing.assert_close(local_clock(.75,bt),torch.tensor([.5,.75,.6875,.5]))
153
+
154
+ def test_gap_labels_and_global_budget(self):
155
+ torch.testing.assert_close(gap_counts(torch.tensor([1,4]),torch.tensor([0,2,3,5]),6),torch.tensor([1.,2.,1.]))
156
+ counts,_=bounded_counts(torch.tensor([100.,100.,100.]),4)
157
+ self.assertLessEqual(int(counts.sum()),4)
158
+ self.assertTrue((counts>=0).all())
159
+
160
+ def test_count_divergence_minimizes_conditional_mean(self):
161
+ prediction=torch.tensor(2.,requires_grad=True)
162
+ count_divergence(torch.tensor([0.,1.,5.]),prediction).mean().backward()
163
+ self.assertAlmostEqual(float(prediction.grad),0.,places=6)
164
+
165
+ def test_insertion_interval_zero_and_terminal(self):
166
+ net=ExpandingNet(4,3,8);x=torch.zeros(1,4,3);b=torch.zeros(1,4);m=b.bool();s=torch.tensor([[.3]])
167
+ self.assertEqual(float(net.counts(x,b,m,s,s).sum()),0.)
168
+ t=torch.ones_like(s)
169
+ self.assertTrue(torch.isfinite(net.counts(x,b,m,s,t)).all())
170
+
171
+ def test_chen_arithmetic_and_covariance(self):
172
+ left=torch.tensor([.2,.04]);right=torch.tensor([-.1,-.02])
173
+ torch.testing.assert_close(chen_two(left,right,.5,.5),torch.tensor([.1,-.14]))
174
+ L=sample_coefficients(torch.tensor(.3),100000);R=sample_coefficients(torch.tensor(.7),100000)
175
+ C=chen_two(L,R,.3,.7)
176
+ torch.testing.assert_close(torch.cov(C.T),torch.diag(torch.tensor([1.,1/3])),atol=.015,rtol=0)
177
+
178
+ def test_same_noise_constant_sde_and_wrong_noise_counterexample(self):
179
+ direct=1+.5+.8*(.2-.1)
180
+ split=(1+.25+.8*.2)+.25+.8*(-.1)
181
+ self.assertAlmostEqual(direct,split);self.assertAlmostEqual(direct,1.58)
182
+ self.assertNotAlmostEqual(direct,1+.5+.8*(-.3))
183
+
184
+ def test_chen_tree_matches_increment_sum(self):
185
+ c=torch.randn(6,16,2)
186
+ torch.testing.assert_close(aggregate_tree(c)[:,0],c[:,:,0].sum(1))
187
+
188
+
189
+ if __name__=='__main__':unittest.main()
lecture_6/verified_examples/README.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Verified Lecture 6 examples
2
+
3
+ These are actual outputs from seeded CPU runs on 2026-09-13. All 16 default
4
+ methods completed 1,000 training steps, sampled, and reproduced identical
5
+ seeded samples after checkpoint reload. Teacher/autoencoder stages also used
6
+ 1,000 steps where applicable. The complete suite passed on PyTorch 2.9.1+cpu
7
+ and PyTorch 2.14.0+cpu with Python 3.12.14. These checked-in outputs use 2.9.1.
8
+ All 23 independent mathematical tests passed in both environments.
9
+
10
+ Reproduce the default runs from `lecture_6/`:
11
+
12
+ ```bash
13
+ python run_all.py --out outputs/verified-torch291 --train-steps 1000
14
+ python -m unittest discover -s tests -v
15
+ python numerical_examples.py --output outputs/numerical
16
+ ```
17
+
18
+ The baseline reports use 128 samples, eight sampling steps, width 64, batch size
19
+ 64, and seed 6270. Posterior methods use four inner-map steps and 32 reward
20
+ particles. Training losses are not comparable across different objectives.
21
+
22
+ | Method | First 20 loss mean | Last 20 loss mean | Selected diagnostic |
23
+ | --- | ---: | ---: | --- |
24
+ | [categorical](categorical/report.json) | 2.47260 | 0.53130 | grammar support 1.000; mean length 4.00 |
25
+ | [consistency](consistency/report.json) | 1.97463 | 1.97996 | mean center distance 0.753; mode entropy 1.386 |
26
+ | [diamond](diamond/report.json) | 2.30034 | 1.39093 | posterior mean RMSE 0.285; variance RMSE 0.314 |
27
+ | [discrete-esd](discrete-esd/report.json) | 2.47265 | 0.55223 | grammar support 1.000; mean length 4.00 |
28
+ | [discrete-lsd](discrete-lsd/report.json) | 2.47260 | 0.52785 | grammar support 0.992; mean length 4.00 |
29
+ | [expanding](expanding/report.json) | 4.25715 | 2.91940 | grammar support 0.617; mean length 4.09 |
30
+ | [flow-matching](flow-matching/report.json) | 3.24047 | 2.02429 | mean center distance 0.575; mode entropy 1.383 |
31
+ | [fmlm](fmlm/report.json) | 2.47259 | 0.52103 | grammar support 1.000; mean length 4.00 |
32
+ | [fmm-eulerian](fmm-eulerian/report.json) | 1.99308 | 2.03712 | mean center distance 0.474; mode entropy 1.386 |
33
+ | [fmm-lagrangian](fmm-lagrangian/report.json) | 1.98769 | 2.05232 | mean center distance 0.461; mode entropy 1.384 |
34
+ | [latent](latent/report.json) | 1.95472 | 1.47142 | mean center distance 1.024; mode entropy 1.383 |
35
+ | [meanflow](meanflow/report.json) | 1.67703 | 1.57479 | mean center distance 0.480; mode entropy 1.382 |
36
+ | [meta](meta/report.json) | 3.04584 | 1.50320 | posterior mean RMSE 0.277; variance RMSE 0.487 |
37
+ | [self-distill](self-distill/report.json) | 3.19830 | 2.18310 | mean center distance 0.729; mode entropy 1.381 |
38
+ | [shortcut](shortcut/report.json) | 3.22197 | 2.18371 | mean center distance 0.738; mode entropy 1.385 |
39
+ | [ssfm](ssfm/report.json) | 0.40952 | 0.00012 | same-noise RMSE 0.00483 |
40
+
41
+ The fixed-length text examples recover almost all phrases in the four-family
42
+ grammar at eight steps. The expanding example still produces invalid
43
+ combinations; its support fraction is retained. Posterior means and variances
44
+ both have measurable error. Continuous samples cover the modes but retain
45
+ finite distributional error. These observations describe the actual small runs,
46
+ and are not evidence of reproducing paper-scale quality.
47
+
48
+ ## Additional verified recipes
49
+
50
+ ```bash
51
+ python examples/meta.py --finetune-steps 300 --out outputs/meta-finetune-verified
52
+ python run.py --mode sample --out outputs/meta-finetune-verified
53
+ python examples/ssfm.py --ssfm-target paper --lr 0.0001 --train-steps 2000 --out outputs/ssfm-paper-stable
54
+ python run.py --mode sample --out outputs/ssfm-paper-stable
55
+ ```
56
+
57
+ `meta-finetune/` records the complete optional reward-drift stage and its
58
+ sampling metrics. `ssfm-paper/` records the paper's gradient orientation with
59
+ its separate lower-learning-rate recipe. Both reproduced seeded samples after
60
+ reloading. The paper-orientation recipe is optimization-sensitive: an initial
61
+ 1,000-step run at learning rate 0.001 diverged in accuracy despite finite
62
+ numbers. Its same-noise RMSE was 51.94. This is why the default implementation
63
+ uses the released code's EMA split target. The lower-learning-rate paper run
64
+ also remained inaccurate, with same-noise RMSE 3.85 and one-step RMSE 22.40.
65
+ It is retained as an optimization-sensitivity comparison, not a successful
66
+ strong-solution fit. These failures concern this small-model training recipe;
67
+ they do not establish a general failure of the paper's objective.
68
+
69
+ `numerical_checks.json` retains the lecture's scalar-flow, posterior-gradient,
70
+ probability-update, insertion-clock, and Brownian-composition checks. The scalar
71
+ map's one-step endpoint RMSE is 0.011255 after 6,000 steps.
72
+
73
+ The JSON files preserve each executed configuration and the full loss history.
74
+ `checkpoint.pt` files are regenerated by the commands and excluded from Git,
75
+ matching the prior lecture folders. `training_reload_log.txt` and
76
+ `mathematics_test_log.txt` record the completed verification.
lecture_6/verified_examples/categorical/config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "categorical",
3
+ "mode": "train-sample",
4
+ "train_steps": 1000,
5
+ "teacher_steps": 1000,
6
+ "finetune_steps": 0,
7
+ "sample_steps": 8,
8
+ "posterior_steps": 4,
9
+ "particles": 32,
10
+ "reward_strength": 1.0,
11
+ "ssfm_target": "official-code",
12
+ "batch_size": 64,
13
+ "samples": 128,
14
+ "width": 64,
15
+ "lr": 0.001,
16
+ "seed": 6270,
17
+ "threads": 1,
18
+ "device": "cpu",
19
+ "data": null,
20
+ "out": "outputs/verified-torch291/categorical"
21
+ }
lecture_6/verified_examples/categorical/losses.json ADDED
The diff for this file is too large to render. See raw diff
 
lecture_6/verified_examples/categorical/report.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "categorical",
3
+ "data_kind": "synthetic-text",
4
+ "train_loss_first_20_mean": 2.472597396373749,
5
+ "train_loss_last_20_mean": 0.5313047975301742,
6
+ "training_steps": 1000,
7
+ "python": "3.12.14",
8
+ "torch": "2.9.1+cpu",
9
+ "heldout_diagonal_ce_at_half_time": 0.45874327421188354,
10
+ "sample_steps": 8,
11
+ "samples": 128,
12
+ "sampling_seed": 6370,
13
+ "unique_fraction": 0.03125,
14
+ "token_entropy": 2.415271520614624,
15
+ "mean_length": 4.0,
16
+ "empty_fraction": 0.0,
17
+ "training_support_fraction": 1.0,
18
+ "elapsed_seconds": 5.423348005999287
19
+ }
lecture_6/verified_examples/categorical/samples.txt ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gold star moves down
2
+ blue square moves right
3
+ gold star moves down
4
+ green triangle moves up
5
+ green triangle moves up
6
+ gold star moves down
7
+ blue square moves right
8
+ green triangle moves up
9
+ gold star moves down
10
+ blue square moves right
11
+ blue square moves right
12
+ red circle moves left
13
+ gold star moves down
14
+ gold star moves down
15
+ blue square moves right
16
+ gold star moves down
17
+ red circle moves left
18
+ green triangle moves up
19
+ blue square moves right
20
+ gold star moves down
21
+ red circle moves left
22
+ red circle moves left
23
+ green triangle moves up
24
+ green triangle moves up
25
+ red circle moves left
26
+ blue square moves right
27
+ green triangle moves up
28
+ green triangle moves up
29
+ gold star moves down
30
+ gold star moves down
31
+ blue square moves right
32
+ blue square moves right
33
+ green triangle moves up
34
+ blue square moves right
35
+ gold star moves down
36
+ gold star moves down
37
+ gold star moves down
38
+ green triangle moves up
39
+ gold star moves down
40
+ green triangle moves up
41
+ blue square moves right
42
+ blue square moves right
43
+ green triangle moves up
44
+ gold star moves down
45
+ gold star moves down
46
+ gold star moves down
47
+ gold star moves down
48
+ green triangle moves up
49
+ red circle moves left
50
+ blue square moves right
51
+ blue square moves right
52
+ red circle moves left
53
+ blue square moves right
54
+ gold star moves down
55
+ blue square moves right
56
+ green triangle moves up
57
+ red circle moves left
58
+ blue square moves right
59
+ green triangle moves up
60
+ gold star moves down
61
+ gold star moves down
62
+ green triangle moves up
63
+ blue square moves right
64
+ green triangle moves up
65
+ blue square moves right
66
+ gold star moves down
67
+ red circle moves left
68
+ red circle moves left
69
+ green triangle moves up
70
+ green triangle moves up
71
+ gold star moves down
72
+ blue square moves right
73
+ green triangle moves up
74
+ blue square moves right
75
+ blue square moves right
76
+ blue square moves right
77
+ gold star moves down
78
+ green triangle moves up
79
+ blue square moves right
80
+ green triangle moves up
81
+ red circle moves left
82
+ gold star moves down
83
+ blue square moves right
84
+ gold star moves down
85
+ red circle moves left
86
+ blue square moves right
87
+ gold star moves down
88
+ gold star moves down
89
+ red circle moves left
90
+ blue square moves right
91
+ red circle moves left
92
+ green triangle moves up
93
+ green triangle moves up
94
+ gold star moves down
95
+ gold star moves down
96
+ green triangle moves up
97
+ red circle moves left
98
+ blue square moves right
99
+ blue square moves right
100
+ red circle moves left
101
+ blue square moves right
102
+ red circle moves left
103
+ red circle moves left
104
+ red circle moves left
105
+ gold star moves down
106
+ green triangle moves up
107
+ blue square moves right
108
+ gold star moves down
109
+ green triangle moves up
110
+ red circle moves left
111
+ gold star moves down
112
+ red circle moves left
113
+ green triangle moves up
114
+ red circle moves left
115
+ red circle moves left
116
+ blue square moves right
117
+ gold star moves down
118
+ green triangle moves up
119
+ blue square moves right
120
+ red circle moves left
121
+ gold star moves down
122
+ gold star moves down
123
+ gold star moves down
124
+ gold star moves down
125
+ red circle moves left
126
+ green triangle moves up
127
+ gold star moves down
128
+ gold star moves down
lecture_6/verified_examples/consistency/config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "consistency",
3
+ "mode": "train-sample",
4
+ "train_steps": 1000,
5
+ "teacher_steps": 1000,
6
+ "finetune_steps": 0,
7
+ "sample_steps": 8,
8
+ "posterior_steps": 4,
9
+ "particles": 32,
10
+ "reward_strength": 1.0,
11
+ "ssfm_target": "official-code",
12
+ "batch_size": 64,
13
+ "samples": 128,
14
+ "width": 64,
15
+ "lr": 0.001,
16
+ "seed": 6270,
17
+ "threads": 1,
18
+ "device": "cpu",
19
+ "data": null,
20
+ "out": "outputs/verified-torch291/consistency"
21
+ }
lecture_6/verified_examples/consistency/losses.json ADDED
The diff for this file is too large to render. See raw diff
 
lecture_6/verified_examples/consistency/report.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "consistency",
3
+ "data_kind": "four-gaussian-mixture",
4
+ "train_loss_first_20_mean": 1.9746342718601226,
5
+ "train_loss_last_20_mean": 1.979964154958725,
6
+ "training_steps": 1000,
7
+ "python": "3.12.14",
8
+ "torch": "2.9.1+cpu",
9
+ "sample_steps": 8,
10
+ "samples": 128,
11
+ "sampling_seed": 6370,
12
+ "finite_samples": true,
13
+ "mean_distance_to_center": 0.7534297704696655,
14
+ "mode_fractions": [
15
+ 0.265625,
16
+ 0.25,
17
+ 0.2421875,
18
+ 0.2421875
19
+ ],
20
+ "mode_entropy": 1.3855692148208618,
21
+ "mean_target_log_density": -7.795166492462158,
22
+ "elapsed_seconds": 3.6416576160045224
23
+ }
lecture_6/verified_examples/consistency/samples.txt ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -1.3468293 1.9925021
2
+ -1.9144447 1.9564545
3
+ -1.8007749 -2.0338287
4
+ -1.9767884 0.2636437
5
+ 0.4644759 -1.6100454
6
+ -1.8300068 2.0076437
7
+ 1.8318725 -1.9341205
8
+ -2.0396407 -1.7563149
9
+ -2.0363870 -1.9806333
10
+ 1.0769628 1.7889115
11
+ 0.1340955 1.3456073
12
+ 1.7798740 -0.5705347
13
+ 2.0481019 0.6637622
14
+ 0.5697179 -0.0764643
15
+ -1.6694670 -2.1333323
16
+ 1.8878694 -2.1138554
17
+ 1.3903328 1.7709353
18
+ 1.3510761 -1.8566105
19
+ 0.3830533 0.7458028
20
+ 1.8123627 -2.1073432
21
+ -1.8500829 1.9188887
22
+ -1.9960229 -0.9180380
23
+ -2.0363288 -1.9042180
24
+ -1.7602494 -1.8083441
25
+ 0.1228525 -2.1484063
26
+ -1.9425657 0.6813170
27
+ 0.9867452 0.2309941
28
+ -0.5291872 -2.0708153
29
+ -1.9266198 1.5953822
30
+ -0.5012224 -1.9294865
31
+ -1.2689531 -1.5546137
32
+ -1.5741237 -1.8497179
33
+ -0.2626170 -1.6006305
34
+ -1.9871480 -2.1482060
35
+ 2.0151453 1.6644613
36
+ -0.1489909 -2.0024414
37
+ 2.0573957 1.4528581
38
+ -0.2505112 1.9968579
39
+ 1.7871954 0.6475998
40
+ 1.8512402 -0.2385958
41
+ 0.1899848 1.9513735
42
+ -1.9870937 -0.6491414
43
+ -0.2206627 -1.5287057
44
+ 1.6779035 1.0743937
45
+ -2.0382123 -2.1339107
46
+ -0.7100272 1.9262421
47
+ -1.6801538 -1.8067182
48
+ 1.8546274 -2.1622596
49
+ 1.5299554 1.2159443
50
+ -1.9548271 1.3845929
51
+ 0.4502607 2.0001235
52
+ -0.0262713 -0.3656653
53
+ 0.9616735 -1.0734054
54
+ 0.8062696 1.8239052
55
+ -0.4521321 1.8881189
56
+ -1.4971223 1.4280133
57
+ 1.2114744 -1.1458678
58
+ -0.5043197 1.1818823
59
+ -2.0388222 -1.5035791
60
+ -1.3591039 0.9025277
61
+ -2.0305381 -0.3237583
62
+ 1.2204367 1.9129956
63
+ 0.3672223 1.9162316
64
+ 2.0437796 0.6819464
65
+ 1.7619469 -1.9899399
66
+ 1.7444496 -1.7915529
67
+ 0.0078025 -1.0781103
68
+ 1.8828144 -2.0743697
69
+ -1.9811914 -2.1016579
70
+ -1.9607775 -0.8501123
71
+ 1.8939016 1.3304422
72
+ 1.7166512 0.3390130
73
+ -0.0189792 -0.1771857
74
+ -0.6227967 1.3938310
75
+ 1.9738953 1.8059912
76
+ 0.0466411 -2.0397491
77
+ 1.7655673 -1.9929256
78
+ 1.8075031 -1.8748856
79
+ 1.9316881 1.7332070
80
+ 1.6287178 -1.4561557
81
+ -1.1077086 1.9380562
82
+ 1.8720345 1.2524481
83
+ 1.5174096 1.3109862
84
+ -1.0241457 0.1447840
85
+ -1.4152889 -0.7302222
86
+ -1.7965597 -0.9746199
87
+ 1.1624088 1.3963469
88
+ -0.4442409 1.4740853
89
+ -1.5870914 1.7438629
90
+ -0.2185191 -0.1900957
91
+ 1.6071042 1.2579901
92
+ -1.4373560 1.5747277
93
+ 1.4849627 -1.7022858
94
+ 1.4948187 1.8095267
95
+ -1.9391402 0.7429604
96
+ -1.0735885 1.5553175
97
+ -0.5654426 1.1886865
98
+ 1.4643161 -2.1554084
99
+ -2.0169582 0.1357105
100
+ 1.1027896 -2.1490393
101
+ -1.9470890 -2.0728121
102
+ -1.9837592 0.9692687
103
+ -0.8680381 2.0148981
104
+ -1.6903710 -1.3934293
105
+ -2.0227857 -1.9842577
106
+ -1.8039379 1.8491473
107
+ 0.8419592 -2.0827856
108
+ 1.3736886 -2.1311660
109
+ -1.6144994 -1.8624021
110
+ -1.2275145 1.6786437
111
+ -0.7562458 -2.1603642
112
+ 1.5444539 1.1505903
113
+ 0.6380618 0.8644766
114
+ 1.3242871 -2.1602378
115
+ 1.8642752 -1.8713832
116
+ -1.7034441 -1.0856594
117
+ 1.6279490 1.2668343
118
+ 1.7643193 1.6216198
119
+ 1.0740453 -0.7010343
120
+ -1.8715028 -2.0824487
121
+ 1.4197307 -1.6388113
122
+ -1.6448362 0.3884219
123
+ -1.9149169 1.7842357
124
+ 1.8479285 1.3923659
125
+ 1.4299746 -2.1582410
126
+ -1.3168693 1.5584388
127
+ -1.4611561 1.2482233
128
+ 1.8228297 -2.0618267
lecture_6/verified_examples/consistency/teacher_losses.json ADDED
@@ -0,0 +1,4002 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "step": 0,
4
+ "loss": 2.901901960372925
5
+ },
6
+ {
7
+ "step": 1,
8
+ "loss": 4.030956745147705
9
+ },
10
+ {
11
+ "step": 2,
12
+ "loss": 3.7361669540405273
13
+ },
14
+ {
15
+ "step": 3,
16
+ "loss": 3.1736671924591064
17
+ },
18
+ {
19
+ "step": 4,
20
+ "loss": 3.2819948196411133
21
+ },
22
+ {
23
+ "step": 5,
24
+ "loss": 2.6870734691619873
25
+ },
26
+ {
27
+ "step": 6,
28
+ "loss": 3.2287180423736572
29
+ },
30
+ {
31
+ "step": 7,
32
+ "loss": 3.540705919265747
33
+ },
34
+ {
35
+ "step": 8,
36
+ "loss": 2.320319652557373
37
+ },
38
+ {
39
+ "step": 9,
40
+ "loss": 3.2631494998931885
41
+ },
42
+ {
43
+ "step": 10,
44
+ "loss": 3.2428276538848877
45
+ },
46
+ {
47
+ "step": 11,
48
+ "loss": 3.1067261695861816
49
+ },
50
+ {
51
+ "step": 12,
52
+ "loss": 2.9945061206817627
53
+ },
54
+ {
55
+ "step": 13,
56
+ "loss": 3.429009199142456
57
+ },
58
+ {
59
+ "step": 14,
60
+ "loss": 3.202871084213257
61
+ },
62
+ {
63
+ "step": 15,
64
+ "loss": 3.343949317932129
65
+ },
66
+ {
67
+ "step": 16,
68
+ "loss": 3.338503837585449
69
+ },
70
+ {
71
+ "step": 17,
72
+ "loss": 2.27468204498291
73
+ },
74
+ {
75
+ "step": 18,
76
+ "loss": 3.2059783935546875
77
+ },
78
+ {
79
+ "step": 19,
80
+ "loss": 3.2105021476745605
81
+ },
82
+ {
83
+ "step": 20,
84
+ "loss": 3.607123374938965
85
+ },
86
+ {
87
+ "step": 21,
88
+ "loss": 2.5147407054901123
89
+ },
90
+ {
91
+ "step": 22,
92
+ "loss": 2.4429540634155273
93
+ },
94
+ {
95
+ "step": 23,
96
+ "loss": 2.693626880645752
97
+ },
98
+ {
99
+ "step": 24,
100
+ "loss": 2.922039031982422
101
+ },
102
+ {
103
+ "step": 25,
104
+ "loss": 3.412623405456543
105
+ },
106
+ {
107
+ "step": 26,
108
+ "loss": 3.049421548843384
109
+ },
110
+ {
111
+ "step": 27,
112
+ "loss": 3.4507718086242676
113
+ },
114
+ {
115
+ "step": 28,
116
+ "loss": 3.2085723876953125
117
+ },
118
+ {
119
+ "step": 29,
120
+ "loss": 3.431762933731079
121
+ },
122
+ {
123
+ "step": 30,
124
+ "loss": 3.186777114868164
125
+ },
126
+ {
127
+ "step": 31,
128
+ "loss": 2.358400821685791
129
+ },
130
+ {
131
+ "step": 32,
132
+ "loss": 2.739171028137207
133
+ },
134
+ {
135
+ "step": 33,
136
+ "loss": 3.3288445472717285
137
+ },
138
+ {
139
+ "step": 34,
140
+ "loss": 2.9850246906280518
141
+ },
142
+ {
143
+ "step": 35,
144
+ "loss": 2.979214906692505
145
+ },
146
+ {
147
+ "step": 36,
148
+ "loss": 3.4282126426696777
149
+ },
150
+ {
151
+ "step": 37,
152
+ "loss": 2.3601138591766357
153
+ },
154
+ {
155
+ "step": 38,
156
+ "loss": 2.754340410232544
157
+ },
158
+ {
159
+ "step": 39,
160
+ "loss": 2.772657871246338
161
+ },
162
+ {
163
+ "step": 40,
164
+ "loss": 3.816230535507202
165
+ },
166
+ {
167
+ "step": 41,
168
+ "loss": 2.872300624847412
169
+ },
170
+ {
171
+ "step": 42,
172
+ "loss": 3.0081868171691895
173
+ },
174
+ {
175
+ "step": 43,
176
+ "loss": 2.6166443824768066
177
+ },
178
+ {
179
+ "step": 44,
180
+ "loss": 2.4548749923706055
181
+ },
182
+ {
183
+ "step": 45,
184
+ "loss": 2.7366158962249756
185
+ },
186
+ {
187
+ "step": 46,
188
+ "loss": 2.7148921489715576
189
+ },
190
+ {
191
+ "step": 47,
192
+ "loss": 2.800400972366333
193
+ },
194
+ {
195
+ "step": 48,
196
+ "loss": 2.9447460174560547
197
+ },
198
+ {
199
+ "step": 49,
200
+ "loss": 2.708866834640503
201
+ },
202
+ {
203
+ "step": 50,
204
+ "loss": 2.883293628692627
205
+ },
206
+ {
207
+ "step": 51,
208
+ "loss": 2.8611910343170166
209
+ },
210
+ {
211
+ "step": 52,
212
+ "loss": 2.477092742919922
213
+ },
214
+ {
215
+ "step": 53,
216
+ "loss": 2.551604986190796
217
+ },
218
+ {
219
+ "step": 54,
220
+ "loss": 2.338512897491455
221
+ },
222
+ {
223
+ "step": 55,
224
+ "loss": 3.476226329803467
225
+ },
226
+ {
227
+ "step": 56,
228
+ "loss": 2.717756509780884
229
+ },
230
+ {
231
+ "step": 57,
232
+ "loss": 2.5666332244873047
233
+ },
234
+ {
235
+ "step": 58,
236
+ "loss": 2.3942244052886963
237
+ },
238
+ {
239
+ "step": 59,
240
+ "loss": 2.3049826622009277
241
+ },
242
+ {
243
+ "step": 60,
244
+ "loss": 2.817511796951294
245
+ },
246
+ {
247
+ "step": 61,
248
+ "loss": 2.9381887912750244
249
+ },
250
+ {
251
+ "step": 62,
252
+ "loss": 3.0970544815063477
253
+ },
254
+ {
255
+ "step": 63,
256
+ "loss": 2.7542073726654053
257
+ },
258
+ {
259
+ "step": 64,
260
+ "loss": 2.95668625831604
261
+ },
262
+ {
263
+ "step": 65,
264
+ "loss": 3.3345565795898438
265
+ },
266
+ {
267
+ "step": 66,
268
+ "loss": 3.0203516483306885
269
+ },
270
+ {
271
+ "step": 67,
272
+ "loss": 3.0535619258880615
273
+ },
274
+ {
275
+ "step": 68,
276
+ "loss": 2.2485365867614746
277
+ },
278
+ {
279
+ "step": 69,
280
+ "loss": 3.313269853591919
281
+ },
282
+ {
283
+ "step": 70,
284
+ "loss": 3.151857614517212
285
+ },
286
+ {
287
+ "step": 71,
288
+ "loss": 3.3004636764526367
289
+ },
290
+ {
291
+ "step": 72,
292
+ "loss": 3.13859224319458
293
+ },
294
+ {
295
+ "step": 73,
296
+ "loss": 2.831691026687622
297
+ },
298
+ {
299
+ "step": 74,
300
+ "loss": 2.824505090713501
301
+ },
302
+ {
303
+ "step": 75,
304
+ "loss": 3.2724480628967285
305
+ },
306
+ {
307
+ "step": 76,
308
+ "loss": 3.3112194538116455
309
+ },
310
+ {
311
+ "step": 77,
312
+ "loss": 3.5525429248809814
313
+ },
314
+ {
315
+ "step": 78,
316
+ "loss": 3.02317214012146
317
+ },
318
+ {
319
+ "step": 79,
320
+ "loss": 2.3117425441741943
321
+ },
322
+ {
323
+ "step": 80,
324
+ "loss": 2.52921986579895
325
+ },
326
+ {
327
+ "step": 81,
328
+ "loss": 3.346832752227783
329
+ },
330
+ {
331
+ "step": 82,
332
+ "loss": 2.557271957397461
333
+ },
334
+ {
335
+ "step": 83,
336
+ "loss": 2.8063182830810547
337
+ },
338
+ {
339
+ "step": 84,
340
+ "loss": 3.1693220138549805
341
+ },
342
+ {
343
+ "step": 85,
344
+ "loss": 2.1511852741241455
345
+ },
346
+ {
347
+ "step": 86,
348
+ "loss": 2.3931725025177
349
+ },
350
+ {
351
+ "step": 87,
352
+ "loss": 2.7104268074035645
353
+ },
354
+ {
355
+ "step": 88,
356
+ "loss": 3.144993305206299
357
+ },
358
+ {
359
+ "step": 89,
360
+ "loss": 2.5371882915496826
361
+ },
362
+ {
363
+ "step": 90,
364
+ "loss": 2.635395050048828
365
+ },
366
+ {
367
+ "step": 91,
368
+ "loss": 2.9128007888793945
369
+ },
370
+ {
371
+ "step": 92,
372
+ "loss": 2.091165781021118
373
+ },
374
+ {
375
+ "step": 93,
376
+ "loss": 2.678255081176758
377
+ },
378
+ {
379
+ "step": 94,
380
+ "loss": 3.1458537578582764
381
+ },
382
+ {
383
+ "step": 95,
384
+ "loss": 3.0256667137145996
385
+ },
386
+ {
387
+ "step": 96,
388
+ "loss": 3.504319906234741
389
+ },
390
+ {
391
+ "step": 97,
392
+ "loss": 2.4840328693389893
393
+ },
394
+ {
395
+ "step": 98,
396
+ "loss": 3.156357765197754
397
+ },
398
+ {
399
+ "step": 99,
400
+ "loss": 2.409656047821045
401
+ },
402
+ {
403
+ "step": 100,
404
+ "loss": 2.607604503631592
405
+ },
406
+ {
407
+ "step": 101,
408
+ "loss": 3.1481847763061523
409
+ },
410
+ {
411
+ "step": 102,
412
+ "loss": 2.3221395015716553
413
+ },
414
+ {
415
+ "step": 103,
416
+ "loss": 2.7403645515441895
417
+ },
418
+ {
419
+ "step": 104,
420
+ "loss": 2.9177207946777344
421
+ },
422
+ {
423
+ "step": 105,
424
+ "loss": 3.1296420097351074
425
+ },
426
+ {
427
+ "step": 106,
428
+ "loss": 2.714864492416382
429
+ },
430
+ {
431
+ "step": 107,
432
+ "loss": 2.2136282920837402
433
+ },
434
+ {
435
+ "step": 108,
436
+ "loss": 3.0324344635009766
437
+ },
438
+ {
439
+ "step": 109,
440
+ "loss": 2.8028464317321777
441
+ },
442
+ {
443
+ "step": 110,
444
+ "loss": 3.500157356262207
445
+ },
446
+ {
447
+ "step": 111,
448
+ "loss": 3.659149646759033
449
+ },
450
+ {
451
+ "step": 112,
452
+ "loss": 2.6796770095825195
453
+ },
454
+ {
455
+ "step": 113,
456
+ "loss": 4.001369476318359
457
+ },
458
+ {
459
+ "step": 114,
460
+ "loss": 3.12492299079895
461
+ },
462
+ {
463
+ "step": 115,
464
+ "loss": 2.186939239501953
465
+ },
466
+ {
467
+ "step": 116,
468
+ "loss": 3.0609922409057617
469
+ },
470
+ {
471
+ "step": 117,
472
+ "loss": 2.7359426021575928
473
+ },
474
+ {
475
+ "step": 118,
476
+ "loss": 2.8246054649353027
477
+ },
478
+ {
479
+ "step": 119,
480
+ "loss": 2.0663673877716064
481
+ },
482
+ {
483
+ "step": 120,
484
+ "loss": 2.82535719871521
485
+ },
486
+ {
487
+ "step": 121,
488
+ "loss": 2.7651166915893555
489
+ },
490
+ {
491
+ "step": 122,
492
+ "loss": 2.3627724647521973
493
+ },
494
+ {
495
+ "step": 123,
496
+ "loss": 3.1746630668640137
497
+ },
498
+ {
499
+ "step": 124,
500
+ "loss": 2.2432596683502197
501
+ },
502
+ {
503
+ "step": 125,
504
+ "loss": 2.632728338241577
505
+ },
506
+ {
507
+ "step": 126,
508
+ "loss": 3.509660005569458
509
+ },
510
+ {
511
+ "step": 127,
512
+ "loss": 2.6030969619750977
513
+ },
514
+ {
515
+ "step": 128,
516
+ "loss": 2.819704532623291
517
+ },
518
+ {
519
+ "step": 129,
520
+ "loss": 2.7884159088134766
521
+ },
522
+ {
523
+ "step": 130,
524
+ "loss": 3.066481590270996
525
+ },
526
+ {
527
+ "step": 131,
528
+ "loss": 2.5375585556030273
529
+ },
530
+ {
531
+ "step": 132,
532
+ "loss": 2.6820192337036133
533
+ },
534
+ {
535
+ "step": 133,
536
+ "loss": 2.8677313327789307
537
+ },
538
+ {
539
+ "step": 134,
540
+ "loss": 3.295163631439209
541
+ },
542
+ {
543
+ "step": 135,
544
+ "loss": 3.008159637451172
545
+ },
546
+ {
547
+ "step": 136,
548
+ "loss": 2.6790380477905273
549
+ },
550
+ {
551
+ "step": 137,
552
+ "loss": 3.2993409633636475
553
+ },
554
+ {
555
+ "step": 138,
556
+ "loss": 2.3291473388671875
557
+ },
558
+ {
559
+ "step": 139,
560
+ "loss": 3.2662582397460938
561
+ },
562
+ {
563
+ "step": 140,
564
+ "loss": 3.1028847694396973
565
+ },
566
+ {
567
+ "step": 141,
568
+ "loss": 3.5241870880126953
569
+ },
570
+ {
571
+ "step": 142,
572
+ "loss": 2.6248207092285156
573
+ },
574
+ {
575
+ "step": 143,
576
+ "loss": 3.289806365966797
577
+ },
578
+ {
579
+ "step": 144,
580
+ "loss": 2.761228322982788
581
+ },
582
+ {
583
+ "step": 145,
584
+ "loss": 2.6195461750030518
585
+ },
586
+ {
587
+ "step": 146,
588
+ "loss": 3.2968337535858154
589
+ },
590
+ {
591
+ "step": 147,
592
+ "loss": 2.2302370071411133
593
+ },
594
+ {
595
+ "step": 148,
596
+ "loss": 2.7895140647888184
597
+ },
598
+ {
599
+ "step": 149,
600
+ "loss": 3.0598552227020264
601
+ },
602
+ {
603
+ "step": 150,
604
+ "loss": 2.991975784301758
605
+ },
606
+ {
607
+ "step": 151,
608
+ "loss": 2.758124589920044
609
+ },
610
+ {
611
+ "step": 152,
612
+ "loss": 2.8041367530822754
613
+ },
614
+ {
615
+ "step": 153,
616
+ "loss": 2.7885689735412598
617
+ },
618
+ {
619
+ "step": 154,
620
+ "loss": 2.642705202102661
621
+ },
622
+ {
623
+ "step": 155,
624
+ "loss": 3.208401679992676
625
+ },
626
+ {
627
+ "step": 156,
628
+ "loss": 2.890425205230713
629
+ },
630
+ {
631
+ "step": 157,
632
+ "loss": 3.0730347633361816
633
+ },
634
+ {
635
+ "step": 158,
636
+ "loss": 2.9297609329223633
637
+ },
638
+ {
639
+ "step": 159,
640
+ "loss": 3.1628060340881348
641
+ },
642
+ {
643
+ "step": 160,
644
+ "loss": 2.235241174697876
645
+ },
646
+ {
647
+ "step": 161,
648
+ "loss": 3.431405544281006
649
+ },
650
+ {
651
+ "step": 162,
652
+ "loss": 3.1083548069000244
653
+ },
654
+ {
655
+ "step": 163,
656
+ "loss": 2.592428207397461
657
+ },
658
+ {
659
+ "step": 164,
660
+ "loss": 2.538461923599243
661
+ },
662
+ {
663
+ "step": 165,
664
+ "loss": 2.8032314777374268
665
+ },
666
+ {
667
+ "step": 166,
668
+ "loss": 2.8171889781951904
669
+ },
670
+ {
671
+ "step": 167,
672
+ "loss": 2.857837677001953
673
+ },
674
+ {
675
+ "step": 168,
676
+ "loss": 2.95976185798645
677
+ },
678
+ {
679
+ "step": 169,
680
+ "loss": 2.500030994415283
681
+ },
682
+ {
683
+ "step": 170,
684
+ "loss": 2.632225513458252
685
+ },
686
+ {
687
+ "step": 171,
688
+ "loss": 2.696317672729492
689
+ },
690
+ {
691
+ "step": 172,
692
+ "loss": 2.671130657196045
693
+ },
694
+ {
695
+ "step": 173,
696
+ "loss": 3.2583823204040527
697
+ },
698
+ {
699
+ "step": 174,
700
+ "loss": 2.750561237335205
701
+ },
702
+ {
703
+ "step": 175,
704
+ "loss": 2.7291007041931152
705
+ },
706
+ {
707
+ "step": 176,
708
+ "loss": 2.5894086360931396
709
+ },
710
+ {
711
+ "step": 177,
712
+ "loss": 2.551658868789673
713
+ },
714
+ {
715
+ "step": 178,
716
+ "loss": 2.7688674926757812
717
+ },
718
+ {
719
+ "step": 179,
720
+ "loss": 2.5460314750671387
721
+ },
722
+ {
723
+ "step": 180,
724
+ "loss": 2.573371648788452
725
+ },
726
+ {
727
+ "step": 181,
728
+ "loss": 2.5819363594055176
729
+ },
730
+ {
731
+ "step": 182,
732
+ "loss": 2.7828993797302246
733
+ },
734
+ {
735
+ "step": 183,
736
+ "loss": 2.3213307857513428
737
+ },
738
+ {
739
+ "step": 184,
740
+ "loss": 2.626124382019043
741
+ },
742
+ {
743
+ "step": 185,
744
+ "loss": 2.0648884773254395
745
+ },
746
+ {
747
+ "step": 186,
748
+ "loss": 2.6399617195129395
749
+ },
750
+ {
751
+ "step": 187,
752
+ "loss": 2.4929964542388916
753
+ },
754
+ {
755
+ "step": 188,
756
+ "loss": 2.738865613937378
757
+ },
758
+ {
759
+ "step": 189,
760
+ "loss": 2.869166851043701
761
+ },
762
+ {
763
+ "step": 190,
764
+ "loss": 2.6773924827575684
765
+ },
766
+ {
767
+ "step": 191,
768
+ "loss": 3.207840919494629
769
+ },
770
+ {
771
+ "step": 192,
772
+ "loss": 2.593851327896118
773
+ },
774
+ {
775
+ "step": 193,
776
+ "loss": 3.145773410797119
777
+ },
778
+ {
779
+ "step": 194,
780
+ "loss": 2.6272592544555664
781
+ },
782
+ {
783
+ "step": 195,
784
+ "loss": 3.2182958126068115
785
+ },
786
+ {
787
+ "step": 196,
788
+ "loss": 2.6175713539123535
789
+ },
790
+ {
791
+ "step": 197,
792
+ "loss": 2.102283000946045
793
+ },
794
+ {
795
+ "step": 198,
796
+ "loss": 2.3725454807281494
797
+ },
798
+ {
799
+ "step": 199,
800
+ "loss": 2.310814142227173
801
+ },
802
+ {
803
+ "step": 200,
804
+ "loss": 2.554727077484131
805
+ },
806
+ {
807
+ "step": 201,
808
+ "loss": 2.290694236755371
809
+ },
810
+ {
811
+ "step": 202,
812
+ "loss": 2.0614757537841797
813
+ },
814
+ {
815
+ "step": 203,
816
+ "loss": 2.4946200847625732
817
+ },
818
+ {
819
+ "step": 204,
820
+ "loss": 3.1302361488342285
821
+ },
822
+ {
823
+ "step": 205,
824
+ "loss": 2.4278793334960938
825
+ },
826
+ {
827
+ "step": 206,
828
+ "loss": 2.7277281284332275
829
+ },
830
+ {
831
+ "step": 207,
832
+ "loss": 1.6022748947143555
833
+ },
834
+ {
835
+ "step": 208,
836
+ "loss": 2.2651426792144775
837
+ },
838
+ {
839
+ "step": 209,
840
+ "loss": 2.446990489959717
841
+ },
842
+ {
843
+ "step": 210,
844
+ "loss": 2.829681634902954
845
+ },
846
+ {
847
+ "step": 211,
848
+ "loss": 2.8909616470336914
849
+ },
850
+ {
851
+ "step": 212,
852
+ "loss": 2.6464128494262695
853
+ },
854
+ {
855
+ "step": 213,
856
+ "loss": 3.0840983390808105
857
+ },
858
+ {
859
+ "step": 214,
860
+ "loss": 2.442357063293457
861
+ },
862
+ {
863
+ "step": 215,
864
+ "loss": 3.077253580093384
865
+ },
866
+ {
867
+ "step": 216,
868
+ "loss": 3.0163815021514893
869
+ },
870
+ {
871
+ "step": 217,
872
+ "loss": 3.3182713985443115
873
+ },
874
+ {
875
+ "step": 218,
876
+ "loss": 2.6422321796417236
877
+ },
878
+ {
879
+ "step": 219,
880
+ "loss": 2.7757790088653564
881
+ },
882
+ {
883
+ "step": 220,
884
+ "loss": 2.817136287689209
885
+ },
886
+ {
887
+ "step": 221,
888
+ "loss": 2.7244391441345215
889
+ },
890
+ {
891
+ "step": 222,
892
+ "loss": 3.3463165760040283
893
+ },
894
+ {
895
+ "step": 223,
896
+ "loss": 2.5178160667419434
897
+ },
898
+ {
899
+ "step": 224,
900
+ "loss": 2.3083720207214355
901
+ },
902
+ {
903
+ "step": 225,
904
+ "loss": 2.6672210693359375
905
+ },
906
+ {
907
+ "step": 226,
908
+ "loss": 2.953312635421753
909
+ },
910
+ {
911
+ "step": 227,
912
+ "loss": 2.245347023010254
913
+ },
914
+ {
915
+ "step": 228,
916
+ "loss": 2.6127264499664307
917
+ },
918
+ {
919
+ "step": 229,
920
+ "loss": 2.3829171657562256
921
+ },
922
+ {
923
+ "step": 230,
924
+ "loss": 1.9589905738830566
925
+ },
926
+ {
927
+ "step": 231,
928
+ "loss": 2.7865824699401855
929
+ },
930
+ {
931
+ "step": 232,
932
+ "loss": 2.784212589263916
933
+ },
934
+ {
935
+ "step": 233,
936
+ "loss": 2.638892412185669
937
+ },
938
+ {
939
+ "step": 234,
940
+ "loss": 2.2629337310791016
941
+ },
942
+ {
943
+ "step": 235,
944
+ "loss": 2.3170275688171387
945
+ },
946
+ {
947
+ "step": 236,
948
+ "loss": 2.3931238651275635
949
+ },
950
+ {
951
+ "step": 237,
952
+ "loss": 2.5577549934387207
953
+ },
954
+ {
955
+ "step": 238,
956
+ "loss": 2.67926025390625
957
+ },
958
+ {
959
+ "step": 239,
960
+ "loss": 2.399914026260376
961
+ },
962
+ {
963
+ "step": 240,
964
+ "loss": 2.719255208969116
965
+ },
966
+ {
967
+ "step": 241,
968
+ "loss": 2.645662784576416
969
+ },
970
+ {
971
+ "step": 242,
972
+ "loss": 2.1666066646575928
973
+ },
974
+ {
975
+ "step": 243,
976
+ "loss": 2.710801839828491
977
+ },
978
+ {
979
+ "step": 244,
980
+ "loss": 2.2600297927856445
981
+ },
982
+ {
983
+ "step": 245,
984
+ "loss": 2.4880356788635254
985
+ },
986
+ {
987
+ "step": 246,
988
+ "loss": 2.333265542984009
989
+ },
990
+ {
991
+ "step": 247,
992
+ "loss": 2.3228213787078857
993
+ },
994
+ {
995
+ "step": 248,
996
+ "loss": 2.98348331451416
997
+ },
998
+ {
999
+ "step": 249,
1000
+ "loss": 2.44199538230896
1001
+ },
1002
+ {
1003
+ "step": 250,
1004
+ "loss": 2.6789755821228027
1005
+ },
1006
+ {
1007
+ "step": 251,
1008
+ "loss": 2.432734489440918
1009
+ },
1010
+ {
1011
+ "step": 252,
1012
+ "loss": 2.3950858116149902
1013
+ },
1014
+ {
1015
+ "step": 253,
1016
+ "loss": 3.024618148803711
1017
+ },
1018
+ {
1019
+ "step": 254,
1020
+ "loss": 2.7950377464294434
1021
+ },
1022
+ {
1023
+ "step": 255,
1024
+ "loss": 2.6282715797424316
1025
+ },
1026
+ {
1027
+ "step": 256,
1028
+ "loss": 2.5368154048919678
1029
+ },
1030
+ {
1031
+ "step": 257,
1032
+ "loss": 2.5300967693328857
1033
+ },
1034
+ {
1035
+ "step": 258,
1036
+ "loss": 2.71651029586792
1037
+ },
1038
+ {
1039
+ "step": 259,
1040
+ "loss": 2.345527172088623
1041
+ },
1042
+ {
1043
+ "step": 260,
1044
+ "loss": 1.991959571838379
1045
+ },
1046
+ {
1047
+ "step": 261,
1048
+ "loss": 2.2183401584625244
1049
+ },
1050
+ {
1051
+ "step": 262,
1052
+ "loss": 2.7822048664093018
1053
+ },
1054
+ {
1055
+ "step": 263,
1056
+ "loss": 2.955565929412842
1057
+ },
1058
+ {
1059
+ "step": 264,
1060
+ "loss": 2.171292781829834
1061
+ },
1062
+ {
1063
+ "step": 265,
1064
+ "loss": 3.007766008377075
1065
+ },
1066
+ {
1067
+ "step": 266,
1068
+ "loss": 2.5466020107269287
1069
+ },
1070
+ {
1071
+ "step": 267,
1072
+ "loss": 2.4173848628997803
1073
+ },
1074
+ {
1075
+ "step": 268,
1076
+ "loss": 2.6756205558776855
1077
+ },
1078
+ {
1079
+ "step": 269,
1080
+ "loss": 2.4434726238250732
1081
+ },
1082
+ {
1083
+ "step": 270,
1084
+ "loss": 2.3825483322143555
1085
+ },
1086
+ {
1087
+ "step": 271,
1088
+ "loss": 2.5813300609588623
1089
+ },
1090
+ {
1091
+ "step": 272,
1092
+ "loss": 2.342559814453125
1093
+ },
1094
+ {
1095
+ "step": 273,
1096
+ "loss": 2.664748191833496
1097
+ },
1098
+ {
1099
+ "step": 274,
1100
+ "loss": 2.8664631843566895
1101
+ },
1102
+ {
1103
+ "step": 275,
1104
+ "loss": 2.8220643997192383
1105
+ },
1106
+ {
1107
+ "step": 276,
1108
+ "loss": 2.6016016006469727
1109
+ },
1110
+ {
1111
+ "step": 277,
1112
+ "loss": 2.292630672454834
1113
+ },
1114
+ {
1115
+ "step": 278,
1116
+ "loss": 2.3435916900634766
1117
+ },
1118
+ {
1119
+ "step": 279,
1120
+ "loss": 2.225806474685669
1121
+ },
1122
+ {
1123
+ "step": 280,
1124
+ "loss": 2.861757755279541
1125
+ },
1126
+ {
1127
+ "step": 281,
1128
+ "loss": 2.4925742149353027
1129
+ },
1130
+ {
1131
+ "step": 282,
1132
+ "loss": 2.3195114135742188
1133
+ },
1134
+ {
1135
+ "step": 283,
1136
+ "loss": 2.723316192626953
1137
+ },
1138
+ {
1139
+ "step": 284,
1140
+ "loss": 2.3318111896514893
1141
+ },
1142
+ {
1143
+ "step": 285,
1144
+ "loss": 2.3740956783294678
1145
+ },
1146
+ {
1147
+ "step": 286,
1148
+ "loss": 2.7161083221435547
1149
+ },
1150
+ {
1151
+ "step": 287,
1152
+ "loss": 1.8623343706130981
1153
+ },
1154
+ {
1155
+ "step": 288,
1156
+ "loss": 3.0774383544921875
1157
+ },
1158
+ {
1159
+ "step": 289,
1160
+ "loss": 2.684474468231201
1161
+ },
1162
+ {
1163
+ "step": 290,
1164
+ "loss": 2.1260976791381836
1165
+ },
1166
+ {
1167
+ "step": 291,
1168
+ "loss": 2.633331775665283
1169
+ },
1170
+ {
1171
+ "step": 292,
1172
+ "loss": 3.048750400543213
1173
+ },
1174
+ {
1175
+ "step": 293,
1176
+ "loss": 2.1517202854156494
1177
+ },
1178
+ {
1179
+ "step": 294,
1180
+ "loss": 2.703066349029541
1181
+ },
1182
+ {
1183
+ "step": 295,
1184
+ "loss": 2.2772347927093506
1185
+ },
1186
+ {
1187
+ "step": 296,
1188
+ "loss": 2.532550573348999
1189
+ },
1190
+ {
1191
+ "step": 297,
1192
+ "loss": 2.5133583545684814
1193
+ },
1194
+ {
1195
+ "step": 298,
1196
+ "loss": 2.2637734413146973
1197
+ },
1198
+ {
1199
+ "step": 299,
1200
+ "loss": 2.8052215576171875
1201
+ },
1202
+ {
1203
+ "step": 300,
1204
+ "loss": 2.3975658416748047
1205
+ },
1206
+ {
1207
+ "step": 301,
1208
+ "loss": 2.142946720123291
1209
+ },
1210
+ {
1211
+ "step": 302,
1212
+ "loss": 2.3383138179779053
1213
+ },
1214
+ {
1215
+ "step": 303,
1216
+ "loss": 2.956615924835205
1217
+ },
1218
+ {
1219
+ "step": 304,
1220
+ "loss": 2.268173933029175
1221
+ },
1222
+ {
1223
+ "step": 305,
1224
+ "loss": 2.2826666831970215
1225
+ },
1226
+ {
1227
+ "step": 306,
1228
+ "loss": 2.504539728164673
1229
+ },
1230
+ {
1231
+ "step": 307,
1232
+ "loss": 2.5966529846191406
1233
+ },
1234
+ {
1235
+ "step": 308,
1236
+ "loss": 1.9715884923934937
1237
+ },
1238
+ {
1239
+ "step": 309,
1240
+ "loss": 2.8570797443389893
1241
+ },
1242
+ {
1243
+ "step": 310,
1244
+ "loss": 2.3709073066711426
1245
+ },
1246
+ {
1247
+ "step": 311,
1248
+ "loss": 2.3691515922546387
1249
+ },
1250
+ {
1251
+ "step": 312,
1252
+ "loss": 2.5264945030212402
1253
+ },
1254
+ {
1255
+ "step": 313,
1256
+ "loss": 2.853039503097534
1257
+ },
1258
+ {
1259
+ "step": 314,
1260
+ "loss": 2.6715211868286133
1261
+ },
1262
+ {
1263
+ "step": 315,
1264
+ "loss": 2.4609460830688477
1265
+ },
1266
+ {
1267
+ "step": 316,
1268
+ "loss": 2.3723304271698
1269
+ },
1270
+ {
1271
+ "step": 317,
1272
+ "loss": 2.623749017715454
1273
+ },
1274
+ {
1275
+ "step": 318,
1276
+ "loss": 2.3588414192199707
1277
+ },
1278
+ {
1279
+ "step": 319,
1280
+ "loss": 2.2384724617004395
1281
+ },
1282
+ {
1283
+ "step": 320,
1284
+ "loss": 2.6265077590942383
1285
+ },
1286
+ {
1287
+ "step": 321,
1288
+ "loss": 2.3127033710479736
1289
+ },
1290
+ {
1291
+ "step": 322,
1292
+ "loss": 2.5432920455932617
1293
+ },
1294
+ {
1295
+ "step": 323,
1296
+ "loss": 2.902012348175049
1297
+ },
1298
+ {
1299
+ "step": 324,
1300
+ "loss": 2.2379114627838135
1301
+ },
1302
+ {
1303
+ "step": 325,
1304
+ "loss": 2.8483102321624756
1305
+ },
1306
+ {
1307
+ "step": 326,
1308
+ "loss": 3.0475165843963623
1309
+ },
1310
+ {
1311
+ "step": 327,
1312
+ "loss": 2.2012202739715576
1313
+ },
1314
+ {
1315
+ "step": 328,
1316
+ "loss": 3.10513973236084
1317
+ },
1318
+ {
1319
+ "step": 329,
1320
+ "loss": 2.7302069664001465
1321
+ },
1322
+ {
1323
+ "step": 330,
1324
+ "loss": 2.05947208404541
1325
+ },
1326
+ {
1327
+ "step": 331,
1328
+ "loss": 2.0735864639282227
1329
+ },
1330
+ {
1331
+ "step": 332,
1332
+ "loss": 2.351263999938965
1333
+ },
1334
+ {
1335
+ "step": 333,
1336
+ "loss": 2.1889426708221436
1337
+ },
1338
+ {
1339
+ "step": 334,
1340
+ "loss": 1.893702745437622
1341
+ },
1342
+ {
1343
+ "step": 335,
1344
+ "loss": 2.886248826980591
1345
+ },
1346
+ {
1347
+ "step": 336,
1348
+ "loss": 2.281409502029419
1349
+ },
1350
+ {
1351
+ "step": 337,
1352
+ "loss": 2.278639793395996
1353
+ },
1354
+ {
1355
+ "step": 338,
1356
+ "loss": 2.7411670684814453
1357
+ },
1358
+ {
1359
+ "step": 339,
1360
+ "loss": 2.242872714996338
1361
+ },
1362
+ {
1363
+ "step": 340,
1364
+ "loss": 2.567128896713257
1365
+ },
1366
+ {
1367
+ "step": 341,
1368
+ "loss": 2.1635279655456543
1369
+ },
1370
+ {
1371
+ "step": 342,
1372
+ "loss": 2.7505345344543457
1373
+ },
1374
+ {
1375
+ "step": 343,
1376
+ "loss": 2.4954588413238525
1377
+ },
1378
+ {
1379
+ "step": 344,
1380
+ "loss": 2.4626471996307373
1381
+ },
1382
+ {
1383
+ "step": 345,
1384
+ "loss": 2.457416296005249
1385
+ },
1386
+ {
1387
+ "step": 346,
1388
+ "loss": 2.4571924209594727
1389
+ },
1390
+ {
1391
+ "step": 347,
1392
+ "loss": 2.3100287914276123
1393
+ },
1394
+ {
1395
+ "step": 348,
1396
+ "loss": 2.4437308311462402
1397
+ },
1398
+ {
1399
+ "step": 349,
1400
+ "loss": 2.0501744747161865
1401
+ },
1402
+ {
1403
+ "step": 350,
1404
+ "loss": 2.1469335556030273
1405
+ },
1406
+ {
1407
+ "step": 351,
1408
+ "loss": 2.464240550994873
1409
+ },
1410
+ {
1411
+ "step": 352,
1412
+ "loss": 1.8512563705444336
1413
+ },
1414
+ {
1415
+ "step": 353,
1416
+ "loss": 2.4845597743988037
1417
+ },
1418
+ {
1419
+ "step": 354,
1420
+ "loss": 2.224407434463501
1421
+ },
1422
+ {
1423
+ "step": 355,
1424
+ "loss": 2.5380733013153076
1425
+ },
1426
+ {
1427
+ "step": 356,
1428
+ "loss": 2.51659893989563
1429
+ },
1430
+ {
1431
+ "step": 357,
1432
+ "loss": 2.0740654468536377
1433
+ },
1434
+ {
1435
+ "step": 358,
1436
+ "loss": 2.069371461868286
1437
+ },
1438
+ {
1439
+ "step": 359,
1440
+ "loss": 2.823765516281128
1441
+ },
1442
+ {
1443
+ "step": 360,
1444
+ "loss": 2.5208475589752197
1445
+ },
1446
+ {
1447
+ "step": 361,
1448
+ "loss": 2.116133213043213
1449
+ },
1450
+ {
1451
+ "step": 362,
1452
+ "loss": 2.556251049041748
1453
+ },
1454
+ {
1455
+ "step": 363,
1456
+ "loss": 2.223443031311035
1457
+ },
1458
+ {
1459
+ "step": 364,
1460
+ "loss": 2.6511716842651367
1461
+ },
1462
+ {
1463
+ "step": 365,
1464
+ "loss": 1.691718339920044
1465
+ },
1466
+ {
1467
+ "step": 366,
1468
+ "loss": 2.411846160888672
1469
+ },
1470
+ {
1471
+ "step": 367,
1472
+ "loss": 2.582014799118042
1473
+ },
1474
+ {
1475
+ "step": 368,
1476
+ "loss": 2.2078142166137695
1477
+ },
1478
+ {
1479
+ "step": 369,
1480
+ "loss": 2.609196662902832
1481
+ },
1482
+ {
1483
+ "step": 370,
1484
+ "loss": 2.444159984588623
1485
+ },
1486
+ {
1487
+ "step": 371,
1488
+ "loss": 2.0085737705230713
1489
+ },
1490
+ {
1491
+ "step": 372,
1492
+ "loss": 2.4077141284942627
1493
+ },
1494
+ {
1495
+ "step": 373,
1496
+ "loss": 2.8086421489715576
1497
+ },
1498
+ {
1499
+ "step": 374,
1500
+ "loss": 2.359715700149536
1501
+ },
1502
+ {
1503
+ "step": 375,
1504
+ "loss": 2.343597888946533
1505
+ },
1506
+ {
1507
+ "step": 376,
1508
+ "loss": 1.948641061782837
1509
+ },
1510
+ {
1511
+ "step": 377,
1512
+ "loss": 2.3641631603240967
1513
+ },
1514
+ {
1515
+ "step": 378,
1516
+ "loss": 2.0386908054351807
1517
+ },
1518
+ {
1519
+ "step": 379,
1520
+ "loss": 2.9259984493255615
1521
+ },
1522
+ {
1523
+ "step": 380,
1524
+ "loss": 2.6643362045288086
1525
+ },
1526
+ {
1527
+ "step": 381,
1528
+ "loss": 2.8584165573120117
1529
+ },
1530
+ {
1531
+ "step": 382,
1532
+ "loss": 2.6431076526641846
1533
+ },
1534
+ {
1535
+ "step": 383,
1536
+ "loss": 2.8262100219726562
1537
+ },
1538
+ {
1539
+ "step": 384,
1540
+ "loss": 2.1087937355041504
1541
+ },
1542
+ {
1543
+ "step": 385,
1544
+ "loss": 2.412994861602783
1545
+ },
1546
+ {
1547
+ "step": 386,
1548
+ "loss": 2.452765703201294
1549
+ },
1550
+ {
1551
+ "step": 387,
1552
+ "loss": 2.2612946033477783
1553
+ },
1554
+ {
1555
+ "step": 388,
1556
+ "loss": 2.9486331939697266
1557
+ },
1558
+ {
1559
+ "step": 389,
1560
+ "loss": 2.2730305194854736
1561
+ },
1562
+ {
1563
+ "step": 390,
1564
+ "loss": 2.526773691177368
1565
+ },
1566
+ {
1567
+ "step": 391,
1568
+ "loss": 2.397615909576416
1569
+ },
1570
+ {
1571
+ "step": 392,
1572
+ "loss": 2.3714022636413574
1573
+ },
1574
+ {
1575
+ "step": 393,
1576
+ "loss": 2.501068353652954
1577
+ },
1578
+ {
1579
+ "step": 394,
1580
+ "loss": 2.101055860519409
1581
+ },
1582
+ {
1583
+ "step": 395,
1584
+ "loss": 1.8332078456878662
1585
+ },
1586
+ {
1587
+ "step": 396,
1588
+ "loss": 2.620009183883667
1589
+ },
1590
+ {
1591
+ "step": 397,
1592
+ "loss": 2.6437087059020996
1593
+ },
1594
+ {
1595
+ "step": 398,
1596
+ "loss": 2.1969316005706787
1597
+ },
1598
+ {
1599
+ "step": 399,
1600
+ "loss": 2.578944444656372
1601
+ },
1602
+ {
1603
+ "step": 400,
1604
+ "loss": 2.8199615478515625
1605
+ },
1606
+ {
1607
+ "step": 401,
1608
+ "loss": 1.9555848836898804
1609
+ },
1610
+ {
1611
+ "step": 402,
1612
+ "loss": 2.3566293716430664
1613
+ },
1614
+ {
1615
+ "step": 403,
1616
+ "loss": 1.9274892807006836
1617
+ },
1618
+ {
1619
+ "step": 404,
1620
+ "loss": 2.3533687591552734
1621
+ },
1622
+ {
1623
+ "step": 405,
1624
+ "loss": 2.3114140033721924
1625
+ },
1626
+ {
1627
+ "step": 406,
1628
+ "loss": 2.3387277126312256
1629
+ },
1630
+ {
1631
+ "step": 407,
1632
+ "loss": 2.3504040241241455
1633
+ },
1634
+ {
1635
+ "step": 408,
1636
+ "loss": 2.694427490234375
1637
+ },
1638
+ {
1639
+ "step": 409,
1640
+ "loss": 2.370358467102051
1641
+ },
1642
+ {
1643
+ "step": 410,
1644
+ "loss": 1.8371087312698364
1645
+ },
1646
+ {
1647
+ "step": 411,
1648
+ "loss": 2.34598970413208
1649
+ },
1650
+ {
1651
+ "step": 412,
1652
+ "loss": 2.001140832901001
1653
+ },
1654
+ {
1655
+ "step": 413,
1656
+ "loss": 2.0652122497558594
1657
+ },
1658
+ {
1659
+ "step": 414,
1660
+ "loss": 2.631736993789673
1661
+ },
1662
+ {
1663
+ "step": 415,
1664
+ "loss": 2.3046376705169678
1665
+ },
1666
+ {
1667
+ "step": 416,
1668
+ "loss": 2.365978240966797
1669
+ },
1670
+ {
1671
+ "step": 417,
1672
+ "loss": 2.047502040863037
1673
+ },
1674
+ {
1675
+ "step": 418,
1676
+ "loss": 2.6210899353027344
1677
+ },
1678
+ {
1679
+ "step": 419,
1680
+ "loss": 2.1412880420684814
1681
+ },
1682
+ {
1683
+ "step": 420,
1684
+ "loss": 2.2439045906066895
1685
+ },
1686
+ {
1687
+ "step": 421,
1688
+ "loss": 2.1576952934265137
1689
+ },
1690
+ {
1691
+ "step": 422,
1692
+ "loss": 2.051438331604004
1693
+ },
1694
+ {
1695
+ "step": 423,
1696
+ "loss": 2.0313544273376465
1697
+ },
1698
+ {
1699
+ "step": 424,
1700
+ "loss": 3.118997573852539
1701
+ },
1702
+ {
1703
+ "step": 425,
1704
+ "loss": 2.471263885498047
1705
+ },
1706
+ {
1707
+ "step": 426,
1708
+ "loss": 1.698156714439392
1709
+ },
1710
+ {
1711
+ "step": 427,
1712
+ "loss": 2.799497365951538
1713
+ },
1714
+ {
1715
+ "step": 428,
1716
+ "loss": 2.1427876949310303
1717
+ },
1718
+ {
1719
+ "step": 429,
1720
+ "loss": 2.820594549179077
1721
+ },
1722
+ {
1723
+ "step": 430,
1724
+ "loss": 1.9575327634811401
1725
+ },
1726
+ {
1727
+ "step": 431,
1728
+ "loss": 2.6089365482330322
1729
+ },
1730
+ {
1731
+ "step": 432,
1732
+ "loss": 2.0574324131011963
1733
+ },
1734
+ {
1735
+ "step": 433,
1736
+ "loss": 2.868596315383911
1737
+ },
1738
+ {
1739
+ "step": 434,
1740
+ "loss": 2.1540873050689697
1741
+ },
1742
+ {
1743
+ "step": 435,
1744
+ "loss": 2.039017677307129
1745
+ },
1746
+ {
1747
+ "step": 436,
1748
+ "loss": 2.4460833072662354
1749
+ },
1750
+ {
1751
+ "step": 437,
1752
+ "loss": 2.5863380432128906
1753
+ },
1754
+ {
1755
+ "step": 438,
1756
+ "loss": 2.5211329460144043
1757
+ },
1758
+ {
1759
+ "step": 439,
1760
+ "loss": 2.0439255237579346
1761
+ },
1762
+ {
1763
+ "step": 440,
1764
+ "loss": 2.083531141281128
1765
+ },
1766
+ {
1767
+ "step": 441,
1768
+ "loss": 2.2036032676696777
1769
+ },
1770
+ {
1771
+ "step": 442,
1772
+ "loss": 2.1617541313171387
1773
+ },
1774
+ {
1775
+ "step": 443,
1776
+ "loss": 2.2706785202026367
1777
+ },
1778
+ {
1779
+ "step": 444,
1780
+ "loss": 2.3687477111816406
1781
+ },
1782
+ {
1783
+ "step": 445,
1784
+ "loss": 2.1419553756713867
1785
+ },
1786
+ {
1787
+ "step": 446,
1788
+ "loss": 2.3326170444488525
1789
+ },
1790
+ {
1791
+ "step": 447,
1792
+ "loss": 2.0808708667755127
1793
+ },
1794
+ {
1795
+ "step": 448,
1796
+ "loss": 2.309194803237915
1797
+ },
1798
+ {
1799
+ "step": 449,
1800
+ "loss": 2.8360342979431152
1801
+ },
1802
+ {
1803
+ "step": 450,
1804
+ "loss": 2.3126049041748047
1805
+ },
1806
+ {
1807
+ "step": 451,
1808
+ "loss": 2.2485318183898926
1809
+ },
1810
+ {
1811
+ "step": 452,
1812
+ "loss": 2.6139726638793945
1813
+ },
1814
+ {
1815
+ "step": 453,
1816
+ "loss": 2.174654483795166
1817
+ },
1818
+ {
1819
+ "step": 454,
1820
+ "loss": 2.4408035278320312
1821
+ },
1822
+ {
1823
+ "step": 455,
1824
+ "loss": 2.3054635524749756
1825
+ },
1826
+ {
1827
+ "step": 456,
1828
+ "loss": 2.500479221343994
1829
+ },
1830
+ {
1831
+ "step": 457,
1832
+ "loss": 2.712820053100586
1833
+ },
1834
+ {
1835
+ "step": 458,
1836
+ "loss": 2.3475780487060547
1837
+ },
1838
+ {
1839
+ "step": 459,
1840
+ "loss": 2.476759910583496
1841
+ },
1842
+ {
1843
+ "step": 460,
1844
+ "loss": 2.163086175918579
1845
+ },
1846
+ {
1847
+ "step": 461,
1848
+ "loss": 2.1306872367858887
1849
+ },
1850
+ {
1851
+ "step": 462,
1852
+ "loss": 2.569213390350342
1853
+ },
1854
+ {
1855
+ "step": 463,
1856
+ "loss": 1.9032127857208252
1857
+ },
1858
+ {
1859
+ "step": 464,
1860
+ "loss": 2.670799493789673
1861
+ },
1862
+ {
1863
+ "step": 465,
1864
+ "loss": 2.116924285888672
1865
+ },
1866
+ {
1867
+ "step": 466,
1868
+ "loss": 2.200054883956909
1869
+ },
1870
+ {
1871
+ "step": 467,
1872
+ "loss": 2.726794719696045
1873
+ },
1874
+ {
1875
+ "step": 468,
1876
+ "loss": 2.4743218421936035
1877
+ },
1878
+ {
1879
+ "step": 469,
1880
+ "loss": 2.1093218326568604
1881
+ },
1882
+ {
1883
+ "step": 470,
1884
+ "loss": 1.994795322418213
1885
+ },
1886
+ {
1887
+ "step": 471,
1888
+ "loss": 2.4643502235412598
1889
+ },
1890
+ {
1891
+ "step": 472,
1892
+ "loss": 2.4895074367523193
1893
+ },
1894
+ {
1895
+ "step": 473,
1896
+ "loss": 2.212019920349121
1897
+ },
1898
+ {
1899
+ "step": 474,
1900
+ "loss": 1.9118317365646362
1901
+ },
1902
+ {
1903
+ "step": 475,
1904
+ "loss": 1.9181571006774902
1905
+ },
1906
+ {
1907
+ "step": 476,
1908
+ "loss": 2.6781809329986572
1909
+ },
1910
+ {
1911
+ "step": 477,
1912
+ "loss": 1.9821468591690063
1913
+ },
1914
+ {
1915
+ "step": 478,
1916
+ "loss": 2.641598701477051
1917
+ },
1918
+ {
1919
+ "step": 479,
1920
+ "loss": 2.110565185546875
1921
+ },
1922
+ {
1923
+ "step": 480,
1924
+ "loss": 2.528163194656372
1925
+ },
1926
+ {
1927
+ "step": 481,
1928
+ "loss": 2.2186732292175293
1929
+ },
1930
+ {
1931
+ "step": 482,
1932
+ "loss": 1.94599187374115
1933
+ },
1934
+ {
1935
+ "step": 483,
1936
+ "loss": 2.3718581199645996
1937
+ },
1938
+ {
1939
+ "step": 484,
1940
+ "loss": 2.222639560699463
1941
+ },
1942
+ {
1943
+ "step": 485,
1944
+ "loss": 2.4093661308288574
1945
+ },
1946
+ {
1947
+ "step": 486,
1948
+ "loss": 2.54209041595459
1949
+ },
1950
+ {
1951
+ "step": 487,
1952
+ "loss": 2.024200201034546
1953
+ },
1954
+ {
1955
+ "step": 488,
1956
+ "loss": 2.5153119564056396
1957
+ },
1958
+ {
1959
+ "step": 489,
1960
+ "loss": 1.658121943473816
1961
+ },
1962
+ {
1963
+ "step": 490,
1964
+ "loss": 2.2563576698303223
1965
+ },
1966
+ {
1967
+ "step": 491,
1968
+ "loss": 2.3844380378723145
1969
+ },
1970
+ {
1971
+ "step": 492,
1972
+ "loss": 2.1449241638183594
1973
+ },
1974
+ {
1975
+ "step": 493,
1976
+ "loss": 2.2108402252197266
1977
+ },
1978
+ {
1979
+ "step": 494,
1980
+ "loss": 2.344649314880371
1981
+ },
1982
+ {
1983
+ "step": 495,
1984
+ "loss": 2.548719644546509
1985
+ },
1986
+ {
1987
+ "step": 496,
1988
+ "loss": 1.7746530771255493
1989
+ },
1990
+ {
1991
+ "step": 497,
1992
+ "loss": 2.309767246246338
1993
+ },
1994
+ {
1995
+ "step": 498,
1996
+ "loss": 2.0731115341186523
1997
+ },
1998
+ {
1999
+ "step": 499,
2000
+ "loss": 2.5398313999176025
2001
+ },
2002
+ {
2003
+ "step": 500,
2004
+ "loss": 2.091824769973755
2005
+ },
2006
+ {
2007
+ "step": 501,
2008
+ "loss": 1.9239593744277954
2009
+ },
2010
+ {
2011
+ "step": 502,
2012
+ "loss": 1.9768168926239014
2013
+ },
2014
+ {
2015
+ "step": 503,
2016
+ "loss": 2.260188341140747
2017
+ },
2018
+ {
2019
+ "step": 504,
2020
+ "loss": 2.553421974182129
2021
+ },
2022
+ {
2023
+ "step": 505,
2024
+ "loss": 2.4699223041534424
2025
+ },
2026
+ {
2027
+ "step": 506,
2028
+ "loss": 2.630557060241699
2029
+ },
2030
+ {
2031
+ "step": 507,
2032
+ "loss": 2.0340492725372314
2033
+ },
2034
+ {
2035
+ "step": 508,
2036
+ "loss": 2.028682231903076
2037
+ },
2038
+ {
2039
+ "step": 509,
2040
+ "loss": 2.45908260345459
2041
+ },
2042
+ {
2043
+ "step": 510,
2044
+ "loss": 2.2142536640167236
2045
+ },
2046
+ {
2047
+ "step": 511,
2048
+ "loss": 2.4662668704986572
2049
+ },
2050
+ {
2051
+ "step": 512,
2052
+ "loss": 2.27579927444458
2053
+ },
2054
+ {
2055
+ "step": 513,
2056
+ "loss": 2.2575185298919678
2057
+ },
2058
+ {
2059
+ "step": 514,
2060
+ "loss": 2.6080620288848877
2061
+ },
2062
+ {
2063
+ "step": 515,
2064
+ "loss": 2.5972297191619873
2065
+ },
2066
+ {
2067
+ "step": 516,
2068
+ "loss": 2.1600301265716553
2069
+ },
2070
+ {
2071
+ "step": 517,
2072
+ "loss": 1.9268064498901367
2073
+ },
2074
+ {
2075
+ "step": 518,
2076
+ "loss": 2.278988838195801
2077
+ },
2078
+ {
2079
+ "step": 519,
2080
+ "loss": 2.4084134101867676
2081
+ },
2082
+ {
2083
+ "step": 520,
2084
+ "loss": 2.7133266925811768
2085
+ },
2086
+ {
2087
+ "step": 521,
2088
+ "loss": 2.123317003250122
2089
+ },
2090
+ {
2091
+ "step": 522,
2092
+ "loss": 2.0050742626190186
2093
+ },
2094
+ {
2095
+ "step": 523,
2096
+ "loss": 2.311730146408081
2097
+ },
2098
+ {
2099
+ "step": 524,
2100
+ "loss": 2.100144624710083
2101
+ },
2102
+ {
2103
+ "step": 525,
2104
+ "loss": 2.182567834854126
2105
+ },
2106
+ {
2107
+ "step": 526,
2108
+ "loss": 2.6850223541259766
2109
+ },
2110
+ {
2111
+ "step": 527,
2112
+ "loss": 2.64558482170105
2113
+ },
2114
+ {
2115
+ "step": 528,
2116
+ "loss": 2.065207004547119
2117
+ },
2118
+ {
2119
+ "step": 529,
2120
+ "loss": 2.57641339302063
2121
+ },
2122
+ {
2123
+ "step": 530,
2124
+ "loss": 2.37033748626709
2125
+ },
2126
+ {
2127
+ "step": 531,
2128
+ "loss": 2.3202273845672607
2129
+ },
2130
+ {
2131
+ "step": 532,
2132
+ "loss": 2.5949063301086426
2133
+ },
2134
+ {
2135
+ "step": 533,
2136
+ "loss": 2.621664047241211
2137
+ },
2138
+ {
2139
+ "step": 534,
2140
+ "loss": 2.4353041648864746
2141
+ },
2142
+ {
2143
+ "step": 535,
2144
+ "loss": 2.0931382179260254
2145
+ },
2146
+ {
2147
+ "step": 536,
2148
+ "loss": 2.1506476402282715
2149
+ },
2150
+ {
2151
+ "step": 537,
2152
+ "loss": 2.0098910331726074
2153
+ },
2154
+ {
2155
+ "step": 538,
2156
+ "loss": 1.8340765237808228
2157
+ },
2158
+ {
2159
+ "step": 539,
2160
+ "loss": 2.3008437156677246
2161
+ },
2162
+ {
2163
+ "step": 540,
2164
+ "loss": 2.4273364543914795
2165
+ },
2166
+ {
2167
+ "step": 541,
2168
+ "loss": 2.4804060459136963
2169
+ },
2170
+ {
2171
+ "step": 542,
2172
+ "loss": 2.25795841217041
2173
+ },
2174
+ {
2175
+ "step": 543,
2176
+ "loss": 2.357149600982666
2177
+ },
2178
+ {
2179
+ "step": 544,
2180
+ "loss": 2.1500396728515625
2181
+ },
2182
+ {
2183
+ "step": 545,
2184
+ "loss": 2.459463596343994
2185
+ },
2186
+ {
2187
+ "step": 546,
2188
+ "loss": 2.2286086082458496
2189
+ },
2190
+ {
2191
+ "step": 547,
2192
+ "loss": 2.4219624996185303
2193
+ },
2194
+ {
2195
+ "step": 548,
2196
+ "loss": 2.686821222305298
2197
+ },
2198
+ {
2199
+ "step": 549,
2200
+ "loss": 2.2649004459381104
2201
+ },
2202
+ {
2203
+ "step": 550,
2204
+ "loss": 2.307349920272827
2205
+ },
2206
+ {
2207
+ "step": 551,
2208
+ "loss": 1.8991062641143799
2209
+ },
2210
+ {
2211
+ "step": 552,
2212
+ "loss": 1.9229987859725952
2213
+ },
2214
+ {
2215
+ "step": 553,
2216
+ "loss": 2.5056543350219727
2217
+ },
2218
+ {
2219
+ "step": 554,
2220
+ "loss": 2.1609060764312744
2221
+ },
2222
+ {
2223
+ "step": 555,
2224
+ "loss": 1.9778512716293335
2225
+ },
2226
+ {
2227
+ "step": 556,
2228
+ "loss": 2.471957206726074
2229
+ },
2230
+ {
2231
+ "step": 557,
2232
+ "loss": 1.8614418506622314
2233
+ },
2234
+ {
2235
+ "step": 558,
2236
+ "loss": 2.335939884185791
2237
+ },
2238
+ {
2239
+ "step": 559,
2240
+ "loss": 1.712602972984314
2241
+ },
2242
+ {
2243
+ "step": 560,
2244
+ "loss": 2.4900341033935547
2245
+ },
2246
+ {
2247
+ "step": 561,
2248
+ "loss": 2.3448946475982666
2249
+ },
2250
+ {
2251
+ "step": 562,
2252
+ "loss": 2.333690643310547
2253
+ },
2254
+ {
2255
+ "step": 563,
2256
+ "loss": 2.3033447265625
2257
+ },
2258
+ {
2259
+ "step": 564,
2260
+ "loss": 1.985489010810852
2261
+ },
2262
+ {
2263
+ "step": 565,
2264
+ "loss": 2.1400845050811768
2265
+ },
2266
+ {
2267
+ "step": 566,
2268
+ "loss": 2.6713786125183105
2269
+ },
2270
+ {
2271
+ "step": 567,
2272
+ "loss": 2.2288951873779297
2273
+ },
2274
+ {
2275
+ "step": 568,
2276
+ "loss": 1.8685835599899292
2277
+ },
2278
+ {
2279
+ "step": 569,
2280
+ "loss": 1.8806357383728027
2281
+ },
2282
+ {
2283
+ "step": 570,
2284
+ "loss": 2.147825241088867
2285
+ },
2286
+ {
2287
+ "step": 571,
2288
+ "loss": 1.928283452987671
2289
+ },
2290
+ {
2291
+ "step": 572,
2292
+ "loss": 1.8230233192443848
2293
+ },
2294
+ {
2295
+ "step": 573,
2296
+ "loss": 1.8360440731048584
2297
+ },
2298
+ {
2299
+ "step": 574,
2300
+ "loss": 2.6959915161132812
2301
+ },
2302
+ {
2303
+ "step": 575,
2304
+ "loss": 1.9693267345428467
2305
+ },
2306
+ {
2307
+ "step": 576,
2308
+ "loss": 2.7600269317626953
2309
+ },
2310
+ {
2311
+ "step": 577,
2312
+ "loss": 2.2720563411712646
2313
+ },
2314
+ {
2315
+ "step": 578,
2316
+ "loss": 2.299776077270508
2317
+ },
2318
+ {
2319
+ "step": 579,
2320
+ "loss": 2.212860584259033
2321
+ },
2322
+ {
2323
+ "step": 580,
2324
+ "loss": 2.3061680793762207
2325
+ },
2326
+ {
2327
+ "step": 581,
2328
+ "loss": 2.2603089809417725
2329
+ },
2330
+ {
2331
+ "step": 582,
2332
+ "loss": 2.0869574546813965
2333
+ },
2334
+ {
2335
+ "step": 583,
2336
+ "loss": 2.23502254486084
2337
+ },
2338
+ {
2339
+ "step": 584,
2340
+ "loss": 2.2090988159179688
2341
+ },
2342
+ {
2343
+ "step": 585,
2344
+ "loss": 2.244767427444458
2345
+ },
2346
+ {
2347
+ "step": 586,
2348
+ "loss": 2.256420135498047
2349
+ },
2350
+ {
2351
+ "step": 587,
2352
+ "loss": 1.9098711013793945
2353
+ },
2354
+ {
2355
+ "step": 588,
2356
+ "loss": 2.3755404949188232
2357
+ },
2358
+ {
2359
+ "step": 589,
2360
+ "loss": 2.6855807304382324
2361
+ },
2362
+ {
2363
+ "step": 590,
2364
+ "loss": 2.460073471069336
2365
+ },
2366
+ {
2367
+ "step": 591,
2368
+ "loss": 1.8837049007415771
2369
+ },
2370
+ {
2371
+ "step": 592,
2372
+ "loss": 2.081373929977417
2373
+ },
2374
+ {
2375
+ "step": 593,
2376
+ "loss": 2.1925439834594727
2377
+ },
2378
+ {
2379
+ "step": 594,
2380
+ "loss": 1.9564194679260254
2381
+ },
2382
+ {
2383
+ "step": 595,
2384
+ "loss": 2.205615758895874
2385
+ },
2386
+ {
2387
+ "step": 596,
2388
+ "loss": 2.478692054748535
2389
+ },
2390
+ {
2391
+ "step": 597,
2392
+ "loss": 2.0080032348632812
2393
+ },
2394
+ {
2395
+ "step": 598,
2396
+ "loss": 2.469820976257324
2397
+ },
2398
+ {
2399
+ "step": 599,
2400
+ "loss": 1.8856621980667114
2401
+ },
2402
+ {
2403
+ "step": 600,
2404
+ "loss": 1.6023671627044678
2405
+ },
2406
+ {
2407
+ "step": 601,
2408
+ "loss": 2.1479015350341797
2409
+ },
2410
+ {
2411
+ "step": 602,
2412
+ "loss": 2.306637763977051
2413
+ },
2414
+ {
2415
+ "step": 603,
2416
+ "loss": 2.2650392055511475
2417
+ },
2418
+ {
2419
+ "step": 604,
2420
+ "loss": 2.517967939376831
2421
+ },
2422
+ {
2423
+ "step": 605,
2424
+ "loss": 2.248115062713623
2425
+ },
2426
+ {
2427
+ "step": 606,
2428
+ "loss": 2.1899242401123047
2429
+ },
2430
+ {
2431
+ "step": 607,
2432
+ "loss": 2.3952863216400146
2433
+ },
2434
+ {
2435
+ "step": 608,
2436
+ "loss": 2.0763449668884277
2437
+ },
2438
+ {
2439
+ "step": 609,
2440
+ "loss": 2.3016607761383057
2441
+ },
2442
+ {
2443
+ "step": 610,
2444
+ "loss": 2.283357858657837
2445
+ },
2446
+ {
2447
+ "step": 611,
2448
+ "loss": 1.9581166505813599
2449
+ },
2450
+ {
2451
+ "step": 612,
2452
+ "loss": 2.4603822231292725
2453
+ },
2454
+ {
2455
+ "step": 613,
2456
+ "loss": 2.20369553565979
2457
+ },
2458
+ {
2459
+ "step": 614,
2460
+ "loss": 2.3975698947906494
2461
+ },
2462
+ {
2463
+ "step": 615,
2464
+ "loss": 2.3169641494750977
2465
+ },
2466
+ {
2467
+ "step": 616,
2468
+ "loss": 2.176382303237915
2469
+ },
2470
+ {
2471
+ "step": 617,
2472
+ "loss": 2.343982219696045
2473
+ },
2474
+ {
2475
+ "step": 618,
2476
+ "loss": 1.8763999938964844
2477
+ },
2478
+ {
2479
+ "step": 619,
2480
+ "loss": 2.083078384399414
2481
+ },
2482
+ {
2483
+ "step": 620,
2484
+ "loss": 1.902529239654541
2485
+ },
2486
+ {
2487
+ "step": 621,
2488
+ "loss": 2.0607450008392334
2489
+ },
2490
+ {
2491
+ "step": 622,
2492
+ "loss": 2.078382730484009
2493
+ },
2494
+ {
2495
+ "step": 623,
2496
+ "loss": 2.4523744583129883
2497
+ },
2498
+ {
2499
+ "step": 624,
2500
+ "loss": 2.1366493701934814
2501
+ },
2502
+ {
2503
+ "step": 625,
2504
+ "loss": 2.0985474586486816
2505
+ },
2506
+ {
2507
+ "step": 626,
2508
+ "loss": 2.5543007850646973
2509
+ },
2510
+ {
2511
+ "step": 627,
2512
+ "loss": 2.5027101039886475
2513
+ },
2514
+ {
2515
+ "step": 628,
2516
+ "loss": 2.8813798427581787
2517
+ },
2518
+ {
2519
+ "step": 629,
2520
+ "loss": 2.3890798091888428
2521
+ },
2522
+ {
2523
+ "step": 630,
2524
+ "loss": 1.9115877151489258
2525
+ },
2526
+ {
2527
+ "step": 631,
2528
+ "loss": 1.8879164457321167
2529
+ },
2530
+ {
2531
+ "step": 632,
2532
+ "loss": 2.415476083755493
2533
+ },
2534
+ {
2535
+ "step": 633,
2536
+ "loss": 2.3512673377990723
2537
+ },
2538
+ {
2539
+ "step": 634,
2540
+ "loss": 2.330165147781372
2541
+ },
2542
+ {
2543
+ "step": 635,
2544
+ "loss": 2.368882179260254
2545
+ },
2546
+ {
2547
+ "step": 636,
2548
+ "loss": 1.8848557472229004
2549
+ },
2550
+ {
2551
+ "step": 637,
2552
+ "loss": 2.5454752445220947
2553
+ },
2554
+ {
2555
+ "step": 638,
2556
+ "loss": 2.4458537101745605
2557
+ },
2558
+ {
2559
+ "step": 639,
2560
+ "loss": 2.3046398162841797
2561
+ },
2562
+ {
2563
+ "step": 640,
2564
+ "loss": 2.293977737426758
2565
+ },
2566
+ {
2567
+ "step": 641,
2568
+ "loss": 2.0221903324127197
2569
+ },
2570
+ {
2571
+ "step": 642,
2572
+ "loss": 1.678128719329834
2573
+ },
2574
+ {
2575
+ "step": 643,
2576
+ "loss": 2.55545711517334
2577
+ },
2578
+ {
2579
+ "step": 644,
2580
+ "loss": 2.0510752201080322
2581
+ },
2582
+ {
2583
+ "step": 645,
2584
+ "loss": 1.8273422718048096
2585
+ },
2586
+ {
2587
+ "step": 646,
2588
+ "loss": 2.4667928218841553
2589
+ },
2590
+ {
2591
+ "step": 647,
2592
+ "loss": 2.062159538269043
2593
+ },
2594
+ {
2595
+ "step": 648,
2596
+ "loss": 1.8708369731903076
2597
+ },
2598
+ {
2599
+ "step": 649,
2600
+ "loss": 1.8367586135864258
2601
+ },
2602
+ {
2603
+ "step": 650,
2604
+ "loss": 2.3304603099823
2605
+ },
2606
+ {
2607
+ "step": 651,
2608
+ "loss": 2.2214672565460205
2609
+ },
2610
+ {
2611
+ "step": 652,
2612
+ "loss": 2.156398057937622
2613
+ },
2614
+ {
2615
+ "step": 653,
2616
+ "loss": 1.802478551864624
2617
+ },
2618
+ {
2619
+ "step": 654,
2620
+ "loss": 2.1194801330566406
2621
+ },
2622
+ {
2623
+ "step": 655,
2624
+ "loss": 1.832618236541748
2625
+ },
2626
+ {
2627
+ "step": 656,
2628
+ "loss": 2.7607004642486572
2629
+ },
2630
+ {
2631
+ "step": 657,
2632
+ "loss": 1.5378355979919434
2633
+ },
2634
+ {
2635
+ "step": 658,
2636
+ "loss": 2.871095895767212
2637
+ },
2638
+ {
2639
+ "step": 659,
2640
+ "loss": 2.1772589683532715
2641
+ },
2642
+ {
2643
+ "step": 660,
2644
+ "loss": 2.378739356994629
2645
+ },
2646
+ {
2647
+ "step": 661,
2648
+ "loss": 1.9543912410736084
2649
+ },
2650
+ {
2651
+ "step": 662,
2652
+ "loss": 1.7253490686416626
2653
+ },
2654
+ {
2655
+ "step": 663,
2656
+ "loss": 2.3326663970947266
2657
+ },
2658
+ {
2659
+ "step": 664,
2660
+ "loss": 2.0331671237945557
2661
+ },
2662
+ {
2663
+ "step": 665,
2664
+ "loss": 2.8661580085754395
2665
+ },
2666
+ {
2667
+ "step": 666,
2668
+ "loss": 2.4486398696899414
2669
+ },
2670
+ {
2671
+ "step": 667,
2672
+ "loss": 2.2856521606445312
2673
+ },
2674
+ {
2675
+ "step": 668,
2676
+ "loss": 2.0959157943725586
2677
+ },
2678
+ {
2679
+ "step": 669,
2680
+ "loss": 1.828498363494873
2681
+ },
2682
+ {
2683
+ "step": 670,
2684
+ "loss": 2.580878257751465
2685
+ },
2686
+ {
2687
+ "step": 671,
2688
+ "loss": 2.111854076385498
2689
+ },
2690
+ {
2691
+ "step": 672,
2692
+ "loss": 2.3081603050231934
2693
+ },
2694
+ {
2695
+ "step": 673,
2696
+ "loss": 2.1535303592681885
2697
+ },
2698
+ {
2699
+ "step": 674,
2700
+ "loss": 2.4697322845458984
2701
+ },
2702
+ {
2703
+ "step": 675,
2704
+ "loss": 1.8599785566329956
2705
+ },
2706
+ {
2707
+ "step": 676,
2708
+ "loss": 2.156494140625
2709
+ },
2710
+ {
2711
+ "step": 677,
2712
+ "loss": 2.1473135948181152
2713
+ },
2714
+ {
2715
+ "step": 678,
2716
+ "loss": 1.5099081993103027
2717
+ },
2718
+ {
2719
+ "step": 679,
2720
+ "loss": 2.241101026535034
2721
+ },
2722
+ {
2723
+ "step": 680,
2724
+ "loss": 2.242471694946289
2725
+ },
2726
+ {
2727
+ "step": 681,
2728
+ "loss": 2.042699098587036
2729
+ },
2730
+ {
2731
+ "step": 682,
2732
+ "loss": 2.1123008728027344
2733
+ },
2734
+ {
2735
+ "step": 683,
2736
+ "loss": 2.017486095428467
2737
+ },
2738
+ {
2739
+ "step": 684,
2740
+ "loss": 2.0131030082702637
2741
+ },
2742
+ {
2743
+ "step": 685,
2744
+ "loss": 1.8260565996170044
2745
+ },
2746
+ {
2747
+ "step": 686,
2748
+ "loss": 1.8099098205566406
2749
+ },
2750
+ {
2751
+ "step": 687,
2752
+ "loss": 1.9493796825408936
2753
+ },
2754
+ {
2755
+ "step": 688,
2756
+ "loss": 1.7958455085754395
2757
+ },
2758
+ {
2759
+ "step": 689,
2760
+ "loss": 2.12551212310791
2761
+ },
2762
+ {
2763
+ "step": 690,
2764
+ "loss": 1.8851398229599
2765
+ },
2766
+ {
2767
+ "step": 691,
2768
+ "loss": 2.169377326965332
2769
+ },
2770
+ {
2771
+ "step": 692,
2772
+ "loss": 2.345599412918091
2773
+ },
2774
+ {
2775
+ "step": 693,
2776
+ "loss": 2.6371800899505615
2777
+ },
2778
+ {
2779
+ "step": 694,
2780
+ "loss": 2.054779291152954
2781
+ },
2782
+ {
2783
+ "step": 695,
2784
+ "loss": 1.8875532150268555
2785
+ },
2786
+ {
2787
+ "step": 696,
2788
+ "loss": 1.899794101715088
2789
+ },
2790
+ {
2791
+ "step": 697,
2792
+ "loss": 1.9862229824066162
2793
+ },
2794
+ {
2795
+ "step": 698,
2796
+ "loss": 2.069486141204834
2797
+ },
2798
+ {
2799
+ "step": 699,
2800
+ "loss": 2.5258560180664062
2801
+ },
2802
+ {
2803
+ "step": 700,
2804
+ "loss": 2.138136863708496
2805
+ },
2806
+ {
2807
+ "step": 701,
2808
+ "loss": 1.7787747383117676
2809
+ },
2810
+ {
2811
+ "step": 702,
2812
+ "loss": 2.3944613933563232
2813
+ },
2814
+ {
2815
+ "step": 703,
2816
+ "loss": 2.2432310581207275
2817
+ },
2818
+ {
2819
+ "step": 704,
2820
+ "loss": 2.23433780670166
2821
+ },
2822
+ {
2823
+ "step": 705,
2824
+ "loss": 2.3525569438934326
2825
+ },
2826
+ {
2827
+ "step": 706,
2828
+ "loss": 1.683660626411438
2829
+ },
2830
+ {
2831
+ "step": 707,
2832
+ "loss": 1.928051233291626
2833
+ },
2834
+ {
2835
+ "step": 708,
2836
+ "loss": 2.214559316635132
2837
+ },
2838
+ {
2839
+ "step": 709,
2840
+ "loss": 2.444596290588379
2841
+ },
2842
+ {
2843
+ "step": 710,
2844
+ "loss": 2.5637311935424805
2845
+ },
2846
+ {
2847
+ "step": 711,
2848
+ "loss": 2.094400405883789
2849
+ },
2850
+ {
2851
+ "step": 712,
2852
+ "loss": 2.1752796173095703
2853
+ },
2854
+ {
2855
+ "step": 713,
2856
+ "loss": 2.1646933555603027
2857
+ },
2858
+ {
2859
+ "step": 714,
2860
+ "loss": 2.3239498138427734
2861
+ },
2862
+ {
2863
+ "step": 715,
2864
+ "loss": 2.528728485107422
2865
+ },
2866
+ {
2867
+ "step": 716,
2868
+ "loss": 1.7567914724349976
2869
+ },
2870
+ {
2871
+ "step": 717,
2872
+ "loss": 1.8295328617095947
2873
+ },
2874
+ {
2875
+ "step": 718,
2876
+ "loss": 2.579841375350952
2877
+ },
2878
+ {
2879
+ "step": 719,
2880
+ "loss": 1.9017343521118164
2881
+ },
2882
+ {
2883
+ "step": 720,
2884
+ "loss": 2.507222890853882
2885
+ },
2886
+ {
2887
+ "step": 721,
2888
+ "loss": 2.127558946609497
2889
+ },
2890
+ {
2891
+ "step": 722,
2892
+ "loss": 2.1579627990722656
2893
+ },
2894
+ {
2895
+ "step": 723,
2896
+ "loss": 1.957413673400879
2897
+ },
2898
+ {
2899
+ "step": 724,
2900
+ "loss": 1.7173194885253906
2901
+ },
2902
+ {
2903
+ "step": 725,
2904
+ "loss": 1.8139698505401611
2905
+ },
2906
+ {
2907
+ "step": 726,
2908
+ "loss": 2.3142149448394775
2909
+ },
2910
+ {
2911
+ "step": 727,
2912
+ "loss": 2.4957833290100098
2913
+ },
2914
+ {
2915
+ "step": 728,
2916
+ "loss": 2.096470832824707
2917
+ },
2918
+ {
2919
+ "step": 729,
2920
+ "loss": 2.1391425132751465
2921
+ },
2922
+ {
2923
+ "step": 730,
2924
+ "loss": 2.0562264919281006
2925
+ },
2926
+ {
2927
+ "step": 731,
2928
+ "loss": 1.704184651374817
2929
+ },
2930
+ {
2931
+ "step": 732,
2932
+ "loss": 2.186826467514038
2933
+ },
2934
+ {
2935
+ "step": 733,
2936
+ "loss": 2.098335027694702
2937
+ },
2938
+ {
2939
+ "step": 734,
2940
+ "loss": 1.9378281831741333
2941
+ },
2942
+ {
2943
+ "step": 735,
2944
+ "loss": 1.9070260524749756
2945
+ },
2946
+ {
2947
+ "step": 736,
2948
+ "loss": 2.5211658477783203
2949
+ },
2950
+ {
2951
+ "step": 737,
2952
+ "loss": 1.8523521423339844
2953
+ },
2954
+ {
2955
+ "step": 738,
2956
+ "loss": 2.3545069694519043
2957
+ },
2958
+ {
2959
+ "step": 739,
2960
+ "loss": 1.715818166732788
2961
+ },
2962
+ {
2963
+ "step": 740,
2964
+ "loss": 1.9143247604370117
2965
+ },
2966
+ {
2967
+ "step": 741,
2968
+ "loss": 1.833640456199646
2969
+ },
2970
+ {
2971
+ "step": 742,
2972
+ "loss": 3.0031652450561523
2973
+ },
2974
+ {
2975
+ "step": 743,
2976
+ "loss": 1.5467760562896729
2977
+ },
2978
+ {
2979
+ "step": 744,
2980
+ "loss": 1.8195242881774902
2981
+ },
2982
+ {
2983
+ "step": 745,
2984
+ "loss": 1.785135269165039
2985
+ },
2986
+ {
2987
+ "step": 746,
2988
+ "loss": 2.0208964347839355
2989
+ },
2990
+ {
2991
+ "step": 747,
2992
+ "loss": 1.799407958984375
2993
+ },
2994
+ {
2995
+ "step": 748,
2996
+ "loss": 2.357728958129883
2997
+ },
2998
+ {
2999
+ "step": 749,
3000
+ "loss": 2.19157338142395
3001
+ },
3002
+ {
3003
+ "step": 750,
3004
+ "loss": 1.7044637203216553
3005
+ },
3006
+ {
3007
+ "step": 751,
3008
+ "loss": 2.1935999393463135
3009
+ },
3010
+ {
3011
+ "step": 752,
3012
+ "loss": 1.8042278289794922
3013
+ },
3014
+ {
3015
+ "step": 753,
3016
+ "loss": 2.340193271636963
3017
+ },
3018
+ {
3019
+ "step": 754,
3020
+ "loss": 1.8830957412719727
3021
+ },
3022
+ {
3023
+ "step": 755,
3024
+ "loss": 2.1636412143707275
3025
+ },
3026
+ {
3027
+ "step": 756,
3028
+ "loss": 2.573277473449707
3029
+ },
3030
+ {
3031
+ "step": 757,
3032
+ "loss": 2.185680866241455
3033
+ },
3034
+ {
3035
+ "step": 758,
3036
+ "loss": 2.005404472351074
3037
+ },
3038
+ {
3039
+ "step": 759,
3040
+ "loss": 2.041130304336548
3041
+ },
3042
+ {
3043
+ "step": 760,
3044
+ "loss": 2.069777250289917
3045
+ },
3046
+ {
3047
+ "step": 761,
3048
+ "loss": 1.942754864692688
3049
+ },
3050
+ {
3051
+ "step": 762,
3052
+ "loss": 2.273555278778076
3053
+ },
3054
+ {
3055
+ "step": 763,
3056
+ "loss": 1.8626675605773926
3057
+ },
3058
+ {
3059
+ "step": 764,
3060
+ "loss": 3.090045690536499
3061
+ },
3062
+ {
3063
+ "step": 765,
3064
+ "loss": 1.6991760730743408
3065
+ },
3066
+ {
3067
+ "step": 766,
3068
+ "loss": 1.9688661098480225
3069
+ },
3070
+ {
3071
+ "step": 767,
3072
+ "loss": 2.0735771656036377
3073
+ },
3074
+ {
3075
+ "step": 768,
3076
+ "loss": 1.9161018133163452
3077
+ },
3078
+ {
3079
+ "step": 769,
3080
+ "loss": 1.935367226600647
3081
+ },
3082
+ {
3083
+ "step": 770,
3084
+ "loss": 2.512490749359131
3085
+ },
3086
+ {
3087
+ "step": 771,
3088
+ "loss": 1.9653754234313965
3089
+ },
3090
+ {
3091
+ "step": 772,
3092
+ "loss": 1.9006037712097168
3093
+ },
3094
+ {
3095
+ "step": 773,
3096
+ "loss": 2.1403775215148926
3097
+ },
3098
+ {
3099
+ "step": 774,
3100
+ "loss": 1.9985692501068115
3101
+ },
3102
+ {
3103
+ "step": 775,
3104
+ "loss": 2.2423832416534424
3105
+ },
3106
+ {
3107
+ "step": 776,
3108
+ "loss": 2.272416114807129
3109
+ },
3110
+ {
3111
+ "step": 777,
3112
+ "loss": 1.6806894540786743
3113
+ },
3114
+ {
3115
+ "step": 778,
3116
+ "loss": 1.6961314678192139
3117
+ },
3118
+ {
3119
+ "step": 779,
3120
+ "loss": 2.070193290710449
3121
+ },
3122
+ {
3123
+ "step": 780,
3124
+ "loss": 2.30169415473938
3125
+ },
3126
+ {
3127
+ "step": 781,
3128
+ "loss": 1.498708963394165
3129
+ },
3130
+ {
3131
+ "step": 782,
3132
+ "loss": 2.672607898712158
3133
+ },
3134
+ {
3135
+ "step": 783,
3136
+ "loss": 2.000545024871826
3137
+ },
3138
+ {
3139
+ "step": 784,
3140
+ "loss": 2.1863222122192383
3141
+ },
3142
+ {
3143
+ "step": 785,
3144
+ "loss": 1.955033302307129
3145
+ },
3146
+ {
3147
+ "step": 786,
3148
+ "loss": 2.0105948448181152
3149
+ },
3150
+ {
3151
+ "step": 787,
3152
+ "loss": 2.3913588523864746
3153
+ },
3154
+ {
3155
+ "step": 788,
3156
+ "loss": 2.0229620933532715
3157
+ },
3158
+ {
3159
+ "step": 789,
3160
+ "loss": 2.0052614212036133
3161
+ },
3162
+ {
3163
+ "step": 790,
3164
+ "loss": 2.718447685241699
3165
+ },
3166
+ {
3167
+ "step": 791,
3168
+ "loss": 2.2307233810424805
3169
+ },
3170
+ {
3171
+ "step": 792,
3172
+ "loss": 2.1480185985565186
3173
+ },
3174
+ {
3175
+ "step": 793,
3176
+ "loss": 2.508347988128662
3177
+ },
3178
+ {
3179
+ "step": 794,
3180
+ "loss": 1.927217960357666
3181
+ },
3182
+ {
3183
+ "step": 795,
3184
+ "loss": 2.075195789337158
3185
+ },
3186
+ {
3187
+ "step": 796,
3188
+ "loss": 2.0269381999969482
3189
+ },
3190
+ {
3191
+ "step": 797,
3192
+ "loss": 1.7403855323791504
3193
+ },
3194
+ {
3195
+ "step": 798,
3196
+ "loss": 2.3028817176818848
3197
+ },
3198
+ {
3199
+ "step": 799,
3200
+ "loss": 2.2278242111206055
3201
+ },
3202
+ {
3203
+ "step": 800,
3204
+ "loss": 2.3212714195251465
3205
+ },
3206
+ {
3207
+ "step": 801,
3208
+ "loss": 2.1449832916259766
3209
+ },
3210
+ {
3211
+ "step": 802,
3212
+ "loss": 1.9621870517730713
3213
+ },
3214
+ {
3215
+ "step": 803,
3216
+ "loss": 2.1465606689453125
3217
+ },
3218
+ {
3219
+ "step": 804,
3220
+ "loss": 2.28023624420166
3221
+ },
3222
+ {
3223
+ "step": 805,
3224
+ "loss": 2.3931326866149902
3225
+ },
3226
+ {
3227
+ "step": 806,
3228
+ "loss": 1.9575012922286987
3229
+ },
3230
+ {
3231
+ "step": 807,
3232
+ "loss": 2.2189478874206543
3233
+ },
3234
+ {
3235
+ "step": 808,
3236
+ "loss": 2.313659906387329
3237
+ },
3238
+ {
3239
+ "step": 809,
3240
+ "loss": 1.785354495048523
3241
+ },
3242
+ {
3243
+ "step": 810,
3244
+ "loss": 2.360384941101074
3245
+ },
3246
+ {
3247
+ "step": 811,
3248
+ "loss": 1.5126988887786865
3249
+ },
3250
+ {
3251
+ "step": 812,
3252
+ "loss": 2.0700507164001465
3253
+ },
3254
+ {
3255
+ "step": 813,
3256
+ "loss": 2.364596128463745
3257
+ },
3258
+ {
3259
+ "step": 814,
3260
+ "loss": 1.7121427059173584
3261
+ },
3262
+ {
3263
+ "step": 815,
3264
+ "loss": 2.4048376083374023
3265
+ },
3266
+ {
3267
+ "step": 816,
3268
+ "loss": 2.1315109729766846
3269
+ },
3270
+ {
3271
+ "step": 817,
3272
+ "loss": 2.0960779190063477
3273
+ },
3274
+ {
3275
+ "step": 818,
3276
+ "loss": 2.1370670795440674
3277
+ },
3278
+ {
3279
+ "step": 819,
3280
+ "loss": 2.2387843132019043
3281
+ },
3282
+ {
3283
+ "step": 820,
3284
+ "loss": 2.6564176082611084
3285
+ },
3286
+ {
3287
+ "step": 821,
3288
+ "loss": 2.3899805545806885
3289
+ },
3290
+ {
3291
+ "step": 822,
3292
+ "loss": 1.8396912813186646
3293
+ },
3294
+ {
3295
+ "step": 823,
3296
+ "loss": 1.849434494972229
3297
+ },
3298
+ {
3299
+ "step": 824,
3300
+ "loss": 2.4848148822784424
3301
+ },
3302
+ {
3303
+ "step": 825,
3304
+ "loss": 2.300788640975952
3305
+ },
3306
+ {
3307
+ "step": 826,
3308
+ "loss": 1.6741901636123657
3309
+ },
3310
+ {
3311
+ "step": 827,
3312
+ "loss": 1.9888312816619873
3313
+ },
3314
+ {
3315
+ "step": 828,
3316
+ "loss": 2.1556782722473145
3317
+ },
3318
+ {
3319
+ "step": 829,
3320
+ "loss": 2.0511889457702637
3321
+ },
3322
+ {
3323
+ "step": 830,
3324
+ "loss": 2.110619068145752
3325
+ },
3326
+ {
3327
+ "step": 831,
3328
+ "loss": 1.8331103324890137
3329
+ },
3330
+ {
3331
+ "step": 832,
3332
+ "loss": 2.0915446281433105
3333
+ },
3334
+ {
3335
+ "step": 833,
3336
+ "loss": 1.3950932025909424
3337
+ },
3338
+ {
3339
+ "step": 834,
3340
+ "loss": 2.5744056701660156
3341
+ },
3342
+ {
3343
+ "step": 835,
3344
+ "loss": 2.351382255554199
3345
+ },
3346
+ {
3347
+ "step": 836,
3348
+ "loss": 2.207592248916626
3349
+ },
3350
+ {
3351
+ "step": 837,
3352
+ "loss": 2.0599913597106934
3353
+ },
3354
+ {
3355
+ "step": 838,
3356
+ "loss": 2.4455690383911133
3357
+ },
3358
+ {
3359
+ "step": 839,
3360
+ "loss": 2.037224769592285
3361
+ },
3362
+ {
3363
+ "step": 840,
3364
+ "loss": 2.1246533393859863
3365
+ },
3366
+ {
3367
+ "step": 841,
3368
+ "loss": 2.539519786834717
3369
+ },
3370
+ {
3371
+ "step": 842,
3372
+ "loss": 2.3089704513549805
3373
+ },
3374
+ {
3375
+ "step": 843,
3376
+ "loss": 1.8031303882598877
3377
+ },
3378
+ {
3379
+ "step": 844,
3380
+ "loss": 2.1725902557373047
3381
+ },
3382
+ {
3383
+ "step": 845,
3384
+ "loss": 1.9818854331970215
3385
+ },
3386
+ {
3387
+ "step": 846,
3388
+ "loss": 2.469529151916504
3389
+ },
3390
+ {
3391
+ "step": 847,
3392
+ "loss": 1.6893788576126099
3393
+ },
3394
+ {
3395
+ "step": 848,
3396
+ "loss": 1.9128904342651367
3397
+ },
3398
+ {
3399
+ "step": 849,
3400
+ "loss": 2.3154168128967285
3401
+ },
3402
+ {
3403
+ "step": 850,
3404
+ "loss": 1.864374041557312
3405
+ },
3406
+ {
3407
+ "step": 851,
3408
+ "loss": 2.139346122741699
3409
+ },
3410
+ {
3411
+ "step": 852,
3412
+ "loss": 1.9899048805236816
3413
+ },
3414
+ {
3415
+ "step": 853,
3416
+ "loss": 1.8425148725509644
3417
+ },
3418
+ {
3419
+ "step": 854,
3420
+ "loss": 2.196641445159912
3421
+ },
3422
+ {
3423
+ "step": 855,
3424
+ "loss": 2.084127187728882
3425
+ },
3426
+ {
3427
+ "step": 856,
3428
+ "loss": 2.589137077331543
3429
+ },
3430
+ {
3431
+ "step": 857,
3432
+ "loss": 1.9049241542816162
3433
+ },
3434
+ {
3435
+ "step": 858,
3436
+ "loss": 2.1088719367980957
3437
+ },
3438
+ {
3439
+ "step": 859,
3440
+ "loss": 1.8666791915893555
3441
+ },
3442
+ {
3443
+ "step": 860,
3444
+ "loss": 2.291273355484009
3445
+ },
3446
+ {
3447
+ "step": 861,
3448
+ "loss": 2.7720913887023926
3449
+ },
3450
+ {
3451
+ "step": 862,
3452
+ "loss": 2.0325875282287598
3453
+ },
3454
+ {
3455
+ "step": 863,
3456
+ "loss": 2.1262521743774414
3457
+ },
3458
+ {
3459
+ "step": 864,
3460
+ "loss": 2.1930947303771973
3461
+ },
3462
+ {
3463
+ "step": 865,
3464
+ "loss": 2.0483975410461426
3465
+ },
3466
+ {
3467
+ "step": 866,
3468
+ "loss": 2.1810200214385986
3469
+ },
3470
+ {
3471
+ "step": 867,
3472
+ "loss": 2.0406017303466797
3473
+ },
3474
+ {
3475
+ "step": 868,
3476
+ "loss": 1.9476172924041748
3477
+ },
3478
+ {
3479
+ "step": 869,
3480
+ "loss": 2.3409388065338135
3481
+ },
3482
+ {
3483
+ "step": 870,
3484
+ "loss": 2.2193973064422607
3485
+ },
3486
+ {
3487
+ "step": 871,
3488
+ "loss": 2.135343313217163
3489
+ },
3490
+ {
3491
+ "step": 872,
3492
+ "loss": 2.0815932750701904
3493
+ },
3494
+ {
3495
+ "step": 873,
3496
+ "loss": 2.2342116832733154
3497
+ },
3498
+ {
3499
+ "step": 874,
3500
+ "loss": 1.839571237564087
3501
+ },
3502
+ {
3503
+ "step": 875,
3504
+ "loss": 2.225438356399536
3505
+ },
3506
+ {
3507
+ "step": 876,
3508
+ "loss": 2.303863525390625
3509
+ },
3510
+ {
3511
+ "step": 877,
3512
+ "loss": 1.9251621961593628
3513
+ },
3514
+ {
3515
+ "step": 878,
3516
+ "loss": 2.1342930793762207
3517
+ },
3518
+ {
3519
+ "step": 879,
3520
+ "loss": 2.1234943866729736
3521
+ },
3522
+ {
3523
+ "step": 880,
3524
+ "loss": 2.137087821960449
3525
+ },
3526
+ {
3527
+ "step": 881,
3528
+ "loss": 1.9579668045043945
3529
+ },
3530
+ {
3531
+ "step": 882,
3532
+ "loss": 2.0309898853302
3533
+ },
3534
+ {
3535
+ "step": 883,
3536
+ "loss": 1.799654245376587
3537
+ },
3538
+ {
3539
+ "step": 884,
3540
+ "loss": 2.4847488403320312
3541
+ },
3542
+ {
3543
+ "step": 885,
3544
+ "loss": 2.6662018299102783
3545
+ },
3546
+ {
3547
+ "step": 886,
3548
+ "loss": 1.9268032312393188
3549
+ },
3550
+ {
3551
+ "step": 887,
3552
+ "loss": 2.043844223022461
3553
+ },
3554
+ {
3555
+ "step": 888,
3556
+ "loss": 2.038583278656006
3557
+ },
3558
+ {
3559
+ "step": 889,
3560
+ "loss": 2.393343925476074
3561
+ },
3562
+ {
3563
+ "step": 890,
3564
+ "loss": 2.155910015106201
3565
+ },
3566
+ {
3567
+ "step": 891,
3568
+ "loss": 2.047548532485962
3569
+ },
3570
+ {
3571
+ "step": 892,
3572
+ "loss": 2.4230449199676514
3573
+ },
3574
+ {
3575
+ "step": 893,
3576
+ "loss": 1.7401704788208008
3577
+ },
3578
+ {
3579
+ "step": 894,
3580
+ "loss": 2.0996835231781006
3581
+ },
3582
+ {
3583
+ "step": 895,
3584
+ "loss": 1.96319580078125
3585
+ },
3586
+ {
3587
+ "step": 896,
3588
+ "loss": 1.9458671808242798
3589
+ },
3590
+ {
3591
+ "step": 897,
3592
+ "loss": 2.0543224811553955
3593
+ },
3594
+ {
3595
+ "step": 898,
3596
+ "loss": 2.5579683780670166
3597
+ },
3598
+ {
3599
+ "step": 899,
3600
+ "loss": 2.102567434310913
3601
+ },
3602
+ {
3603
+ "step": 900,
3604
+ "loss": 1.797571063041687
3605
+ },
3606
+ {
3607
+ "step": 901,
3608
+ "loss": 2.612189292907715
3609
+ },
3610
+ {
3611
+ "step": 902,
3612
+ "loss": 1.8275275230407715
3613
+ },
3614
+ {
3615
+ "step": 903,
3616
+ "loss": 2.3661575317382812
3617
+ },
3618
+ {
3619
+ "step": 904,
3620
+ "loss": 2.412741184234619
3621
+ },
3622
+ {
3623
+ "step": 905,
3624
+ "loss": 1.7417240142822266
3625
+ },
3626
+ {
3627
+ "step": 906,
3628
+ "loss": 1.9783049821853638
3629
+ },
3630
+ {
3631
+ "step": 907,
3632
+ "loss": 3.020042896270752
3633
+ },
3634
+ {
3635
+ "step": 908,
3636
+ "loss": 2.264007568359375
3637
+ },
3638
+ {
3639
+ "step": 909,
3640
+ "loss": 2.6521012783050537
3641
+ },
3642
+ {
3643
+ "step": 910,
3644
+ "loss": 1.8450102806091309
3645
+ },
3646
+ {
3647
+ "step": 911,
3648
+ "loss": 2.0339226722717285
3649
+ },
3650
+ {
3651
+ "step": 912,
3652
+ "loss": 1.9741251468658447
3653
+ },
3654
+ {
3655
+ "step": 913,
3656
+ "loss": 2.638288736343384
3657
+ },
3658
+ {
3659
+ "step": 914,
3660
+ "loss": 2.128150463104248
3661
+ },
3662
+ {
3663
+ "step": 915,
3664
+ "loss": 2.2978391647338867
3665
+ },
3666
+ {
3667
+ "step": 916,
3668
+ "loss": 2.329345226287842
3669
+ },
3670
+ {
3671
+ "step": 917,
3672
+ "loss": 1.7687416076660156
3673
+ },
3674
+ {
3675
+ "step": 918,
3676
+ "loss": 1.7877784967422485
3677
+ },
3678
+ {
3679
+ "step": 919,
3680
+ "loss": 2.0238168239593506
3681
+ },
3682
+ {
3683
+ "step": 920,
3684
+ "loss": 2.0090293884277344
3685
+ },
3686
+ {
3687
+ "step": 921,
3688
+ "loss": 2.5923585891723633
3689
+ },
3690
+ {
3691
+ "step": 922,
3692
+ "loss": 2.2417752742767334
3693
+ },
3694
+ {
3695
+ "step": 923,
3696
+ "loss": 2.1116175651550293
3697
+ },
3698
+ {
3699
+ "step": 924,
3700
+ "loss": 1.826296091079712
3701
+ },
3702
+ {
3703
+ "step": 925,
3704
+ "loss": 1.888626217842102
3705
+ },
3706
+ {
3707
+ "step": 926,
3708
+ "loss": 1.9428234100341797
3709
+ },
3710
+ {
3711
+ "step": 927,
3712
+ "loss": 1.937356948852539
3713
+ },
3714
+ {
3715
+ "step": 928,
3716
+ "loss": 2.575594902038574
3717
+ },
3718
+ {
3719
+ "step": 929,
3720
+ "loss": 2.1356945037841797
3721
+ },
3722
+ {
3723
+ "step": 930,
3724
+ "loss": 2.0911166667938232
3725
+ },
3726
+ {
3727
+ "step": 931,
3728
+ "loss": 2.0979466438293457
3729
+ },
3730
+ {
3731
+ "step": 932,
3732
+ "loss": 2.5593225955963135
3733
+ },
3734
+ {
3735
+ "step": 933,
3736
+ "loss": 1.8475861549377441
3737
+ },
3738
+ {
3739
+ "step": 934,
3740
+ "loss": 1.9928505420684814
3741
+ },
3742
+ {
3743
+ "step": 935,
3744
+ "loss": 1.6050671339035034
3745
+ },
3746
+ {
3747
+ "step": 936,
3748
+ "loss": 2.3365602493286133
3749
+ },
3750
+ {
3751
+ "step": 937,
3752
+ "loss": 1.6974786520004272
3753
+ },
3754
+ {
3755
+ "step": 938,
3756
+ "loss": 2.5650625228881836
3757
+ },
3758
+ {
3759
+ "step": 939,
3760
+ "loss": 2.400352954864502
3761
+ },
3762
+ {
3763
+ "step": 940,
3764
+ "loss": 2.04494571685791
3765
+ },
3766
+ {
3767
+ "step": 941,
3768
+ "loss": 1.9382586479187012
3769
+ },
3770
+ {
3771
+ "step": 942,
3772
+ "loss": 2.147663116455078
3773
+ },
3774
+ {
3775
+ "step": 943,
3776
+ "loss": 1.8787052631378174
3777
+ },
3778
+ {
3779
+ "step": 944,
3780
+ "loss": 2.428316593170166
3781
+ },
3782
+ {
3783
+ "step": 945,
3784
+ "loss": 2.1108169555664062
3785
+ },
3786
+ {
3787
+ "step": 946,
3788
+ "loss": 1.6542246341705322
3789
+ },
3790
+ {
3791
+ "step": 947,
3792
+ "loss": 2.0597152709960938
3793
+ },
3794
+ {
3795
+ "step": 948,
3796
+ "loss": 2.3472602367401123
3797
+ },
3798
+ {
3799
+ "step": 949,
3800
+ "loss": 1.8338260650634766
3801
+ },
3802
+ {
3803
+ "step": 950,
3804
+ "loss": 1.7510230541229248
3805
+ },
3806
+ {
3807
+ "step": 951,
3808
+ "loss": 1.7876065969467163
3809
+ },
3810
+ {
3811
+ "step": 952,
3812
+ "loss": 2.431952714920044
3813
+ },
3814
+ {
3815
+ "step": 953,
3816
+ "loss": 1.9844751358032227
3817
+ },
3818
+ {
3819
+ "step": 954,
3820
+ "loss": 1.6035586595535278
3821
+ },
3822
+ {
3823
+ "step": 955,
3824
+ "loss": 2.2497174739837646
3825
+ },
3826
+ {
3827
+ "step": 956,
3828
+ "loss": 2.1397483348846436
3829
+ },
3830
+ {
3831
+ "step": 957,
3832
+ "loss": 2.418480396270752
3833
+ },
3834
+ {
3835
+ "step": 958,
3836
+ "loss": 2.0681729316711426
3837
+ },
3838
+ {
3839
+ "step": 959,
3840
+ "loss": 2.1492745876312256
3841
+ },
3842
+ {
3843
+ "step": 960,
3844
+ "loss": 2.292433023452759
3845
+ },
3846
+ {
3847
+ "step": 961,
3848
+ "loss": 1.993412733078003
3849
+ },
3850
+ {
3851
+ "step": 962,
3852
+ "loss": 1.9851655960083008
3853
+ },
3854
+ {
3855
+ "step": 963,
3856
+ "loss": 2.1893622875213623
3857
+ },
3858
+ {
3859
+ "step": 964,
3860
+ "loss": 2.258875608444214
3861
+ },
3862
+ {
3863
+ "step": 965,
3864
+ "loss": 2.1283998489379883
3865
+ },
3866
+ {
3867
+ "step": 966,
3868
+ "loss": 1.8134756088256836
3869
+ },
3870
+ {
3871
+ "step": 967,
3872
+ "loss": 1.8318551778793335
3873
+ },
3874
+ {
3875
+ "step": 968,
3876
+ "loss": 2.4340434074401855
3877
+ },
3878
+ {
3879
+ "step": 969,
3880
+ "loss": 1.9633982181549072
3881
+ },
3882
+ {
3883
+ "step": 970,
3884
+ "loss": 2.085658311843872
3885
+ },
3886
+ {
3887
+ "step": 971,
3888
+ "loss": 1.3723973035812378
3889
+ },
3890
+ {
3891
+ "step": 972,
3892
+ "loss": 3.041292667388916
3893
+ },
3894
+ {
3895
+ "step": 973,
3896
+ "loss": 2.3183510303497314
3897
+ },
3898
+ {
3899
+ "step": 974,
3900
+ "loss": 1.9262609481811523
3901
+ },
3902
+ {
3903
+ "step": 975,
3904
+ "loss": 2.1205694675445557
3905
+ },
3906
+ {
3907
+ "step": 976,
3908
+ "loss": 1.4980692863464355
3909
+ },
3910
+ {
3911
+ "step": 977,
3912
+ "loss": 2.5546534061431885
3913
+ },
3914
+ {
3915
+ "step": 978,
3916
+ "loss": 2.7014734745025635
3917
+ },
3918
+ {
3919
+ "step": 979,
3920
+ "loss": 1.676489233970642
3921
+ },
3922
+ {
3923
+ "step": 980,
3924
+ "loss": 1.5694572925567627
3925
+ },
3926
+ {
3927
+ "step": 981,
3928
+ "loss": 2.120713233947754
3929
+ },
3930
+ {
3931
+ "step": 982,
3932
+ "loss": 2.21758770942688
3933
+ },
3934
+ {
3935
+ "step": 983,
3936
+ "loss": 1.9932773113250732
3937
+ },
3938
+ {
3939
+ "step": 984,
3940
+ "loss": 2.172217607498169
3941
+ },
3942
+ {
3943
+ "step": 985,
3944
+ "loss": 1.980347990989685
3945
+ },
3946
+ {
3947
+ "step": 986,
3948
+ "loss": 2.1737043857574463
3949
+ },
3950
+ {
3951
+ "step": 987,
3952
+ "loss": 2.1837902069091797
3953
+ },
3954
+ {
3955
+ "step": 988,
3956
+ "loss": 1.7776117324829102
3957
+ },
3958
+ {
3959
+ "step": 989,
3960
+ "loss": 2.1192994117736816
3961
+ },
3962
+ {
3963
+ "step": 990,
3964
+ "loss": 1.7178640365600586
3965
+ },
3966
+ {
3967
+ "step": 991,
3968
+ "loss": 2.1105740070343018
3969
+ },
3970
+ {
3971
+ "step": 992,
3972
+ "loss": 1.9493019580841064
3973
+ },
3974
+ {
3975
+ "step": 993,
3976
+ "loss": 2.4504644870758057
3977
+ },
3978
+ {
3979
+ "step": 994,
3980
+ "loss": 2.0112550258636475
3981
+ },
3982
+ {
3983
+ "step": 995,
3984
+ "loss": 2.2686667442321777
3985
+ },
3986
+ {
3987
+ "step": 996,
3988
+ "loss": 2.4370152950286865
3989
+ },
3990
+ {
3991
+ "step": 997,
3992
+ "loss": 1.8057717084884644
3993
+ },
3994
+ {
3995
+ "step": 998,
3996
+ "loss": 1.7339015007019043
3997
+ },
3998
+ {
3999
+ "step": 999,
4000
+ "loss": 1.915513038635254
4001
+ }
4002
+ ]
lecture_6/verified_examples/diamond/config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "diamond",
3
+ "mode": "train-sample",
4
+ "train_steps": 1000,
5
+ "teacher_steps": 1000,
6
+ "finetune_steps": 0,
7
+ "sample_steps": 8,
8
+ "posterior_steps": 4,
9
+ "particles": 32,
10
+ "reward_strength": 1.0,
11
+ "ssfm_target": "official-code",
12
+ "batch_size": 64,
13
+ "samples": 128,
14
+ "width": 64,
15
+ "lr": 0.001,
16
+ "seed": 6270,
17
+ "threads": 1,
18
+ "device": "cpu",
19
+ "data": null,
20
+ "out": "outputs/verified-torch291/diamond"
21
+ }
lecture_6/verified_examples/diamond/losses.json ADDED
The diff for this file is too large to render. See raw diff