Add aligned cell feedback for the existing Value F1 reward
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- README.md+5-1
- harbor-manifest.json
- tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/task.toml+1-1
- tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/tests/Dockerfile+1-1
- tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/tests/verifier.py+51-5
- tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/task.toml+1-1
- tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/tests/Dockerfile+1-1
- tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/tests/verifier.py+51-5
- tasks/charts-inside-documents--assessment-billing-run-01-a758923341/task.toml+1-1
- tasks/charts-inside-documents--assessment-billing-run-01-a758923341/tests/Dockerfile+1-1
- tasks/charts-inside-documents--assessment-billing-run-01-a758923341/tests/verifier.py+51-5
- tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/task.toml+1-1
- tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/tests/Dockerfile+1-1
- tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/tests/verifier.py+51-5
- tasks/charts-inside-documents--chemo-verification-01-755808e636/task.toml+1-1
- tasks/charts-inside-documents--chemo-verification-01-755808e636/tests/Dockerfile+1-1
- tasks/charts-inside-documents--chemo-verification-01-755808e636/tests/verifier.py+51-5
- tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/task.toml+1-1
- tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/tests/Dockerfile+1-1
- tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/tests/verifier.py+51-5
- tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/task.toml+1-1
- tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/tests/Dockerfile+1-1
- tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/tests/verifier.py+51-5
- tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/task.toml+1-1
- tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/tests/Dockerfile+1-1
- tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/tests/verifier.py+51-5
- tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/task.toml+1-1
- tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/tests/Dockerfile+1-1
- tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/tests/verifier.py+51-5
- tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/task.toml+1-1
- tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/tests/Dockerfile+1-1
- tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/tests/verifier.py+51-5
- tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/task.toml+1-1
- tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/tests/Dockerfile+1-1
- tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/tests/verifier.py+51-5
- tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/task.toml+1-1
- tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/tests/Dockerfile+1-1
- tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/tests/verifier.py+51-5
- tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/task.toml+1-1
- tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/tests/Dockerfile+1-1
- tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/tests/verifier.py+51-5
- tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/task.toml+1-1
- tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/tests/Dockerfile+1-1
- tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/tests/verifier.py+51-5
- tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/task.toml+1-1
- tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/tests/Dockerfile+1-1
- tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/tests/verifier.py+51-5
- tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/task.toml+1-1
- tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/tests/Dockerfile+1-1
- tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/tests/verifier.py+51-5
227 unmodified lines228229230231231232233234235236237238239227 unmodified lines
Instructions reproduce the [published coding-agent prompt](https://arxiv.org/html/2607.29677v1#A3.SS1), with a standardized document filename.Agents receive only `document.pdf` and `schema.json` and write `output.json`.The separate verifier uses the existing ExtractBench evaluator at commit `741c1b651e8851c1bd3424ac4d41b643b9e41761`.The separate verifier uses the existing ExtractBench evaluator at commit `2f27f100730afc7c395602e26a2a87e07ea66b31`.The reward is Value F1 in [0, 1]; `metrics.json` also records perfect-document status.`feedback.json` records aligned output/reference cell paths, value outcomes, andeach matched cell's contribution to the same F1 reward. Paths refer to normalizedscoring inputs; one-sided cells contribute to the denominator. This feedback doesnot change the reward or assign credit to reasoning steps.This prompt does not request citations, so this lane does not measure grounding.The agent timeout is 1800 seconds per document.
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/agency_staffing_invoice_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:handwritten", "length:medium", "domain:D6"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/aggregate_qc_report_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D3"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/assessment_billing_run_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D8"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/capacity_change_pack_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D2"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/chemo_verification_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D6"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/claims_triage_bundle_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D1"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/contractor_dispute_binder_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D3"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/dam_operations_report_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D2"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/drilling_report_bundle_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D2"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/earthwork_quantity_packet_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D3"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/eligibility_appeals_file_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D6"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/gantt_schedule_board_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:short", "domain:D5"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/integrity_filing_annex_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D2"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/med_gas_shutdown_notice_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D6"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/parking_variance_hearing_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D8"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
5 unmodified lines678991011125 unmodified linessource_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"source_case_id = "charts_inside_documents/pipeline_inspection_report_01"source_split = "charts_inside_documents"scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D2"]
123345FROM python:3.12-slim-bookwormRUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"WORKDIR /appCOPY . /tests/3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556185758596016 unmodified lines77787941428081828384858687888990914 unmodified lines96979899571001011021032 unmodified lines106107108661091101111121131141151161171181191201211223 unmodified lines
import argparseimport jsonfrom collections.abc import Mapping, Sequencefrom datetime import UTC, datetimefrom pathlib import Pathfrom typing import Any
from extract_bench.evaluation.evaluators.extract import ExtractEvaluatorfrom extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCellfrom extract_bench.evaluation.score_case import load_extract_test_casefrom extract_bench.schemas.extract_output import ExtractOutputfrom extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResultfrom extract_bench.schemas.product import ProductType
def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]: expected = sum(cell.gt_path is not None for cell in cells) predicted = sum(cell.pred_path is not None for cell in cells) matched = sum(cell.value_correct for cell in cells) if (expected, predicted, matched) != ( metadata["expected_cells"], metadata["predicted_cells"], metadata["v_correct"], ): raise ValueError("Value feedback does not account for the scorer's cell counts") denominator = expected + predicted entries = [] for cell in cells: if cell.gt_path is None: outcome = "prediction_only" elif cell.pred_path is None: outcome = "reference_only" else: outcome = "matched" if cell.value_correct else "value_differs" entries.append( { "reference_path": cell.gt_path, "output_path": cell.pred_path, "outcome": outcome, "f1_credit": 2.0 / denominator if cell.value_correct else 0.0, } ) return { "schema_version": 1, "status": "scored", "path_space": "normalized_scoring_inputs", "counts": {"expected": expected, "predicted": predicted, "matched": matched}, "value_incomplete": metadata["value_incomplete"], "cells": entries, }
def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]: """Use exactly the normal evaluator's normalization and metric selection.""" case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf")) now = datetime.now(UTC)16 unmodified lines completed_at=now, latency_in_ms=0, ) bundle = ExtractEvaluator().compute_metrics(result, case) return { cells: list[ValueCell] = [] bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells) metrics = { metric.metric_name: metric.value for metric in bundle.metrics if metric.metric_name.startswith("extract_unified_value_") } value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1") return metrics, _feedback(cells, value_f1.metadata)
def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:4 unmodified lines """ log_dir.mkdir(parents=True, exist_ok=True) reward_path = log_dir / "reward.txt" for name in ("reward.txt", "metrics.json", "feedback.json"): reward_path.unlink(missing_ok=True) (log_dir / name).unlink(missing_ok=True) try: prediction = json.loads(prediction_path.read_text(encoding="utf-8")) except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:2 unmodified lines if not isinstance(prediction, dict): report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0} else: metrics = score_prediction(test_json, prediction) metrics, feedback = score_prediction(test_json, prediction) report = { "status": "scored", "value_f1": metrics["extract_unified_value_f1"], "metrics": metrics, } if report["status"] == "invalid_submission": feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []} report["perfect"] = int(report["value_f1"] == 1.0) (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8") (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8") reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8") return report
README.md+5-1
harbor-manifest.json
tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/task.toml+1-1
tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/tests/Dockerfile+1-1
tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/tests/verifier.py+51-5
tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/task.toml+1-1
tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/tests/Dockerfile+1-1
tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/tests/verifier.py+51-5
tasks/charts-inside-documents--assessment-billing-run-01-a758923341/task.toml+1-1
tasks/charts-inside-documents--assessment-billing-run-01-a758923341/tests/Dockerfile+1-1
tasks/charts-inside-documents--assessment-billing-run-01-a758923341/tests/verifier.py+51-5
tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/task.toml+1-1
tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/tests/Dockerfile+1-1
tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/tests/verifier.py+51-5
tasks/charts-inside-documents--chemo-verification-01-755808e636/task.toml+1-1
tasks/charts-inside-documents--chemo-verification-01-755808e636/tests/Dockerfile+1-1
tasks/charts-inside-documents--chemo-verification-01-755808e636/tests/verifier.py+51-5
tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/task.toml+1-1
tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/tests/Dockerfile+1-1
tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/tests/verifier.py+51-5
tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/task.toml+1-1
tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/tests/Dockerfile+1-1
tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/tests/verifier.py+51-5
tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/task.toml+1-1
tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/tests/Dockerfile+1-1
tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/tests/verifier.py+51-5
tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/task.toml+1-1
tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/tests/Dockerfile+1-1
tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/tests/verifier.py+51-5
tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/task.toml+1-1
tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/tests/Dockerfile+1-1
tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/tests/verifier.py+51-5
tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/task.toml+1-1
tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/tests/Dockerfile+1-1
tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/tests/verifier.py+51-5
tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/task.toml+1-1
tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/tests/Dockerfile+1-1
tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/tests/verifier.py+51-5
tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/task.toml+1-1
tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/tests/Dockerfile+1-1
tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/tests/verifier.py+51-5
tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/task.toml+1-1
tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/tests/Dockerfile+1-1
tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/tests/verifier.py+51-5
tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/task.toml+1-1
tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/tests/Dockerfile+1-1
tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/tests/verifier.py+51-5
tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/task.toml+1-1
tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/tests/Dockerfile+1-1
tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/tests/verifier.py+51-5