SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2607.24884 · 2026

Beyond "What to Retrieve": Uncertainty in Retrieval-Augmented Code Generation

Xiaoli Zhang, Kumar Chandan, Li Sah, Lian

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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; 5 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/2607.24884.json · badge: /api/ran/2607.24884.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
Rocky5502/OpenCoder_V1 canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
edit_similarity Ran
ran, honoured the contract we drafted
Rocky5502/OpenCoder_V1/opencoder/evaluation/metrics.py
code served (permissive licence) · get_code("c5019596846e0026")
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 difflib

def edit_similarity(pred: str, ref: str) -> float:
    return float(difflib.SequenceMatcher(None, pred, ref).ratio())

ARGS = {
    "pred": "hello world",
    "ref": "hello word"
}
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
estimate_pass_at_k Ran
ran, honoured the contract we drafted
Rocky5502/OpenCoder_V1/opencoder/evaluation/metrics.py
code served (permissive licence) · get_code("42c81d3f43739308")
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

def estimate_pass_at_k(n: int, c: int, k: int) -> float:
    """Unbiased pass@k estimator from Codex/HumanEval.

    ``n`` is the number of generated samples and ``c`` is how many passed.
    """
    if n <= 0 or c <= 0:
        return 0.0
    if k <= 0:
        return 0.0
    if k > n:
        k = n
    if n - c < k:
        return 1.0
    return float(1.0 - math.comb(n - c, k) / math.comb(n, k))


ARGS = {
    "n": 10,
    "c": 5,
    "k": 3,
}
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
exact_match Ran
ran, honoured the contract we drafted
Rocky5502/OpenCoder_V1/opencoder/evaluation/metrics.py
code served (permissive licence) · get_code("095c99ea52e24d66")
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 torch.nn as nn

torch.manual_seed(0)

# The function exact_match takes two string parameters: pred and ref
# It strips both strings and compares them for equality
# No complex objects needed - just strings

ARGS = {
    "pred": "hello world ",
    "ref": "hello world"
}
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 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
extract_repo_knowledge Ran
ran; our contract draft was wrong, not the code
Rocky5502/OpenCoder_V1/opencoder/phase1_repo_knowledge/extract.py
code served (permissive licence) · get_code("93c070bd84dd8a9a")
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 list, 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 tempfile
import os

# Create a temporary directory with some Python files for testing
temp_dir = tempfile.mkdtemp()

# Create a simple Python module structure
os.makedirs(os.path.join(temp_dir, 'module1'), exist_ok=True)

# Write test Python files
test_file_1 = os.path.join(temp_dir, 'test_module.py')
with open(test_file_1, 'w') as f:
    f.write('''
def simple_function(x, y):
    """This is a simple function."""
    return x + y

class MyClass:
    """A test class."""
    def method_one(self, a):
        """First method."""
        return a * 2
    
    def method_two(self, b):
        """Second method."""
        return b + 1

from ..utils import helper_func
''')

test_file_2 = os.path.join(temp_dir, 'module1', 'sub_module.py')
with open(test_file_2, 'w') as f:
    f.write('''
def another_function(param):
    """Another test function."""
    pass

class AnotherClass:
    """Another class."""
    pass
''')

test_file_3 = os.path.join(temp_dir, 'empty.py')
with open(test_file_3, 'w') as f:
    f.write('# Empty file with just a comment\n')

# Create __pycache__ directory to test skipping
os.makedirs(os.path.join(temp_dir, '__pycache__'), exist_ok=True)
with open(os.path.join(temp_dir, '__pycache__', 'should_skip.py'), 'w') as f:
    f.write('# This should be skipped\n')

ARGS = {
    'root': temp_dir,
    'max_files': None
}
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 list, ndim 1, dtype family float — a list 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
extract_source_knowledge Ran
ran; our contract draft was wrong, not the code
Rocky5502/OpenCoder_V1/opencoder/phase1_repo_knowledge/extract.py
code served (permissive licence) · get_code("0615393cf2c5420a")
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 list, 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 ast
from dataclasses import dataclass, field
from typing import Iterator, List, Optional, Sequence, Tuple

@dataclass
class RepoFunction:
    file_path: str
    qualname: str
    signature: str
    docstring: Optional[str]
    body: str
    start_line: int
    end_line: int
    kind: str = 'function'
    description: Optional[str] = None
    uncertainty: Optional[float] = None
    metadata: dict = field(default_factory=dict)

def _segment(source: str, node: ast.AST) -> str:
    try:
        return ast.get_source_segment(source, node) or ''
    except Exception:
        return ''

def extract_source_knowledge(file_path: str, source: str) -> List[RepoFunction]:
    """Extract knowledge items from one in-memory Python source string."""
    try:
        tree = ast.parse(source)
    except Exception:
        return []
    items: List[RepoFunction] = []
    parents: dict[ast.AST, ast.AST] = {}
    for parent in ast.walk(tree):
        for child in ast.iter_child_nodes(parent):
            parents[child] = parent
    local_definitions = {node.name for node in ast.iter_child_nodes(tree) if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef))}
    for node in ast.walk(tree):
        if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
            parent = parents.get(node)
            is_method = isinstance(parent, ast.ClassDef)
            qualname = f'{parent.name}.{node.name}' if is_method else node.name
            sig = f"{node.name}({', '.join((a.arg for a in node.args.args))})"
            items.append(RepoFunction(file_path=file_path, qualname=qualname, signature=sig, docstring=ast.get_docstring(node), body=_segment(source, node), start_line=node.lineno, end_line=getattr(node, 'end_lineno', node.lineno), kind='method' if is_method else 'function'))
        elif isinstance(node, ast.ClassDef):
            items.append(RepoFunction(file_path=file_path, qualname=node.name, signature=f'class {node.name}', docstring=ast.get_docstring(node), body=_segment(source, node), start_line=node.lineno, end_line=getattr(node, 'end_lineno', node.lineno), kind='class'))
        elif isinstance(node, ast.ImportFrom) and node.level > 0:
            module = '.' * node.level + (node.module or '')
            for alias in node.names:
                if alias.name == '*':
                    continue
                local_name = alias.asname or alias.name
                if local_name in local_definitions:
                    continue
                items.append(RepoFunction(file_path=file_path, qualname=local_name, signature=f'imported {local_name} from {module}', docstring=None, body=_segment(source, node), start_line=node.lineno, end_line=getattr(node, 'end_lineno', node.lineno), kind='imported_api'))
    return items

source_code = '''
def hello_world(x, y):
    """A simple function."""
    return x + y

class MyClass:
    """A simple class."""
    def method_one(self, a):
        """Method docstring."""
        return a * 2
    
    def method_two(self, b, c):
        return b - c

from ..utils import helper_func
from ..config import Config
'''

ARGS = {
    'file_path': 'test_module.py',
    'source': source_code
}
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 list, ndim 1, dtype family float — a list 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
extract_sources_knowledge Ran
ran; our contract draft was wrong, not the code
Rocky5502/OpenCoder_V1/opencoder/phase1_repo_knowledge/extract.py
code served (permissive licence) · get_code("63158217b21bd36c")
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 list, 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 ast
from dataclasses import dataclass, field
from typing import Iterator, List, Optional, Sequence, Tuple

@dataclass
class RepoFunction:
    file_path: str
    qualname: str
    signature: str
    docstring: Optional[str]
    body: str
    start_line: int
    end_line: int
    kind: str = 'function'
    description: Optional[str] = None
    uncertainty: Optional[float] = None
    metadata: dict = field(default_factory=dict)

def _segment(source: str, node: ast.AST) -> str:
    try:
        return ast.get_source_segment(source, node) or ''
    except Exception:
        return ''

def extract_source_knowledge(file_path: str, source: str) -> List[RepoFunction]:
    """Extract knowledge items from one in-memory Python source string."""
    try:
        tree = ast.parse(source)
    except Exception:
        return []
    items: List[RepoFunction] = []
    parents: dict[ast.AST, ast.AST] = {}
    for parent in ast.walk(tree):
        for child in ast.iter_child_nodes(parent):
            parents[child] = parent
    local_definitions = {node.name for node in ast.iter_child_nodes(tree) if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef))}
    for node in ast.walk(tree):
        if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
            parent = parents.get(node)
            is_method = isinstance(parent, ast.ClassDef)
            qualname = f'{parent.name}.{node.name}' if is_method else node.name
            sig = f"{node.name}({', '.join((a.arg for a in node.args.args))})"
            items.append(RepoFunction(file_path=file_path, qualname=qualname, signature=sig, docstring=ast.get_docstring(node), body=_segment(source, node), start_line=node.lineno, end_line=getattr(node, 'end_lineno', node.lineno), kind='method' if is_method else 'function'))
        elif isinstance(node, ast.ClassDef):
            items.append(RepoFunction(file_path=file_path, qualname=node.name, signature=f'class {node.name}', docstring=ast.get_docstring(node), body=_segment(source, node), start_line=node.lineno, end_line=getattr(node, 'end_lineno', node.lineno), kind='class'))
        elif isinstance(node, ast.ImportFrom) and node.level > 0:
            module = '.' * node.level + (node.module or '')
            for alias in node.names:
                if alias.name == '*':
                    continue
                local_name = alias.asname or alias.name
                if local_name in local_definitions:
                    continue
                items.append(RepoFunction(file_path=file_path, qualname=local_name, signature=f'imported {local_name} from {module}', docstring=None, body=_segment(source, node), start_line=node.lineno, end_line=getattr(node, 'end_lineno', node.lineno), kind='imported_api'))
    return items

def extract_sources_knowledge(sources: Sequence[Tuple[str, str]]) -> List[RepoFunction]:
    items: List[RepoFunction] = []
    for file_path, source in sources:
        items.extend(extract_source_knowledge(file_path, source))
    return items

source1 = '''
def hello(x, y):
    """Say hello."""
    return x + y

class MyClass:
    """A simple class."""
    def method_one(self, a):
        """Method one."""
        return a * 2

from . import utils
from .config import Config
'''

source2 = '''
def process(data):
    """Process data."""
    pass

async def async_fetch(url):
    """Fetch from URL."""
    pass
'''

ARGS = {
    'sources': [
        ('file1.py', source1),
        ('file2.py', source2),
    ]
}
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 list, ndim 1, dtype family float — a list 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
parse_dependency_descriptions Ran
ran; our contract draft was wrong, not the code
Rocky5502/OpenCoder_V1/opencoder/baselines/alliancecoder.py
code served (permissive licence) · get_code("34e72b2d2d0bd87c")
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 list, 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 re
from dataclasses import dataclass
from typing import Any, Iterable, List, Sequence

@dataclass(frozen=True)
class DependencyPrediction:
    description: str
    ordinal: int

_LIST_PREFIX = re.compile('^\\s*(?:[-*]\\s+|\\d+[.)]\\s+)')

_NAMED_DESCRIPTION = re.compile('^(?:\\*\\*)?`[^`]+`(?:\\*\\*)?\\s*:\\s*(.+)$')

def parse_dependency_descriptions(text: str) -> List[DependencyPrediction]:
    """Parse an LLM list while preserving order and removing exact repeats."""
    predictions: List[DependencyPrediction] = []
    seen: set[str] = set()
    for line in text.splitlines():
        value = _LIST_PREFIX.sub('', line).strip()
        value = value.strip('` ')
        named = _NAMED_DESCRIPTION.match(_LIST_PREFIX.sub('', line).strip())
        if named:
            value = named.group(1).strip()
        if not value or value.lower() in {'none', 'n/a', 'no dependencies'}:
            continue
        normalized = re.sub('\\s+', ' ', value).casefold()
        if normalized in seen:
            continue
        seen.add(normalized)
        predictions.append(DependencyPrediction(value, len(predictions) + 1))
    return predictions

# Setup code to construct valid arguments
sample_text = """- numpy
* pandas
1. scipy
2. torch
- NumPy
** `requests`: HTTP library
none
n/a
1. scikit-learn
   Multiple   spaces
"""

ARGS = {
    "text": sample_text
}
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 list, ndim 1, dtype family float — a list 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
re_safe_name Ran
ran; our contract draft was wrong, not the code
Rocky5502/OpenCoder_V1/opencoder/pipeline.py
code served (permissive licence) · get_code("97e318479d9485e0")
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 = {
    "value": "Hello-World_123!@#$%"
}
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

Also present in other papers' code

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

Repository-level code generation relies on heterogeneous evidence whose relevance, compatibility, and completeness are inherently uncertain. Similar-code examples, repository context, and project-specific APIs may provide complementary information, but can also introduce noisy, redundant, or conflicting signals. Existing retrieval-augmented approaches primarily optimize retrieval relevance without explicitly modeling how uncertainty in retrieved evidence affects downstream generation. We introduce OpenCoder, an uncertainty-aware framework that estimates source-specific uncertainty, uses it to filter and rank heterogeneous evidence, and guides generation, verification, and repair. A factorial analysis over API knowledge, repository context, and similar-code evidence reveals no universal additive source ranking; instead, significant cross-source interactions depend on the accompanying evidence and LLM backend. On an expanded 32-task RepoExecinline evaluation, OpenCoder improves GPT selected-output correctness over Baseline RAG from 56.25% to 78.13%. However, it matches a verification-and-repair control, and the corresponding Gemini improvement is not statistically supported, indicating backend-dependent benefits. Target-aware API refinement also substantially improves API-set retrieval. These findings support treating uncertainty as an actionable control signal for repository-level retrieval, verification, and repair. Our code and supporting materials are available at https://github.com/Rocky5502/OpenCoder_V1.

For agents

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

get_harvested_code_for_paper("2607.24884")
get_code_for_paper("2607.24884")
have("2607.24884")

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

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

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

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

Connect an agent — have() is free.