cl-agentic-vault / methods /batchensemble.md
TLESORT's picture
Release of the Continual-Learning Ideas Vault (vault commit c7897617) (part 8)
e597105 verified
|
Raw History Blame Contribute Delete
3.93 kB
---
family: architecture
introduced-in: "[[wen2020-batche]]"
stores: [per-task-rank-1-fast-weights, per-task-head, frozen-modules]
requires-boundaries: yes
requires-task-id: train+test
memory-growth: linear
tags: [method]
---
# BatchEnsemble
## What it does
BatchEnsemble composes each ensemble member's (or, in lifelong learning, each
task's) weight matrix as the Hadamard product of one shared full-rank "slow"
weight W and a member-specific rank-1 "fast" weight r_i s_iᵀ:
W_i = W ∘ (r_i s_iᵀ). Since W_i x = (W(x ∘ r_i)) ∘ s_i, every member reduces to
element-wise scaling of a layer's inputs and outputs around one shared matrix
multiply, so all members run vectorized in a single forward pass on one device.
For lifelong learning, one member is assigned per task: task 1 trains W plus
its fast weights, each later task trains only its own two vectors per layer
(plus a per-task head) with W frozen — past tasks' models are never modified,
so forgetting is prevented by construction, with no rehearsal buffer.
## Aspects
- **Stores**: per task, two vectors (r_t, s_t) per layer — input- and
output-dimension sized — plus a per-task final linear classifier; the shared
weight is stored once and frozen after task 1. Fast weights are initialized
as random sign vectors (this, not an explicit diversity loss, provides
member diversity in the ensemble use).
- **Update rule**: task 1 minimizes the task loss over (W, r_1, s_1); task
t > 1 minimizes it over (r_t, s_t) and the task head only. Weight decay is
applied to the mean ensemble weight (or the shared weight alone), computable
without materializing any W_i.
- **Requires**: task boundaries during training (a new fast-weight pair per
task) and task identity at train and test to select the fast weights and
head (cf. [[settings-should-declare-drift-assumptions]]). From-scratch
start; no stored data.
- **Costs**: memory grows linearly in task count but at two vectors per layer
per task — on Split-ImageNet, 100 tasks cost 20% total parameter overhead
(30M vs 25M for one ResNet-50). Compute overhead is one Hadamard product
per layer: 1.11X a vanilla network's training compute on Split-CIFAR100
(LeNet). If tasks arrive in parallel, all can be trained simultaneously in
one vectorized pass.
## Documented behavior
- [[wen2020-batche]] (introducing): on Split-CIFAR100 (task-IL, 20 tasks,
reduced ResNet-18, from scratch) comparable average accuracy to PNN while
preserving PNN's no-forgetting property, with 4X speed-up and 50X less
memory; costs 1.11X compute / 1.10X memory of a vanilla network vs DEN
9.58X/5.31X and RCL 26.41X/2.52X. On Split-ImageNet (100 tasks, ResNet-50)
consistently outperforms a parameter-matched BN-Tuned baseline; an
individual-network-per-task upper bound remains above it. Authors flag
rank-1 expressiveness as a concern for strongly varied tasks, and that only
task-1 knowledge transfers forward (shared weight trained on task 1 only).
- [[wortsman2020-supsup]] uses BatchEnsemble as a primary baseline in the
task-given (GG) setting and positions it as confined to that setting —
unlike its own entropy-based task inference, BatchEnsemble needs the task
descriptor at test time.
## Links
uses:: [[multiplicative-context-gating]] (each task's rank-1 fast weight multiplies the shared weight element-wise — equivalently, learned per-task element-wise scaling of each layer's inputs and outputs; unlike PSP's random contexts, the modulation vectors are trained on the task)
uses:: [[per-task-capacity]] (two trainable vectors per layer plus a linear head are allocated to each new task; nothing else changes)
uses:: [[frozen-modules]] (the shared slow weight is trained on the first task only and frozen for all subsequent tasks, making past-task models immutable)
## Papers engaging this method
```dataview
LIST FROM [[]] AND ("papers" OR "influences")
```