| --- |
| language: |
| - zh |
| - en |
| license: cc-by-4.0 |
| size_categories: |
| - n<1K |
| task_categories: |
| - question-answering |
| - text-retrieval |
| pretty_name: SGR-Bench |
| tags: |
| - benchmark |
| - information-retrieval |
| - web-agents |
| - question-answering |
| - state-gated-retrieval |
| configs: |
| - config_name: default |
| data_files: |
| - split: goal |
| path: goal_hf.jsonl |
| - split: constraint |
| path: constraint_hf.jsonl |
| --- |
| |
| # SGR-Bench |
|
|
| This is the official dataset repository for the paper [SGR-Bench: Benchmarking Search Agents on State-Gated Retrieval](https://huggingface.co/papers/2605.22219). |
|
|
| SGR-Bench is a dataset for evaluating **State-Gated Retrieval**. In this setting, the answer-bearing evidence is not exposed in the default state of a website. It becomes available only after the user configures site-internal filters, views, hierarchies, scopes, time windows, or result pages. |
|
|
| This release contains **100 aligned task records** organized into two prompt formulations: |
|
|
| - `goal`: a goal-oriented version that states the target information need while leaving more of the retrieval process implicit. |
| - `constraint`: a constraint-guided version of the same retrieval task, with more of the retrieval logic made explicit. |
|
|
| Aligned `goal` and `constraint` records share the same source, reference answer, output schema, and rubric. |
|
|
| ## What This Dataset Tests |
|
|
| The dataset focuses on specialized, high-information-density public websites. In these tasks, finding a relevant website is usually not enough. A model often needs to: |
|
|
| - identify the relevant public data source; |
| - establish the correct retrieval state through filters, searches, views, tables, scopes, or historical windows; |
| - preserve data and control dependencies across retrieval steps; |
| - produce a structured answer under a fixed schema. |
|
|
| ## Files |
|
|
| The repository provides English loadable JSONL splits and per-task JSON files in English and Chinese. |
|
|
| | Path | Description | |
| | --- | --- | |
| | `goal.jsonl` | Goal-oriented English task records, one JSON object per line | |
| | `constraint.jsonl` | Constraint-guided English task records, one JSON object per line | |
| | `data_en/goal/*.json` | Per-task English JSON files corresponding to `goal.jsonl` | |
| | `data_en/constraint/*.json` | Per-task English JSON files corresponding to `constraint.jsonl` | |
| | `data_zh/goal/*.json` | Per-task Chinese JSON files aligned to the `goal` split | |
| | `data_zh/constraint/*.json` | Per-task Chinese JSON files aligned to the `constraint` split | |
|
|
| The two splits are aligned by `task_id`. For example, `data_en/goal/arxiv_001-g.json` corresponds to `data_en/constraint/arxiv_001.json`. |
|
|
| ## Dataset Statistics |
|
|
| | Statistic | Value | |
| | --- | ---: | |
| | Total aligned task records | 100 | |
| | Loadable splits | `goal`, `constraint` | |
| | Source families | 6 | |
| | Distinct websites | 14 | |
| | Output families | ordered-table style structured outputs | |
| | Dependency annotations | data dependency and optional control dependency | |
| | Expected output cardinality | 2 to 44 rows/records | |
| | Mean expected output cardinality | 6.42 | |
| | Median expected output cardinality | 4.0 | |
|
|
| Source-family distribution by aligned task record count, out of 100 total records: |
|
|
| | Source family | Task records | Share | |
| | --- | ---: | ---: | |
| | Scholarly archives | 18 | 18.0% | |
| | Official statistics | 12 | 12.0% | |
| | Environmental monitoring | 24 | 24.0% | |
| | Regulatory resources | 22 | 22.0% | |
| | Vulnerability records | 6 | 6.0% | |
| | Life-science resources | 18 | 18.0% | |
|
|
| ## Task Record Fields |
|
|
| Each line in `goal.jsonl` or `constraint.jsonl` is a complete English-language task record. The per-task JSON files under `data_en` contain the same records; `data_zh` provides Chinese-language counterparts with the same task structure. |
|
|
| | Field | Meaning | |
| | --- | --- | |
| | `task_id` | Unique task identifier. The `goal` version uses the `-g` suffix; the aligned `constraint` version removes that suffix. | |
| | `domain` | Source identifier, such as `ARXIV`, `EUROPEPMC_PMC`, `WATER_QUALITY_PORTAL`, or `CFPB_REPORTS`. | |
| | `autonomy_type` | Task or output type. Current value: `ordered table`. | |
| | `oracle_output_cardinality` | Expected number of rows or records in the reference answer. | |
| | `instruction` | Natural-language task prompt. In `goal.jsonl` and `constraint.jsonl`, this field is in English; Chinese counterparts are provided under `data_zh`. | |
| | `start_url` | Reference entry URL for the target source. This field supports dataset configuration and analysis; whether it is given to a model depends on the evaluation protocol. | |
| | `output_format` | Required answer format, including column order, separators, sorting rules, and fallback outputs such as `NONE`. | |
| | `oracle_answer` | Verified reference answer serialized in the required task format. | |
| | `metadata` | Structured annotation describing the retrieval-state logic and dependency structure of the task. | |
| | `rubric` | Scoring and normalization rules, including inclusion conditions, exclusion conditions, field schema, separators, ordering, deduplication, and acceptable field-level equivalences. | |
| | `all_involved_urls` | Optional field. Some tasks use a larger fixed URL set for validation. | |
|
|
| ## Metadata Fields |
|
|
| The `metadata` object explains why a task belongs to state-gated retrieval and which dependencies must be preserved. |
|
|
| | Metadata field | Meaning | |
| | --- | --- | |
| | `State-Gated Retrieval` | Short entries summarizing the target retrieval state: which source scope, filters, tables, views, or historical windows must be established before the answer is available. | |
| | `dependency_type` | Coarse dependency type. `Data + Control` means retrieved evidence both supplies answer content and affects later filtering or branching decisions; `Data` means the task is mainly evidence-dependent. | |
| | `intra_chain` | Boolean indicating whether the task contains dependencies within a single retrieval chain. | |
| | `inter_chain` | Boolean indicating whether the task requires merging or comparing multiple retrieval branches, tables, pages, or source states. | |
| | `data_dependency` | Describes how earlier retrieved data supplies candidate sets, fields, joins, or final answer rows. | |
| | `control_dependency` | Describes which conditions determine later search, filtering, validation, or ranking steps. The single data-only task does not include this field. | |
| | `freeze` | Fact-stability note. It records the historical window, versioned source, or relatively stable public reference basis used to keep the answer reproducible. | |
| | `answer_type` | Structured answer type, such as `multi-row ordered table` or `mixed multi-line output`. | |
|
|
| ## Rubric Fields |
|
|
| The `rubric` field makes evaluation more reproducible and less dependent on subjective judgment. |
|
|
| | Rubric field | Meaning | |
| | --- | --- | |
| | `inclusion_conditions` | Conditions a candidate row or record must satisfy to be included in the answer. | |
| | `exclusion_conditions` | Common false positives or incorrect matches that should be excluded. | |
| | `normalization` | Task-level normalization rules, usually covering separators, schema, date formats, row keys, ordering, deduplication keys, and field-level equivalence rules. | |
|
|
| ## Loading |
|
|
| In the current release, the supported loading paths are straightforward: |
|
|
| - load the English benchmark splits from `goal.jsonl` and `constraint.jsonl`; |
| - read aligned per-task English files from `data_en`; |
| - read aligned Chinese counterparts from `data_zh` when bilingual inspection is needed. |
|
|
| For local use, each JSON line in `goal.jsonl` or `constraint.jsonl` is already a complete task record. The corresponding per-task files in `data_en` contain the same English records with one file per task. |
|
|
| ```python |
| from datasets import load_dataset |
| |
| goal = load_dataset( |
| "Ninggggy/SGR-BENCH", |
| split="goal", |
| ) |
| |
| constraint = load_dataset( |
| "Ninggggy/SGR-BENCH", |
| split="constraint", |
| ) |
| ``` |
|
|
| The per-task JSON files can also be read directly: |
|
|
| ```python |
| import json |
| from pathlib import Path |
| |
| task = json.loads(Path("data_en/goal/arxiv_001-g.json").read_text()) |
| print(task["task_id"]) |
| print(task["instruction"]) |
| print(task["rubric"]["normalization"]["schema"]) |
| ``` |
|
|
| ## Evaluation Notes |
|
|
| This dataset can be used to evaluate search agents, retrieval-augmented language models, and web-browsing agents. Model outputs should be parsed according to each task's `output_format` and normalized with the corresponding `rubric`. |
|
|
| For ordered-table tasks, evaluation can separately check: |
|
|
| - field-level correctness after row alignment; |
| - complete-row correctness, where all fields in a row must match the reference; |
| - order correctness when the task specifies a required row ordering. |
|
|
| The files include `oracle_answer`; use them as evaluation instances with visible references rather than as hidden test submissions. |
|
|
| ## Open-Source Evaluation Use |
|
|
| ### MCP setup |
|
|
| SGR-Bench can be run with three external retrieval tools: |
|
|
| - Serper search; |
| - Fetch webpage reading; |
| - Sylphx/PDF reading. |
|
|
| Together, these three tools cover the main retrieval actions used in the benchmark: finding official entry points, reading webpage content, and extracting evidence from official PDF documents. |
|
|
| ### Keys and credentials |
|
|
| No key is required to inspect the dataset files themselves, load the JSONL splits, or score saved predictions offline. Keys are only needed when the evaluation stack depends on external MCP servers or hosted model providers. |
|
|
| A typical hosted setup uses: |
|
|
| - `SERPER_API_KEY` for the Serper search MCP server; |
| - `OPENROUTER_API_KEY` for OpenRouter-backed model access; |
| - `OPENAI_API_KEY` for OpenAI-backed Codex runs. |
|
|
| On the MCP side, two dependencies matter in practice: |
|
|
| - the fetch server typically depends on the Python module `mcp_server_fetch`, and, when a SOCKS proxy is used, also on `socksio`; |
| - PDF reading can be provided through a Sylphx/PDF backend such as `@sylphx/pdf-reader-mcp@2.0.8`. |
|
|
| For the search MCP specifically, the naming is fixed rather than ad hoc: both the launcher and the server implementation read `SERPER_API_KEY`. |
|
|
| ### Minimal testing procedure |
|
|
| A minimal evaluation pass is best organized task by task, with separate attention to final-answer scoring and trace-level error review: |
|
|
| 1. Select one task record from `goal` or `constraint`, and first read the task prompt, `output_format`, `oracle_answer`, and `rubric` together so that the target object set, constraints, schema, and ordering requirements are all explicit before testing. |
| 2. Run the model on the task `instruction`. Include `start_url` only if that is part of the chosen protocol, and require the model to produce a final answer in the prescribed output format. |
| 3. Save both the final answer and the intermediate trace when available. For case-level diagnosis, the trace is not optional in practice, because the benchmark's main failure taxonomy is defined over where the solution path first goes wrong. |
| 4. Canonicalize and score the final answer against `oracle_answer` under the task-specific normalization rules. |
| 5. If the answer is not fully correct, treat the final mismatch only as the surface symptom. Then trace backward and identify the earliest decisive error that explains the downstream failure. |
| 6. Assign one primary failure class to the case. The repository's current review standard uses six mutually exclusive top-level classes: `self-rewriting`, `drift`, `criterion mismatch`, `in-page misreading`, `retrieval dependency not closed`, and `final answer composition error`. |
| 7. Record a short justification for the case review. At minimum, the note should state the primary class, the first real root cause, the key evidence in the trace, and why the case does not belong to the nearest competing class. |
|
|
| For a smoke test, it is usually best to start from one low-cardinality task and verify schema compliance, field formatting, row ordering, evidence traceability, and whether the trace is rich enough to support root-cause attribution if the answer is wrong. |
|
|
| ### Scoring a single task case |
|
|
| Single-case scoring should follow reviewer-defined answer canonicalization, deterministic metric computation, and a separate root-cause review when the answer is not fully correct. |
|
|
| 1. Canonicalize both the prediction and the reference answer using the task-specific normalization rules in `rubric`. |
| 2. Parse the canonicalized prediction and reference into rows and fields under the prescribed schema. |
| 3. Align rows using the task-specific row keys defined by the benchmark. |
| 4. Compute exact match, item-level F1, row-level F1, and pairwise order accuracy. |
| 5. If the case is incorrect, do not stop at the score. Use the trace to identify the first real root cause rather than labeling the case only by the final surface defect. |
|
|
| In this scoring scheme: |
|
|
| - exact match requires the full serialized answer to match after allowed normalization, including the required row content and required row order; |
| - item-level F1 gives credit at the field or cell level after row alignment; |
| - row-level F1 gives credit only when all fields in an aligned row are correct; |
| - pairwise order accuracy checks whether the relative order among shared rows is preserved. |
|
|
| For ordered-table tasks, the scoring logic should distinguish clearly between local correctness and structural correctness. A case may preserve many locally correct fields while still failing at the row level or full-answer level. |
|
|
| This distinction matters for diagnosis: |
|
|
| - high `item_f1` with low `row_f1` or low `em` should not be treated as automatic evidence of final formatting failure; |
| - such these cases should first be checked for `criterion mismatch`, `retrieval dependency not closed`, or upstream `drift`; |
| - `final answer composition error` should be used only when the upstream reasoning chain is already basically correct and the answer is corrupted mainly at the final write-out stage. |
|
|
| The canonicalization step is intentionally narrow. It may normalize whitespace, punctuation, capitalization, date formatting, unit formatting, abbreviations, and a small set of task-specific aliases, but it should not fill missing fields, repair factual errors, or merge source-distinct entities. |
|
|
| For case review, the current repository-standard decision rule is: classify the case by the earliest decisive error, not by where the final answer looks wrong. A concise case note should therefore include four items: |
|
|
| - the primary failure class; |
| - the first real root cause; |
| - the key trace evidence; |
| - why the case does not belong to the nearest adjacent class. |
|
|
| ## Language and Sources |
|
|
| The loadable JSONL splits use English task prompts. Chinese counterparts for the per-task JSON files are provided under `data_zh`. Source terminology, identifiers, URLs, and many field values are preserved in the form used by the public source. All tasks are based on publicly accessible websites. This release does not contain private identifying information, personal sensitive information, or proprietary data. |
|
|
| ## Limitations |
|
|
| This is a compact diagnostic evaluation set. It prioritizes relatively stable public sources and structured answers, so it covers less rapidly changing content such as breaking news, live dashboards, or frequently updated public records. This release evaluates final structured outputs and provides retrieval-state annotations, but it does not provide a unified trajectory-level annotation for every intermediate model action. |