SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2606.22728 · 2026

When Confidence Takes the Wrong Path: Diagnosing Retrieval-State Lock-In in RAG

Sahib Julka

arXiv · PDF

Code that ran

6 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 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/2606.22728.json · badge: /api/ran/2606.22728.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
julka01/OntoGraphRAG community
Papers with Code archive
6 ran · 0 no recorded run
FunctionStatusWhere it lives
_clean_id Ran
ran; our contract draft was wrong, not the code
julka01/OntoGraphRAG/ontographrag/rag/graph_state.py
code served (permissive licence) · get_code("2c8e31cd959ab276")
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
import numpy as np
from typing import Any, Dict, Iterable, List, Optional, Sequence, Set

torch.manual_seed(0)

ARGS = {
    'value': 'test_string'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
_set_from Ran
ran; our contract draft was wrong, not the code
julka01/OntoGraphRAG/ontographrag/rag/graph_state.py
code served (permissive licence) · get_code("c74cb87ffda343e8")
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 set. 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
from typing import Iterable, Any, Set

torch.manual_seed(0)

def _clean_id(value: Any) -> str:
    text = str(value or '').strip()
    return text

def _set_from(values: Iterable[Any]) -> Set[str]:
    return {text for text in (_clean_id(v) for v in values) if text}

# Construct arguments for _set_from
# The function takes an Iterable[Any] and converts each element to a string via _clean_id
# _clean_id converts to string, strips whitespace, and filters out empty strings

# Create a variety of test values to pass through _set_from
test_values = [
    "hello",
    "world",
    42,
    3.14,
    None,
    "",
    "  spaces  ",
    123,
    "duplicate",
    "duplicate",
    True,
    False,
]

ARGS = {
    "values": test_values
}
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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
graph_state_diversity Ran
ran; our contract draft was wrong, not the code
julka01/OntoGraphRAG/ontographrag/rag/graph_state.py
code served (permissive licence) · get_code("af2a7d197523ddc6")
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) 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 math
from collections import Counter
from itertools import combinations
from typing import Any, Dict, Iterable, List, Optional, Sequence, Set

# Build sample graph states with the expected structure
sample_states = [
    {
        'seed_signature': 'sig_a',
        'path_signature': 'path_1',
        'subgraph_signature': 'subgraph_x',
        'chunk_signature': 'chunk_1',
        'route': 'route_north',
        'seed_entity_ids': ['entity_1', 'entity_2'],
        'entity_ids': ['entity_1', 'entity_2', 'entity_3'],
        'path_ids': ['path_1', 'path_2'],
        'relationship_ids': ['rel_1'],
        'chunk_ids': ['chunk_1', 'chunk_2'],
    },
    {
        'seed_signature': 'sig_b',
        'path_signature': 'path_1',
        'subgraph_signature': 'subgraph_y',
        'chunk_signature': 'chunk_2',
        'route': 'route_south',
        'seed_entity_ids': ['entity_2', 'entity_4'],
        'entity_ids': ['entity_2', 'entity_4', 'entity_5'],
        'path_ids': ['path_2', 'path_3'],
        'relationship_ids': ['rel_2', 'rel_3'],
        'chunk_ids': ['chunk_2', 'chunk_3'],
    },
    {
        'seed_signature': 'sig_a',
        'path_signature': 'path_2',
        'subgraph_signature': 'subgraph_x',
        'chunk_signature': 'chunk_1',
        'route': 'route_north',
        'seed_entity_ids': ['entity_1'],
        'entity_ids': ['entity_1', 'entity_6'],
        'path_ids': ['path_1'],
        'relationship_ids': ['rel_4'],
        'chunk_ids': [],
    },
]

ARGS = {
    'sample_states': sample_states,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
mean_pairwise_jaccard Ran
ran, honoured the contract we drafted
julka01/OntoGraphRAG/ontographrag/rag/graph_state.py
code served (permissive licence) · get_code("cda8c9f7d5ae3904")
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 float, 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
import numpy as np
from itertools import combinations
from typing import Any, Dict, Iterable, List, Optional, Sequence, Set

torch.manual_seed(0)

# The function mean_pairwise_jaccard takes:
# - sets: Sequence[Iterable[Any]] - a sequence of iterables containing any values

# Let's create test data with distinct iterables
sets_input = [
    [1, 2, 3, 4],           # First set
    [3, 4, 5, 6],           # Second set with some overlap
    ['a', 'b', 'c'],        # Third set with different elements
    [1, 2, 'a', 'b'],       # Fourth set with mixed overlap
]

ARGS = {
    "sets": sets_input
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
normalized_entropy Ran
ran, honoured the contract we drafted
julka01/OntoGraphRAG/ontographrag/rag/graph_state.py
code served (permissive licence) · get_code("20662a3a355d6192")
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 float, 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 math
from collections import Counter

ARGS = {
    "labels": ["cat", "dog", "cat", "bird", "dog", "cat"]
}
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 float, 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
shannon_entropy Ran
ran, honoured the contract we drafted
julka01/OntoGraphRAG/ontographrag/rag/graph_state.py
code served (permissive licence) · get_code("3742500c9838c323")
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 float, 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 math
from collections import Counter
from typing import Sequence

def shannon_entropy(labels: Sequence[str]) -> float:
    labels = [str(label) for label in labels]
    if not labels:
        return 0.0
    n = len(labels)
    counts = Counter(labels)
    value = float(-sum((c / n * math.log(c / n, 2) for c in counts.values())))
    return 0.0 if abs(value) < 1e-12 else value


# Test case 1: labels with mixed distribution
labels_1 = ["cat", "dog", "cat", "bird", "dog", "cat"]

ARGS = {
    "labels": labels_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 float, 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

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

The trustworthiness of a retrieval-augmented generation (RAG) system depends on more than the answer it returns, yet many black-box uncertainty methods still read agreement among sampled answers as confidence. That inference fails when repeated samples condition on the same defective retrieval state. The state may be empty, with the model falling back on parametric memory, or populated by a coherent but wrong neighbourhood. In either case, the answers agree because the error is stable. The problem is recognised in deployed RAG, but it has lacked a name, a measurable signature, and a prevalence bound. We supply all three. We name the failure retrieval-state lock-in and diagnose it by separating the three objects a single confidence score conflates: the answer surface, the retrieved evidence, and the retrieval state itself. In an inspectable, ontology-guided knowledge-graph RAG (KG-RAG) system across six question-answering snapshots, we measure the agreement blind spot directly: at five samples per question, 42% of KG-RAG errors and 59% of dense-retrieval errors carry zero answer dispersion, so agreement has nothing to rank, while evidence-and retrieval-state checks still flag most of them. The decomposition supports an auditable decision rule: accepting an answer only when answer, evidence, and retrieval checks all agree that it is low-risk reaches 91.9% pooled precision against a 69.7% accept-all rate. The cost is coverage: it certifies only 7.7% of answers as low-risk. On the clinical calibration domain it reaches 100% precision under an automated judge; this is an in-domain automated-label upper bound, not a clinical safety claim, and still needs human validation. Confidence in RAG is object-specific: when answers agree, the useful question is which part of the pipeline to distrust.

For agents

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

get_harvested_code_for_paper("2606.22728")
get_code_for_paper("2606.22728")
have("2606.22728")

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

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

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

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

Connect an agent — have() is free.