Deep-Research Agents › Uncertainty scoring and abstention

Michael BrenndoerferDecember 1, 20264 min read
Language AI HandbookAll chapters
Part 49 of 67Long-Horizon Agents and Interoperability
Chapter 375Deep-Research Agents › Uncertainty scoring and abstention
Reading section 12 of 17 · Uncertainty scoring and abstention · 4 minSection 12 of 17 · 4 min

Section 12 of 17 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

The uncertainty rule first runs on lexical candidates for inspection. The answer runs it again after semantic approval. The score uses recorded origin count, assigned authority, and a flag from the negation-marker heuristic.

PythonIn [31]
CollapseExpand
EVIDENCE_WEIGHT = 0.4
AUTHORITY_WEIGHT = 0.4
CONFLICT_WEIGHT = 0.2
ASSERT_CUTOFF = 0.35


def max_authority(claim: Claim) -> float:
    if not claim.evidence:
        return 0.0
    return max(
        next(d for d in docs if d.doc_id == sp.doc_id).authority
        for sp in claim.evidence
    )


def claim_uncertainty(claim: Claim, has_conflict: bool) -> dict:
    n = claim.independent_count
    a = max_authority(claim)
    # Score in [0,1]; higher = more uncertain.
    n_score = 1.0 / (1.0 + n)
    a_score = 1.0 - a
    conflict_score = 1.0 if has_conflict else 0.0
    u = (
        EVIDENCE_WEIGHT * n_score
        + AUTHORITY_WEIGHT * a_score
        + CONFLICT_WEIGHT * conflict_score
    )
    if n == 0 or has_conflict:
        label = "abstain"
    elif n == 1:
        label = "hedge"
    elif u < ASSERT_CUTOFF:
        label = "assert"
    else:
        label = "hedge"
    return {
        "claim_id": claim.claim_id,
        "claim": claim.text[:50],
        "n_indep": n,
        "max_auth": round(a, 2),
        "conflict": has_conflict,
        "uncertainty": round(u, 3),
        "label": label,
    }


u_rows = [
    claim_uncertainty(c, bool(detect_conflicts(c.text, c.evidence)))
    for c in ledger
]
u_df = pd.DataFrame(u_rows)
ConsoleOut [32]
CollapseExpand
                                                        claim_id                                              claim  n_indep  max_auth  conflict  uncertainty   label
7c9fd6b4e2a52693397964b390bd1c575a130845aa1ea96a38b891a3c89137d1 audits must be performed by an independent auditor        1      0.92     False        0.232   hedge
35cae509a0a30076eb6ae2c9dfa445772222e9f5c89f8dbbfdbaf87595428206                    audit results must be published        2      0.92     False        0.165  assert
36703c089bd247f268690d3971081490ed209d6df7f9a58a5c5b2dc4912ac1bf candidates residing in Cedar City must be notified        0      0.00     False        0.800 abstain
b45eca72f8aaaa20b086c5b87463f61861d60383a32a66fa98be2b0f135658df       civil penalties apply to all AI hiring tools        0      0.00     False        0.800 abstain
c48564a69b2f573f8695196cfd1907b96cadd239933f35c80d51c9dd09461612 EU framework requires an equivalent audit obligati        0      0.00     False        0.800 abstain

The score is a weighted heuristic. For origin count n, maximum assigned authority a and conflict flag c, the three terms are 0.4/(1+n), 0.4(1−a) and 0.2c. Each unweighted input is in [0,1], so the weighted sum is too. The policy abstains with zero origins or a conflict and hedges with exactly one origin. When n is at least two and c is zero, it asserts if u < 0.35, equivalently if a > 1/8 + 1/(1+n). For n=2 this bound is 11/24. For n=3 it is 3/8. The weights and cutoff are illustrative. The decision uses the unrounded score. A score of 0.349933 can therefore yield an assertion while the printed score rounds to 0.350.

A zero-origin row reports that the pre-review candidate pass retained no spans with a known origin. A negation flag withholds the claim for review. The label describes the decision taken by this rule; the scores are not calibrated probabilities.

PythonIn [33]
CollapseExpand
unc_components_df = pd.DataFrame(
    [
        {
            "claim_short": f"C{ledger.index(c) + 1}",
            "n_indep": c.independent_count,
            "n_score": 1.0 / (1.0 + c.independent_count),
            "a_score": 1.0 - max_authority(c),
            "c_score": 1.0 if detect_conflicts(c.text, c.evidence) else 0.0,
            "label": claim_uncertainty(
                c, bool(detect_conflicts(c.text, c.evidence))
            )["label"],
        }
        for c in ledger
    ]
)
unc_components_df["w_n"] = EVIDENCE_WEIGHT * unc_components_df["n_score"]
unc_components_df["w_a"] = AUTHORITY_WEIGHT * unc_components_df["a_score"]
unc_components_df["w_c"] = CONFLICT_WEIGHT * unc_components_df["c_score"]
VisualizationOut [34]
CollapseExpand
Stacked bars showing weighted uncertainty signals per ledger claim.
Stacked uncertainty signals for each ledger claim, with the weighted evidence-count, authority, and conflict terms summing to the bar height. Labels show decisions on the lexical candidates before quote approval. The 0.35 guide applies only with at least two recorded origins and no flagged conflict.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy