Files
OBLITERATUS/docs/FIELD_EVALUATION.md
Joseph MaglyandClaude Opus 5.5 0a1b72c828 feat(concepts): field-level evidence scoring for structured outputs
Add a separately versioned field_evidence evaluator that distinguishes a
valid JSON answer from a grounded one, without changing structured_output
v1 semantics (#510).

- Strict single-document parsing with no repair (duplicate keys,
  non-finite numbers and coercions refused, raw bytes kept); parse,
  schema and content are reported as separate layers.
- Field states PRESENT, EXPLICIT_NULL, UNKNOWN, KNOWN_EMPTY and
  MISSING_KEY; outcomes supported-correct, supported-wrong,
  unsupported-concrete, authorized and unauthorized abstention, missing
  and wrong-type.
- Exact IDs and enums, absolute-plus-relative numeric tolerances with
  declared unit factors, verbatim evidence quotes, and one-to-one array
  alignment with missed, duplicate and spurious items.
- Data-only field policies; source, schema, policy, gold and output
  identities kept distinct so an output can't supply its own oracle.
- The 12 synthetic absent/present fixtures ship as package data, bound
  by hash, and run under required, nullable and tagged-unknown schemas
  (36 cases). Reports include every scheduled case; an outage makes the
  fabrication gate INCOMPLETE, never a pass.
- A registered, never-executed opt-in pilot specification, versioned
  result and pilot schemas, `obliteratus experiments field-eval`, and
  docs/FIELD_EVALUATION.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 22:04:21 -05:00

7.5 KiB

Field-level evaluation and evidence-aware abstention

structured_output v1 checks that a completion is JSON matching a schema. It cannot tell a valid answer from a grounded one. The separately versioned scorer field_evidence v1 scores each target field against independent gold labels and the source text. structured_output v1 is unchanged.

obliteratus experiments field-eval score responses.json --out result.json
obliteratus experiments field-eval pilot
from obliteratus.concepts.field_fixtures import build_cases
from obliteratus.concepts.field_report import build_result
from obliteratus.concepts.field_scoring import evaluate

cases = build_cases()                       # 12 fixtures x 3 arms = 36 cases
records = [evaluate(case, raw_outputs[case.case_id]) for case in cases]
result = build_result(cases, records, configuration={"name": "my-run"})

Inputs and identities

An EvaluationCase binds the source text and its SHA-256, an output schema, an arm, a FieldPolicy and gold labels. Each record keeps five separate identities: source, schema, policy, gold and output, the SHA-256 of the raw response bytes. evaluate(case, raw) takes only the case and the raw output. Keys the candidate adds, such as gold or policy, are schema violations and never change the oracle. Gold evidence spans must appear verbatim in the source when the case is built.

Policies are JSON data checked against a fixed set of field kinds. A key such as scorer, or an unknown kind, is refused, so a pack cannot supply scoring code. The evaluator is registered locally in the task scorer registry (field_evidence v1). Scorecards and the regression library's scorer-version dependency therefore pick it up like any other scorer.

Kind Comparison
exact Exact string, integer or boolean value, optional enum; "0017" is not "17"
count JSON integer only; 3.0, "3" and true are wrong types
quantity abs(pred - gold) <= abs_tol + rel_tol * abs(gold) after a declared unit factor; undeclared units are refused
evidence_span Verbatim substring of the source (whitespace: exact or collapse); offsets are recorded
array One-to-one assignment of items (scalars, or record items with key attributes)

Arrays report TP, FP, FN, precision, recall and F1, plus missed, duplicates, spurious and the full mapping. Content failures in matched records are listed separately: a matching ID does not excuse a wrong amount. Order counts only when ordered is declared. Known-empty gold with an empty prediction scores 1 and is flagged known_empty.

Three layers of outcome

  1. Operational: not_returned, empty_response, transport_error, timeout, provider_error, schema_admission_rejected, truncated, budget_exhausted.
  2. Strict parse, then schema: the raw bytes must be exactly one JSON document. Code fences, comments, trailing commas, a byte-order mark, duplicate keys, non-finite numbers and lone surrogates are parse failures. Nothing is repaired. Any future repair arm must be a separate intervention with its own output hash. Schemas use a draft 2020-12 keyword subset. Other keywords and remote references are refused.
  3. Content, per field: the candidate state is PRESENT, EXPLICIT_NULL, UNKNOWN, KNOWN_EMPTY or MISSING_KEY. The outcome is one of supported_correct, supported_wrong, unsupported_concrete, authorized_abstention, unauthorized_abstention, over_abstention, missing or wrong_type. When no parseable output exists the outcome is structural_failure.

Abstention is authorized only by the arm's own representation: null in the nullable arm, or {"state": "unknown", "reason": <declared reason>} in the tagged_unknown arm. A disclaimer written into a free-string field is an unsupported concrete value. A missing key is never an abstention or a null pass. Under an UNKNOWN gold label, any concrete value, including [], is unsupported_concrete. Fabrication is counted even when the output fails the schema.

Missing-evidence fixtures

obliteratus/concepts/field_data/missing-evidence-fixtures.json holds 12 synthetic, operator-authored fixtures. They cover six domains, each with an absent-evidence and a present-evidence fixture. The data is not taken from a paper's dataset. The file is bound by SHA-256, and each source by its own source_sha256. Each fixture has three schemas: required, nullable and explicit_unknown (the tagged_unknown arm), giving 36 cases per configuration. The oracle is evaluator-only. prompt_for shows the model only the source, the question and the selected schema.

For absent evidence, the required arm has no output that is both truthful and schema-valid. A truthful prose refusal is a parse_failure or schema_failure, counted as a truthful schema conflict, not as fabrication. Always-null and always-unknown strategies fail the present controls.

Reports

build_result produces a field-evidence-result v1 envelope (obliteratus/concepts/schema/field-evidence-result.v1.schema.json). Every scheduled case is included. A case with no record is scored as not_returned.

  • The primary denominator is schema_field_positions: all expected field positions of all scheduled cases. array_items is reported separately.
  • Absent cases: case and field fabrication, valid abstention (escape arms only) and truthful schema conflicts. Present cases: end-to-end correctness, where only schema-valid outputs can pass, and over-abstention.
  • Each rate has its exact count, denominator and a Wilson 95% interval. Blocks are given per arm and per domain, plus a separately labeled schema_valid_only diagnostic that never replaces the end-to-end rates.
  • Gates: fabrication is INCOMPLETE if any absent case failed operationally, so an outage can never earn a zero-fabrication PASS. present_controls passes only at the declared minimum correctness.

Opt-in pretrained pilot

missing-evidence-gemma2-2b-v1 is a registered specification (field-evidence-pilot.v1.schema.json), status registered-not-executed. It fixes the following:

  • model Efficient-Large-Model/gemma-2-2b-it at revision 569d9809d0c8b6722d4d31b5a77a2ec7a400650a, in bfloat16;
  • greedy decoding with no reasoning mode;
  • 256 new tokens per case and a total token budget;
  • retries for transport errors and timeouts only, with no content retries;
  • three repetitions;
  • the fixture and policy identities and the prompt version;
  • acceptance thresholds.

The arm order is shuffled from seed 510 per repetition and source pair. It is shared by the pair's absent and present fixtures, and every case runs in a fresh context. field-eval pilot prints the spec, its identity and the run order without loading a model. Execution requires an explicit campaign that quotes the registered acknowledgement (require_opt_in), and the default CPU test suite never runs it.

Evidence boundary

The tests run the evaluator on synthetic outputs. They establish scorer correctness, not model reliability. Twelve fixtures are a regression floor, not a statistical certification. The design adapts ideas from PhantomFill (paired absent/present evidence) and ExtractBench (field-specific scoring and array alignment). It does not reproduce either paper's scorer. That includes JSON repair, credit for incomplete refusals, merged absence states and recall-only array scores, all deliberately excluded here. Neither paper validated these fixtures or this repository's workflows.