SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2507.06196 · 2025

UQLM: A Python Package for Uncertainty Quantification in Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2507.06196.json · badge: /api/ran/2507.06196.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
cvs-health/uqlm canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
clean_if_name Ran
ran; our contract draft was wrong, not the code
cvs-health/uqlm/uqlm/code/lcb_grader.py
code served (permissive licence) · get_code("ec88955355e0aa69")
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 str. 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 ast

# Test case 1: Code with if __name__ == '__main__' block
code_with_main = """
def hello():
    print("hello")

if __name__ == '__main__':
    hello()
"""

# Test case 2: Code without if __name__ == '__main__' block
code_without_main = """
def hello():
    print("hello")

hello()
"""

# Test case 3: Code with other if statements (should not be modified)
code_with_other_if = """
x = 5
if x > 3:
    print("x is large")
"""

# Test case 4: Empty code
code_empty = ""

# Test case 5: Code with if __name__ == '__main__' at the beginning
code_main_first = """
if __name__ == '__main__':
    print("main")

def hello():
    pass
"""

ARGS = {
    "code": code_with_main
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
evaluate_row_unified Ran
ran; our contract draft was wrong, not the code
cvs-health/uqlm/uqlm/code/code_evaluation.py
code served (permissive licence) · get_code("07a5d363bf4db8b3")
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 json
import sys

# Create a minimal row dict with valid test data
row = {
    'response': '''```python
def add(a, b):
    return a + b
''',
    'public_test_cases': [
        {'input': [1, 2], 'output': 3},
        {'input': [5, 7], 'output': 12}
    ],
    'metadata': {
        'func_name': 'add'
    }
}

# Define arguments for evaluate_row_unified
ARGS = {
    'row': row,
    'timeout': 6,
    'runner_path': 'lcb_grader.py',
    'memory_limit_bytes': 4 * 1024 ** 3,
    'cpu_time_limit_seconds': 10,
    'max_file_size_bytes': 1024 ** 2
}
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 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
make_function Ran
ran; our contract draft was wrong, not the code
cvs-health/uqlm/uqlm/code/lcb_grader.py
code served (permissive licence) · get_code("68fb9511f08d5adb")
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 str. 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 ast

code_sample = """
x = 5
y = 10
result = x + y
print(result)
"""

ARGS = {
    "code": code_sample
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
sanitize_llm_output Ran
ran; our contract draft was wrong, not the code
cvs-health/uqlm/uqlm/code/code_evaluation.py
code served (permissive licence) · get_code("fc0bbef7e3b31704")
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 str. 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 re
import html

def sanitize_llm_output(raw: str) -> str:
    """
    Model responses often include extraneous formatting such as markdown fences, explanatory prose, HTML‑escaped characters, and partial or malformed code blocks.

    This function cleans the model response to ensure that only executable Python code is forwarded to the next evaluation stage.
    - Normalizes newline formats and unescapes HTML entities.
    - If the response contains no ``` fences, the raw text is returned after stripping surrounding backticks.
    - If fenced code blocks exist, all blocks are extracted.
    - The longest fenced block is selected (typically the actual code solution).
    - Trailing or malformed backticks are removed.
    """
    if raw is None:
        return ''
    text = html.unescape(raw.replace('\r\n', '\n').replace('\r', '\n')).strip()
    if '```' not in text:
        return text.strip('`').strip()
    blocks = re.findall('```(?:python|py)?\\s*\\n(.*?)```', text, flags=re.S)
    if blocks:
        code = max(blocks, key=len)
        return code.strip()
    stripped = re.sub('```+', '', text).strip()
    return stripped


# Test case 1: raw string with markdown code fences
test_input_1 = """Here is the solution:

def hello():
    return "world"

"""

# Test case 2: raw string with HTML entities and newline variations
test_input_2 = "x < 5 and y > 3\r\nprint('hello')\r\n"

# Test case 3: raw string with no code fences
test_input_3 = "just some plain text"

# Test case 4: raw string with backticks but no triple backticks
test_input_4 = "`some code` here"

# Test case 5: raw string with multiple code blocks (longest should be selected)
test_input_5 = """First block:

x = 1


Second block (longer):

def solution():
    result = []
    for i in range(10):
        result.append(i * 2)
    return result

"""

# Test case 6: raw string that is None
test_input_6 = None

# Test case 7: raw string with malformed backticks
test_input_7 = "``````some code here``````"

ARGS = {
    "raw": test_input_1
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
truncatefn Ran
ran; our contract draft was wrong, not the code
cvs-health/uqlm/uqlm/code/lcb_grader.py
code served (permissive licence) · get_code("993984482b377429")
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 str. 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

torch.manual_seed(0)

ARGS = {
    "s": "This is a test string that will be truncated because it is longer than the default length of 300 characters. " * 5,
    "length": 300
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
evaluate_python_code Not yet run
unverified (harvested, no recorded run)
cvs-health/uqlm/uqlm/code/code_evaluation.py
code served (permissive licence) · get_code("60cdbbe10c98b7ab")
How it ran

no invocation recorded.

Also present in other papers' code

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

Hallucinations, defined as instances where Large Language Models (LLMs) generate false or misleading content, pose a significant challenge that impacts the safety and trust of downstream applications. We introduce UQLM, a Python package for LLM hallucination detection using state-of-the-art uncertainty quantification (UQ) techniques. This toolkit offers a suite of UQ-based scorers that compute response-level confidence scores ranging from 0 to 1. This library provides an off-the-shelf solution for UQ-based hallucination detection that can be easily integrated to enhance the reliability of LLM outputs.

For agents

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

get_harvested_code_for_paper("2507.06196")
get_code_for_paper("2507.06196")
have("2507.06196")

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

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

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

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

Connect an agent — have() is free.