Skip to content

Reconciliation discards grounded mentions instead of clustering them #2

Description

@jolovicdev

Summary

reconciliation.enabled=True with use_workforce=True deletes grounded mentions.

The resolver worker uses keep_indices to deduplicate coreferent mentions. The runtime
honours that literally and drops those extractions from DocumentResult.extractions.

Coreference belongs in canonical_claims. keep_indices should not be doing it.

Reproduction

Text with repeat and short-form mentions:

Dr. Elena Marku presented the audit findings on Tuesday. Marku argued that the reserve
was understated. Later, Elena Marku met the board chair, Petar Nikolic. Nikolic
disagreed with Dr. Marku on the timeline.

Same request and model (deepseek/deepseek-chat, temperature=0.0), reconciliation off vs on:

reconciliation=off -> 4 extractions
  [0] 'Elena Marku'     4-15
  [1] 'Elena Marku'   111-122
  [2] 'Petar Nikolic' 144-157
  [3] 'Dr. Marku'     182-191

reconciliation=on  -> 2 extractions
  [0] 'Dr. Elena Marku'   0-15
  [1] 'Petar Nikolic'   144-157

Two grounded spans are gone. Each surviving claim carries a single extraction_indices
entry, so nothing recovers them.

Impact

  1. Span grounding is what separates Sourcery from plain structured-output libraries.
    This feature removes it without warning.
  2. ReconciliationConfig.min_mentions_for_claim (contracts/models.py:262) is unusable.
    _worker_claims counts only mentions that survived keep_indices
    (blackgeorge_runtime.py:227). The resolver has already collapsed the duplicates, so
    claims hold one mention each. min_mentions_for_claim=2 returns zero claims.
  3. DocumentResult has two layers by design: extractions are mentions,
    canonical_claims aggregate them. Pruning mentions collapses both into one.

Root cause

The resolver instruction never defines what keep_indices is for
(blackgeorge_runtime.py:651-652):

"Read blackboard key 'coreference_clusters' and produce canonical resolved entities
and claims. Return mode='resolver', keep_indices, and canonical_claims."

Handed a coreference cluster, "canonical resolved entities" reads as deduplicate, so the
model returns one index per entity. The runtime applies it at blackgeorge_runtime.py:730.

Fix

  • Keep every aligned mention in reconciled_extractions. Prune false positives only,
    never duplicates.
  • Rewrite the resolver instruction: keep every mention index, express coreference only
    through canonical_claims[].mention_indices.
  • If false-positive pruning stays, move it to its own field (drop_indices) so the two
    intents cannot be confused.

Environment

sourceryforge 0.3.0, blackgeorge 1.3.1, Python 3.12.14, model deepseek/deepseek-chat.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions