SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.16282 · ACL · 2024

Confidence Under the Hood: An Investigation into the Confidence-Probability Alignment in Large Language Models

Abhishek Kumar, Jad Kabbara, Robert Morabito, Ali Emami, Sanzhar Umbet

arXiv · PDF · Open in the Atlas

Code that ran

1 of 6 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; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 0 failures of our instrument; 5 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/2405.16282.json · badge: /api/ran/2405.16282.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
akkeshav/confidence_probability_alignment marked official in Papers with Code
Papers with Code archive
1 ran · 5 no recorded run
FunctionStatusWhere it lives
ModelFactory Ran
ran on a synthesized input · constructed an object; no result was computed
akkeshav/confidence_probability_alignment/get_confidence.py
code served (permissive licence) · get_code("84f36aa0e79a5f61")
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, ModelFactory: 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
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a mock tokenizer that satisfies AutoTokenizer interface
class MockTokenizer:
    def __init__(self):
        self.vocab_size = 32000
        self.model_max_length = 2048
        self.pad_token_id = 0
        self.eos_token_id = 2
        self.bos_token_id = 1
    
    def __call__(self, text, return_tensors=None, padding=False, truncation=False):
        # Return a mock tokenized output
        return {
            'input_ids': torch.tensor([[1, 2, 3, 4]]),
            'attention_mask': torch.tensor([[1, 1, 1, 1]])
        }
    
    def decode(self, token_ids):
        return "decoded text"

# Create a mock Mistral model that satisfies MistralForCausalLM interface
class MockMistralModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.config = Mock()
        self.config.vocab_size = 32000
        self.config.hidden_size = 128
        self.lm_head = nn.Linear(128, 32000)
        self.model = Mock()
    
    def forward(self, input_ids, attention_mask=None):
        # Return mock logits
        batch_size, seq_len = input_ids.shape
        logits = torch.randn(batch_size, seq_len, 32000)
        return Mock(logits=logits)
    
    def generate(self, input_ids, max_length=100, **kwargs):
        return torch.cat([input_ids, torch.randint(0, 32000, (input_ids.shape[0], 10))], dim=1)

# Mock the from_pretrained methods
original_auto_tokenizer = __import__('transformers').AutoTokenizer
original_mistral = __import__('transformers').MistralForCausalLM

def mock_tokenizer_from_pretrained(model_name):
    return MockTokenizer()

def mock_mistral_from_pretrained(model_name):
    return MockMistralModel()

# Patch the from_pretrained methods
__import__('transformers').AutoTokenizer.from_pretrained = mock_tokenizer_from_pretrained
__import__('transformers').MistralForCausalLM.from_pretrained = mock_mistral_from_pretrained

ARGS = {
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ModelFactory — 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 ModelFactory 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
closed_source_models Not yet run
unverified (harvested, no recorded run)
akkeshav/confidence_probability_alignment/get_confidence.py
code served (permissive licence) · get_code("db638a55764fbb97")
How it ran

no invocation recorded.

generate_internal_confidence Not yet run
unverified (harvested, no recorded run)
akkeshav/confidence_probability_alignment/get_confidence.py
code served (permissive licence) · get_code("a11a1bc7d00792f1")
How it ran

no invocation recorded.

get_model_and_tokenizer Not yet run
unverified (harvested, no recorded run)
akkeshav/confidence_probability_alignment/get_confidence.py
code served (permissive licence) · get_code("6473e0d73faf9415")
How it ran

no invocation recorded.

get_open_ai_response Not yet run
unverified (harvested, no recorded run)
akkeshav/confidence_probability_alignment/get_confidence.py
code served (permissive licence) · get_code("ecd24c9dd0803fa0")
How it ran

no invocation recorded.

open_source_models Not yet run
unverified (harvested, no recorded run)
akkeshav/confidence_probability_alignment/get_confidence.py
code served (permissive licence) · get_code("137b72efd24c38e1")
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-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

As the use of Large Language Models (LLMs) becomes more widespread, understanding their self-evaluation of confidence in generated responses becomes increasingly important as it is integral to the reliability of the output of these models. We introduce the concept of Confidence-Probability Alignment, that connects an LLM's internal confidence, quantified by token probabilities, to the confidence conveyed in the model's response when explicitly asked about its certainty. Using various datasets and prompting techniques that encourage model introspection, we probe the alignment between models' internal and expressed confidence. These techniques encompass using structured evaluation scales to rate confidence, including answer options when prompting, and eliciting the model's confidence level for outputs it does not recognize as its own. Notably, among the models analyzed, OpenAI's GPT-4 showed the strongest confidence-probability alignment, with an average Spearman's ρ of 0.42, across a wide range of tasks. Our work contributes to the ongoing efforts to facilitate risk assessment in the application of LLMs and to further our understanding of model trustworthiness. 1

For agents

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

get_harvested_code_for_paper("2405.16282")
get_code_for_paper("2405.16282")
have("2405.16282")

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

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

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

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

Connect an agent — have() is free.