Multiple Modes for Continual Learning
Abstract
Adapting model parameters to incoming streams of data is a crucial factor to deep learning scalability.
Interestingly, prior continual learning strategies in online settings inadvertently anchor their updated parameters to a local parameter subspace to remember old tasks, else drift away from the subspace and forget.
From this observation, we formulate a trade-off between constructing multiple parameter modes and allocating tasks per mode.
Mode-Optimized Task Allocation (MOTA), our contributed adaptation strategy, trains multiple modes in parallel, then optimizes task allocation per mode.
We empirically demonstrate improvements over baseline continual learning strategies and across varying distribution shifts, namely subpopulation, domain, and task shift
Introduction
As the world changes, so must our models of it.
The premise of continual (or incremental or lifelong) learning is to build adaptive systems that enable a model to return accurate predictions as the test-time distribution changes, such as a change in domain or task.
Training sequentially on multiple different task distributions tends to result in catastrophic forgetting (McCloskey & Cohen, 1989), where parameter updates benefiting the inference of the new task may worsen that of prior tasks.
Alleviating this is the motivation for our work.
To enable flexibility in adoption, we do not assume parameter adaptation w.r.t.
known task boundaries at test-time, and we assume only access to model parameters alone (no conditioning inputs, query sets, rehearsal or replay buffers, N -shot metadata, or any historical data).
This carries positive implications for adoption in online learning settings, and robustness towards different distribution shifts (e.g. sub-population, domain, task shifts).
Interestingly.
prior work in non-rehearsal methods (notably regularization and parameter isolation methods) tend to "anchor" the parameter updates with respect to a local parameter subspace.
These methods begin with a model initialization, then update the model with respect to the first task, and henceforth all future parameter updates on new tasks are computed with respect to this local subspace.
The key question we ask here: what happens when we consider the global geometry of the parameter space?
Contributions.
We introduce a new rehearsal-free continual learning algorithm
(Algorithm 1).
We initialize pre-trained parameters, maximize the distance between the parameters on the first task, then on subsequent tasks we optimize each parameter based on the loss with respect to their joint probability distribution as well as the each parameter’s drift from its prior position (and reinforce with backtracking).
Evaluating forgetting per capacity, MOTA tends to outperform baseline algorithms (Table 3), and adapts parameters to sub-population, domain, and task shifts (Tables 1, 2).
Related Work.
Lange et al.
(2019) taxonomized continual learning algorithms into replay, regularization, and parameter isolation methods.
Replay (or rehearsal) methods store previous task samples to supplement retraining with the new task, such as iCaRL (Rebuffi et al., 2017), ER (Ratcliff, 1990;
Robins, 1995; Riemer et al., 2018; Chaudhry et al., 2019), and A-GEM (Chaudhry et al., 2018b).
Parameter isolation methods allocate different models or subnetworks within a model to different tasks, such as PackNet (Mallya & Lazebnik, 2017), HAT (Serrà et al., 2018), and SupSup (Wortsman et al., 2020).
Task oracles may be required to activate the task-specific parameters.
Regularization methods add regularization terms to the loss function to consolidate prior task knowledge, such as
EWC (Kirkpatrick et al., 2017b), SI (Zenke et al., 2017), and LwF (Li & Hoiem, 2016).
These methods tend to rely on no other task-specific information or supporting data other than the model weights alone.
We are amongst the first to leverage the global geometry of the loss landscape for task adaptation.
Though our method leverages multiple models, we do not assume known task boundaries through a task oracle, and we use smaller models for fair capacity comparison.
Trade-off between Multiple Modes and Task Allocation
First we introduce the problem set-up of continual learning (with assumptions extendable to broader online learning settings.
Then we share the observations that motivate our study into multiple modes.
Finally we present a trade-off, which motivates our proposed learning algorithm.
Problem Setup.
A base learner receives T tasks sequentially.
D t = { x t , y t } denotes the dataset of the t -th task.
In the continual learning setting, given loss function L , a neural network f
( θ ; x ) optimizes its parameters θ such that it can perform well on the t -th task while minimizing performance drop on the previous ( t − 1) tasks: θ ∗ :
= arg min θ (cid:80) Tt =
1 L ( f ( θ ; x t ) , y t ) .
We assume the only information available at test-time is the model(s) parameters and the new task’s data points.
The learner cannot access any prior data points from previous tasks, and capacity is not permitted to increase after each task.
Additionally, we do not assume parameter adaptation at test-time can be conditioned on task boundaries or conditioning inputs (task index, K -shot query data, etc).
Trade-off.
We denote θ init as the initialization parameter, θ MTL(1,...,T) as the multi-task parameter trained on tasks 1 , ..., T , and θ i,t as the parameter of mode index i updated on task t .
Many regularization-based methods are grounded on minimizing drift (change in parameters) to reduce forgetting on prior tasks.
Yet in Figure 3, a multi-task learner has a higher average drift consistently between tasks than EWC, even when both begin from a shared starting point (init → task 1).
When given visibility to prior tasks, a multi-task learner will depart the subspace of the previous parameter, and drift far.
This contradicts with the notion of forcing parameters to reside in the subspace of the previous parameter.
The regularization-based methods essentially anchor all future parameters to the first task observed.
Results in mode connectivity (Fort & Jastrzebski, 2019; Draxler et al., 2019; Garipov et al., 2018) show that a single task can have multiple parameters ("modes") that manifest functional diversity.
We explored computing multiple modes with respect to task 1 to incorporate the broader geometry of the parameter space beyond the subspace of one mode.
To bring performance gains and capacity efficiency, we further obtained this trade-off between the number of modes, number of tasks allocated per mode, and capacity (Theorem 1).
Theorem
If the number of modes N is optimized against capacity | θ | and the set of tasks allocated per mode | T ( i ) = { t }| for i ∈ N , t ∈ T , then the total task drift is lower in the multi-mode setting than single-mode setting:
[Equation]
Proof.
See Appendix A.3.
As a result, our proposed algorithm is motivated to train multiple modes while optimizing for tasks learnt per mode.
Mode-Optimized Task Allocation
Mode-Optimized Task Allocation (MOTA)
Once the first task is received, we train N models in parallel such that the distance between them is maximized.
Then for each subsequent task, we coordinate the parameter updates of the modes such that the drift per mode is minimized, and only the minimum number of modes needed to solve the task will be updated.
3.1 Mode initialization
We begin with a pre-trained initialization.
We instantiate N models on this initialization of a fixed model architecture, and denote this set of parameters { θ i,t } N for i ∈ N and t ∈ T .
We train the parameters in parallel such that the distance between each other is maximized.
For each batch per epoch, we randomly generate weights { α i } N that sum to 1 to compute an interpolated parameter (cid:98) θ = Σ
Ni α
i θ i,t .
We compute the distance (cosine similarity) between the N modes Σ Nj,j ̸
= i dist ( θ i,t , θ j,t to be maximized (adjusted with a penalty coefficient β max ).
We update each mode with respect to the input loss (evaluated with (cid:98) θ ) and the distance maximization term.
3.2 Mode adaptation
For each mode per epoch, we compute the loss with respect to a joint probability distribution.
We also compute a distance term between each mode’s parameters and its parameters at the ( t − 1) -th task dist ( θ i,t , θ i,t − 1 ) to be minimized (adjusted with a penalty coefficient β min ).
We use the EWC regularization term for distance minimization.
We update each mode with respect to the joint loss and its respective parameter drift, and checkpoint each update.
We compute the gradient update for each mode with respect to the joint probability distribution between all the modes.
Specifically, we compute the average probability distribution returned at the last (softmax) layer ℓ = − 1 of each model ρ { θ i,t } N = 1 N Σ Ni f
( θ ℓ = − 1 i,t ; x ) .
If a task has a high level of certainty, then only a small subset of models would need to be updated and return a probability distribution skewed toward the target class while the other non-updated / minimally-updated models would return a random distribution, and the resulting averaged distribution would still be slightly skewed towards the target class.
For a task of low certainty, then more models (of high functional diversity) would be updated to return a robust probability distribution.
By the time we have jointlyaccurate modes, it is likely most of the modes have been over-optimized, and thus over-drifted.
Thus, we need to backtrack and find the optimal checkpoints across modes that minimize loss with respect to their checkpointed joint probability distribution and drift.
We adopted the simplest backtracking algorithm: we enumerate through every combination of model checkpoint per epoch across the modes, and select the checkpoint combination that minimizes the loss with respect to the joint probability distribution for task t and minimizes total parameter drift.
Evaluation
We review our main results on MOTA’s improvement in task adaptation here.
Detailed experimental configurations and supplementary results can be found in the Appendix.
We evaluate MOTA against different types of distribution shifts (Table 1, Table 2).
Evaluating on task shift in CIFAR100 and TinyImageNet, we observe improved backward and forward transfer with
MOTA, indicating lower forgetting as well as improved feature transferability between tasks.
As task boundaries are not necessary for parameter adaptation, we can evaluate our method on settings that do not require an assumption of task boundaries, namely sub-population and domain shift.
We find that our method also outperforms on backward/forward transfer on Instance-IL CIFAR (sub-population shift) and Task-IL DomainNet (domain shift).
We primarily baseline MOTA against other regularization-based methods (Table 3).
Though MOTA aims to find a combination of parameters that can perform close to the multi-task learning strategy, it falls shortly behind.
By optimizing (i) the number of modes throughout the parameter space against (ii) optimal task allocation per parameter, MOTA can outperform other regularization and replay methods.
In particular, MOTA outperforms its component baselines: EWC (where this baseline and
MOTA use the EWC regularization term in minimizing mode drift), and ensembling (where this baseline and MOTA use the same distance maximization procedure from init to return modes).
We show that the optimal combination of these components can yield superior performance.
[Table] [Table]
[Table]
Conclusion
Driven by observations in the optimization behavior of multi-task learners, we hypothesize incorporating the broader geometry of the parameter space into a continual learner for improved adaptation between data distributions.
Supported by the formulation of a trade-off between the number of modes and task allocation per mode, we demonstrate that Mode-Optimized Task Allocation (MOTA) can outperform existing baselines.
It can retain a high average accuracy on current and previous data in sub-population, domain, and task shift settings.
A Appendix A.1 Experimental configurations
Incremental Learning (IL) Settings.
A task is a subsequent training phase with a new batch of data, pertaining to a new label set, new domain, or different output space.
In instance-IL, each new task bring new instances from known classes.
In class/task-IL, each new task bring instances from new classes only.
Class-IL performs inference w.r.t.
all observed classes.
Task-IL performs inference w.r.t.
the label set of the task.
We evaluate on task-IL unless otherwise specified.
Datasets.
Task-IL Split-CIFAR100 (Krizhevsky, 2009) is constructed by dividing 100 fine labels into 10 tasks (10 fine labels per task).
Instance-IL Split-CIFAR100 (Krizhevsky, 2009) is constructed by dividing 100 fine labels (mapped to 5 coarse labels) into 5 tasks (20 coarse labels per task).
Instance-IL DomainNet (Peng et al., 2019) is composed of 6 domains with 345 labels.
Task-IL
TinyImageNet (Stanford) is constructed by dividing 200 labels into 10 tasks (20 labels per task).
Architectures.
We utilize ResNets-{18, 50, 152} (He et al., 2015), loading weights from PyTorch (Paszke et al., 2019) pretrained on ImageNet, with { 11 , 181 , 642 || 23 , 528 , 522 || 58 , 164 , 298 } trainable parameters respectively.
To retain comparable capacity, ResNet-50 (-18) is the default model for baselines (MOTA).
We loaded pre-trained ImageNet weights for each ResNet architecture with
PyTorch (Paszke et al., 2019).
We trained for 200 epochs, with batch size 512, using AdamW optimizer (learning rate 0.1 with 1cycle learning rate policy) train/val/test split of 70/10/20%, We train and evaluate (including when averaging the joint probability distribution) using a cross-entropy loss function.
We used seed 3407 through all operations; for those requiring multiple unique random values (e.g. multiple randomly initialized models), the seed is the index of the object (1, 2, ...).
MOTA.
The distance maximization coefficient β max is 100.0.
For the distance minimization procedure in subsequent epochs, we retain the elastic weights consolidation procedure of computing the Fisher information matrix and computing its corresponding regularization term.
We retain EWC’s lambda β min =
λ = 1 , 000 .
Baselines & Ablations.
We do not assume task boundaries at test-time for parameter adaptation, and do not use task index to recompute task-specific parameters.
We evaluate against regularization methods (Elastic Weight Consolidation (Kirkpatrick et al., 2017b), Synaptic Intelligence (Zenke et al., 2017), Learning without Forgetting (Li & Hoiem, 2016)).
The regularization strength for weight penalty for EWC and SI is 1 , 000 and 100 respectively, with SI dampening term 0 .
1 , and LwF’s temperature for distillation loss 2 . 0 .
We also compare against two replay baselines (Experience
Replay (Rolnick et al., 2018), Averaged Gradient of Episodic Memory (Chaudhry et al., 2018b)), though they require a task replay buffer for parameter adaptation.
The memory buffer’s budget per class is 100 , with A-GEM epsilon (parameter to ensure numerical stability of A-GEM) 10 − 7 .
We introduce two ablations: Ensemble (distance max.) which is an ensemble of modes obtained using
MOTA’s distance maximization procedure and trained on all tasks, and Ensemble (independent seeds) which is an ensemble of modes trained on all tasks but from independent random initializations.
We used the same number of models in ensemble as the number of modes of the comparable MOTA ( N = 2 for Table 3).
We retain the same distance maximization coefficients as MOTA, and use unique seeds (1,2,...) for each model’s random initialization.
Metrics.
Single-Task Learning trains on each task independently.
Multi-Task Learning trains on all seen tasks simultaneously.
Primarily baselined against regularization methods, capacity is the number of trainable model parameters.
When considering replay methods as well, we distinguish capacity w.r.t.
model parameters from repay buffer, where the replay budget is 100 per class.
The average drift distance between tasks is the distance between the updated parameters and previous parameters, averaged for each task update instance.
For multiple model parameters, we take the cumulative distance.
We compute this from 1 T − 1 Σ
Tt =2 Σ
Ni dist ( θ i,t , θ i,t − 1 ) .
Given Acc ( θ, x t ) as the validation accuracy on the t -th task, average accuracy is the average validation accuracy across all seen tasks w.r.t.
the parameters updated at the t -th task.
We compute this from 1 t (cid:80) t v =1 Acc ( θ t , x v ) .
Backward Transfer (Lopez-Paz & Ranzato, 2017) measures the influence that learning a task has on the performance on previous tasks.
We compute this from 1 t − 1 (cid:80) t − 1 v =1 Acc ( θ t , x v ) − Acc ( θ v , x v ) .
Forward Transfer (Lopez-Paz & Ranzato, 2017) measures the influence that learning a task has on the performance of future tasks.
We compute this from 1 t − 1 (cid:80) tv =2 Acc ( θ v − 1 , x v ) − Acc ( θ init , x v ) .
Remembering (Díaz-Rodríguez et al., 2018) computes the forgetting part of Backward Transfer.
We compute this from 1 − | min(0 , 1 t − 1 (cid:80) t − 1 v =1 Acc ( θ t , x v ) − Acc ( θ v , x v )) | .
Forgetting (Chaudhry et al., 2018a) is calculated by the difference of the peak accuracy and ending accuracy of each task.
We compute this from 1 T − 1 (cid:80) T − 1 v =1 max t ∈{ 1 ,...,T − 1 } ( Acc ( θ t , x v ) − Acc ( θ T , x v )) .
A.2 Distance regularization term
Distance maximization term.
For this distance maximization procedure, we used the average cosine similarity between each layer ℓ between every pair of models dist =
[Equation]
out of [Equation] and N layers and models respectively.
Distance minimization term.
Importance of each parameter is computed for each task by the parameter’s corresponding diagonal element from its Fisher Information matrix F .
Given the index of the parameters i ( i th element of θ t , i th diagonal element of F ), importance of the previous task compared to the next task λ , we can compute the EWC regularization term (Kirkpatrick et al., 2017a): (cid:80) | θ
[Equation] 1 | i = [Equation]
A.3 Analysis on Multiple Modes vs Task Allocation Trade-off
First we denote θ init as the initialization parameter, θ MTL(1,...,T) as the multi-task parameter trained on tasks 1 , ..., T , and θ i,t as the parameter of mode index i updated on task t .
Lemma 1 Iterating through each task t , for a reference multi-task parameter θ MTL , the cumulative distance between an updated θ i,t and previous θ i,t − 1 parameter with respect to θ MTL will exceed the drift between θ i,t and θ i,t − 1 :
[Equation]
Proof.
By the triangle inequality, the sum of the distances between the previous and the updated parameter with respect to θ MTL will exceed the drift between the previous and the updated parameter:
[Equation]
Thus, we can show that that the cumulative distance between an updated parameter with respect to θ MTL will exceed the drift between the updated and previous parameters.
Hence, this cumulative distance also measures the task drift.
[Equation]
Definition 1 (Task Allocation)
Task Allocation is defined as a procedure that allocates a set of tasks
T ( i ) = { t } to be learnt by a parameter mode θ i,t of index i .
Definition 1.1 (Optimal Task Allocation)
Optimal Task Allocation is defined as a procedure that maximizes the number of tasks |{ t }| allocated per mode of index i , while minimizing the total drift between parameter updates Σ [-Ni =
-]N i =
1 Σ T ( i ) t ( θ i [Equation] t − θ i
[Equation] t − [Equation] Corollary 1 We can approximate Optimal Task Allocation by optimizing the number of tasks |{ t }| allocated to mode i against the cumulative distance between an updated θ i,t and previous θ i,t − 1 parameter with respect to θ MTL (Lemma 1).
This results in:
[Equation]
In other words, T ( i ) ∝ 1 θ i,t − θ MTL .
At least one task must be allocated per mode | T ( i ) | ≥ 1 .
Corollary
Given L ( f ( θ MTL(1,...,T) ; x T ( i ) ) , y T ( i ) )
≈ L ( f ( θ T ( i ) ; x T ( i ) ) , y T ( i ) ) , we use θ MTL =
θ MTL(1,...,T) as the reference multi-task parameter.
Theorem
If the number of modes N is optimized against capacity | θ | and the set of tasks allocated per mode | T ( i ) = { t }| for i ∈ N , t ∈ T , then the total task drift is lower in the multi-mode setting than single-mode setting:
[Equation]
Proof.
Based on Lemma 1, given N modes and optimal task allocation T ( i ) with respect to the distance between each θ i and θ MTL , we can compute the total drift with respect to θ MTL as Σ Ni =1 Σ T ( i ) t ( θ i,t − θ MTL ) .
Note that the capacity of an evaluated mode changes between the multi-mode and single-mode setting.
We can compute the total drift normalized by capacity (specifically the number of parameter values) with the squared Euclidean distance averaged by number of dimensions
[Equation]
given | θ MTL | ≡ | θ i,t | .
From Corollary 1, | T ( i ) | is larger when θ i is closer to θ MTL .
Thus for a threshold T , we can decompose the total drift into:
[Equation]
Consequently, taking the difference in total drift (Eqt 4) between multiple-mode against single-mode settings result in the follow trade-off function:
[Equation]
Notably, for small T (e
[Equation]
g. T = 1 ), the Σ T ( i ) (cid:12)(cid:12) | T ( [Equation] |≤T t
[Equation]
) 2 term only learns a few tasks per mode, lowers the capacity available per mode | θ | /N , and thus these capacity-inefficient modes are redundant .
Furthermore, as T decreases, the functional diversity of a mode is less important, and any random mode can generalize the set of tasks T ( i ) (cid:12)(cid:12) | T ( i ) | ≤ T .
Hence,
[Equation]
[Equation]
If N = 1 , then π = 0 , given:
[Equation]
Performance would be identical to the single-mode sequential learning case.
If N → ∞ (and redundant modes dominate) [Equation] then π > 0 , given:
[Equation]
Though the terms where | T ( i ) | > T may reduce the cumulative distance compared to a singlemode setting, an extremely large number of modes will result in excess modes only storing one/few tasks.
These excess terms will increase, and the cumulative distance from θ MTL will be greater in the multi-mode setting than the single-mode setting.
If 0 < N < ∞ is optimized, then π < 0 , given:
[Equation]
For | T ( i ) | ≤ T , any sampled mode will be similarly distant from θ MTL , thus we can cancel this term on both sides.
[Equation]
This result shows that, compared to single-mode sequential learning, if we optimize the number of modes N , then we can minimize the cumulative distance with respect to θ MTL , and thus minimize the total task drift.
In other words, we conclude that optimizing the number of modes N against capacity | θ | and tasks allocated per parameter | T ( i ) | can outperform training on a single mode.
If we increase N , then we can minimize the total task drift.
If N is too large, however, then the number of tasks allocated per parameter | T ( i ) | decreases, and thus increases the number of redundant mode terms (and total task drift). [Equation] [Figure]
[Equation]
A.4 Tradeoff between accuracy and capacity
[Figure]
1: Varying modes count: Compared to EWC (ResNet50/152), we evaluate the trade-off between accuracy against capacity (number of modes), given a constant number of tasks.
We learn from ensemble performance in Table 3 that utilizing global geometry alone is not sufficient to improve average accuracy, and that we need to optimally allocate tasks per mode.
Similarly in Figure 1, we observe a similar inclination for a balance between capturing global geometry and optimizing tasks per mode.
We would expect that, given a constant number of tasks, an increasing number of modes would result in improved average accuracy.
Instead, the average accuracy gain between 2-6 ResNet18s is minimal.
We also observe a trade-off between the number of modes and optimal task allocation per mode.
Considering EWC (ResNet50; i.e. 1 ×
ResNet50) and 2 − 3 × ResNet50, an increase in the number of modes results in an increase in average accuracy.
Considering constant capacity, 4 × ResNet18 outperforms 2 × ResNet50; however, 3 × ResNet50 outperforms 6 × ResNet18.
A.5 Changes to the geometry of the parameter space
From Table 1, the average task drift (drift distance between the next and previous task’s parameters) tends to be lower for MOTA than EWC, Single-Task, and Multi-Task Learning.
This can be visually observed in the trajectory of the parameters in Figure 2.
We also observe from Figure 2 that the loss landscape changes drastically between tasks.
A region considered to be low-loss by a parameter at task t becomes a high-loss region with respect to the next task t + 1 .
As each task is added, the sharpness of the basin upon which the EWC parameter exists tends to increase.
This change in sharpness tends to be much smaller for the regions in which MOTA modes are located, where the basin still retains a similar level of flatness.
E W
C
Task
[Table]
M o d e M o d e
[Table]
E W
C
M o d e M o d e
[Table]
[Figure]
1: procedure update_parameters ( D t , { θ i,t } Ni =1 )
▷ Passanewtask D t toourcurrentparameters { θ i,t } Ni
=1 2: if t =1 then ▷ Checkifinitializingparametersforthefirsttime 3: { θ i,t } Ni =1 ← initialize_task
( D 1 , { θ i,t } Ni =1 ) 4: else 5: { θ i,t − 1 } Ni =1 ← { θ i,t } Ni =
▷ Retainacopyofthelasttask’sparameters 6: for e in epochs do 7: for θ i,t in { θ i,t } Ni =1 do 8: for ( x t , y t ) in D t do 9: ρ { θ i,t } Ni =1 =
joint_inference ( x t , { θ i,t } Ni =1 ) 10:
L t =
L ( ρ { θ i,t } N , y t ) + β min dist( θ i,t , θ i,t − 1 )
▷ Computelossw.r.t.
jointprobabilityanddrift 11: θ i,t := θ i,t − ∂ L t
∂θ
i,t ▷ Updateeachparameterindependently 12: { t ∗ , e ∗ } N := arg min { t,e } N L ( ρ { θ i,t,e } N , y t )
▷ Backtracking:
Enumeratethroughparametercombinations + Σ N i =1 dist ( θ i,t,e , θ i,t − 1 ) for { θ i,t,e } N i =1 ∼ { θ i,t,e } N × epochs i = 13: { θ i,t } Ni =1 ← { θ i,t ∗ ,e ∗ } Ni = 14: return { θ i,t } Ni =
1: procedure initialize_task1 ( D 1 , { θ i,t } Ni =1 ) ▷ Initializeparametersontask D 1 andemptyparametersset { θ i,t } Ni = 2: { θ i,t } Ni =1 ← { θ init } Ni = 3: for e in epochs do 4: for ( x t , y t ) in D 1 do 5: α i ∼ [0 , 1] ∀ i ∈ N s.t.
Σ Ni =
α i ≡6: (cid:98) θ = Σ Ni =
α i θ i,t ▷ Sampleinterpolatedparameter (cid:98) θ 7:
L t =
L ( f ( (cid:98) θ ); x t , y t ) + β max Σ Nj =1 ,j ̸
= i dist( θ i,t , θ j,t )
▷ Computelossanddistanceterm 8: θ i,t :
= θ i,t − ∂ L t
∂θ
i,t
▷ Updateeachparameterindependently 9: return { θ i,t } Ni =
Algorithm
1: procedure joint_inference ( x , { θ i,t } Ni =1 )
▷ Inferenceusingthesetofparameters { θ i,t } Ni = 2: ρ { θ i,t,e } N = 1 N Σ N i =1 f ( θ ℓ = − 1 i,t ; x ) ▷ Takingaverageofthejointprobabilitydistributionreturnedatthesoftmaxlayer ℓ = −3: return ρ { θ i,t,e } N