Ashish-Ranjan's picture
Update dataset card
9899bcc verified
|
Raw History Blame Contribute Delete
10.8 kB
---
license: other
license_name: research-only
license_link: LICENSE.md
language:
- en
pretty_name: Policy Structure Pages
size_categories:
- n<1K
task_categories:
- image-text-to-text
tags:
- document-parsing
- document-understanding
- structured-extraction
- json
- insurance
- legal-documents
- sft
- vision-language
extra_gated_heading: Research-only access
extra_gated_prompt: >-
This dataset contains page images and verbatim text of publicly filed insurance policy forms and a public
card agreement. Their copyrights remain with their owners, and some pages contain ISO copyrighted material.
They are included only so the research can be reproduced. By requesting access you agree to use the
dataset for non-commercial research only, not to redistribute the page images or document text, and to
follow LICENSE.md.
extra_gated_fields:
Name: text
Affiliation: text
Intended use: text
I will use this dataset only for non-commercial research: checkbox
I will not redistribute the page images or document text: checkbox
extra_gated_button_content: Agree and request access
configs:
- config_name: extraction
data_files:
- split: train
path: extraction/train-*.parquet
- split: validation
path: extraction/validation-*.parquet
- config_name: sft_mix
data_files:
- split: train
path: sft_mix/train-*.parquet
- config_name: heldout_pages
data_files:
- split: test
path: heldout_pages/test-*.parquet
- config_name: heldout_trees
data_files:
- split: test
path: heldout_trees/test-*.parquet
---
# Policy Structure Pages
**Page images of insurance policies, each paired with that page's content as nested JSON.** This is the training and evaluation data behind [Ashish-Ranjan/Qwen3.5-9B-Policy-Structure-LoRA](https://huggingface.co/Ashish-Ranjan/Qwen3.5-9B-Policy-Structure-LoRA), a LoRA adapter for Qwen3.5-9B. It reads a policy one page at a time and returns the whole document as one nested tree: sections, subsections, numbered clauses, lettered items and definitions.
- **Model:** [Ashish-Ranjan/Qwen3.5-9B-Policy-Structure-LoRA](https://huggingface.co/Ashish-Ranjan/Qwen3.5-9B-Policy-Structure-LoRA)
- **Live demo:** [policy-structure-extractor.vercel.app](https://policy-structure-extractor.vercel.app)
- **Access:** gated, for non-commercial research only (see [LICENSE.md](LICENSE.md))
## Dataset summary
| Config | Split | Rows | What a row is |
|---|---|---|---|
| `extraction` | `train` | 265 | One page image + the "open path" from the previous page → that page's JSON. From 15 documents |
| `extraction` | `validation` | 16 | The same, for the held-out GEICO auto policy (pages 3–18) |
| `sft_mix` | `train` | 484 | The exact training mix in ms-swift chat format: the 265 extraction pages plus 219 self-distilled conversations |
| `heldout_pages` | `test` | 34 | Page images of the two held-out policies, GEICO auto (pages 3–18) and Encompass home (pages 3–20) |
| `heldout_trees` | `test` | 2 | Hand-authored reference trees for those two whole documents (585 and 716 nodes), for full-document evaluation |
```python
from datasets import load_dataset
pages = load_dataset("Ashish-Ranjan/Policy-Structure-Pages", "extraction") # requires accepting the agreement and `hf auth login`
mix = load_dataset("Ashish-Ranjan/Policy-Structure-Pages", "sft_mix")
```
## How the data works
A policy is too long for one generation, and its nesting runs across pages, so each example is **one page**:
1. **Input:** the page image (rendered at 200 DPI) plus the **open path**. The open path is the chain of nodes still open at the end of the previous page, from the document root down through the last child at each level. Its deepest entry carries a `tail`, the last 150 characters of its text.
2. **Target:** only what is printed on that page, as a tree. A node that continues from an earlier page is written as a **stub** along the left edge, for example `{"cont": true, "type": "clause", "label": "12."}`. Stubs never repeat earlier text. If the page starts mid-sentence, the deepest stub's `text` holds just the continuation.
3. **Reassembly:** merging the page targets in order reproduces each document's full reference tree exactly. The merge code is [`page_merge.py`](https://huggingface.co/Ashish-Ranjan/Qwen3.5-9B-Policy-Structure-LoRA/blob/main/page_merge.py) in the model repo.
Every node is `{type, label, title, text, children}`, and empty fields are left out:
| Field | Meaning |
|---|---|
| `type` | `document`, `part`, `section`, `subsection`, `clause`, `definition`, `subclause`, `item`, `paragraph` |
| `label` | the enumerator as printed: `"A."`, `"12."`, `"(a)"` |
| `title` | the heading, including a bold run-in heading |
| `text` | the node's own prose, verbatim, including typos as printed |
| `children` | child nodes in reading order |
Page furniture is left out: running headers and footers, page numbers, form numbers, copyright lines, insurer address blocks, policy-number boxes and endorsement banners. The full instructions are in [`system_prompt.txt`](system_prompt.txt).
## Data fields
**`extraction`**
| Field | Type | Description |
|---|---|---|
| `id` | string | `<doc_id>_p<page>` |
| `doc_id` | string | document id, by kind for training documents (e.g. `homeowners_3`); `geico_auto` for validation |
| `doc_kind`, `layout` | string | e.g. `Homeowners`, `2-column` |
| `page` | int | page number in the source PDF |
| `first_page` | bool | true when the open path is empty |
| `image` | image | the page, 200 DPI PNG (US letter = 1700×2200 px) |
| `system` | string | the extraction system prompt |
| `prompt` | string | the user message: one of several phrasings, plus the open path |
| `open_path` | string (JSON) | the open path as a list |
| `target` | string (JSON) | the page's tree, compact JSON exactly as trained |
| `target_tokens` | int | target length in Qwen3.5 tokens |
**`sft_mix`** has these fields:
- `id`;
- `kind` (`extraction`, `contrast`, `retention_image` or `retention_text`);
- `thinking` (whether the answer includes a reasoning block);
- `source` (JSON);
- `messages` (a list of `{role, content}`, where `<image>` marks the image);
- `images` (a list of images).
It is the file the released model was trained on.
**`heldout_pages`** has `doc_id`, `page` and `image`. **`heldout_trees`** has `doc_id`, `name`, `kind`, `layout`, `pages` and `tree` (a JSON string).
## Dataset creation
### Curation rationale
General document parsers flatten structure. For retrieval over contracts and policies, what matters is *which* coverage a clause belongs to and *which* exclusion an item modifies. This dataset teaches a vision-language model to keep that nesting, page by page, in a form that merges deterministically.
### Source data
- **Training documents:** 15 publicly available policy forms and one public bank card agreement. Most are filings on a US state insurance regulator's policy-comparison pages, plus one Canadian homeowners policy. They are identified by kind only:
| Kind | Documents | Training pages |
|---|---|---|
| Homeowners | 6 | 131 |
| Personal auto | 5 | 39 |
| Renters, with endorsements | 1 | 39 |
| Dwelling fire | 1 | 27 |
| Manufactured home | 1 | 22 |
| Credit-card agreement | 1 | 7 |
13 of the 15 documents are two-column layouts.
- **Held-out documents:** GEICO Family Automobile Insurance Policy (form A-30ME, single column) and Encompass Special Home Policy (two columns). Both come from the same regulator's public filings and were never used for training.
- **Excluded from training:** cover, contents and declarations pages; data tables, schedule boxes and blank pages; and 5 near-duplicate pages (4-gram Jaccard ≥ 0.7).
### Annotations
- **Who labelled it:** one annotator (the author), working from the page images and using the PDF text layer for exact wording.
- **What was labelled:** a reference tree for each *whole* document.
- **From trees to pages:** each tree was aligned to the page breaks with a shingle aligner, checked against the first and last printed line of every page, and sliced into page targets. Merging the slices back reproduces every tree exactly.
- **Normalisation:** node types were normalised with one rule. The first enumerated level under a section is a `clause`; deeper levels are `item`s.
### Self-distilled records (in `sft_mix`)
These records keep the model's general behaviour. The original Qwen3.5-9B wrote the answers, about 75% of them with thinking on:
- **`contrast` (71):** pages from the training documents with ordinary prompts (summarise, answer a question, list the headings, transcribe, a generic JSON request). These teach that JSON appears only under the extraction prompt.
- **`retention_image` (99):** general image questions from [the_cauldron](https://huggingface.co/datasets/HuggingFaceM4/the_cauldron) (natural images, charts, documents, infographics, OCR, diagrams, screens).
- **`retention_text` (49):** English prompts from [oasst2](https://huggingface.co/datasets/OpenAssistant/oasst2).
### Personal and sensitive information
All documents are specimen forms with no real policyholder data. Some specimen endorsement pages show placeholder values, such as the insured name "Amuro Ray" and the policy number "FGCHOY3JOYYYY-00".
## Considerations and limitations
- **Small and single-domain:** 15 training documents, mostly US personal-lines insurance plus one card agreement.
- **Known label inconsistency:** some documents keep the printed punctuation on labels (`"4."`, `"a)"`), others store bare labels (`"4"`, `"a"`). Models trained on this sometimes drop the period.
- **Single annotator, no inter-annotator agreement measured.** Reference trees reflect one person's reading of heading levels.
- **No tables:** the schema has no table type. Key-value tables are written as items, and grids are excluded.
- **Copyrighted content:** see the licence section. Don't use this data to republish the documents.
## Licence
See [LICENSE.md](LICENSE.md).
- **The documents** stay the property of their owners and are included only for non-commercial research reproduction.
- **The annotation structure and generated answers** are under CC BY-NC 4.0.
- **Retention prompts and images** keep their original licences.
This project is not affiliated with or endorsed by any insurer or other company whose documents appear here. **Rights holders:** to have a document removed, open a discussion in the **Community** tab.
## Citation
```bibtex
@misc{ranjan2026policystructurepages,
title = {Policy Structure Pages: page-level nested JSON targets for insurance policy documents},
author = {Ranjan, Ashish},
year = {2026},
howpublished = {\url{https://huggingface.co/datasets/Ashish-Ranjan/Policy-Structure-Pages}}
}
```