GEM (Gradient Episodic Memory) is a continual learning method that stores a small number of examples from past tasks in memory and, every time the weights are updated on a new example, uses gradient inner products to check whether the direction "does not increase the loss on the stored examples"; if it would increase that loss, the gradient is corrected to the closest safe direction before updating. Lopez-Paz and Ranzato of Facebook AI Research presented it at NIPS (now NeurIPS) in 2017.
The GEM paper frames continual learning in the following setting, which is closer to how humans learn.
- There are many tasks, and each task has few examples
- Examples arrive one at a time (or in small minibatches), and the same example is never seen twice
- Each example comes with a task descriptor indicating which task it belongs to (in this paper, an integer task index)
Training with plain SGD in this setting increases the loss on previous tasks every time the weights move to fit examples from a new task, so the model forgets previous tasks.
GEM's key idea is to treat the loss on previous tasks not as something added to the "objective" but as a constraint that it "must not increase." Methods that use previous-task examples to preserve outputs (knowledge distillation, as in iCaRL) aim to "not change" the outputs on previous tasks, so performance on previous tasks never improves either. GEM only requires that the loss "not increase," leaving room for learning a new task to improve performance on previous tasks (positive backward transfer).
Picture descending a mountain path: you move in the direction you want to go (the new task's gradient) while choosing only directions that do not take you away from important places you passed earlier (the previous tasks). If the direction you want would take you away from an important place, you adjust it to the direction that is as close as possible to it while not moving away.
Along with the method, the paper also proposes three metrics for evaluating continual learning: average accuracy (ACC), backward transfer (BWT), and forward transfer (FWT).

