SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.00259 · NeurIPS · 2024

Enhancing Diversity in Bayesian Deep Learning via Hyperspherical Energy Minimization of CKA

Qinxun Bai, David Smerkous, Fuxin Li

arXiv · PDF · Open in the Atlas

Code that ran

7 of 19 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 5 failures of our instrument; 12 no recorded run), measured 2026-11-23; 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/2411.00259.json · badge: /api/ran/2411.00259.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
Deep-Machine-Vision/he-cka-ensembles marked official in Papers with Code
Papers with Code archive
7 ran · 12 no recorded run
FunctionStatusWhere it lives
EMA Ran
ran on a synthesized input · constructed an object; no result was computed
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("9036f42b36c62bb0")
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, EMA: 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)

# Create a small initial tensor for the EMA
initial_tensor = torch.randn(2, 4)

# Define ARGS dictionary with all parameters for EMA.__init__
ARGS = {
    'decay': 0.99,
    'initial': initial_tensor
}
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 EMA — 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 EMA 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
detach_diagonal Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("17277f273917cf17")
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 (2, 4, 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 a small batched tensor [B, N, P]
# B=2 (batch), N=4 (first square dim), P=4 (second square dim)
gram = torch.randn(2, 4, 4, requires_grad=True)

ARGS = {
    "gram": gram,
    "readd": 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 Tensor, ndim 3, dtype family float, shape (2, 4, 4) — shape (2, 4, 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
hyperenergy_gram Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("09adcb1ba247435b")
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 (2, 4, 5) 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 tensors with distinct dimension sizes for clarity
# X: [B, N, P] where B=2 (batch), N=4 (num points), P=3 (features)
X = torch.randn(2, 4, 3, requires_grad=True)

# Y: [B, L, P] where B=2 (batch), L=5 (different from N), P=3 (same features)
Y = torch.randn(2, 5, 3, requires_grad=True)

# Build kwargs that hyperenergy_gram might use
kwargs_dict = {
    'arc_eps': 1.005,
    'eps': 0.0001,
    'mhe_s': 2
}

ARGS = {
    'X': X,
    'Y': Y,
    'detach_diag': True,
    'readd': True,
    'arc_eps': 1.005,
    'eps': 0.0001,
    'mhe_s': 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 Tensor, ndim 3, dtype family float, shape (2, 4, 5) — shape (2, 4, 5) 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
hyperspherical_energy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("189230e658112733")
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 1, dtype family float, shape (2,) 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 batched feature tensors
# Shape [B, N*P] format: 2 models, 12 flattened features each
features_2d = torch.randn(2, 12)

# Shape [B, N, P] format: 2 models, 3x4 gram matrices
features_3d = torch.randn(2, 3, 4)

ARGS = {
    "features": features_2d,
    "s": 0.5,
    "half_space": False,
    "eps": 3e-05,
    "arc_eps": 0.0003,
    "offset": 0.0,
    "reduction": "mean",
    "remove_diag": True,
    "detach_right": False,
    "abs_vals": False,
    "use_exp": False,
}
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 1, dtype family float, shape (2,) — shape (2,) 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
register_model_kernel Ran
ran; our contract draft was wrong, not the code
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("42842f48a3537257")
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 function. 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 function register_model_kernel is a decorator factory that takes a name string
# and returns a decorator. The decorator registers a class in AVAILABLE_KERNELS dict.
# 
# To construct valid arguments, we need:
# - name: a string to use as the key in AVAILABLE_KERNELS

# Example of how the decorator would be used:
# @register_model_kernel("my_model")
# class MyModel:
#     pass

# For setup purposes, we'll provide a simple string name
ARGS = {
    "name": "test_kernel_model"
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
unit_vector_rows Ran
ran, honoured the contract we drafted
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("0f4775316d8a360b")
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 2, dtype family float, shape (2, 12) 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)

# Test case 1: 2D input (already vectorized)
features_2d = torch.randn(2, 12)

# Test case 2: 3D input (gram matrix that needs vectorization)
features_3d = torch.randn(2, 4, 3)

ARGS = {
    "features": features_2d,
    "eps": 1e-06,
    "vectorize": 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 Tensor, ndim 2, dtype family float, shape (2, 12) — shape (2, 12) 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
vectorize_grams Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("ad9c14c7c7ee4c60")
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 2, dtype family float, shape (2, 12) 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 a batched gram matrix with shape [B, N, P]
# B=2 (batch size), N=4, P=3 (distinct sizes for different dimensions)
gram = torch.randn(2, 4, 3)

ARGS = {
    "gram": gram
}
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 2, dtype family float, shape (2, 12) — shape (2, 12) 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
BaseModelKernel Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("97d771b52d7d258e")
How it ran

no invocation recorded.

FeatureKernel Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("68f7b9162c05d546")
How it ran

no invocation recorded.

HEModelKernel Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("893c6101f062d6e1")
How it ran

no invocation recorded.

batched_gram Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("0323344675a6cdd0")
How it ran

no invocation recorded.

build_model_kernel Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("88020a1f65b635e9")
How it ran

no invocation recorded.

center_gram Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("b2174c8f0519c0cd")
How it ran

no invocation recorded.

cossim_gram Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("e1d0a2d50b1be24c")
How it ran

no invocation recorded.

laplacian_gram Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("6a5ac817802e3767")
How it ran

no invocation recorded.

learned_gram Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("53fdc3e076551676")
How it ran

no invocation recorded.

linear_gram Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("c76a29ddc6955622")
How it ran

no invocation recorded.

log_gram Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("79d630fbd2b5a65b")
How it ran

no invocation recorded.

rbf_gram Not yet run
unverified (harvested, no recorded run)
Deep-Machine-Vision/he-cka-ensembles/hyper/diversity/model_kernels.py
code served (permissive licence) · get_code("7b85bee07d9485cd")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

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

Abstract

Particle-based Bayesian deep learning often requires a similarity metric to compare two networks. However, naive similarity metrics lack permutation invariance and are inappropriate for comparing networks. Centered Kernel Alignment (CKA) on feature kernels has been proposed to compare deep networks but has not been used as an optimization objective in Bayesian deep learning. In this paper, we explore the use of CKA in Bayesian deep learning to generate diverse ensembles and hypernetworks that output a network posterior. Noting that CKA projects kernels onto a unit hypersphere and that directly optimizing the CKA objective leads to diminishing gradients when two networks are very similar. We propose adopting the approach of hyperspherical energy (HE) on top of CKA kernels to address this drawback and improve training stability. Additionally, by leveraging CKA-based feature kernels, we derive feature repulsive terms applied to synthetically generated outlier examples. Experiments on both diverse ensembles and hypernetworks show that our approach significantly outperforms baselines in terms of uncertainty quantification in both synthetic and realistic outlier detection tasks.

For agents

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

get_harvested_code_for_paper("2411.00259")
get_code_for_paper("2411.00259")
have("2411.00259")

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

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

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

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

Connect an agent — have() is free.