Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
667 lines (634 loc) · 44 KB
/
Copy pathindex.html
File metadata and controls
667 lines (634 loc) · 44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="light dark" />
<title>GLOVES · Flow-based Policy Adaptation without Policy Updates</title>
<meta name="description" content="GLOVES corrects the actions of frozen VLA and code-as-policy agents with a goal-agnostic expert flow — intervening only when an action looks out of distribution." />
<meta name="citation_title" content="Flow-based Policy Adaptation without Policy Updates" />
<meta name="citation_author" content="Sun, Luzhe" /><meta name="citation_author" content="Ji, Jingtian" />
<meta name="citation_author" content="Chen, Haoran" /><meta name="citation_author" content="Zhou, Jiawei" />
<meta name="citation_author" content="Walter, Matthew R." />
<meta name="citation_pdf_url" content="https://arxiv.org/abs/2606.06461v1" />
<script>
window.MathJax = { tex: { inlineMath: [["\\(", "\\)"]], displayMath: [["\\[", "\\]"]] }, svg: { fontCache: "global" } };
</script>
<script defer src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<style>
/* ============ theme (follows the system) ============ */
:root {
--bg: #fbfbfa; --bg2: #f3f4f2; --card: #ffffff; --fg: #15171c; --muted: #6a707b; --line: #e6e6e2;
--agent: #2166ac; --lift: #0b3c6e; --expert: #e8705f; --gold: #d9962b; --red: #b51700; --green: #2f8a3a;
--noise: #9e9e9e; --violet: #7b61c9; --orange: #e8892b;
--veil: rgba(251, 251, 250, 0.80); --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
--radius: 16px; --maxw: 1180px;
--font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0d0f12; --bg2: #13161a; --card: #171a1f; --fg: #eceef2; --muted: #9aa1ad; --line: #262a31;
--agent: #6aa8e8; --lift: #a9c8f0; --expert: #f08a7a; --gold: #f0b44c; --red: #ff6b5a; --green: #5cc06c;
--noise: #8a8f98; --violet: #a993ec; --orange: #f2a052;
--veil: rgba(13, 15, 18, 0.74); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
}
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--agent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
section { padding: 72px 0 8px; }
h2 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
h3 { font-size: 19px; font-weight: 600; margin: 0 0 6px; }
.kicker { font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.lead { color: var(--muted); font-size: 17px; max-width: 760px; margin: 0 0 28px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.paperfig { background: #fff; border-radius: 12px; padding: 10px; }
.paperfig img, .paperfig video { display: block; width: 100%; height: auto; border-radius: 6px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; color: #fff; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
/* ============ nav ============ */
nav.top { position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line); }
nav.top .wrap { display: flex; align-items: center; gap: 22px; height: 52px; }
nav.top .brand { font-weight: 700; color: var(--fg); }
nav.top .links { display: flex; gap: 18px; font-size: 14px; overflow-x: auto; }
nav.top .links a { color: var(--muted); white-space: nowrap; }
nav.top .links a:hover { color: var(--fg); text-decoration: none; }
/* ============ hero ============ */
.hero { position: relative; min-height: 92vh; display: flex; align-items: center; overflow: hidden; padding: 0; }
.mosaic { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; gap: 2px; }
.mosaic figure { margin: 0; position: relative; overflow: hidden; }
.mosaic video { width: 100%; height: 100%; object-fit: cover; filter: saturate(.9); }
.mosaic figcaption { position: absolute; left: 14px; top: 14px; font-size: 12px; font-weight: 600; color: #fff;
background: rgba(0,0,0,.45); padding: 3px 10px; border-radius: 999px; z-index: 2; }
.veil { position: absolute; inset: 0; background:
radial-gradient(ellipse at 50% 46%, var(--veil) 0%, var(--veil) 42%, color-mix(in srgb, var(--bg) 40%, transparent) 100%),
linear-gradient(to bottom, transparent 70%, var(--bg) 100%); }
.hero-inner { position: relative; z-index: 3; width: 100%; text-align: center; padding: 80px 24px 110px; }
.hero h1 { font-size: clamp(40px, 6.4vw, 78px); line-height: 1.02; letter-spacing: -0.025em; margin: 0; font-weight: 700; }
.hero h1 .g { background: linear-gradient(92deg, var(--agent), var(--violet) 55%, var(--expert)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { font-size: clamp(18px, 2.2vw, 26px); font-weight: 500; margin: 12px 0 18px; }
.hero .tldr { max-width: 760px; margin: 0 auto 22px; font-size: 17px; color: var(--fg); opacity: .85; }
.authors { font-size: 16px; margin-bottom: 4px; }
.authors a { color: var(--fg); border-bottom: 1px solid color-mix(in srgb, var(--fg) 25%, transparent); }
.authors a:hover { text-decoration: none; border-color: var(--fg); }
.authors span { margin: 0 8px; white-space: nowrap; }
.aff { font-size: 14px; color: var(--muted); }
.btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 15px;
background: var(--fg); color: var(--bg); }
.btn:hover { text-decoration: none; opacity: .88; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid color-mix(in srgb, var(--fg) 30%, transparent); }
.btn.off { opacity: .45; pointer-events: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 980px; margin: 34px auto 0; }
.stat { background: color-mix(in srgb, var(--card) 86%, transparent); border: 1px solid var(--line); border-radius: 14px; padding: 14px 10px; }
.stat b { display: block; font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; }
.stat b .arrow { color: var(--muted); font-weight: 400; }
.stat span { font-size: 13px; color: var(--muted); }
/* ============ problem ============ */
.three { display: grid; grid-template-columns: 1.05fr 1.2fr 1fr; gap: 16px; }
.three .card { padding: 20px 22px; }
.three h3, .lead, .q { text-wrap: balance; }
.agents { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.agents div { background: var(--bg2); border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 14.5px; }
.agents small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; white-space: nowrap; }
.fails { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; margin-top: 8px; }
.fails figure { margin: 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.fails img { width: 100%; height: 92px; object-fit: contain; display: block; margin-bottom: 1px; }
.q { margin-top: 10px; font-weight: 600; color: var(--red); font-size: 13.5px; text-align: center; white-space: nowrap; }
ul.x { list-style: none; padding: 0; margin: 10px 0 0; }
ul.x li { padding: 8px 0 8px 24px; position: relative; border-bottom: 1px dashed var(--line); font-size: 14.5px; line-height: 1.35; }
ul.x li::before { content: "✕"; position: absolute; left: 2px; color: var(--red); font-weight: 700; }
ul.x li small { color: var(--muted); display: block; font-size: 12.5px; }
/* ============ setup strip ============ */
.setup { display: grid; grid-template-columns: 1fr 1.35fr; gap: 16px; margin-top: 16px; }
.setup .card { padding: 22px; }
.formula { font-size: 17px; overflow-x: auto; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pill { background: var(--bg2); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; }
/* ============ method ============ */
.teaser { margin-top: 6px; }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
@media (min-width: 1300px) { .methods { margin: 18px -50px 0; } }
.method { padding: 18px; display: flex; flex-direction: column; }
.method .head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.method .paperfig { margin-bottom: 14px; }
.method .eqs { font-size: 14px; }
.method .eqs > div { margin: 7px 0; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.method .eqs mjx-container { margin: 0 !important; }
.method .note { font-size: 13.5px; color: var(--muted); margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); }
.step { display: inline-block; flex: none; font-size: 11px; font-weight: 700; color: #fff; border-radius: 999px; padding: 1px 9px; }
/* toy */
.toy { display: grid; grid-template-columns: 1.7fr 1fr; gap: 0; margin-top: 18px; overflow: hidden; }
.toy canvas { width: 100%; height: 380px; display: block; background: var(--card); }
.toy .ctl { padding: 22px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.toy label { font-size: 14px; display: block; }
.toy input[type=range] { width: 100%; accent-color: var(--agent); }
.toy .read { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toy .read div { background: var(--bg2); border-radius: 12px; padding: 10px 12px; }
.toy .read b { font-size: 24px; display: block; }
.toy .read span { font-size: 12.5px; color: var(--muted); }
.switch { display: flex; gap: 6px; }
.switch button { flex: 1; }
/* ============ results ============ */
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button, .switch button { font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.seg button.on, .switch button.on { background: var(--card); color: var(--fg); box-shadow: var(--shadow); font-weight: 600; }
.res-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.chart { padding: 16px 16px 8px; }
.chart h3 { display: flex; justify-content: space-between; align-items: baseline; }
.chart h3 small { font-weight: 500; font-size: 13px; color: var(--green); }
.chart svg { width: 100%; height: 230px; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.real { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.real .card { padding: 18px; }
.vids3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.vids3 figure { margin: 0; }
.vids3 video { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: #000; display: block; }
.vids3 figcaption { font-size: 12.5px; font-weight: 600; margin-top: 5px; }
.hbars { display: grid; gap: 7px; }
.hbar { display: grid; grid-template-columns: 54px 1fr 54px; align-items: center; gap: 10px; font-size: 13.5px; }
.hbar .track { height: 12px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 999px; width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.hbar b { text-align: right; }
/* ============ gallery ============ */
.gal-ctl { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.gal { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.gal figure { margin: 0; }
.gal video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #111; display: block; }
.gal figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ok { color: var(--green); font-weight: 600; } .bad { color: var(--red); font-weight: 600; }
/* ============ analysis ============ */
details.ana { margin-top: 6px; }
details.ana > summary { cursor: pointer; list-style: none; padding: 16px 20px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
details.ana > summary::-webkit-details-marker { display: none; }
details.ana > summary::after { content: "+"; color: var(--muted); }
details.ana[open] > summary::after { content: "-"; }
.ana-body { padding: 0 20px 22px; }
.ana-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 22px; align-items: center; }
.wr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wr .w { background: var(--bg2); border-radius: 12px; padding: 10px 12px; }
.wr .w header { display: flex; justify-content: space-between; font-weight: 600; font-size: 15px; }
.wr .w header span { font-weight: 500; color: var(--muted); font-size: 13px; }
.wr .w { aspect-ratio: 1 / 0.6; display: flex; flex-direction: column; }
.wr svg { width: 100%; flex: 1; min-height: 0; display: block; }
.bigs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.bigs b { display: block; font-size: 34px; color: var(--agent); letter-spacing: -0.02em; line-height: 1.1; }
.bigs span { font-size: 13px; color: var(--muted); }
.recov { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 16px; }
.recov th, .recov td { padding: 7px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.recov th:first-child, .recov td:first-child { text-align: left; }
.recov td.best { font-weight: 700; color: var(--agent); }
.recov .d { display: block; font-size: 11px; font-weight: 600; line-height: 1.1; }
.recov .up { color: var(--green); } .recov .dn { color: var(--red); }
.recov thead th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
/* ============ bib/footer ============ */
pre.bib { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.5; position: relative; }
.copy { position: absolute; right: 10px; top: 10px; font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--fg); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
footer { padding: 46px 0 60px; color: var(--muted); font-size: 13.5px; text-align: center; }
/* reveal */
.rv { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }
@media (max-width: 960px) {
.mosaic { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr); }
.three, .setup, .methods, .charts, .real, .toy, .ana-grid { grid-template-columns: 1fr; }
.toy .ctl { border-left: 0; border-top: 1px solid var(--line); }
.stats { grid-template-columns: repeat(2, 1fr); }
.gal { grid-template-columns: repeat(3, 1fr); }
}
</style>
</head>
<body>
<nav class="top"><div class="wrap">
<span class="brand">🧤 GLOVES</span>
<div class="links">
<a href="#idea">Idea</a><a href="#method">Method</a><a href="#results">Results</a>
<a href="#rollouts">Rollouts</a><a href="#analysis">Analysis</a><a href="#bibtex">BibTeX</a>
</div>
</div></nav>
<!-- ================= HERO ================= -->
<header class="hero">
<div class="mosaic" aria-hidden="true">
<figure><video src="media/videos/charger_result_sync/01_cam_VLA_Finetuned_Flower_fail.mp4" autoplay muted loop playsinline></video></figure>
<figure><video src="media/videos/charger_result_sync/03_cam_VLA_FEEG_success.mp4" autoplay muted loop playsinline></video></figure>
<figure><video src="media/videos/charger_result_sync/04_cam_VLA_IFAE_success.mp4" autoplay muted loop playsinline></video></figure>
<figure><video src="media/videos/cup_result_sync/01_VLA_finetune_fail.mp4" autoplay muted loop playsinline></video></figure>
<figure><video src="media/videos/cup_result_sync/03_VLA_FEEG_success.mp4" autoplay muted loop playsinline></video></figure>
<figure><video src="media/videos/cup_result_sync/04_VLA_IFAE_success.mp4" autoplay muted loop playsinline></video></figure>
</div>
<div class="veil"></div>
<div class="hero-inner">
<h1><span class="g">GLOVES</span></h1>
<div class="sub">Flow-based Policy Adaptation without Policy Updates</div>
<p class="tldr">A goal-agnostic expert flow that corrects the action chunks of a <b>frozen</b> agent — a VLA or a code-as-policy LLM — and steps in <b>only when an action looks out of distribution</b>.</p>
<div class="authors">
<span><a href="https://tllokn.github.io/">Luzhe Sun</a><sup>*1</sup></span>
<span><a href="https://ttic.edu/ripl/people/">Jingtian Ji</a><sup>*1</sup></span>
<span><a href="https://ttic.edu/ripl/people/">Haoran Chen</a><sup>1</sup></span>
<span><a href="https://joezhouai.com/">Jiawei Zhou</a><sup>2</sup></span>
<span><a href="https://home.ttic.edu/~mwalter/">Matthew R. Walter</a><sup>1</sup></span>
</div>
<div class="aff"><sup>1</sup>Toyota Technological Institute at Chicago · <sup>2</sup>Stony Brook University · <sup>*</sup>equal contribution</div>
<div class="btns">
<a class="btn" href="https://arxiv.org/abs/2606.06461">📄 Paper</a>
<a class="btn ghost" href="https://arxiv.org/abs/2606.06461">arXiv</a>
<a class="btn ghost" href="doc/poster.pdf">Poster</a>
<span class="btn ghost off">Code (soon)</span>
</div>
<div class="stats">
<div class="stat"><b class="mono">45<span class="arrow">→</span>100%</b><span>real charger insertion, VLA + GRIP</span></div>
<div class="stat"><b class="mono">33<span class="arrow">→</span>77%</b><span>Slalom, VLA + LIFT</span></div>
<div class="stat"><b class="mono">64<span class="arrow">→</span>98%</b><span>Slalom, code-as-policy + LIFT</span></div>
<div class="stat"><b class="mono">0.36 ms</b><span>OOD gate per chunk</span></div>
</div>
</div>
</header>
<main>
<!-- ================= IDEA ================= -->
<section id="idea"><div class="wrap">
<div class="kicker">The problem</div>
<h2>Good intent, unreliable execution</h2>
<p class="lead">Pretrained agents know <i>what</i> to do, but their actions drift under domain shift — and the agent itself often can't be retrained.</p>
<div class="three">
<div class="card rv">
<h3>Agents propose actions</h3>
<div class="agents">
<div>VLA<small>FLOWER · language goal</small></div>
<div>Code-as-Policy<small>LLM writes the code</small></div>
<div style="grid-column: 1 / -1">IL / RL<small>any frozen policy</small></div>
</div>
</div>
<div class="card rv">
<h3>…but actions fail locally</h3>
<div class="fails">
<figure><img src="media/new/fail_misalign.png" alt="" />Misalignment</figure>
<figure><img src="media/new/fail_collision.png" alt="" />Collision</figure>
<figure><img src="media/new/fail_jitter.png" alt="" />Jitter</figure>
<figure><img src="media/new/fail_misground.png" alt="" />Misgrounding</figure>
</div>
<div class="q">Can we fix the action without updating the agent?</div>
</div>
<div class="card rv">
<h3>Why not finetune?</h3>
<ul class="x">
<li>Black-box API <small>no access to weights</small></li>
<li>Human operator <small>a person can't be retrained</small></li>
<li>Few expert demos <small>too few to finetune safely</small></li>
<li>Cost & forgetting <small>may erode pretrained skills</small></li>
</ul>
</div>
</div>
<div class="setup">
<div class="card rv">
<div class="kicker" style="margin-bottom:4px">Setup</div>
<div class="formula">\[ \underbrace{\mathrm{Agent}(I,{\color{#d9962b}g})}_{\text{frozen}} \mapsto {\color{#d9962b}a_u},\qquad \tilde a \sim \mathcal{A}_\theta(\,\cdot \mid {\color{#d9962b}a_u},\, I\,) \]</div>
<div class="muted" style="font-size:14.5px">GLOVES never sees the goal. The proposed chunk \(a_u\) is the <b>intent cue</b>; the skill comes from an expert prior over \((I,a)\).</div>
</div>
<div class="card rv">
<div class="kicker" style="margin-bottom:4px">One expert flow, two jobs</div>
<div style="font-size:15px">Train a conditional flow \(v_\theta(x\mid t, I)\) on goal-free expert pairs \(\mathcal D_e=\{(I_i,a^e_i)\}\).
Run it <b>backward</b> to decide <i>when</i> to help, and <b>forward</b> (guided) to decide <i>how</i>.</div>
<div class="pills"><span class="pill">no policy updates</span><span class="pill">no goal labels</span><span class="pill">no separate detector</span></div>
</div>
</div>
</div></section>
<!-- ================= METHOD ================= -->
<section id="method"><div class="wrap">
<div class="kicker">Method</div>
<h2>When to adapt, and how</h2>
<p class="lead">Each proposed chunk is scored by the reverse flow. In-distribution chunks are executed as is; flagged chunks are edited by <b style="color:var(--agent)">GRIP</b> or <b style="color:var(--lift)">LIFT</b>.</p>
<div class="paperfig teaser rv"><img src="media/new/teaser.jpg" alt="GLOVES overview: OOD gate, then GRIP or LIFT editing of flagged chunks." /></div>
<div class="methods">
<article class="card method rv">
<div class="head"><span class="tag" style="background:var(--red)">When</span><h3 style="margin:0">Flow-based OOD gate</h3></div>
<div class="paperfig"><video src="media/method/ood-detection.webm" autoplay muted loop playsinline></video></div>
<div class="eqs">
<div><span class="step" style="background:var(--noise)">score</span>\( \hat z = a_u - v_\theta(a_u\mid 1, I),\ \ s=\|\hat z\|_2^2 \)</div>
<div><span class="step" style="background:var(--violet)">calibrate</span>\( p=\frac{1+\sum_i \mathbf 1\{s_i\ge s\}}{n+1} \)</div>
<div><span class="step" style="background:var(--red)">gate</span>\( \text{edit only if}\ \ p\le\alpha \)</div>
</div>
<div class="note">One midpoint reverse step · 0.36 ms per sample · calibrated on held-out expert data.</div>
</article>
<article class="card method rv">
<div class="head"><span class="tag" style="background:var(--agent)">How ①</span><h3 style="margin:0">GRIP</h3></div>
<div class="paperfig"><video src="media/method/FEEG.mp4" autoplay muted loop playsinline></video></div>
<div class="eqs">
<div><span class="step" style="background:var(--noise)">add noise</span>\( x_t = t\,{\color{#e8892b}a_u} + (1-t)\,{\color{#9e9e9e}\epsilon} \)</div>
<div><span class="step" style="background:var(--expert)">estimate</span>\( {\color{#e8705f}a_e=\hat x_1} = x_t + (1-t)\,{\color{#2166ac}v_\theta(x_t\mid t, I)} \)</div>
<div><span class="step" style="background:var(--orange)">regularize</span>\( E = \tfrac12\|{\color{#e8705f}a_e}-{\color{#e8892b}a_u}\|_2^2 \)</div>
<div><span class="step" style="background:var(--agent)">guided step</span>\( x_{t-1} = x_t + \Delta t\,({\color{#2166ac}v_\theta}{\color{#e8892b}-\lambda_{\mathrm{align}}\nabla_{x_t}E}) \)</div>
</div>
<div class="note"><b>G</b>uided <b>R</b>efinement with an <b>I</b>ntent-<b>P</b>reserving energy. Needs only the expert flow; \(\lambda_{\mathrm{align}}=1\) everywhere.</div>
</article>
<article class="card method rv">
<div class="head"><span class="tag" style="background:var(--lift)">How ②</span><h3 style="margin:0">LIFT</h3></div>
<div class="paperfig"><video src="media/method/IFAE.mp4" autoplay muted loop playsinline></video></div>
<div class="eqs">
<div><span class="step" style="background:#1e90e8">agent side</span>\( {\color{#1e90e8}q_k} = (1-t_k){\color{#9e9e9e}\epsilon_k} + t_k{\color{#d9962b}a_u} \)</div>
<div><span class="step" style="background:var(--expert)">shift</span>\( {\color{#e8705f}p_k} = {\color{#1e90e8}q_k} + ({\color{#c9a06b}a^{(k)}} - a_u) \)</div>
<div><span class="step" style="background:var(--violet)">transport</span>\( v_p = v_u(p_k)+\omega[{\color{#e8705f}v_e(p_k)}-{\color{#1e90e8}v_u(p_k)}] \)</div>
<div><span class="step" style="background:var(--green)">update</span>\( a^{(k+1)} = a^{(k)}{\color{#7b61c9}+\eta\Delta t_k(v_p-v_q)}{\color{#2f8a3a}+\lambda(\hat a_u-\hat a_e)} \)</div>
</div>
<div class="note"><b>L</b>earned <b>I</b>nversion-<b>F</b>ree <b>T</b>ransport. Adds an agent flow \(v_u\) from rollouts; no noising depth to tune.</div>
</article>
</div>
<!-- interactive toy -->
<div class="card toy rv">
<canvas id="toy" aria-label="Interactive 1-D GRIP simulation"></canvas>
<div class="ctl">
<div><h3 style="margin:0">Try it: GRIP in 1-D</h3>
<div class="muted" style="font-size:13.5px">Expert actions live in two modes. The agent proposes \(a_u\) slightly off the upper mode. Exact flow for this toy, computed live.</div></div>
<label>Autonomy level \(t_0\): <b id="t0v"></b><input id="t0" type="range" min="0.05" max="0.9" step="0.01" value="0.32" /></label>
<label>Regularization \(\lambda\): <b id="lv"></b><input id="lam" type="range" min="0" max="4" step="0.1" value="2" /></label>
<label>Agent action \(a_u\): <b id="auv"></b><input id="au" type="range" min="-0.2" max="1.6" step="0.01" value="0.45" /></label>
<div class="read">
<div><b id="keep" class="mono"></b><span>samples keep the intended mode</span></div>
<div><b id="move" class="mono"></b><span>mean edit size |ã − a<sub>u</sub>|</span></div>
</div>
</div>
</div>
</div></section>
<!-- ================= RESULTS ================= -->
<section id="results"><div class="wrap">
<div class="kicker">Results</div>
<div class="res-head">
<div><h2>Better agents, same weights</h2>
<p class="lead" style="margin:0">Success rate (%) of two very different frozen agents before and after correction. <sup>+</sup> = with OOD gate.</p></div>
<div class="seg" id="agentSeg"><button class="on" data-a="vla">VLA (FLOWER)</button><button data-a="cap">Code-as-Policy</button></div>
</div>
<div class="charts" id="charts"></div>
<div class="legend">
<span><i style="background:var(--noise)"></i>agent alone</span>
<span><i style="background:var(--gold)"></i>prior shared-autonomy baselines (DDPM, CSA)</span>
<span><i style="background:var(--agent)"></i>GRIP</span>
<span><i style="background:var(--lift)"></i>LIFT</span>
</div>
<div class="real">
<div class="card rv">
<h3>Real robot · charger insertion <span class="muted" style="font-weight:400;font-size:14px">— precise local correction</span></h3>
<div class="vids3">
<figure><video data-sync="ch" src="media/videos/charger_result_sync/01_cam_VLA_Finetuned_Flower_fail.mp4" muted loop playsinline preload="metadata"></video><figcaption class="bad">VLA</figcaption></figure>
<figure><video data-sync="ch" src="media/videos/charger_result_sync/03_cam_VLA_FEEG_success.mp4" muted loop playsinline preload="metadata"></video><figcaption style="color:var(--agent)">VLA + GRIP</figcaption></figure>
<figure><video data-sync="ch" src="media/videos/charger_result_sync/04_cam_VLA_IFAE_success.mp4" muted loop playsinline preload="metadata"></video><figcaption style="color:var(--lift)">VLA + LIFT</figcaption></figure>
</div>
<div class="hbars" data-of="40" data-v='[["VLA",18,"noise"],["CSA",21,"gold"],["GRIP",40,"agent"],["LIFT",27,"lift"]]'></div>
</div>
<div class="card rv">
<h3>Real robot · cup serving <span class="muted" style="font-weight:400;font-size:14px">— sustained trajectory refinement</span></h3>
<div class="vids3">
<figure><video data-sync="cup" src="media/videos/cup_result_sync/01_VLA_finetune_fail.mp4" muted loop playsinline preload="metadata"></video><figcaption class="bad">VLA</figcaption></figure>
<figure><video data-sync="cup" src="media/videos/cup_result_sync/03_VLA_FEEG_success.mp4" muted loop playsinline preload="metadata"></video><figcaption style="color:var(--agent)">VLA + GRIP</figcaption></figure>
<figure><video data-sync="cup" src="media/videos/cup_result_sync/04_VLA_IFAE_success.mp4" muted loop playsinline preload="metadata"></video><figcaption style="color:var(--lift)">VLA + LIFT</figcaption></figure>
</div>
<div class="hbars" data-of="30" data-v='[["VLA",2,"noise"],["CSA",4,"gold"],["GRIP",22,"agent"],["LIFT",16,"lift"]]'></div>
</div>
</div>
</div></section>
<!-- ================= ROLLOUTS ================= -->
<section id="rollouts"><div class="wrap">
<div class="kicker">Rollouts</div>
<h2>Simulation, side by side</h2>
<p class="lead">Same VLA, same scenes — only the action-level correction changes.</p>
<div class="gal-ctl">
<div class="seg" id="taskSeg"><button class="on" data-t="slalom">Slalom</button><button data-t="can">CAN</button></div>
<div class="seg" id="methSeg">
<button class="on" data-m="base">VLA</button><button data-m="ddpm">+ DDPM</button><button data-m="csa">+ CSA</button>
<button data-m="feeg">+ GRIP</button><button data-m="ifae">+ LIFT</button>
</div>
</div>
<div class="gal" id="gal"></div>
</div></section>
<!-- ================= ANALYSIS ================= -->
<section id="analysis"><div class="wrap">
<div class="kicker">Analysis</div>
<h2>Does the gate catch bad chunks?</h2>
<p class="lead">Rollouts have no per-action labels, so we inject known perturbations into a near-perfect imitation agent and measure detection and recovery.</p>
<div class="card rv">
<div style="padding:20px 20px 4px" class="ana-grid">
<div>
<div class="wr" id="wr"></div>
<div class="muted" style="font-size:12.5px;margin-top:8px"><span style="color:var(--noise)">- - clean chunk</span> <span style="color:var(--red)">— perturbed chunk</span> · AUROC: mean over 3 tasks</div>
</div>
<div>
<div class="bigs">
<div><b class="mono">.975</b><span>precision</span></div><div><b class="mono">.758</b><span>recall</span></div>
<div><b class="mono">.938</b><span>AUROC</span></div><div><b class="mono">.003</b><span>FP rate</span></div>
</div>
<div class="muted" style="text-align:center;font-size:13px;margin:6px 0 10px">3 tasks × 4 perturbations · α = 0.005 · 1 reverse step · 0.36 ms</div>
<div class="paperfig"><img src="media/new/ood_density.png" alt="Reverse-flow score densities of clean vs. perturbed Keypad chunks." /></div>
</div>
</div>
<details class="ana">
<summary>Recovery across all four perturbations (composite success, %)</summary>
<div class="ana-body">
<table class="recov mono" id="recov"></table>
<div class="muted" style="font-size:13px;margin-top:10px">Equal-weight mean over Noised / Laggy / Slow / Shift; triangles show the change from Unassisted in percentage points; ⁺ = OOD gate. Residual is trained on these very perturbations; GLOVES is not. Laggy is the hardest to detect: a repeated chunk can still fit the scene — detecting the injection ≠ detecting harm.</div>
</div>
</details>
</div>
</div></section>
<!-- ================= BIBTEX ================= -->
<section id="bibtex"><div class="wrap">
<div class="kicker">Cite</div>
<h2>BibTeX</h2>
<pre class="bib" id="bib">@article{sun2026flow,
title={Flow-based Policy Adaptation without Policy Updates},
author={Sun, Luzhe and Ji, Jingtian and Chen, Haoran and Zhou, Jiawei and Walter, Matthew R},
journal={arXiv preprint arXiv:2606.06461},
year={2026}
}<button class="copy" data-copy="bib">Copy</button></pre>
<script>
document.querySelectorAll('.copy').forEach(btn => btn.onclick = () => {
const pre = document.getElementById(btn.dataset.copy);
navigator.clipboard.writeText(pre.firstChild.textContent.trim()); btn.textContent = 'Copied';
setTimeout(() => btn.textContent = 'Copy', 1500);
});
</script>
</div></section>
</main>
<footer><div class="wrap">GLOVES · Flow-based Policy Adaptation without Policy Updates · TTIC & Stony Brook</div></footer>
<script src="media/videos/simulation_showcase_webm/manifest.js"></script>
<script>
const css = n => getComputedStyle(document.documentElement).getPropertyValue('--' + n).trim();
/* ---------- reveal on scroll ---------- */
const io = new IntersectionObserver(es => es.forEach(e => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }), { threshold: .12 });
document.querySelectorAll('.rv').forEach(el => io.observe(el));
/* ---------- sim bar charts ---------- */
const METHODS = ['Agent', 'DDPM', 'CSA', 'GRIP', 'GRIP⁺', 'LIFT', 'LIFT⁺'];
const COLS = ['noise', 'gold', 'gold', 'agent', 'agent', 'lift', 'lift'];
const DATA = {
vla: { Slalom: [33.1, 33.5, 32.9, 30.6, 31.5, 76.7, 64.3], CAN: [26.2, 32.8, 22.2, 39.4, 41.2, 42.5, 44.7], Keypad: [46.7, 56.0, 48.7, 61.3, 62.0, 58.7, 62.0] },
cap: { Slalom: [63.7, 81.0, 72.3, 92.0, 89.7, 97.7, 95.7], CAN: [54.7, 59.7, 57.2, 68.4, 64.7, 62.8, 61.9], Keypad: [53.7, 52.3, 52.7, 54.7, 52.0, 60.7, 63.7] }
};
let agent = 'vla';
function drawCharts() {
const box = document.getElementById('charts'); box.innerHTML = '';
for (const [task, v] of Object.entries(DATA[agent])) {
const best = Math.max(...v.slice(3)), gain = (best - v[0]).toFixed(1);
const lo = Math.max(0, Math.floor((Math.min(...v) - 12) / 10) * 10), hi = Math.max(...v) + 8;
const W = 360, H = 230, pad = 24, bw = (W - 2 * pad) / 7;
let s = `<svg viewBox="0 0 ${W} ${H}" preserveAspectRatio="none">`;
s += `<line x1="${pad - 6}" x2="${W - pad + 6}" y1="${H - 26}" y2="${H - 26}" stroke="${css('line')}"/>`;
const y0 = H - 26, sc = (H - 56) / (hi - lo);
const yb = y0 - (v[0] - lo) * sc;
s += `<line x1="${pad - 6}" x2="${W - pad + 6}" y1="${yb}" y2="${yb}" stroke="${css('noise')}" stroke-dasharray="3 4" opacity=".7"/>`;
v.forEach((val, i) => {
const x = pad + i * bw + bw * .14, w = bw * .72, h = (val - lo) * sc;
const isBest = i >= 3 && val === best;
s += `<rect class="bar" x="${x}" y="${y0 - h}" width="${w}" height="${h}" rx="4" fill="${css(COLS[i])}" opacity="${i === 4 || i === 6 ? .72 : 1}" style="transform:scaleY(0);transform-box:fill-box;transform-origin:50% 100%"><title>${METHODS[i]}: ${val}%</title></rect>`;
s += `<text x="${x + w / 2}" y="${y0 - h - 6}" text-anchor="middle" font-size="11" fill="${isBest ? css('fg') : css('muted')}" font-weight="${isBest ? 700 : 400}">${val}</text>`;
s += `<text x="${x + w / 2}" y="${H - 8}" text-anchor="middle" font-size="10.5" fill="${css('muted')}">${i === 0 ? (agent === 'vla' ? 'VLA' : 'CaP') : METHODS[i]}</text>`;
});
s += '</svg>';
const el = document.createElement('div'); el.className = 'card chart';
el.innerHTML = `<h3>${task}<small>+${gain} pts</small></h3>${s}`;
box.appendChild(el);
}
requestAnimationFrame(() => document.querySelectorAll('#charts .bar').forEach((r, i) => {
r.style.transition = `transform .8s cubic-bezier(.2,.8,.2,1) ${i % 7 * 40}ms`;
r.getBoundingClientRect(); r.style.transform = 'scaleY(1)';
}));
}
document.querySelectorAll('#agentSeg button').forEach(b => b.onclick = () => {
document.querySelectorAll('#agentSeg button').forEach(x => x.classList.toggle('on', x === b)); agent = b.dataset.a; drawCharts();
});
drawCharts();
matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { drawCharts(); drawWr(); toy.draw(); });
/* ---------- real-robot bars + synced videos ---------- */
document.querySelectorAll('.hbars').forEach(hb => {
const of = +hb.dataset.of;
hb.innerHTML = JSON.parse(hb.dataset.v).map(([n, k, c]) =>
`<div class="hbar"><span>${n}</span><div class="track"><div class="fill" data-w="${100 * k / of}" style="background:var(--${c})"></div></div><b class="mono">${k}/${of}</b></div>`).join('');
});
const vio = new IntersectionObserver(es => es.forEach(e => {
const grp = e.target.querySelectorAll('video');
if (e.isIntersecting) {
e.target.querySelectorAll('.fill').forEach(f => f.style.width = f.dataset.w + '%');
grp.forEach(v => { v.currentTime = 0; v.play().catch(() => {}); });
} else grp.forEach(v => v.pause());
}), { threshold: .35 });
document.querySelectorAll('.real .card').forEach(c => vio.observe(c));
/* ---------- rollout gallery ---------- */
let gTask = 'slalom', gMeth = 'base';
function drawGal() {
const g = document.getElementById('gal');
const M = window.SIMULATION_SHOWCASE;
const e = M && M.entries[gTask] && M.entries[gTask].vla && M.entries[gTask].vla[gMeth];
if (!e) { g.innerHTML = '<div class="muted">Videos not found.</div>'; return; }
g.innerHTML = e.videos.slice(0, 5).map(v => {
const ok = v.outcome === 'success';
const cap = (v.caption || '').replace(/ · (Success|Failure)/, '');
return `<figure><video src="${v.src}" autoplay muted loop playsinline preload="metadata"></video>
<figcaption><span class="${ok ? 'ok' : 'bad'}">${ok ? '✓ success' : '✗ failure'}</span> · ${cap}</figcaption></figure>`;
}).join('');
}
const segs = (id, cb) => document.querySelectorAll(`#${id} button`).forEach(b => b.onclick = () => {
document.querySelectorAll(`#${id} button`).forEach(x => x.classList.toggle('on', x === b)); cb(b); drawGal();
});
segs('taskSeg', b => gTask = b.dataset.t); segs('methSeg', b => gMeth = b.dataset.m);
drawGal();
/* ---------- perturbation sparklines ---------- */
function drawWr() {
const W = 260, H = 130, n = 50, xs = [...Array(n)].map((_, i) => i / (n - 1));
const base = xs.map(t => .6 * Math.sin(2 * Math.PI * t * .9) + .2);
let seed = 3; const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647 - .5;
const wr = [['Noised', '1.000', base.map(b => b + .55 * rnd())], ['Laggy', '.780', xs.map(t => .6 * Math.sin(2 * Math.PI * (t - .25) * .9) + .2)],
['Slow', '.988', base.map(b => .45 * b)], ['Shift', '.983', base.map(b => b + .45)]];
const P = arr => arr.map((y, i) => `${10 + xs[i] * (W - 20)},${H / 2 + 4 - y * 44}`).join(' ');
document.getElementById('wr').innerHTML = wr.map(([nm, au, y]) => `<div class="w"><header>${nm}<span>AUROC <b style="color:var(--fg)">${au}</b></span></header>
<svg viewBox="0 0 ${W} ${H}" preserveAspectRatio="xMidYMid meet"><polyline points="${P(base)}" fill="none" stroke="${css('noise')}" stroke-width="2.4" stroke-dasharray="6 5"/>
<polyline points="${P(y)}" fill="none" stroke="${css('red')}" stroke-width="3" stroke-linejoin="round"/></svg></div>`).join('');
}
drawWr();
(() => {
const heads = ['', 'Unassisted', 'Residual', 'DDPM', 'CSA', 'GRIP', 'GRIP⁺', 'LIFT', 'LIFT⁺'];
const rows = { Slalom: [40.6, 38.4, 24.8, 49.6, 41.9, 40.7, 58.2, 59.2], CAN: [44.2, 55.9, 49.5, 58.8, 65.9, 64.2, 62.9, 66.8], Keypad: [48.5, 53.8, 63.1, 62.4, 72.4, 72.4, 67.2, 67.9] };
const gain = { Slalom: [-2.2, -15.8, 9.0, 1.3, 0.1, 17.6, 18.6], CAN: [11.7, 5.3, 14.6, 21.7, 20.0, 18.7, 22.6], Keypad: [5.3, 14.6, 13.9, 23.9, 23.9, 18.7, 19.4] }; // vs. unassisted, from the paper
let h = '<thead><tr>' + heads.map(x => `<th>${x}</th>`).join('') + '</tr></thead><tbody>';
for (const [t, v] of Object.entries(rows)) {
const m = Math.max(...v);
h += `<tr><td>${t}</td>` + v.map((x, i) => {
const g = i ? gain[t][i - 1] : null;
const d = g === null ? '' : `<span class="d ${g >= 0 ? 'up' : 'dn'}">${g >= 0 ? '▲' : '▼'} ${Math.abs(g).toFixed(1)}</span>`;
return `<td class="${x === m ? 'best' : ''}">${x.toFixed(1)}${d}</td>`;
}).join('') + '</tr>';
}
document.getElementById('recov').innerHTML = h + '</tbody>';
})();
/* ---------- interactive 1-D GRIP toy (exact rectified flow of a 2-mode mixture) ---------- */
const toy = (() => {
const MU = [-1, 1], S0 = 0.08, N = 24, STEPS = 60, VMAX = 2.8;
let s = 11; const rn = () => { s = (s * 16807) % 2147483647; return s / 2147483647; };
const EPS = [...Array(N)].map(() => Math.sqrt(-2 * Math.log(rn())) * Math.cos(2 * Math.PI * rn()));
function v(x, t) {
const vr = t * t * S0 * S0 + (1 - t) * (1 - t); let wsum = 0, e = 0;
const ls = MU.map(m => -((x - t * m) ** 2) / (2 * vr)); const mx = Math.max(...ls);
MU.forEach((m, i) => { const w = Math.exp(ls[i] - mx); wsum += w; e += w * (m + (t * S0 * S0 / vr) * (x - t * m)); });
return (e / wsum - x) / Math.max(1 - t, 1e-3);
}
function paths(au, t0, lam) {
return EPS.map(ep => {
let x = t0 * au + (1 - t0) * ep; const pts = [[t0, x]];
for (let i = 0; i < STEPS; i++) {
const t = t0 + (1 - t0) * i / STEPS, dt = (1 - t0) / STEPS;
let vv = v(x, t);
if (lam > 0) { const h = 1e-3, x1 = z => z + (1 - t) * v(z, t);
vv -= lam * ((0.5 * (x1(x + h) - au) ** 2 - 0.5 * (x1(x - h) - au) ** 2) / (2 * h)); }
x += dt * vv; pts.push([t + dt, x]);
}
return { ep, pts };
});
}
const cv = document.getElementById('toy'), ctx = cv.getContext('2d');
const el = id => document.getElementById(id);
function draw() {
const dpr = devicePixelRatio || 1, W = cv.clientWidth, H = cv.clientHeight;
cv.width = W * dpr; cv.height = H * dpr; ctx.setTransform(dpr, 0, 0, dpr, 0, 0); ctx.clearRect(0, 0, W, H);
const au = +el('au').value, t0 = +el('t0').value, lam = +el('lam').value;
el('t0v').textContent = t0.toFixed(2); el('lv').textContent = lam.toFixed(1); el('auv').textContent = au.toFixed(2);
const L = 90, R = W - 70, top = 26, bot = H - 34;
const X = t => L + (1 - t) * (R - L); // data (t=1) on the left, noise (t=0) on the right
const Y = y => top + (bot - top) * (0.5 - Math.max(-VMAX, Math.min(VMAX, y)) / (2 * VMAX));
const C = n => css(n);
// axes + densities
ctx.lineWidth = 1.2; ctx.strokeStyle = C('muted');
[L, R].forEach(x => { ctx.beginPath(); ctx.moveTo(x, top); ctx.lineTo(x, bot); ctx.stroke(); });
ctx.lineWidth = 2.4;
ctx.strokeStyle = C('expert'); ctx.beginPath();
for (let i = 0; i <= 200; i++) { const y = -VMAX + 2 * VMAX * i / 200; const d = .5 * (Math.exp(-((y - 1) ** 2) / (2 * .03)) + Math.exp(-((y + 1) ** 2) / (2 * .03)));
i ? ctx.lineTo(L - 6 - 55 * d, Y(y)) : ctx.moveTo(L - 6 - 55 * d, Y(y)); } ctx.stroke();
ctx.strokeStyle = C('noise'); ctx.beginPath();
for (let i = 0; i <= 200; i++) { const y = -VMAX + 2 * VMAX * i / 200; const d = Math.exp(-y * y / 2);
i ? ctx.lineTo(R + 6 + 50 * d, Y(y)) : ctx.moveTo(R + 6 + 50 * d, Y(y)); } ctx.stroke();
ctx.font = '600 12px ' + getComputedStyle(document.body).fontFamily; ctx.textAlign = 'center';
ctx.fillStyle = C('expert'); ctx.fillText('Expert', L, H - 12);
ctx.fillStyle = C('muted'); ctx.fillText('Gaussian', R, H - 12); ctx.fillText('t₀', X(t0), H - 12);
ctx.setLineDash([3, 4]); ctx.strokeStyle = C('line'); ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(X(t0), top); ctx.lineTo(X(t0), bot); ctx.stroke(); ctx.setLineDash([]);
const P = paths(au, t0, lam), target = au >= 0 ? 1 : -1;
let keep = 0, move = 0;
P.forEach(({ ep, pts }) => {
ctx.setLineDash([4, 4]); ctx.strokeStyle = C('noise'); ctx.globalAlpha = .35; ctx.lineWidth = 1;
ctx.beginPath(); ctx.moveTo(X(1), Y(au)); ctx.lineTo(X(0), Y(ep)); ctx.stroke(); ctx.setLineDash([]); ctx.globalAlpha = 1;
const end = pts[pts.length - 1][1], ok = Math.sign(end) === target; keep += ok; move += Math.abs(end - au);
ctx.strokeStyle = ok ? C('green') : C('red'); ctx.lineWidth = 2; ctx.globalAlpha = .85; ctx.beginPath();
pts.forEach(([t, y], i) => i ? ctx.lineTo(X(t), Y(y)) : ctx.moveTo(X(t), Y(y))); ctx.stroke(); ctx.globalAlpha = 1;
ctx.fillStyle = C('fg'); ctx.beginPath(); ctx.arc(X(t0), Y(pts[0][1]), 2.6, 0, 7); ctx.fill();
});
ctx.fillStyle = C('gold'); ctx.beginPath(); ctx.arc(L, Y(au), 7, 0, 7); ctx.fill();
ctx.fillStyle = C('gold'); ctx.textAlign = 'right'; ctx.font = 'italic 15px Georgia, serif'; ctx.fillText('aᵤ', L - 12, Y(au) + 5);
el('keep').textContent = `${keep}/${N}`; el('move').textContent = (move / N).toFixed(2);
}
['t0', 'lam', 'au'].forEach(id => el(id).addEventListener('input', draw));
addEventListener('resize', draw); draw();
return { draw };
})();
</script>
</body>
</html>