SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.14952 · CVPR · 2022

Energy-based Latent Aligner for Incremental Learning

Vineeth Balasubramanian, K Joseph, Salman Khan, Shahbaz Khan, Rao, ‡⋆ Fahad, Muhammad Anwer

arXiv · PDF · Open in the Atlas

Code that ran

5 of 13 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; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 1 failure of our instrument; 8 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/2203.14952.json · badge: /api/ran/2203.14952.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
jie-su/bpd community (classifier label)
classifier basis not recorded on the link
3 ran · 7 no recorded run
josephkj/eli marked official in Papers with Code
Papers with Code archive
2 ran · 1 no recorded run
FunctionStatusWhere it lives
EBM Ran
ran on a synthesized input
josephkj/eli/classification/utils/ebm_aligner.py
code served (permissive licence) · get_code("1cb1eede30824641")
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 Tensor, ndim 2, dtype family float, shape (2, 1) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 torch.nn as nn

class EBM(nn.Module):
    """Defining the Energy Based Model.
    """

    def __init__(self, latent_dim=32, n_layer=1, n_hidden=64):
        super().__init__()
        mlp = nn.ModuleList()
        if n_layer == 0:
            mlp.append(nn.Linear(latent_dim, 1))
        else:
            mlp.append(nn.Linear(latent_dim, n_hidden))
            for _ in range(n_layer - 1):
                mlp.append(nn.LeakyReLU(0.2))
                mlp.append(nn.Linear(n_hidden, n_hidden))
            mlp.append(nn.LeakyReLU(0.2))
            mlp.append(nn.Linear(n_hidden, 1))
        self.mlp = nn.Sequential(*mlp)

    def forward(self, x):
        return self.mlp(x)


INIT_ARGS = {
    'latent_dim': 4,
    'n_layer': 2,
    'n_hidden': 8,
}

ARGS = {
    'x': torch.randn(2, 4),
}

if __name__ == '__main__':
    model = EBM(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 1) — shape (2, 1) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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)
EBMAligner Ran
ran on a synthesized input
josephkj/eli/classification/utils/ebm_aligner.py
code served (permissive licence) · get_code("f593c64c16aa19d9")
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 Tensor, ndim 2, dtype family float; no output shape is stated. 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 and ndim 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 torch.nn as nn
import numpy as np

class EBM(nn.Module):
    """Defining the Energy Based Model.
    """

    def __init__(self, latent_dim=32, n_layer=1, n_hidden=64):
        super().__init__()
        mlp = nn.ModuleList()
        if n_layer == 0:
            mlp.append(nn.Linear(latent_dim, 1))
        else:
            mlp.append(nn.Linear(latent_dim, n_hidden))
            for _ in range(n_layer - 1):
                mlp.append(nn.LeakyReLU(0.2))
                mlp.append(nn.Linear(n_hidden, n_hidden))
            mlp.append(nn.LeakyReLU(0.2))
            mlp.append(nn.Linear(n_hidden, 1))
        self.mlp = nn.Sequential(*mlp)

    def forward(self, x):
        return self.mlp(x)

class Metrics:

    def __init__(self):
        self.val = 0
        self.sum = 0
        self.count = 0
        self.avg = 0

    def update(self, val, n=1):
        self.val = val
        self.sum += val * n
        self.count += n
        self.avg = self.sum / self.count

class EBMAligner:
    """Manages the lifecycle of the proposed Energy Based Latent Alignment.
    """

    def __init__(self, ebm_latent_dim=64, ebm_n_layers=2, ebm_n_hidden_units=64, max_iter=1500, ebm_lr=0.0001, n_langevin_steps=30, langevin_lr=0.1, ema_decay=0.89, log_iter=50, output_dir='/home/joseph/workspace/lantern'):
        self.is_enabled = False
        self.ebm_latent_dim = ebm_latent_dim
        self.ebm_n_layers = ebm_n_layers
        self.ebm_n_hidden_units = ebm_n_hidden_units
        self.ebm_ema = None
        self.max_iter = max_iter
        self.ebm_lr = ebm_lr
        self.n_langevin_steps = n_langevin_steps
        self.langevin_lr = langevin_lr
        self.ema_decay = ema_decay
        self.log_iter = log_iter
        self.output_dir = output_dir
        self.known_classes = 0

    def ema(self, model1, model2, decay=0.999):
        par1 = dict(model1.named_parameters())
        par2 = dict(model2.named_parameters())
        for k in par1.keys():
            par1[k].data.mul_(decay).add_(par2[k].data, alpha=1 - decay)

    def requires_grad(self, model, flag=True):
        for p in model.parameters():
            p.requires_grad = flag

    def sampler(self, ebm_model, x, langevin_steps=30, lr=0.1, return_seq=False):
        """The langevin sampler to sample from the ebm_model

        :param ebm_model: The source EBM model
        :param x: The data which is updated
        """
        x_k = x.clone().detach().requires_grad_(True)
        
        for k in range(langevin_steps):
            energy = ebm_model(x_k).sum()
            grad = torch.autograd.grad(energy, x_k)[0]
            x_k = x_k - lr * grad
            x_k = x_k.detach().requires_grad_(True)
        
        return x_k.detach()


INIT_ARGS = {
    'ebm_latent_dim': 4,
    'ebm_n_layers': 2,
    'ebm_n_hidden_units': 8,
    'max_iter': 10,
    'ebm_lr': 0.0001,
    'n_langevin_steps': 5,
    'langevin_lr': 0.1,
    'ema_decay': 0.89,
    'log_iter': 2,
    'output_dir': '/tmp'
}

ARGS = {
    'ebm_model': EBM(latent_dim=4, n_layer=2, n_hidden=8),
    'x': torch.randn(2, 4),
    'langevin_steps': 5,
    'lr': 0.1,
    'return_seq': False
}

METHOD = 'sampler'

if __name__ == '__main__':
    aligner = EBMAligner(**INIT_ARGS)
    result = aligner.sampler(**ARGS)
    print(f"Result shape: {result.shape}")
    print(f"Result: {result}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
matplotlib, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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)
clones Ran
ran; our contract draft was wrong, not the code
jie-su/bpd/model/layers_sub.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from smiles724/molformer, is pointer only (licence: NONE) · get_code("cf78c734df121970")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from smiles724/molformer, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

norm_shape Ran
ran, honoured the contract we drafted
jie-su/bpd/tool/utils.py
code served (permissive licence) · get_code("6d4971d4af2d0623")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

torch.manual_seed(0)

# Test case 1: integer input
shape_int = 5

# Test case 2: tuple of ints input
shape_tuple = (2, 3, 4)

# Test case 3: list that can be converted to tuple
shape_list = [7, 8]

ARGS = {
    'shape': shape_int
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: none by the harness; any seed is in the setup block
str2bool Ran
ran on a synthesized input
jie-su/bpd/tool/utils.py
code served (permissive licence) · get_code("d1b2a3e236cfd907")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

ARGS = {
    'v': 'true'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: none by the harness; any seed is in the setup block
Disentangler Not yet run
unverified (harvested, no recorded run)
jie-su/bpd/model/build_net.py
code served (permissive licence) · get_code("6b27ea4ac6f86d40")
How it ran

no invocation recorded.

Generator Not yet run
unverified (harvested, no recorded run)
jie-su/bpd/model/build_net.py
code served (permissive licence) · get_code("b39040341d334314")
How it ran

no invocation recorded.

Reconstructor Not yet run
unverified (harvested, no recorded run)
jie-su/bpd/model/build_net.py
code served (permissive licence) · get_code("890f680a573b7205")
How it ran

no invocation recorded.

load_dsads Not yet run
unverified (harvested, no recorded run)
jie-su/bpd/datasets/dataset_load.py
code served (permissive licence) · get_code("c4da517c7047a35e")
How it ran

no invocation recorded.

load_mhealth Not yet run
unverified (harvested, no recorded run)
jie-su/bpd/datasets/dataset_load.py
code served (permissive licence) · get_code("468fc4eb946078a7")
How it ran

no invocation recorded.

load_pamap2 Not yet run
unverified (harvested, no recorded run)
jie-su/bpd/datasets/dataset_load.py
code served (permissive licence) · get_code("6600946312e48b28")
How it ran

no invocation recorded.

process_inputs_fp Not yet run
unverified (harvested, no recorded run)
josephkj/eli/classification/utils/ebm_aligner.py
code served (permissive licence) · get_code("e26044f85fda2569")
How it ran

no invocation recorded.

sliding_window Not yet run
unverified (harvested, no recorded run)
jie-su/bpd/tool/utils.py
code served (permissive licence) · get_code("058fe3614265d463")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 1 the same month, 1 later) and 9 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
clones 79 other papers
40 dated earlier, 4 the same month, 35 later · 11 only as an assembly brick
1411.4555 (2014-11)
Show and Tell: A Neural Image Caption Generator
1612.00563 (2016-12)
Self-critical Sequence Training for Image Captioning
1706.03762 (2017-06)
Attention Is All You Need
and 76 more not named here
EBM
brick of this paper's assembly: model
1 other paper
1 dated earlier · 1 only as an assembly brick
2103.02603 (2021-03)
Towards Open World Object Detection
norm_shape 1 other paper
1 dated earlier
1609.08144 (2016-09)
Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation
str2bool 1 other paper
1 dated earlier
1908.05547 (2019-08)
Beyond Cartesian Representations for Local Descriptors

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

Deep learning models tend to forget their earlier knowledge while incrementally learning new tasks. This behavior emerges because the parameter updates optimized for the new tasks may not align well with the updates suitable for older tasks. The resulting latent representation mismatch causes forgetting. In this work, we propose ELI: Energybased Latent Aligner for Incremental Learning, which first learns an energy manifold for the latent representations such that previous task latents will have low energy and the current task latents have high energy values. This learned manifold is used to counter the representational shift that happens during incremental learning. The implicit regularization that is offered by our proposed methodology can be used as a plug-and-play module in existing incremental learning methodologies. We validate this through extensive evaluation on CIFAR-100, ImageNet subset, ImageNet 1k and Pascal VOC datasets. We observe consistent improvement when ELI is added to three prominent methodologies in class-incremental learning, across multiple incremental settings. Further, when added to the state-of-the-art incremental object detector, ELI provides over 5% improvement in detection accuracy, corroborating its effectiveness and complementary advantage to the existing art. Code is available at: https:// github.com/ JosephKJ/ ELI .

For agents

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

get_harvested_code_for_paper("2203.14952")
get_code_for_paper("2203.14952")
have("2203.14952")

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

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

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

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

Connect an agent — have() is free.