xujustinj commited on
Commit
f32fd1d
·
verified ·
1 Parent(s): 092b835

Add aligned cell feedback for the existing Value F1 reward

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. README.md +5 -1
  2. harbor-manifest.json +0 -0
  3. tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/task.toml +1 -1
  4. tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/tests/Dockerfile +1 -1
  5. tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/tests/verifier.py +51 -5
  6. tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/task.toml +1 -1
  7. tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/tests/Dockerfile +1 -1
  8. tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/tests/verifier.py +51 -5
  9. tasks/charts-inside-documents--assessment-billing-run-01-a758923341/task.toml +1 -1
  10. tasks/charts-inside-documents--assessment-billing-run-01-a758923341/tests/Dockerfile +1 -1
  11. tasks/charts-inside-documents--assessment-billing-run-01-a758923341/tests/verifier.py +51 -5
  12. tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/task.toml +1 -1
  13. tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/tests/Dockerfile +1 -1
  14. tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/tests/verifier.py +51 -5
  15. tasks/charts-inside-documents--chemo-verification-01-755808e636/task.toml +1 -1
  16. tasks/charts-inside-documents--chemo-verification-01-755808e636/tests/Dockerfile +1 -1
  17. tasks/charts-inside-documents--chemo-verification-01-755808e636/tests/verifier.py +51 -5
  18. tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/task.toml +1 -1
  19. tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/tests/Dockerfile +1 -1
  20. tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/tests/verifier.py +51 -5
  21. tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/task.toml +1 -1
  22. tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/tests/Dockerfile +1 -1
  23. tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/tests/verifier.py +51 -5
  24. tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/task.toml +1 -1
  25. tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/tests/Dockerfile +1 -1
  26. tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/tests/verifier.py +51 -5
  27. tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/task.toml +1 -1
  28. tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/tests/Dockerfile +1 -1
  29. tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/tests/verifier.py +51 -5
  30. tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/task.toml +1 -1
  31. tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/tests/Dockerfile +1 -1
  32. tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/tests/verifier.py +51 -5
  33. tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/task.toml +1 -1
  34. tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/tests/Dockerfile +1 -1
  35. tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/tests/verifier.py +51 -5
  36. tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/task.toml +1 -1
  37. tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/tests/Dockerfile +1 -1
  38. tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/tests/verifier.py +51 -5
  39. tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/task.toml +1 -1
  40. tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/tests/Dockerfile +1 -1
  41. tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/tests/verifier.py +51 -5
  42. tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/task.toml +1 -1
  43. tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/tests/Dockerfile +1 -1
  44. tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/tests/verifier.py +51 -5
  45. tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/task.toml +1 -1
  46. tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/tests/Dockerfile +1 -1
  47. tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/tests/verifier.py +51 -5
  48. tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/task.toml +1 -1
  49. tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/tests/Dockerfile +1 -1
  50. tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/tests/verifier.py +51 -5
README.md CHANGED
@@ -228,8 +228,12 @@ harbor run --repo https://huggingface.co/datasets/llamaindex/ExtractBenchPro -p
228
 
229
  Instructions reproduce the [published coding-agent prompt](https://arxiv.org/html/2607.29677v1#A3.SS1), with a standardized document filename.
230
  Agents receive only `document.pdf` and `schema.json` and write `output.json`.
231
- The separate verifier uses the existing ExtractBench evaluator at commit `741c1b651e8851c1bd3424ac4d41b643b9e41761`.
232
  The reward is Value F1 in [0, 1]; `metrics.json` also records perfect-document status.
 
 
 
 
233
  This prompt does not request citations, so this lane does not measure grounding.
234
  The agent timeout is 1800 seconds per document.
235
 
 
228
 
229
  Instructions reproduce the [published coding-agent prompt](https://arxiv.org/html/2607.29677v1#A3.SS1), with a standardized document filename.
230
  Agents receive only `document.pdf` and `schema.json` and write `output.json`.
231
+ The separate verifier uses the existing ExtractBench evaluator at commit `2f27f100730afc7c395602e26a2a87e07ea66b31`.
232
  The reward is Value F1 in [0, 1]; `metrics.json` also records perfect-document status.
233
+ `feedback.json` records aligned output/reference cell paths, value outcomes, and
234
+ each matched cell's contribution to the same F1 reward. Paths refer to normalized
235
+ scoring inputs; one-sided cells contribute to the denominator. This feedback does
236
+ not change the reward or assign credit to reasoning steps.
237
  This prompt does not request citations, so this lane does not measure grounding.
238
  The agent timeout is 1800 seconds per document.
239
 
harbor-manifest.json CHANGED
The diff for this file is too large to render. See raw diff
 
tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/agency_staffing_invoice_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:handwritten", "length:medium", "domain:D6"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/agency_staffing_invoice_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:handwritten", "length:medium", "domain:D6"]
12
 
tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--agency-staffing-invoice-01-9aebdbb0d3/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/aggregate_qc_report_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D3"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/aggregate_qc_report_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D3"]
12
 
tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--aggregate-qc-report-01-3bcd23f4aa/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--assessment-billing-run-01-a758923341/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/assessment_billing_run_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D8"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/assessment_billing_run_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D8"]
12
 
tasks/charts-inside-documents--assessment-billing-run-01-a758923341/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--assessment-billing-run-01-a758923341/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/capacity_change_pack_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D2"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/capacity_change_pack_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D2"]
12
 
tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--capacity-change-pack-01-426d0e3de2/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--chemo-verification-01-755808e636/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/chemo_verification_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D6"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/chemo_verification_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D6"]
12
 
tasks/charts-inside-documents--chemo-verification-01-755808e636/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--chemo-verification-01-755808e636/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/claims_triage_bundle_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D1"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/claims_triage_bundle_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D1"]
12
 
tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--claims-triage-bundle-01-6e0e405433/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/contractor_dispute_binder_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D3"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/contractor_dispute_binder_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D3"]
12
 
tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--contractor-dispute-binder-01-62110b282f/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/dam_operations_report_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D2"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/dam_operations_report_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D2"]
12
 
tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--dam-operations-report-01-dec2676e78/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/drilling_report_bundle_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D2"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/drilling_report_bundle_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D2"]
12
 
tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--drilling-report-bundle-01-9ba0552503/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/earthwork_quantity_packet_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D3"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/earthwork_quantity_packet_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D3"]
12
 
tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--earthwork-quantity-packet-01-c12c7681e1/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/eligibility_appeals_file_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D6"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/eligibility_appeals_file_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:medium", "domain:D6"]
12
 
tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--eligibility-appeals-file-01-220e0e6b43/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/gantt_schedule_board_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:short", "domain:D5"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/gantt_schedule_board_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:digital", "length:short", "domain:D5"]
12
 
tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--gantt-schedule-board-01-824296e2a8/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/integrity_filing_annex_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D2"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/integrity_filing_annex_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D2"]
12
 
tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--integrity-filing-annex-01-5eab6bac71/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/med_gas_shutdown_notice_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D6"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/med_gas_shutdown_notice_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D6"]
12
 
tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--med-gas-shutdown-notice-01-a3c934ad1a/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/parking_variance_hearing_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D8"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/parking_variance_hearing_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:scan", "length:medium", "domain:D8"]
12
 
tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--parking-variance-hearing-01-57fcc48058/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122
 
tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/task.toml CHANGED
@@ -6,7 +6,7 @@ source_repo = "llamaindex/ExtractBenchPro"
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/pipeline_inspection_report_01"
8
  source_split = "charts_inside_documents"
9
- scorer_revision = "741c1b651e8851c1bd3424ac4d41b643b9e41761"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D2"]
12
 
 
6
  source_revision = "16f6672e06cf77491ec6d18c817d67864b90d845"
7
  source_case_id = "charts_inside_documents/pipeline_inspection_report_01"
8
  source_split = "charts_inside_documents"
9
+ scorer_revision = "2f27f100730afc7c395602e26a2a87e07ea66b31"
10
  prompt_source = "https://arxiv.org/html/2607.29677v1#A3.SS1"
11
  tags = ["source:synthetic", "challenge:charts_inside_documents", "perception:image", "length:medium", "domain:D2"]
12
 
tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/tests/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
- RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@741c1b651e8851c1bd3424ac4d41b643b9e41761" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
 
1
  FROM python:3.12-slim-bookworm
2
  RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
3
+ RUN pip install --no-cache-dir "llama-extract-bench @ git+https://github.com/run-llama/ExtractBench.git@2f27f100730afc7c395602e26a2a87e07ea66b31" "parse-bench==1.0.4"
4
  WORKDIR /app
5
  COPY . /tests/
tasks/charts-inside-documents--pipeline-inspection-report-01-78ea67a3bf/tests/verifier.py CHANGED
@@ -4,18 +4,57 @@ from __future__ import annotations
4
 
5
  import argparse
6
  import json
 
7
  from datetime import UTC, datetime
8
  from pathlib import Path
9
  from typing import Any
10
 
11
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
 
12
  from extract_bench.evaluation.score_case import load_extract_test_case
13
  from extract_bench.schemas.extract_output import ExtractOutput
14
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
15
  from extract_bench.schemas.product import ProductType
16
 
17
 
18
- def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  """Use exactly the normal evaluator's normalization and metric selection."""
20
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
21
  now = datetime.now(UTC)
@@ -38,12 +77,15 @@ def score_prediction(test_json: Path, prediction: Any) -> dict[str, float]:
38
  completed_at=now,
39
  latency_in_ms=0,
40
  )
41
- bundle = ExtractEvaluator().compute_metrics(result, case)
42
- return {
 
43
  metric.metric_name: metric.value
44
  for metric in bundle.metrics
45
  if metric.metric_name.startswith("extract_unified_value_")
46
  }
 
 
47
 
48
 
49
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
@@ -54,7 +96,8 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
54
  """
55
  log_dir.mkdir(parents=True, exist_ok=True)
56
  reward_path = log_dir / "reward.txt"
57
- reward_path.unlink(missing_ok=True)
 
58
  try:
59
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
60
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
@@ -63,14 +106,17 @@ def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, A
63
  if not isinstance(prediction, dict):
64
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
65
  else:
66
- metrics = score_prediction(test_json, prediction)
67
  report = {
68
  "status": "scored",
69
  "value_f1": metrics["extract_unified_value_f1"],
70
  "metrics": metrics,
71
  }
 
 
72
  report["perfect"] = int(report["value_f1"] == 1.0)
73
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
 
74
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
75
  return report
76
 
 
4
 
5
  import argparse
6
  import json
7
+ from collections.abc import Mapping, Sequence
8
  from datetime import UTC, datetime
9
  from pathlib import Path
10
  from typing import Any
11
 
12
  from extract_bench.evaluation.evaluators.extract import ExtractEvaluator
13
+ from extract_bench.evaluation.metrics.extract.unified_evidence_metric import ValueCell
14
  from extract_bench.evaluation.score_case import load_extract_test_case
15
  from extract_bench.schemas.extract_output import ExtractOutput
16
  from extract_bench.schemas.pipeline_io import InferenceRequest, InferenceResult
17
  from extract_bench.schemas.product import ProductType
18
 
19
 
20
+ def _feedback(cells: Sequence[ValueCell], metadata: Mapping[str, Any]) -> dict[str, Any]:
21
+ expected = sum(cell.gt_path is not None for cell in cells)
22
+ predicted = sum(cell.pred_path is not None for cell in cells)
23
+ matched = sum(cell.value_correct for cell in cells)
24
+ if (expected, predicted, matched) != (
25
+ metadata["expected_cells"],
26
+ metadata["predicted_cells"],
27
+ metadata["v_correct"],
28
+ ):
29
+ raise ValueError("Value feedback does not account for the scorer's cell counts")
30
+ denominator = expected + predicted
31
+ entries = []
32
+ for cell in cells:
33
+ if cell.gt_path is None:
34
+ outcome = "prediction_only"
35
+ elif cell.pred_path is None:
36
+ outcome = "reference_only"
37
+ else:
38
+ outcome = "matched" if cell.value_correct else "value_differs"
39
+ entries.append(
40
+ {
41
+ "reference_path": cell.gt_path,
42
+ "output_path": cell.pred_path,
43
+ "outcome": outcome,
44
+ "f1_credit": 2.0 / denominator if cell.value_correct else 0.0,
45
+ }
46
+ )
47
+ return {
48
+ "schema_version": 1,
49
+ "status": "scored",
50
+ "path_space": "normalized_scoring_inputs",
51
+ "counts": {"expected": expected, "predicted": predicted, "matched": matched},
52
+ "value_incomplete": metadata["value_incomplete"],
53
+ "cells": entries,
54
+ }
55
+
56
+
57
+ def score_prediction(test_json: Path, prediction: Any) -> tuple[dict[str, float], dict[str, Any]]:
58
  """Use exactly the normal evaluator's normalization and metric selection."""
59
  case = load_extract_test_case(test_json, source_file=Path("/app/document.pdf"))
60
  now = datetime.now(UTC)
 
77
  completed_at=now,
78
  latency_in_ms=0,
79
  )
80
+ cells: list[ValueCell] = []
81
+ bundle = ExtractEvaluator().compute_metrics(result, case, value_cells=cells)
82
+ metrics = {
83
  metric.metric_name: metric.value
84
  for metric in bundle.metrics
85
  if metric.metric_name.startswith("extract_unified_value_")
86
  }
87
+ value_f1 = next(metric for metric in bundle.metrics if metric.metric_name == "extract_unified_value_f1")
88
+ return metrics, _feedback(cells, value_f1.metadata)
89
 
90
 
91
  def verify(test_json: Path, prediction_path: Path, log_dir: Path) -> dict[str, Any]:
 
96
  """
97
  log_dir.mkdir(parents=True, exist_ok=True)
98
  reward_path = log_dir / "reward.txt"
99
+ for name in ("reward.txt", "metrics.json", "feedback.json"):
100
+ (log_dir / name).unlink(missing_ok=True)
101
  try:
102
  prediction = json.loads(prediction_path.read_text(encoding="utf-8"))
103
  except (FileNotFoundError, UnicodeDecodeError, json.JSONDecodeError) as error:
 
106
  if not isinstance(prediction, dict):
107
  report = {"status": "invalid_submission", "error": "Expected one JSON object", "value_f1": 0.0}
108
  else:
109
+ metrics, feedback = score_prediction(test_json, prediction)
110
  report = {
111
  "status": "scored",
112
  "value_f1": metrics["extract_unified_value_f1"],
113
  "metrics": metrics,
114
  }
115
+ if report["status"] == "invalid_submission":
116
+ feedback = {"schema_version": 1, "status": "invalid_submission", "error": report["error"], "cells": []}
117
  report["perfect"] = int(report["value_f1"] == 1.0)
118
  (log_dir / "metrics.json").write_text(json.dumps(report, indent=2, allow_nan=False) + "\n", encoding="utf-8")
119
+ (log_dir / "feedback.json").write_text(json.dumps(feedback, indent=2, allow_nan=False) + "\n", encoding="utf-8")
120
  reward_path.write_text(f"{report['value_f1']}\n", encoding="utf-8")
121
  return report
122