Dataset Viewer
Auto-converted to Parquet Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    CastError
Message:      Couldn't cast
record_id: string
context: string
question: string
json_schema: string
validated_output: string
source_split: string
source_dataset: string
question_type: string
schema_complexity: string
source_id: string
errored_json: string
error_count: int64
error_difficulty: string
error_type: string
error_types: string
error_location: string
error_locations: string
error_description: string
error_descriptions: string
error_difficulties: string
error_source: string
errors_json: string
finetuning_task: string
finetuning_question: string
finetuning_input: string
finetuning_target: string
finetuning_messages: string
repair_candidate: string
true_has_error: bool
-- schema metadata --
pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 3761
to
{'record_id': Value('string'), 'source_dataset': Value('string'), 'context': Value('string'), 'question': Value('string'), 'json_schema': Value('string'), 'validated_output': Value('string'), 'errored_json': Value('string'), 'error_count': Value('int64'), 'error_source': Value('string'), 'finetuning_task': Value('string'), 'finetuning_question': Value('string'), 'finetuning_input': Value('string'), 'finetuning_target': Value('string'), 'repair_candidate': Value('string'), 'true_has_error': Value('bool')}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 149, in get_rows_or_raise
                  return get_rows(
                      dataset=dataset,
                  ...<4 lines>...
                      column_names=column_names,
                  )
                File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/utils.py", line 129, in get_rows
                  rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
                File "/src/services/worker/src/worker/utils.py", line 489, in safe_iter
                  yield from ds.decode(False) if ds.features else ds
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2818, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2355, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2380, in _iter_arrow
                  for key, pa_table in self.ex_iterable._iter_arrow():
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 536, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 419, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/parquet/parquet.py", line 220, in _generate_tables
                  yield Key(file_idx, batch_idx), self._cast_table(pa_table)
                                                  ~~~~~~~~~~~~~~~~^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/parquet/parquet.py", line 156, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2369, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2297, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              record_id: string
              context: string
              question: string
              json_schema: string
              validated_output: string
              source_split: string
              source_dataset: string
              question_type: string
              schema_complexity: string
              source_id: string
              errored_json: string
              error_count: int64
              error_difficulty: string
              error_type: string
              error_types: string
              error_location: string
              error_locations: string
              error_description: string
              error_descriptions: string
              error_difficulties: string
              error_source: string
              errors_json: string
              finetuning_task: string
              finetuning_question: string
              finetuning_input: string
              finetuning_target: string
              finetuning_messages: string
              repair_candidate: string
              true_has_error: bool
              -- schema metadata --
              pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 3761
              to
              {'record_id': Value('string'), 'source_dataset': Value('string'), 'context': Value('string'), 'question': Value('string'), 'json_schema': Value('string'), 'validated_output': Value('string'), 'errored_json': Value('string'), 'error_count': Value('int64'), 'error_source': Value('string'), 'finetuning_task': Value('string'), 'finetuning_question': Value('string'), 'finetuning_input': Value('string'), 'finetuning_target': Value('string'), 'repair_candidate': Value('string'), 'true_has_error': Value('bool')}
              because column names don't match

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

SOB-FT Finetune Ready

~100k source rows → ~152k chat SFT examples for fine-tuning a small language model on JSON extraction (generation) and JSON error detection / repair (correction), with prompts aligned to our SOB extraction and zero-shot repair benchmarks.

Derived from mariem123kfg/sob-ft-extract (multi-source structured extraction corpus, excluding original SOB benchmark rows). Errors were injected in-house, then rows were materialized into ready-to-train prompt/target pairs.


What is in this repo

File Size (approx.) Description
sob_ft_finetune_ready_sft.jsonl 5.3 GB Primary training file — one JSON object per line, chat format
sob_ft_finetune_ready.parquet 2.0 GB Same 100,405 source rows with full columns + pre-built finetuning_* fields
sob_ft_finetune_ready_manifest.json 2 KB Counts, task mix, error-source breakdown, pipeline notes

The SFT file is the main artifact for TRL / Axolotl / HF SFT trainers. The parquet is better for filtering, analysis, and custom prompt assembly.


Numbers at a glance

Count
Source rows 100,405
Clean rows (error_count = 0) 52,110
Errored rows (error_count > 0) 48,295
SFT lines total 152,515
→ repair examples (every row) 100,405
→ extract examples (clean rows only) 52,110

Error injection mix (errored rows)

error_source Rows
algorithmic 43,582
mixed (algo + LLM) 3,375
llm (semantic only) 1,338
clean (converted pending LLM rows)
Total clean in corpus 52,106

Error difficulty (errored rows)

error_difficulty Rows
medium 22,326
hard 18,681
easy 7,288

~20% of errored rows were candidates for an Ollama semantic pass (granite4.1:8b); subset partially completed before finalize (see Pipeline below).


Two tasks, one model

We train one checkpoint on a shuffled mixture of two instruction formats. The prompt template tells the model which behavior to run at inference time.

1. Extract (generation)

When: clean rows (error_count = 0) in the primary parquet view; also emitted as separate SFT lines for all 52,110 clean rows.

System:

You extract structured JSON from text. Given a SCHEMA, CONTEXT, and QUESTION, return a single valid JSON object that matches the schema and is grounded in the context. No markdown, no code fences.

User (shape matches run_sob_extract_benchmark.py prompt_only):

Schema:
{json_schema}

Context:
{context}

Question: {question}

<think>
</think>
Return ONLY valid JSON that matches the schema, using information from the context. No explanation.

Target: validated_output (gold JSON string).

2. Repair (correction)

When: every row in SFT; primary parquet task for errored rows.

System:

You verify and repair JSON answers. Given a CONTEXT, QUESTION, JSON SCHEMA, and a candidate JSON, decide whether the candidate JSON is fully correct and grounded in the context. If it is wrong, return the corrected JSON. If it is already correct, return it unchanged and report no error. Respond with ONLY a single JSON object of the form: {"has_error": <bool>, "location": <string or null>, "corrected_json": <object>}. No prose, no markdown, no code fences.

User (shape matches run_medschema_benchmark.py / benchmark-2.ipynb zero_shot):

CONTEXT:
{context}

QUESTION:
{question}

JSON SCHEMA:
{json_schema}

CANDIDATE JSON:
{candidate}

Where candidate = validated_output on clean rows and candidate = errored_json on errored rows (same rule as our repair benchmark eval set).

Target (structured):

{
  "has_error": true,
  "location": ["field_path"],
  "corrected_json": { ... gold ... }
}

On clean repair SFT rows: "has_error": false, "location": null, "corrected_json" equals gold.


SFT JSONL format

Each line is one training example:

{
  "record_id": "ft_extract_00060136",
  "source_dataset": "scrapegraphai_finetuning_subset",
  "error_count": 2,
  "error_source": "algorithmic",
  "error_difficulty": "medium",
  "error_type": "sibling_value_swap",
  "true_has_error": true,
  "repair_candidate": "{...}",
  "finetuning_question": "Extract structured data for ProductDetailPage from the context.",
  "task": "repair",
  "finetuning_input": "CONTEXT:\n...\n\nQUESTION:\n...\n\nJSON SCHEMA:\n...\n\nCANDIDATE JSON:\n...",
  "finetuning_target": "{\"has_error\": true, \"location\": [...], \"corrected_json\": {...}}",
  "messages": [
    {"role": "system", "content": "..."},
    {"role": "user", "content": "..."},
    {"role": "assistant", "content": "..."}
  ]
}
  • task: "extract" or "repair"
  • messages: ready for Hugging Face apply_chat_template / TRL SFT — train on assistant tokens only
  • finetuning_input / finetuning_target: duplicate of user/assistant content for trainers that prefer flat fields

SFT line policy

Row type SFT lines emitted
Clean (error_count = 0) extract + 1× repair (candidate = gold, has_error: false)
Errored (error_count > 0) repair only

Shuffle before training. A common mix is to use all 152,515 lines or to filter task == "repair" for repair-only ablations.


Parquet columns (100,405 rows)

Core source fields (from sob-ft-extract + error injection):

  • record_id, source_dataset, context, question, json_schema
  • validated_output — schema-valid gold JSON
  • errored_json — corrupted candidate JSON (equals gold on clean rows)
  • error_count, error_difficulty, error_type, error_location, error_description, error_source, errors_json, …

Pre-built finetuning fields (from finalize_ft_extract_for_finetune.py):

  • finetuning_task — primary task: extract (clean) or repair (errored)
  • finetuning_question — resolved question (see fallbacks below)
  • finetuning_input, finetuning_target, finetuning_messages
  • repair_candidate — JSON string passed as CANDIDATE in repair prompts
  • true_has_error — bool label for repair eval

How this dataset was built

Step 1 — Download & filter source

  • Source: mariem123kfg/sob-ft-extract
  • Excluded rows whose source_dataset matches original SOB (interfaze-ai/sob) — those use a separate error pipeline
  • 100,405 rows retained

Top source_dataset groups:

Source Rows
scrapegraphai_full 35,025
boradorish/STAGE-eval 19,257
hotpotqa 16,597
ChristianAzinn/json-training 13,303
scrapegraphai_finetuning_subset 10,630
others 5,593

Step 2 — Error injection (generate_ft_extract_multi_errors.py)

  • 50/50 split per source_dataset group: half of each group gets 1–3 injected errors; half stays clean in place (no duplicate __clean rows)
  • Algorithmic errors: schema-aware corruptions (typos, enum swaps, sibling swaps, off-by-one, pool substitutions, …) with difficulty tags easy / medium / hard
  • LLM semantic pass: 20% of errored rows targeted for Ollama granite4.1:8b; run was partially completed (6.2k / 10k subset done) before finalize

Step 3 — Finalize for finetune (finalize_ft_extract_for_finetune.py)

  • Pending unfinished LLM-subset rows: 50% converted to clean, 50% kept algorithmic
  • Built extract + repair prompts (full context, no benchmark eval trim)
  • Wrote parquet + 152,515-line SFT JSONL
  • Seed 42 shuffle on write

Reproduce locally:

python generate_ft_extract_multi_errors.py   # if rebuilding from scratch
python finalize_ft_extract_for_finetune.py --data-dir ./sob_ft_extract_with_errors

Question & context fallbacks

Missing questions (~10,630 rows): mostly scrapegraphai_finetuning_subset where question is null in source. We set:

  • Extract structured data for {schema.title} from the context. when the schema title is informative
  • otherwise: Extract structured JSON from the context that matches the JSON schema.

Stored in finetuning_question and inserted under QUESTION: in repair prompts / Question: in extract prompts.

Empty context (~16,046 rows): mostly ChristianAzinn/json-training and Hermes JSON-mode sources — schema+JSON examples without a document passage. Repair prompts still include an empty CONTEXT: block. For repair training aligned with grounded SOB benchmark eval, consider filtering these out (context.strip() non-empty).


Evaluation alignment

Task Benchmark script Mode
Extract run_sob_extract_benchmark.py prompt_only
Repair run_medschema_benchmark.py, combined_benchmark_dgx.py zero_shot

Fine-tuning prompts were built to match these eval templates so benchmark gains translate to the fine-tuned checkpoint.

Recommended eval metrics for repair: JSON validity, schema conformance, repair exact match, detection accuracy, localization accuracy, over-correction rate on clean candidates (stratified by error_difficulty and error_source).


Loading the data

SFT JSONL (recommended for training)

import json

rows = []
with open("sob_ft_finetune_ready_sft.jsonl") as f:
    for line in f:
        rows.append(json.loads(line))

# or stream with datasets
from datasets import load_dataset
ds = load_dataset("json", data_files="sob_ft_finetune_ready_sft.jsonl", split="train")

Parquet (recommended for analysis / filtering)

import pandas as pd

df = pd.read_parquet("sob_ft_finetune_ready.parquet")
repair = df[df["finetuning_task"] == "repair"]
grounded = df[df["context"].str.strip().astype(bool)]  # drop empty-context rows

Hugging Face Hub

from huggingface_hub import hf_hub_download

sft = hf_hub_download(
    repo_id="seneca-center/sob-ft-finetune-ready",
    filename="sob_ft_finetune_ready_sft.jsonl",
    repo_type="dataset",
)

Training tips

  1. Mix extract + repair in one run (shuffle the 152k SFT lines) unless ablating a single task.
  2. Mask loss on user/system tokens — only train assistant completions.
  3. Split by record_id for train/val/test, not by individual SFT lines, to avoid leakage between extract and repair views of the same row.
  4. Filter empty-context rows for repair if you care about context-grounded correction.
  5. Watch over-correction on clean repair examples (has_error: false targets).

Limitations

  • Error injection partially LLM-complete; some rows never received semantic pass
  • ~16% of rows lack usable context text
  • Source corpora are heterogeneous (web scrape, HotpotQA, JSON-mode synthetic, etc.) — not i.i.d. with SOB test split
  • Original SOB (interfaze-ai/sob) rows are not included

License

MIT — consistent with downstream use for research and fine-tuning. Verify licenses of upstream sources in mariem123kfg/sob-ft-extract for commercial use.


Citation

If you use this dataset, please cite the upstream SOB / structured-output benchmark work and reference this repo:

@misc{seneca-sob-ft-finetune-ready,
  title  = {SOB-FT Finetune Ready: Extract + Repair SFT Corpus},
  author = {Seneca Center},
  year   = {2026},
  url    = {https://huggingface.co/datasets/seneca-center/sob-ft-finetune-ready}
}

Changelog

  • 2026-08 — Initial release: 100,405 rows, 152,515 SFT examples, benchmark-aligned extract/repair prompts, manifest v1.
Downloads last month
72