SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2508.01957 · ICML · 2025

Stochastic Encodings for Active Feature Acquisition

Pietro Liò, Mihaela Van Der Schaar, Alexander Norcliffe, Changhee Lee, Fergus Imrie

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (7 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-24; 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/2508.01957.json · badge: /api/ran/2508.01957.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
a-norcliffe/SEFA community
Papers with Code archive
9 ran · 1 no recorded run
FunctionStatusWhere it lives
BaseModel Ran
ran on a synthesized input · constructed an object; no result was computed
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("6c06e913faa2ea6c")
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, BaseModel: the run constructed the object and did not call it, so no result was computed. 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
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset
import numpy as np

torch.manual_seed(0)

class CategoricalInput(nn.Module):
    def __init__(self, most_categories):
        super().__init__()
        self.most_categories = most_categories

    def forward(self, x, mask):
        x = ((x + 1.0) * mask).long()
        return F.one_hot(x, num_classes=self.most_categories + 1).float().view(x.shape[0], -1)

class ContinuousInput(nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, x, mask):
        return torch.cat([x * mask, mask], dim=-1)

class MixedInput(nn.Module):
    def __init__(self, num_con_features, most_categories):
        super().__init__()
        self.con_input = ContinuousInput()
        self.cat_input = CategoricalInput(most_categories)
        self.num_con_features = num_con_features

    def forward(self, x, mask):
        x_con = x[:, :self.num_con_features]
        mask_con = mask[:, :self.num_con_features]
        x_con = self.con_input(x_con, mask_con)
        x_cat = x[:, self.num_con_features:]
        mask_cat = mask[:, self.num_con_features:]
        x_cat = self.cat_input(x_cat, mask_cat)
        return torch.cat([x_con, x_cat], dim=-1)

acquisition_batch_limit = 10000000
cooldown = 0
lr_factor = 0.2
min_lr = 1e-07

class BaseModel(nn.Module):
    def __init__(self, config):
        super().__init__()
        self.in_dim = 2 * config['num_con_features'] + config['num_cat_features'] * (config['most_categories'] + 1)
        if config['num_con_features'] == 0:
            self.input_type = 'categorical'
            self.input_layer = CategoricalInput(config['most_categories'])
        elif config['num_cat_features'] == 0:
            self.input_type = 'continuous'
            self.input_layer = ContinuousInput()
        elif config['num_con_features'] > 0 and config['num_cat_features'] > 0:
            self.input_type = 'mixed'
            self.input_layer = MixedInput(config['num_con_features'], config['most_categories'])
        else:
            raise ValueError('Invalid input configuration, must have at least one continuous or categorical feature.')
        self.epochs = config['epochs'] if 'epochs' in config else None
        self.lr = config['lr'] if 'lr' in config else None
        self.batchsize = config['batchsize'] if 'batchsize' in config else None
        self.patience = config['patience'] if 'patience' in config else None
        self.num_features = config['num_con_features'] + config['num_cat_features']
        self.max_dim = config['max_dim'] if 'max_dim' in config and config['max_dim'] is not None else self.num_features
        self.out_dim = config['out_dim']
        self.batch_limit = acquisition_batch_limit

    @property
    def device(self):
        return next(self.parameters()).device

    def clear_cache(self):
        if self.device != torch.device('cpu'):
            torch.cuda.empty_cache()

    def predict(self, x, mask):
        raise NotImplementedError

    def loss_func(self, x, y, mask, data_mask=None):
        raise NotImplementedError

    def load(self, path):
        self.load_state_dict(torch.load(path + '/best_model.pt', map_location=self.device))
        self.eval()

    def subsample_mask(self, mask):
        return (torch.rand_like(mask) > torch.rand_like(mask[:, :1])).float() * mask

    @torch.no_grad()
    def calc_val_dict(self, val_loader, metric_f):
        val_metric = 0
        for x, y, m_data in val_loader:
            x = x.to(self.device)
            y = y.to(self.device)
            m_data = m_data.to(self.device)
            val_metric += metric_f(self.predict(x, m_data), y) / len(val_loader)
        return (val_metric, {'Predictive Metric': val_metric})

config = {
    'num_con_features': 2,
    'num_cat_features': 2,
    'most_categories': 3,
    'epochs': 10,
    'lr': 0.001,
    'batchsize': 32,
    'patience': 5,
    'out_dim': 1,
    'max_dim': 4
}

ARGS = {
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BaseModel — 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 BaseModel 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
BlockLinear Ran
ran on a synthesized input · constructed an object; no result was computed
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("2a51583493902833")
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, BlockLinear: 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)

ARGS = {
    "in_dims": 2,
    "out_dims": 3,
    "num_blocks": 4,
}
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 BlockLinear — 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 BlockLinear 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
CategoricalBlockStochasticMLP Ran
ran on a synthesized input · constructed an object; no result was computed
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("e118ed18632c691e")
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, CategoricalBlockStochasticMLP: 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)

# Analyze the function signature and body:
# __init__ parameters:
#   - num_cat_features: int, number of categorical features
#   - out_dims: int, output dimension size
#   - most_categories: int, maximum number of categories

# The forward method uses:
#   - x: tensor of shape (batchsize, num_cat_features) with float values
#   - mask: tensor of shape (batchsize, num_cat_features) for masking
# It computes embeddings and returns (mu, sigma)

# Create small but distinct dimensions
num_cat_features = 3
out_dims = 4
most_categories = 5

ARGS = {
    "num_cat_features": num_cat_features,
    "out_dims": out_dims,
    "most_categories": most_categories,
}
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 CategoricalBlockStochasticMLP — 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 CategoricalBlockStochasticMLP 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
CategoricalInput Ran
ran on a synthesized input · constructed an object; no result was computed
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("ab668350219ed48c")
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, CategoricalInput: 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)

ARGS = {
    "most_categories": 5
}
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 CategoricalInput — 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 CategoricalInput 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
ContinuousBlockStochasticMLP Ran
ran on a synthesized input · constructed an object; no result was computed
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("31aae5fcf05e438b")
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, ContinuousBlockStochasticMLP: 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)

ARGS = {
    "num_con_features": 4,
    "hidden_dim": 3,
    "out_dims": 2,
    "num_hidden": 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 ContinuousBlockStochasticMLP — 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 ContinuousBlockStochasticMLP 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
ContinuousInput Ran
ran on a synthesized input
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("34dc88c6db19d176")
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. 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

class ContinuousInput(nn.Module):
    """A layer that takes continuous inputs, [x*m , m] is the model input."""

    def __init__(self):
        super().__init__()

    def forward(self, x, mask):
        return torch.cat([x * mask, mask], dim=-1)


INIT_ARGS = {}

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

if __name__ == '__main__':
    model = ContinuousInput(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("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 — 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)
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("331a88baba0746eb")
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, MLP: 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)

ARGS = {
    "in_dim": 4,
    "hidden_dim": 8,
    "out_dim": 3,
    "num_hidden": 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 MLP — 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 MLP 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
MixedInput Ran
ran on a synthesized input · constructed an object; no result was computed
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("1a359553cf3e1433")
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, MixedInput: 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)

# MixedInput.__init__ takes num_con_features and most_categories
# num_con_features: int, number of continuous features
# most_categories: int, maximum number of categories across all categorical features

num_con_features = 2
most_categories = 5

ARGS = {
    "num_con_features": num_con_features,
    "most_categories": most_categories,
}
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 MixedInput — 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 MixedInput 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
kl_01_loss Ran
ran; our contract draft was wrong, not the code
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("13b4ca8c38efd9fe")
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 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

torch.manual_seed(0)

# z_mu and z_sig are used in arithmetic operations and torch.log
# They should be tensors with compatible shapes for element-wise operations
# The function sums over dim=-1, so we need at least 2 dimensions
# Using batch_size=2, latent_dim=4

z_mu = torch.randn(2, 4)  # batch size 2, latent dimension 4
z_sig = torch.abs(torch.randn(2, 4)) + 0.1  # positive values for log stability

ARGS = {
    "z_mu": z_mu,
    "z_sig": z_sig,
}
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 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
SEFA Not yet run
unverified (harvested, no recorded run)
a-norcliffe/SEFA/models/sefa.py
code served (permissive licence) · get_code("e8647629fff5fdc2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 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 10 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-24.

Repositories linked to this paper

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

Abstract

Active Feature Acquisition is an instance-wise, sequential decision making problem. The aim is to dynamically select which feature to measure based on current observations, independently for each test instance. Common approaches either use Reinforcement Learning, which experiences training difficulties, or greedily maximize the conditional mutual information of the label and unobserved features, which makes myopic acquisitions. To address these shortcomings, we introduce a latent variable model, trained in a supervised manner. Acquisitions are made by reasoning about the features across many possible unobserved realizations in a stochastic latent space. Extensive evaluation on a large range of synthetic and real datasets demonstrates that our approach reliably outperforms a diverse set of baselines.

For agents

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

get_harvested_code_for_paper("2508.01957")
get_code_for_paper("2508.01957")
have("2508.01957")

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

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

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

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

Connect an agent — have() is free.