SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2302.11344 · ICLR · 2023

Error Sensitivity Modulation based Experience Replay: Mitigating Abrupt Representation Drift in Continual Learning

Bahram Zonooz, Elahe Arani, Fahad Sarfraz, Episodic Memory

arXiv · PDF · Open in the Atlas

Code that ran

2 of 3 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2302.11344.json · badge: /api/ran/2302.11344.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
neurai-lab/esmer canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
FunctionStatusWhere it lives
Buffer Ran
ran on a synthesized input
neurai-lab/esmer/models/esmer.py
code served (permissive licence) · get_code("e7451956d67f9229")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from torchvision import transforms

# Define the reservoir function and Buffer class
def reservoir(num_seen_examples: int, buffer_size: int) -> int:
    """
    Reservoir sampling algorithm.
    :param num_seen_examples: the number of seen examples
    :param buffer_size: the maximum buffer size
    :return: the target index if the current image is sampled, else -1
    """
    if num_seen_examples < buffer_size:
        return num_seen_examples
    rand = np.random.randint(0, num_seen_examples + 1)
    if rand < buffer_size:
        return rand
    else:
        return -1

class Buffer:
    """
    The memory buffer of rehearsal method.
    """

    def __init__(self, buffer_size, device, n_tasks=None, mode='reservoir'):
        assert mode in ['ring', 'reservoir']
        self.buffer_size = buffer_size
        self.device = device
        self.num_seen_examples = 0
        self.functional_index = eval(mode)
        if mode == 'ring':
            assert n_tasks is not None
            self.task_number = n_tasks
            self.buffer_portion_size = buffer_size // n_tasks
        self.attributes = ['examples', 'labels', 'logits', 'task_labels', 'activations', 'contexts', 'timestamps', 'is_noise']

    def init_tensors(self, examples: torch.Tensor, labels: torch.Tensor, logits: torch.Tensor, task_labels: torch.Tensor, activations: torch.Tensor, contexts: torch.Tensor, timestamps: torch.Tensor, is_noise: torch.Tensor) -> None:
        """
        Initializes just the required tensors.
        """
        for attr_str in self.attributes:
            attr = eval(attr_str)
            if attr is not None and (not hasattr(self, attr_str)):
                typ = torch.int64 if attr_str.endswith(('els', 'stamps', 'is_noise')) else torch.float32
                setattr(self, attr_str, torch.zeros((self.buffer_size, *attr.shape[1:]), dtype=typ, device=self.device))

    def add_data(self, examples, labels=None, logits=None, task_labels=None, activations=None, contexts=None, timestamps=None, is_noise=None):
        """
        Adds the data to the memory buffer according to the reservoir strategy.
        """
        if not hasattr(self, 'examples'):
            self.init_tensors(examples, labels, logits, task_labels, activations, contexts, timestamps, is_noise)
        for i in range(examples.shape[0]):
            index = reservoir(self.num_seen_examples, self.buffer_size)
            self.num_seen_examples += 1
            if index >= 0:
                self.examples[index] = examples[i].to(self.device)
                if labels is not None:
                    self.labels[index] = labels[i].to(self.device)
                if logits is not None:
                    self.logits[index] = logits[i].to(self.device)
                if task_labels is not None:
                    self.task_labels[index] = task_labels[i].to(self.device)
                if activations is not None:
                    self.activations[index] = activations[i].to(self.device)
                if contexts is not None:
                    self.contexts[index] = contexts[i].to(self.device)
                if timestamps is not None:
                    self.timestamps[index] = timestamps[i].to(self.device)
                if is_noise is not None:
                    self.is_noise[index] = is_noise[i].to(self.device)

    def get_data(self, size: int, transform=None, multiple_aug=False, return_non_aug=False):
        """
        Random samples a batch of size items.
        """
        if size > min(self.num_seen_examples, self.examples.shape[0]):
            size = min(self.num_seen_examples, self.examples.shape[0])
        choice = np.random.choice(min(self.num_seen_examples, self.examples.shape[0]), size=size, replace=False)
        if transform is None:
            transform = lambda x: x
        ret_tuple = (torch.stack([transform(ee.cpu()) for ee in self.examples[choice]]),)
        if hasattr(self, 'labels'):
            ret_tuple += (self.labels[choice],)
        if hasattr(self, 'logits'):
            ret_tuple += (self.logits[choice],)
        if hasattr(self, 'task_labels'):
            ret_tuple += (self.task_labels[choice],)
        return ret_tuple


INIT_ARGS = {
    'buffer_size': 8,
    'device': 'cpu',
    'n_tasks': None,
    'mode': 'reservoir'
}

ARGS = {
    'examples': torch.randn(2, 3, 4, 4),
    'labels': torch.randint(0, 5, (2,)),
    'logits': torch.randn(2, 5),
    'task_labels': torch.randint(0, 2, (2,)),
    'activations': torch.randn(2, 6),
    'contexts': torch.randn(2, 7),
    'timestamps': torch.randint(0, 100, (2,)),
    'is_noise': torch.randint(0, 2, (2,))
}

METHOD = 'add_data'

if __name__ == '__main__':
    buffer = Buffer(**INIT_ARGS)
    buffer.add_data(**ARGS)
    print(f"Buffer num_seen_examples: {buffer.num_seen_examples}")
    print(f"Buffer examples shape: {buffer.examples.shape}")
    print("Setup and execution successful!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ContinualModel Ran
ran on a synthesized input
neurai-lab/esmer/models/esmer.py
code served (permissive licence) · get_code("57fede31419af8bc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn
from torchvision import transforms
from argparse import Namespace

# Create a simple backbone network
class SimpleBackbone(nn.Module):
    def __init__(self, input_dim=12, hidden_dim=8, output_dim=5):
        super().__init__()
        self.fc1 = nn.Linear(input_dim, hidden_dim)
        self.fc2 = nn.Linear(hidden_dim, output_dim)
        self.relu = nn.ReLU()
    
    def forward(self, x):
        x = x.view(x.size(0), -1)
        x = self.relu(self.fc1(x))
        x = self.fc2(x)
        return x

backbone = SimpleBackbone(input_dim=12, hidden_dim=8, output_dim=5)

loss = nn.CrossEntropyLoss()

args = Namespace(lr=0.01)

transform = transforms.Compose([
    transforms.ToTensor(),
])

INIT_ARGS = {
    'backbone': backbone,
    'loss': loss,
    'args': args,
    'transform': transform
}

# For observe method
batch_size = 2
input_channels = 3
height = 2
width = 2
num_classes = 5

inputs = torch.randn(batch_size, input_channels, height, width)
labels = torch.randint(0, num_classes, (batch_size,))
not_aug_inputs = torch.randn(batch_size, input_channels, height, width)

ARGS = {
    'inputs': inputs,
    'labels': labels,
    'not_aug_inputs': not_aug_inputs
}

METHOD = 'observe'
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ESMER Not yet run
unverified (harvested, no recorded run)
neurai-lab/esmer/models/esmer.py
code served (permissive licence) · get_code("a06b0cf06a43ac3f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 1 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
ContinualModel
brick of this paper's assembly: helper
3 other papers
1 dated earlier, 1 the same month, 1 later
2201.12604 (2022-01)
Learning Fast, Learning Slow: A General Continual Learning Method based on Complementary Learning System
2302.11346 (2023-02)
Task-Aware Information Routing from Common Representation Space in Lifelong Learning
2403.13249 (2024-03)
A Unified and General Framework for Continual Learning

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Humans excel at lifelong learning, as the brain has evolved to be robust to distribution shifts and noise in our ever-changing environment. Deep neural networks (DNNs), however, exhibit catastrophic forgetting and the learned representations drift drastically as they encounter a new task. This alludes to a different errorbased learning mechanism in the brain. Unlike DNNs, where learning scales linearly with the magnitude of the error, the sensitivity to errors in the brain decreases as a function of their magnitude. To this end, we propose ESMER which employs a principled mechanism to modulate error sensitivity in a dual-memory rehearsalbased system. Concretely, it maintains a memory of past errors and uses it to modify the learning dynamics so that the model learns more from small consistent errors compared to large sudden errors. We also propose Error-Sensitive Reservoir Sampling to maintain episodic memory, which leverages the error history to pre-select low-loss samples as candidates for the buffer, which are better suited for retaining information. Empirical results show that ESMER effectively reduces forgetting and abrupt drift in representations at the task boundary by gradually adapting to the new task while consolidating knowledge. Remarkably, it also enables the model to learn under high levels of label noise, which is ubiquitous in real-world data streams. Code: https://github.com/NeurAI-Lab/ESMER * Contributed equally.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2302.11344")
get_code_for_paper("2302.11344")
have("2302.11344")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2302.11344.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2302.11344.svg)](https://syntology.ai/paper/2302.11344)

Connect an agent — have() is free.