-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathslides.md~
More file actions
850 lines (606 loc) · 18.1 KB
/
slides.md~
File metadata and controls
850 lines (606 loc) · 18.1 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
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
---
layout: cover
# background: ./images/bone-wall.png
class: text-center
title: BONE
mdc: true
---
# Algorithms and Applications for Sequential Decision Making
February 2025
Kevin Murphy (Google DeepMind)
Joint work with: Gerardo Duran-Martin (QMU), Alexander Shestopaloff (QMU),
Leandro Sánchez-Betancourt (OMI), Peter Chang (MIT), Matt Jones (U. Colorado)
---
# Sequential online learning and prediction
Observe sequence of features $x_i$ and observations $y_i$:
$$
{\cal D}_{1:t-1} = \{(x_1, y_1), \ldots, (x_{t-1}, y_{t-1})\}.
$$
Given new input $x_{t}$ (and past ${\cal D}_{1:t-1})$,
predict the output $y_t$ using some decision rule
$$
\hat{y}_{t} = \pi_{t}(x_{t}, {\cal D}_{1:t-1}).
$$
Incur loss
$$
\ell_t = {\cal L}(y_t, \hat{y}_{t})
$$
Repeat
Goal: (efficiently) update predictor/policy $\pi_t$ so as to minimize
the expected sum of losses, $\sum_t E[\ell_t]$.
---
## Sequential classification
A running example

---
## Optimal prediction using Bayesian decision theory
For $\ell_2$ loss (regression), use posterior mean
$$
\begin{aligned}
\hat{y}_t &= \arg \min_{a} E[\ell_2(y_t, a) | x_t, D_{1:t-1}] \\
&= \arg \min_{a} \int p(y_t|x_t, D_{1:t-1}) (y_t-a)^2 dy_t \\
&= E[y_t|x_t,D_{1:t-1}]
\end{aligned}
$$
For $\ell_{01}$ loss (classification), use posterior mode
$$
\begin{aligned}
\hat{y}_t &= \arg \min_a E[\ell_{01}(y_t, a) | x_t, D_{1:t-1}] \\
&= \arg \min_{a} \sum_{y_t} p(y_t|x_t, D_{1:t-1}) {\cal I}(y_t \neq a) \\
&= \arg \min_a 1-p(y_t=a|x_t,D_{1:t-1}) \\
&= \arg \max_{y_t} p(y_t|x_t,D_{1:t-1})
\end{aligned}
$$
In general, $\hat{y}_t = f(p(y_t|x_t, D_{1:t-1}))$
---
## Generative model
Optimal predictor: $\hat{y}_t = f(p(y_t|x_t, D_{1:t-1}))$
Use parametric model $p(y_t|x_t,\theta_t)$
where $\theta_t$ summarizes $D_{1:t-1}$.
{style="max-width: 50%"}
---
## Sequential Bayesian inference
One step ahead predictive distribution (for unknown $y_t$)
$$
\begin{aligned}
\underbrace{p(y_t|x_t, D_{1:t-1})}_\text{obs. predictive}
&=
\int
\underbrace{p(y_t | \theta_t, x_{t})}_\text{likelihood}
\underbrace{p(\theta_t |D_{1:t-1})}_\text{param. predictive}
d\theta_t
\\
\underbrace{p(\theta_t|D_{1:t-1})}_\text{param. predictive}
&= \int \underbrace{p(\theta_t|\theta_{t-1})}_\text{dynamics}
\underbrace{p(\theta_{t-1}|D_{1:t-1})}_\text{previous posterior}
d\theta_{t-1}
\end{aligned}
$$
New posterior (after seeing $y_t$):
$$
\underbrace{p(\theta_t|D_{1:t})}_\text{posterior}
\propto
\underbrace{p(y_t|\theta_t,x_t)}_\text{likelihood}
\underbrace{p(\theta_t|D_{1:t-1})}_\text{prior}
$$
---
## Measurement (observation) model
Linear Gaussian model (with measurement noise cov. $R_t$)
$$
p_t(y_t|\theta_t) = N(y_t|H_t \theta_t, R_t)
$$
Special case: Linear Regression ($H_t = x_t^\intercal$):
$$
p(y_t|\theta_t, x_t) = N(y_t|x_t^\intercal \theta_t, R_t)
$$
Binary logistic Regression
$$
p(y_t|\theta_t, x_t)
= {\rm Bern}(y_t|\sigma(x_t^\intercal \theta_t))
$$
Multinomial logistic Regression
$$
p(y_t|\theta_t, x_t)
= {\rm Cat}(y_t|{\cal S}(\theta_t x_t))
$$
MLP classifier
$$
p(y_t|\theta_t, x_t) = {\rm Cat}(y_t|{\cal S}
(\theta_t^{(1)} \text{relu}(\theta_t^{(1)} x_t)))
= {\rm Cat}(y_t|h(\theta_t,x_t))
$$
---
## Dynamics model (for the latent parameter)
Linear Gaussian dynamics (with system / process noise cov. $Q_t$)
$$
p(\theta_t | \theta_{t-1}) =
N(\theta_t | F_t \theta_{t-1} + b_t, Q_t)
$$
Special case of LG: Ornstein-Uhlenbeck process
$$
F_t = \gamma_t I,
b_t = (1-\gamma_t) \mu_0,
Q_t =(1-\gamma_t^2) \Sigma_0
$$
Special case of OU ($\gamma_t=1$): constant parameter
$$
p(\theta_t | \theta_{t-1}) = \delta(\theta_t - \theta_{t-1})
= N(\theta_t|\theta_{t-1}, 0 I)
$$
Shrink and Perturb (Ash and Adams, 2020):
$$
p(\theta_t | \theta_{t-1})
= N(\theta_t|\theta_{t-1}, Q_t)
$$
---
## Turning the Bayesian crank: Predict step
Gaussian ansatz
$$
p(\theta_{t-1}|D_{1:t-1})
= N(\theta_{t-1}|\mu_{t-1},\Sigma_{t-1})
$$
Compute prior from previous posterior
$$
\begin{aligned}
p(\theta_t|D_{1:t-1})
&= \int p(\theta_t|\theta_{t-1})
p(\theta_{t-1}|D_{1:t-1}) d\theta_{t-1} \\
&=
\int N(\theta_t | F_t \theta_{t-1} + b_t , Q_t)
N(\theta_{t-1}|\mu_{t-1},\Sigma_{t-1})
d\theta_{t-1} \\
&= N(\theta_t|\mu_{t|t-1}, \Sigma_{t|t-1}) \\
\mu_{t|t-1} &= F_t \mu_{t-1} + b_t \\
\Sigma_{t|t-1} &= F_t \Sigma_{t-1} F_t^\intercal + Q_t
\end{aligned}
$$
Special case for constant parameter ($F_t=I$, $Q_t=0$)
$$
\begin{aligned}
p(\theta_t|D_{1:t-1})
&= N(\theta_t|\mu_{t-1}, \Sigma_{t-1})
\end{aligned}
$$
---
## Turning the Bayesian crank: Update step
New posterior (after seeing $y_t$):
$$
\underbrace{p(\theta_t|D_{1:t})}_\text{posterior}
\propto
\underbrace{N(y_t|h(\theta_t,x_t), R)}_\text{likelihood}
\underbrace{N(\theta_t|\mu_{t|t-1}, \Sigma_{t|t-1})}_\text{prior}
$$
Focus of this talk: how to compute this posterior efficiently
---
## Kalman filtering
If we have LG dynamics and LG observations, get closed form solution!
Predict step:
$$
\begin{aligned}
p(\theta_t|D_{1:t-1})
&= N(\theta_t|\mu_{t|t-1}, \Sigma_{t|t-1}) \\
\mu_{t|t-1} &= F_t \mu_{t-1} + b_t \\
\Sigma_{t|t-1} &= F_t \Sigma_{t-1} F_t^\intercal + Q_t
\end{aligned}
$$
Update step:
$$
\begin{aligned}
p(\theta_t|D_{1:t}) &= N(\theta_t|\mu_{t}, \Sigma_{t}) \\
\Sigma_{t}^{-1} &= \Sigma_{t|t-1}^{-1} + H_t^\intercal R_t^{-1} H_t \\
\mu_{t|t-1} &= \mu_{t|t-1} + K_t(y_t - \hat{y}_t) \\
\hat{y}_t &= h(\mu_{t|t-1},x_t) = H_t \mu_{t|t-1} \\
K_t &= \Sigma_t H_t R_t^{-1}
\end{aligned}
$$
---
## KF for denoising
$y_t \sim N(\cdot|\theta, \sigma^2)$.
Plot $E[\theta|y_{1:t}] \pm {\rm Std}(\theta|y_{1:t})$ vs $t$.
{style="max-width: 50%"}
---
## KF for online linear regression
$y_t|x_t \sim N(\cdot|\theta^\intercal x_t, \sigma^2)$.
Plot $E[\theta^{1:2}|y_{1:t}]$ vs $t$.
{style="max-width: 50%"}
---
## General case: use variational infernece
Batch version: Minimize KL from true posterior $p(\theta|D)$
to approximate posterior $q_{\psi}(\theta)$
$$
\begin{aligned}
\psi &= \arg \min_{\psi} KL(q_{\psi}(\theta) |
\frac{1}{Z} p_0(\theta) p(D|\theta)) \\
&= \arg \min_{\psi} L(\psi) + \text{const} \\
L(\psi) &=
\underbrace{E_{\theta \sim q_{\psi}}
[-\log p(D|\theta)]}_\text{E[NLL]}
+
\underbrace{KL(q_\psi | p_0)}_\text{regularizer}
\end{aligned}
$$
Online version
$$
\begin{aligned}
\psi_t
&= \arg \min_{\psi} L_t(\psi) \\
L_t(\psi) &=
\underbrace{E_{\theta \sim q_{\psi}}
[-\log p(y_t|h_t(\theta_t))]}_\text{incremental E[NLL]}
+
\underbrace{KL(q_\psi | q_{\psi_{t|t-1}})}_\text{recursive
regularizer}
\end{aligned}
$$
---
## Backgound: Exponential family distributions
We will consider exponential family variational posteriors with
natural parameters $\psi$,
dual (moment) parameters $\rho$,
sufficient statistics $T(\theta)$,
and log-partition function $\Phi(\psi)$:
$$
\begin{aligned}
q_{\psi}(\psi) &= \exp(\psi^\intercal T(\theta) - \Phi(\psi)) \\
\rho &= E_{\theta \sim q_{\psi}}[T(\theta)]
= \nabla_{\psi} \Phi(\psi)
\end{aligned}
$$
Example: Gaussian distribution
$$
\begin{aligned}
\psi_t^{(1)} &= \Sigma_t^{-1} \mu_t \\
\psi_t^{(2)} &= -\frac{1}{2} \Sigma_t^{-1} \\
\rho_t^{(1)} &= \mu_t \\
\rho_t^{(2)} &= \mu_t \mu_t^\intercal + \Sigma_t
\end{aligned}
$$
---
## Background: Natural Gradient Descent
NGD = preconditioned gradient descent
$$
\begin{aligned}
\psi &:=
\psi + \alpha F_{\psi}^{-1} \nabla_{\psi} L(\psi)
\end{aligned}
$$
where $F$ is the Fisher information matrix.
For exponential families, we have
$$
\begin{aligned}
F_{\psi} &= \frac{\partial \rho}{\partial \psi}
F_{\psi}^{-1} \nabla_{\psi} L(\psi)
&= \nabla_{\rho} L(\rho)
\end{aligned}
$$
---
## Background: BLR and BBB
Bayesian Learning Rule (Khan and Rue, 2023) uses multiple iterations
of natural gradient descent (NGD) on the VI objective
(Evidence Lower Bound).
In the online setting, we get the following
iterative update at each step $t$:
$$
\begin{aligned}
\psi_{t,i} &=
\psi_{t,i-1} + \alpha F_{\psi_{t|t-1}}^{-1}
\nabla_{\psi_{t,i-1}} L_t(\psi_{t,i-1}) \\
&= \psi_{t,i-1} + \alpha
\nabla_{\rho_{t,i-1}} L_t(\psi_{t,i-1}) \\
L_t(\psi_{t,i}) &=
E_{q_{\psi_{t,i}}}[
\log p(y_{t} \vert h_{t}(\theta_{t}))]
-KL(q_{\psi_{t,i}} | q_{\psi_{t \vert t-1}})
\end{aligned}
$$
Bayes By Backprop (Blundell et al, 2015)
is similar to BLR but uses GD, not NGD.
$$
\begin{aligned}
\psi_{t,i} &=
\psi_{t,i-1} + \alpha
\nabla_{\psi_{t,i-1}} L_t(\psi_{t,i-1})
\end{aligned}
$$
---
## Our approach: BONG and LOFI
- "Bayesian online natural gradient" (BONG).
Matt Jones, Peter Chang, Kevin Murphy.
NeurIPS 2024.
- "Low-rank extended Kalman filtering for online learning of neural
networks from streaming data'' (LOFI).
Peter Chang, Gerardo Duran-Martin, Alex Shestopaloff, Matt Jones, Kevin Murphy.
COLLAS 2023.
Contributions:
- C1. Simplified one-step version of BLR.
- C2. Faster (deterministic) way to compute (the gradient of) the objective.
- C3. Faster diagonal plus low-rank (DLR) variational posterior (LOFI).
- C4. Unifying framework (and experimental comparison)
for many previous methods.
---
## C1. Single step update
In the BLR, if
we initialize with $\psi_{t,0}=\psi_{t|t-1}$,
then the KL term vanishes,
but we still have implicit regularization due to initialization.
$$
\begin{aligned}
L_t(\psi_{t,i}) &=
E_{q_{\psi_{t,i}}}[
\log p(y_{t} \vert h_{t}(\theta_{t}))]
-\cancel{KL(q_{\psi_{t,i}} | q_{\psi_{t \vert t-1}})}
\end{aligned}
$$
In BONG, we therefore just take one step update of
$$
\begin{aligned}
L_t(\psi_{t}) &=
E_{q_{\psi_{t}}}[
\log p(y_{t} \vert h_{t}(\theta_{t}))]
\end{aligned}
$$
Theorem: This is exact in the conjugate case
(eg. Gaussian prior, linear Gaussian likelihood).
---
## BLR vs BONG
{style="max-width: 50%"}
---
## 4 update rules
- (NGD or GD) x (Implicit reg. or KL reg)
$$
\begin{array}{lll} \hline
{\rm Name} & {\rm Loss} & {\rm Update} \\
{\rm BONG} & {\rm E[NLL]} & {\rm NGD} (I=1) \\
{\rm BOG} & {\rm E[NLL]} & {\rm GD} (I=1) \\
{\rm BLR} & {\rm ELBO} & {\rm NGD (I>1)} \\
{\rm BBB} & {\rm ELBO} & {\rm GD} (I>1) \\
\end{array}
$$
---
## C2. Faster update
Generic update rule for Gaussian variational family
$$
\begin{aligned}
\mu_t &= \mu_{t|t-1} + \Sigma_t
\underbrace{E_{\theta_t \sim q_{\psi_{t|t-1}}}
[\nabla_{\theta_t} \log p(y_t|h(x_t,\theta_t))]}_{g_t} \\
\Sigma_t^{-1} &= \Sigma_{t|t-1}^{-1} -
\underbrace{E_{\theta_t \sim q_{\psi_{t|t-1}}}[
\nabla^2_{\theta_t} \log p(y_t|h(x_t,\theta_t))]}_{G_t}
\end{aligned}
$$
Key question: how to compute gradient $g_t$ and
Hessian $G_t$?
---
## Computing the gradient
Exact expected gradient
$$
\begin{aligned}
g_t = E_{\theta_t \sim q_{\psi_{t|t-1}}}
[\nabla_{\theta_t} \log p(y_t|h(x_t,\theta_t))]
\end{aligned}
$$
Standard approach: Monte Carlo approximation
$$
\begin{aligned}
g_t^{MC} = \frac{1}{K} \sum_{k=1}^K
\nabla_{\theta_t} \log p(y_t|h(x_t,\theta_t^k)),
\theta_t^k \sim q_{\psi_{t|t-1}}
\end{aligned}
$$
Our approach: linearize the likelihood and compute
expectation deterministically (c.f., EKF)
$$
\begin{aligned}
g_t^{LIN} &= H_t^\intercal R_t^{-1} (y_t-\hat{y}_t) \\
\hat{y}_t &= h(\mu_{t|t-1},x_t) \\
H_t &= \frac{\partial h_t}{\partial \theta_t}|_{\theta_t=\mu_{t|t-1}} \\
R_t &= \text{Var}(y_t|\theta_t=\mu_{t|t-1}) \\
&= \hat{y}_t (1-\hat{y}_t) // {\rm Bernoulli}
\end{aligned}
$$
---
## Computing the Hessian: second-order approximations
Exact expected Hessian
$$
\begin{aligned}
G_t &= E_{\theta_t \sim q_{\psi_{t|t-1}}}[
\nabla^2_{\theta_t} \log p(y_t|h(x_t,\theta_t))]
\end{aligned}
$$
- MC-Hess: Sample $\theta_t^k$ and plug into Hessian
$$
G_t^{MC-HESS} = \frac{1}{K} \sum_{k=1}^K
\nabla^2_{\theta_t} \log p(y_t|h(x_t,\theta_t^k))]
$$
- Lin-Hess: Linearize and compute Jacobian
$$
G_t^{LIN-HESS} = -H_t^\intercal R_t^{-1} H_t
$$
---
## Computing the Hessian: empirical Fisher approximations
Exact expected Hessian
$$
\begin{aligned}
G_t &= E_{\theta_t \sim q_{\psi_{t|t-1}}}[
\nabla^2_{\theta_t} \log p(y_t|h(x_t,\theta_t))]
\end{aligned}
$$
- EF with MC gradients (BLR):
$$
G_t^{MC-EF} = -g_t^{MC} (g_t^{MC})^\intercal
$$
- EF with linearized gradients (BONG):
$$
G_t^{LIN-EF} = -g_t^{LIN} (g_t^{LIN})^\intercal
$$
---
## C3. LOFI: DLR variational posterior
We use a Gaussian variational family
$$
q_{\psi_t}(\theta_t) = N(\theta_t | \mu_t, \Sigma_t)
$$
|Name|Form|Complexity|
|----|----|----------|
Full rank | $(\mu,\Sigma)$ | $O(P^3)$
Diagonal (mean field) | $(\mu,{\rm diag}(\sigma))$ | $O(P)$
Diagonal+low rank (DLR) | $(\mu,({\rm diag}(\Upsilon)+W W^{\intercal})^{-1})$ | $O(P R^2)$
---
## DLR update
EKF Predict-Update, then SVD projection.
{style="max-width: 50%"}
---
## DLR update
{style="max-width: 40%"}
---
## C4. Unified framework
- 4 updates x 4 grad/Hess $g/G$ x 3 families $q$ = 48 methods
- Covers many new / existing methods, e.g., BBB, VON, SLANG,
CM-EKF, VD-EKF, RVGA, LRVGA, LOFI
- P: \# params, R: rank, M: \# MC, I: \# iter, C: output dim
{style="max-width: 50%"}
---
## Example: two moons binary classification
* Using a single hidden-layer neural network and moment-matched (EKF) approx.

---
## Sample efficiency: Misclassification vs sample size (MNIST)
{style="max-width: 50%"}
---
## Calibration: ECE vs sample size
Expected calibration error
{style="max-width: 75%"}
----
## Application: multi-armed bandits
{style="max-width: 20%"}
----
## From Bandits to Contextual Bandits
MAB
$$
\begin{aligned}
\arg \max_{a_{1:T}} & \sum_{t=1}^T E[R(a_t)] \\
R(a_t=k) & \sim N(\mu_k, \sigma_k^2) // \text{Gaussian bandit} \\
R(a_t=k) & \sim {\rm Bern}(\mu_k) // \text{Bernoulli bandit}
\end{aligned}
$$
CB
$$
\begin{aligned}
\arg \max_{\pi_{1:T}} & \sum_{t=1}^T E[R(s_t, \pi_t(s_t))] \\
R(s_t, a_t=k) & \sim N(w_k^\intercal s_t, \sigma_k^2)
// \text{linear regression} \\
R(s_t, a_t=k) & \sim {\rm Bern}(\sigma((w_k^\intercal s_t)))
// \text{logistic regression} \\
R(s_t,a_t=k) &\sim N(h(\theta,s_t,k), \sigma^2)
// \text{neural bandit}
\end{aligned}
$$
----
## Applications of (Contextual) Bandits
|Application|State|Action|Reward|
|---|---|---|---|
Clinical trials | Patient features | Drug $1 \ldots K$ | Health outcome
Recommender system| User/movie features | Movie $1 \ldots K$ | Rating $1 \ldots 5$
Advertising system| User/webpage features | Ad $1 \ldots K$ | Click $0,1$
BayesOpt | - | Parameters $\theta \in R^D$ | Objective fn.
---
## Exploration-Exploitation Tradeoff
Need to try new actions (explore) to learn about their effects
before exploiting the best action.
{style="max-width: 25%"}
---
zoom: 0.8
---
## Upper Confidence Bound (UCB)
$$
\begin{aligned}
\pi_t(a^* | s_t) &= {\cal I}
(a^* = \arg \max_{a} \mu_t(a) + c \sigma_t(a) )\\
\mu_t(a) &= E[R(s_t, a) | D_{1:t-1}] \\
\sigma_t(a) &= \sqrt{ Var(R(s_t, a) | D_{1:t-1} ) }
\end{aligned}
$$
{style="max-width: 50%"}
----
## Thompson Sampling (TS)
$$
\begin{aligned}
\pi_t(a^*|s_t) &= p(a^* = \arg \max_{a} R(a, s_t) |D_{1:t-1}) \\
&= \int {\cal I}(a^* = \arg \max_{a} R(a, s_t; \theta) )
p(\theta|D_{1:t-1}) d\theta \\
&\approx {\cal I}(a^* = \arg \max_{a})
R(a, x_t; \tilde{\theta}_t) ) \\
& \text{ where } \tilde{\theta}_t \sim p(\theta|D_{1:t-1})
\end{aligned}
$$
----
## Bayesian updating for contextual bandits
$$
\begin{aligned}
p(r|s,a;\theta) &= N(r|h(\theta,s), \sigma^2) // \text{Likelihood} \\
p(\theta|D_{1:t-1}) &= \prod_a N(\theta^a|\mu_{t-1}^a, \Sigma_{t-1}^a) //
\text{Factored prior} \\
p(\theta|D_{1:t}) &= \prod_a N(\theta^a|\mu_{t}^a, \Sigma_{t}^a)
// \text{Factored posterior} \\
(\mu_t^a,\Sigma_t^a)
&= \text{Update}(\mu_{t-1}^a \Sigma_{t-1}^a, s_t, r_t, a_t)
// \text{iff $a=a_t$}
\end{aligned}
$$
----
## Contextual bandit shootout (MNIST)
{style="max-width: 50%"}
``Efficient Online Bayesian Inference for Neural Bandits''.
Gerardo Duran-Martin, Aleyna Kara, Kevin Murphy. AISTATS 2022.
---
## Changes in the data-generating process
When more data does not lead to better performance.
- DGP $p_t(y_t|x_t)$ might change slowly or suddenly
- Slow changes: sensor degrades, bandit/RL policy slightly updated
- Sudden changes: shock to system due to news events (e.g. Covid, DeepSeek)
- Need adaptive learning rules!
---
## Non-stationary moons dataset

---
## The full dataset (without knowledge of the task boundaries)
{style="max-width: 50%"}
---
## Non-stationary moons using constant parameter assumption

---
## BONE
- "BONE: (B)ayesian (O)nline learning in (N)on-stationary (E)nvironments".
Gerardo Duran-Martin, Leandro Sánchez-Betancourt, Alexander Shestopaloff, and Kevin Murphy.
Arxiv, 2024.
- Hierarchical Bayesian model that allows $\theta_t$ to drift
slowly within a "regime" (DGP $p(y_t|\theta_t, x_t)$),
and then suddenly switch
to a new "regime" (different DGP $p'(y_t|\theta_t, x_t)$)
- Regime is specifed by a latent discrete indicator variable
(auxiliary variable)
- Subsumes prior work on changepoint models, etc.
---
layout: two-cols
---
## Hierarchical Bayesian model
Switching State Space Model (SSM).
{style="max-width: 20%"}
::right::
$$
x += 1
$$
---
## BONE bakeoff

---
## Summary and future work
- Sequential Bayesian inference has many applications,
from online learning to bandits.
- We propose new efficient (and deterministic) algorithms
based on recursive variational inference and (low rank) Gaussian approximations
(BONG/LOFI).
- Modeling non-stationarity is important in many applications,
and can require additional modeling and algorithmic tricks
(BONE).
- Future work: applications to RL.