SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2025.findings-acl.234 · ACL Findings · 2025

Beyond Semantic Entropy: Boosting LLM Uncertainty Quantification with Pairwise Semantic Similarity

Dang Nguyen, Baharan Mirzasoleiman, Ali Payani

Open in the Atlas

Code that ran

11 of 11 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 10 have no contract verdict; 0 failures of our instrument; 0 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/2025.findings-acl.234.json · badge: /api/ran/2025.findings-acl.234.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
BigML-CS-UCLA/SNNE canonical (classifier label)
classifier basis: census
11 ran · 0 no recorded run
FunctionStatusWhere it lives
choose_best_hyperparams Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/kle/utils.py
code served (permissive licence) · get_code("086ade762e39861d")
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 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 numpy as np

# Construct the results dictionary structure that the function expects
results = {
    'uncertainty': {
        'semantic_kernel_heat_alpha_0.4': {
            'AUROC_hp': {
                'mean': 0.85
            }
        },
        'semantic_kernel_heat_alpha_0.5': {
            'AUROC_hp': {
                'mean': 0.82
            }
        },
        'semantic_kernel_heat_alpha_0.6': {
            'AUROC_hp': {
                'mean': 0.88
            }
        }
    }
}

ARGS = {
    'results': results,
    'base_name': 'semantic_kernel_heat',
    'method_names': [
        '{base_name}_alpha_0.4',
        '{base_name}_alpha_0.5',
        '{base_name}_alpha_0.6'
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 float — 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
contract_cliques Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/kle/core.py
code served (permissive licence) · get_code("44fb757e1d0a4728")
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 Graph. 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 networkx as nx

# Create a simple graph with nodes 0, 1, 2, 3, 4
G = nx.Graph()
G.add_nodes_from(range(5))
G.add_edges_from([(0, 1), (1, 2), (2, 3), (3, 4), (0, 4)])

# Define cliques - lists of node indices to contract
# Clique 1: nodes 0 and 1
# Clique 2: nodes 3 and 4
cliques = [
    [0, 1],
    [3, 4]
]

ARGS = {
    "G": G,
    "cliques": cliques
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Graph — a Graph output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Graph output the recorded ndim 1 and dtype family int 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
find_cliques_directed Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/kle/core.py
code served (permissive licence) · get_code("d8f6ead6270bbba5")
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 generator. 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 networkx as nx

# Create a directed graph with some edges
# The function looks for edges (u, v) where v also has an edge back to u (bidirectional)
G = nx.DiGraph()

# Add nodes
G.add_nodes_from([0, 1, 2, 3, 4])

# Add directed edges
# Create some bidirectional edges: 0<->1, 1<->2, 0<->2 (forms a clique)
# And some unidirectional edges: 3->4 (not bidirectional)
G.add_edge(0, 1)
G.add_edge(1, 0)
G.add_edge(1, 2)
G.add_edge(2, 1)
G.add_edge(0, 2)
G.add_edge(2, 0)
G.add_edge(3, 4)

ARGS = {
    "G": G
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator 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
get_from_sem_to_sentence_id Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/compute_kle.py
code served (permissive licence) · get_code("dd2fe1251f13e011")
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 defaultdict. 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.

from collections import Counter, defaultdict

# The function takes ordered_ids as input
# It iterates over enumerate(ordered_ids), so ordered_ids needs to be iterable
# It uses el as dictionary keys, so elements should be hashable
# The function builds a defaultdict(list) mapping each element to indices where it appears

# Create a simple list of IDs (integers are hashable)
ordered_ids = [1, 2, 1, 3, 2, 1, 4]

ARGS = {
    "ordered_ids": ordered_ids
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict 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
get_laplacian Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/kle/kernels.py
code served (permissive licence) · get_code("3f42a743236609e1")
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 ndarray, ndim 2, dtype family int, shape (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 networkx as nx
import torch
import numpy as np

# Create a simple undirected graph
G_undirected = nx.Graph()
G_undirected.add_edges_from([(0, 1), (1, 2), (2, 3), (0, 3)])

# Create a simple directed graph
G_directed = nx.DiGraph()
G_directed.add_edges_from([(0, 1), (1, 2), (2, 3)])

ARGS = {
    "G": G_undirected,
    "norm_lapl": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (4, 4) — shape (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
heat_kernel Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/kle/kernels.py
code served (permissive licence) · get_code("db0edf83b86b3b4a")
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 ndarray, ndim 2, dtype family float, shape (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 networkx as nx
import torch
import scipy

torch.manual_seed(0)

# Create a simple undirected graph
G = nx.Graph()
G.add_edges_from([(0, 1), (1, 2), (2, 3), (0, 3)])

# Define arguments for heat_kernel function
ARGS = {
    "G": G,
    "t": 0.4,
    "norm_lapl": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (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
kernels_from_results Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/kle/utils.py
code served (permissive licence) · get_code("30dab71ad01ff6a7")
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 defaultdict. 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 collections

# Construct a valid results dict with 'uncertainty' key containing various kernel types
results = {
    'uncertainty': {
        'heat_kernel_1': 0.5,
        'heat_kernel_2': 0.6,
        'matern_kernel_1': 0.7,
        'matern_kernel_2': 0.8,
        'weighted_heat_kernel_1': 0.4,
        'weighted_heat_kernel_2': 0.45,
        'weighted_matern_kernel_1': 0.55,
        'weighted_matern_kernel_2': 0.65,
        'semantic_kernel_heat_1': 0.3,
        'semantic_kernel_heat_2': 0.35,
        'semantic_kernel_matern_1': 0.4,
        'semantic_kernel_matern_2': 0.42,
        'semantic_kernel_prod_1': 0.5,
        'semantic_kernel_prod_2': 0.52,
        'semantic_kernel_sum_1': 0.6,
        'semantic_kernel_sum_2': 0.62,
        'heat_UNANSWERABLE_1': 0.1,
        'matern_UNANSWERABLE_1': 0.1,
        'other_key': 0.9,
    }
}

ARGS = {
    'results': results
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict 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
matern_kernel Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/kle/kernels.py
code served (permissive licence) · get_code("1d95e7d657659a85")
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 ndarray, ndim 2, dtype family float, shape (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 networkx as nx
import torch
import numpy as np

torch.manual_seed(0)

# Create a simple undirected graph
G = nx.Graph()
G.add_edges_from([(0, 1), (1, 2), (2, 3), (3, 0)])

# Define arguments for matern_kernel
ARGS = {
    "G": G,
    "kappa": 1.0,
    "nu": 1,
    "norm_lapl": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (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
normalize_kernel Ran
ran, honoured the contract we drafted
BigML-CS-UCLA/SNNE/snne/kle/core.py
code served (permissive licence) · get_code("8ce6bec1d737caea")
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 ndarray, ndim 2, dtype family float, shape (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 numpy as np

# Create a small positive semi-definite kernel matrix
# Using a simple covariance-like structure
K = np.array([
    [4.0, 1.0, 0.5, 0.2],
    [1.0, 3.0, 0.3, 0.1],
    [0.5, 0.3, 2.0, 0.4],
    [0.2, 0.1, 0.4, 1.5]
], dtype=np.float64)

ARGS = {
    "K": K
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (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
reorder_by_semantic_ids Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/compute_kle.py
code served (permissive licence) · get_code("731beffe97bda275")
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 Graph. 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 networkx as nx
from collections import defaultdict

# Create a sample graph with some nodes and edges
graph = nx.Graph()
graph.add_nodes_from([0, 1, 2, 3, 4])
graph.add_edges_from([(0, 1), (1, 2), (2, 3), (3, 4)])

# Create semantic_ids list - maps sentence positions to semantic IDs
semantic_ids = [10, 20, 10, 30, 20]

# Create ordered_sem_ids - the desired order of semantic IDs
ordered_sem_ids = [10, 20, 30]

ARGS = {
    "graph": graph,
    "semantic_ids": semantic_ids,
    "ordered_sem_ids": ordered_sem_ids,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Graph — a Graph output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Graph output the recorded ndim 1 and dtype family int 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
unpickle Ran
ran on a synthesized input
BigML-CS-UCLA/SNNE/snne/kle/utils.py
code served (permissive licence) · get_code("970a9f6952201473")
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 dict. 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 pickle
import io

torch.manual_seed(0)

# Create a simple pickled object to unpickle
test_data = {"key": "value", "tensor": torch.randn(2, 4)}

# Serialize the test data to a BytesIO object
pickled_buffer = io.BytesIO()
pickle.dump(test_data, pickled_buffer)
pickled_buffer.seek(0)

ARGS = {
    "infile": pickled_buffer,
    "device": "cpu"
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 1 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.

FunctionAlso present inEarliest-datedOthers named
normalize_kernel 1 other paper
1 same year, order not determinable
2510.21891 (2025-10)
Embedding Trust: Semantic Isotropy Predicts Nonfactuality in Long-Form Text Generation

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

Hallucination in large language models (LLMs) can be detected by assessing the uncertainty of model outputs, typically measured using entropy. Semantic entropy (SE) enhances traditional entropy estimation by quantifying uncertainty at the semantic cluster level. However, as modern LLMs generate longer one-sentence responses, SE becomes less effective because it overlooks two crucial factors: intra-cluster similarity (the spread within a cluster) and intercluster similarity (the distance between clusters). To address these limitations, we propose a simple black-box uncertainty quantification method inspired by nearest neighbor estimates of entropy. Our approach can also be easily extended to white-box settings by incorporating token probabilities. Additionally, we provide theoretical results showing that our method generalizes semantic entropy. Extensive empirical results demonstrate its effectiveness compared to semantic entropy across two recent LLMs (Phi3 and Llama3) and three common text generation tasks: question answering, text summarization, and machine translation. Our code is available at https://github.com/BigML-CS-UCLA/SNNE.

For agents

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

get_harvested_code_for_paper("2025.findings-acl.234")
get_code_for_paper("2025.findings-acl.234")
have("2025.findings-acl.234")

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

curl https://syntology.ai/api/ran/2025.findings-acl.234.json

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

[![Syntology run record](https://syntology.ai/api/ran/2025.findings-acl.234.svg)](https://syntology.ai/paper/2025.findings-acl.234)

Connect an agent — have() is free.