SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.10102 · ICLR · 2021

CAPTURING LABEL CHARACTERISTICS IN VAEs

Philip Torr, Tom Joy, Sebastian Schmon, N Siddharth, Tom Rainforth

arXiv · PDF · Open in the Atlas

Code that ran

13 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (12 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 12 have no contract verdict; 1 failure 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/2006.10102.json · badge: /api/ran/2006.10102.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
thwjoy/ccvae canonical (classifier label)
classifier basis: classifier_2025
6 ran · 0 no recorded run
mori97/revae community
Papers with Code archive
7 ran · 1 no recorded run
FunctionStatusWhere it lives
BaseREVAEMNIST Ran
ran on a synthesized input · constructed an object; no result was computed
mori97/revae/models/mnist.py
code served (permissive licence) · get_code("76a3b3ce30f40be0")
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 an instance of its own class, BaseREVAEMNIST: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn

torch.manual_seed(0)

# Based on the BaseREVAEMNIST class signature, we need:
# - z_c_dim: int
# - z_exc_dim: int

ARGS = {
    "z_c_dim": 4,
    "z_exc_dim": 3,
}
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 BaseREVAEMNIST — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BaseREVAEMNIST 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: none by the harness; any seed is in the setup block
CELEBADecoder Ran
ran on a synthesized input · constructed an object; no result was computed
thwjoy/ccvae/models/semisup_vae.py
pointer only (licence: NONE) · get_code("8a4777adc80a0c27")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, thwjoy/ccvae 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.

CELEBAEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
thwjoy/ccvae/models/semisup_vae.py
pointer only (licence: NONE) · get_code("194a6e10b3eab0df")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, thwjoy/ccvae 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.

Classifier Ran
ran on a synthesized input · constructed an object; no result was computed
thwjoy/ccvae/models/semisup_vae.py
pointer only (licence: NONE) · get_code("319ead4f1c1f8df6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, thwjoy/ccvae 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.

CondPrior Ran
ran on a synthesized input · constructed an object; no result was computed
thwjoy/ccvae/models/semisup_vae.py
pointer only (licence: NONE) · get_code("b428bb64e0c11ea0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, thwjoy/ccvae 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.

Diagonal Ran
ran on a synthesized input · constructed an object; no result was computed
thwjoy/ccvae/models/semisup_vae.py
pointer only (licence: NONE) · get_code("3342e27354ab9e19")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, thwjoy/ccvae 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.

REVAEMNIST Ran
ran on a synthesized input · constructed an object; no result was computed
mori97/revae/models/mnist.py
code served (permissive licence) · get_code("5a1fb6fa55266ac1")
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 an instance of its own class, REVAEMNIST: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn
import torch.nn.functional as F
from torch.distributions.normal import Normal

torch.manual_seed(0)

class _Classifier(nn.Module):
    def __init__(self, z_c_dim):
        super(_Classifier, self).__init__()
        self.fc1 = nn.Linear(z_c_dim, 50)
        self.fc2 = nn.Linear(50, 10)

    def forward(self, z_c):
        h = F.relu(self.fc1(z_c))
        h = self.fc2(h)
        return h

class _ConditionalPrior(nn.Module):
    def __init__(self, z_c_dim):
        super(_ConditionalPrior, self).__init__()
        self.fc1 = nn.Linear(10, 50)
        self.fc2 = nn.Linear(50, 2 * z_c_dim)

    def forward(self, y):
        h = F.relu(self.fc1(y))
        mu, logvar = torch.chunk(self.fc2(h), 2, dim=1)
        return (mu, logvar)

class _Decoder(nn.Module):
    def __init__(self, z_dim):
        super(_Decoder, self).__init__()
        self.fc1 = nn.Linear(z_dim, 600)
        self.fc2 = nn.Linear(600, 600)
        self.fc3 = nn.Linear(600, 784)

    def forward(self, z):
        h = F.relu(self.fc1(z))
        h = F.relu(self.fc2(h))
        h = torch.sigmoid(self.fc3(h))
        return h

class _Encoder(nn.Module):
    def __init__(self, z_dim):
        super(_Encoder, self).__init__()
        self.fc1 = nn.Linear(784, 600)
        self.fc2 = nn.Linear(600, 600)
        self.fc3 = nn.Linear(600, 2 * z_dim)

    def forward(self, x):
        h = F.relu(self.fc1(x))
        h = F.relu(self.fc2(h))
        mu, logvar = torch.chunk(self.fc3(h), 2, dim=1)
        return (mu, logvar)

class BaseREVAEMNIST(nn.Module):
    def __init__(self, z_c_dim, z_exc_dim):
        super(BaseREVAEMNIST, self).__init__()
        self._z_c_dim = z_c_dim
        self._z_exc_dim = z_exc_dim
        self.encoder = _Encoder(z_c_dim + z_exc_dim)
        self.decoder = _Decoder(z_c_dim + z_exc_dim)
        self.classifier = _Classifier(z_c_dim)
        self.cond_prior = _ConditionalPrior(z_c_dim)

    @property
    def z_c_dim(self):
        return self._z_c_dim

    @property
    def z_exc_dim(self):
        return self._z_exc_dim

    def forward(self, x, y):
        raise NotImplementedError()

def _check_label(labels):
    n_uns = (labels == -1).sum().item()
    if not (labels[:n_uns] == -1).all():
        raise RuntimeError('Unsupervised samples should come before the supervised samples.')

def reparameterize(mu, logvar, n_samples=1):
    std = torch.exp(0.5 * logvar)
    eps = torch.randn(n_samples, *std.size(), device=std.device)
    z = mu + eps * std
    return z.squeeze(0)

class REVAEMNIST(BaseREVAEMNIST):
    def __init__(self, z_c_dim, z_exc_dim):
        super(REVAEMNIST, self).__init__(z_c_dim, z_exc_dim)

    def forward(self, x, y):
        eye = torch.eye(10, device=y.device)
        _check_label(y)
        n_uns = (y == -1).sum().item()
        batch_size = x.size(0)
        z_mu, z_logvar = self.encoder(x)
        z = reparameterize(z_mu, z_logvar)
        z_c, z_exc = (z[:, :self.z_c_dim], z[:, self.z_c_dim:])
        recon = self.decoder(z)
        h = F.log_softmax(self.classifier(z_c), dim=1)
        y_uns = F.gumbel_softmax(h[:n_uns], tau=0.1)
        y_sup = eye[y[n_uns:]]
        y = torch.cat((y_uns, y_sup), dim=0)
        return torch.zeros(batch_size)

ARGS = {
    "z_c_dim": 3,
    "z_exc_dim": 2,
}
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 REVAEMNIST — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a REVAEMNIST 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: none by the harness; any seed is in the setup block
SSVAE_CCVAE Ran
ran on a synthesized input · constructed an object; no result was computed
thwjoy/ccvae/models/semisup_vae.py
pointer only (licence: NONE) · get_code("9f4b467114c264bf")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, thwjoy/ccvae 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.

_Classifier Ran
ran on a synthesized input · constructed an object; no result was computed
mori97/revae/models/mnist.py
code served (permissive licence) · get_code("50e4b27b44bab302")
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 an instance of its own class, _Classifier: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn

torch.manual_seed(0)

# The _Classifier.__init__ takes z_c_dim as a parameter
# z_c_dim is used to create fc1 = nn.Linear(z_c_dim, 50)
# So z_c_dim should be an integer representing the input dimension

z_c_dim = 4

ARGS = {
    "z_c_dim": z_c_dim
}
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 _Classifier — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a _Classifier 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: none by the harness; any seed is in the setup block
_ConditionalPrior Ran
ran on a synthesized input · constructed an object; no result was computed
mori97/revae/models/mnist.py
code served (permissive licence) · get_code("52e0ab14a73e3c8b")
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 an instance of its own class, _ConditionalPrior: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn

torch.manual_seed(0)

# The _ConditionalPrior.__init__ takes z_c_dim as a parameter
# It expects an integer that determines the latent dimension
z_c_dim = 8

ARGS = {
    "z_c_dim": z_c_dim
}
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 _ConditionalPrior — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a _ConditionalPrior 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: none by the harness; any seed is in the setup block
_Decoder Ran
ran on a synthesized input · constructed an object; no result was computed
mori97/revae/models/mnist.py
code served (permissive licence) · get_code("a0ca0389acc43dae")
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 an instance of its own class, _Decoder: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn

torch.manual_seed(0)

# The _Decoder.__init__ only takes z_dim as a parameter
# z_dim is an integer representing the latent dimension size
z_dim = 4

ARGS = {
    "z_dim": z_dim
}
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 _Decoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a _Decoder 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: none by the harness; any seed is in the setup block
_Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
mori97/revae/models/mnist.py
code served (permissive licence) · get_code("8cc912b6c76d68f3")
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 an instance of its own class, _Encoder: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn

torch.manual_seed(0)

# The _Encoder.__init__ takes z_dim as a parameter
# z_dim is used to construct fc3 which outputs 2 * z_dim dimensions
# Looking at the forward method, it expects input x of shape (batch, 784)
# and returns (mu, logvar) where each is (batch, z_dim)

z_dim = 5

ARGS = {
    'z_dim': z_dim
}
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 _Encoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a _Encoder 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: none by the harness; any seed is in the setup block
reparameterize Ran
ran; our contract draft was wrong, not the code
mori97/revae/models/mnist.py
code served (permissive licence) · get_code("d7b93d9b79b19888")
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 Tensor, ndim 3, dtype family float, shape (3, 2, 4) 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

torch.manual_seed(0)

# Create small tensors for mu and logvar
# mu: mean of the distribution, shape (2, 4)
# logvar: log variance of the distribution, shape (2, 4)
mu = torch.randn(2, 4)
logvar = torch.randn(2, 4)

# n_samples: number of samples to draw
n_samples = 3

ARGS = {
    "mu": mu,
    "logvar": logvar,
    "n_samples": n_samples,
}
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 Tensor, ndim 3, dtype family float, shape (3, 2, 4) — shape (3, 2, 4) 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
_check_label Not yet run
unverified (harvested, no recorded run)
mori97/revae/models/mnist.py
code served (permissive licence) · get_code("f0a964e499bbb150")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 14 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.

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

We present a principled approach to incorporating labels in variational autoencoders (VAEs) that captures the rich characteristic information associated with those labels. While prior work has typically conflated these by learning latent variables that directly correspond to label values, we argue this is contrary to the intended effect of supervision in VAEs-capturing rich label characteristics with the latents. For example, we may want to capture the characteristics of a face that make it look young, rather than just the age of the person. To this end, we develop the characteristic capturing VAE (CCVAE), a novel VAE model and concomitant variational objective which captures label characteristics explicitly in the latent space, eschewing direct correspondences between label values and latents. Through judicious structuring of mappings between such characteristic latents and labels, we show that the CCVAE can effectively learn meaningful representations of the characteristics of interest across a variety of supervision schemes. In particular, we show that the CCVAE allows for more effective and more general interventions to be performed, such as smooth traversals within the characteristics for a given label, diverse conditional generation, and transferring characteristics across datapoints 1 .

For agents

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

get_harvested_code_for_paper("2006.10102")
get_code_for_paper("2006.10102")
have("2006.10102")

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

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

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

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

Connect an agent — have() is free.