Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
4
19
text
stringlengths
9.98k
3.6M
9223732
<|im_start|>system You are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME RDF/XML to conform to Library of Congress specifications. Rules: 1. Fix namespace declarations (use bf: for BIBFRAME, bflc: for LC extensions) 2. Add missing required properties (bf:title, bf:adminMetadata, etc.) 3. Conver...
22867435
<|im_start|>system You are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME RDF/XML to conform to Library of Congress specifications. Rules: 1. Fix namespace declarations (use bf: for BIBFRAME, bflc: for LC extensions) 2. Add missing required properties (bf:title, bf:adminMetadata, etc.) 3. Conver...
11285346
<|im_start|>system You are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME RDF/XML to conform to Library of Congress specifications. Rules: 1. Fix namespace declarations (use bf: for BIBFRAME, bflc: for LC extensions) 2. Add missing required properties (bf:title, bf:adminMetadata, etc.) 3. Conver...
21741343
<|im_start|>system You are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME RDF/XML to conform to Library of Congress specifications. Rules: 1. Fix namespace declarations (use bf: for BIBFRAME, bflc: for LC extensions) 2. Add missing required properties (bf:title, bf:adminMetadata, etc.) 3. Conver...
12511149
"<|im_start|>system\nYou are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME R(...TRUNCATED)
17856242
"<|im_start|>system\nYou are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME R(...TRUNCATED)
13609160
"<|im_start|>system\nYou are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME R(...TRUNCATED)
16993690
"<|im_start|>system\nYou are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME R(...TRUNCATED)
14395618
"<|im_start|>system\nYou are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME R(...TRUNCATED)
11181090
"<|im_start|>system\nYou are a BIBFRAME expert assistant. Your task is to correct invalid BIBFRAME R(...TRUNCATED)
End of preview. Expand in Data Studio

BIBFRAME Corrections Dataset

Paired examples of corrupted and corrected BIBFRAME RDF/XML for training LLMs on metadata repair tasks.

Dataset Description

This dataset contains 8,284 (corrupted → valid) BIBFRAME RDF/XML pairs derived from real Library of Congress catalog records. Each example presents an intentionally broken BIBFRAME record alongside the correct version, formatted as a ChatML prompt-completion pair.

Dataset Construction

1. Source Collection

~10,000 BIBFRAME Work and Instance records were fetched from id.loc.gov using the LOC Search API, sampled evenly across diversity facets:

Facet Categories Purpose
LCC classification 21 classes (A–Z) Subject diversity
Content type 10 types (Text, Audio, Cartography, ...) Format diversity
Carrier type 5 types (print, electronic, microform, ...) Medium diversity
Language Multiple ISO 639-2 codes Linguistic diversity

2. Corruption Generation

Each valid record was corrupted with 1–3 realistic errors drawn from weighted strategies:

Corruption Type Weight Example
Remove required property 25% Delete bf:title from a Work
Wrong namespace prefix 15% bf:BF: or bibframe:
Literal instead of resource 15% <bf:contribution>Smith</bf:contribution> instead of nested resource
Missing rdf:type 10% Remove rdf:type triple
Wrong nesting 10% Misplaced child elements
Remove namespace declaration 10% Drop xmlns:madsrdf
Typo in property name 8% bf:contentbf:cnotent
Duplicate property 5% Repeated element
Empty value 2% <bf:title></bf:title>

3. Formatting

Pairs are formatted in ChatML with a system prompt instructing the model to correct BIBFRAME RDF/XML:

<|im_start|>system
You are a BIBFRAME expert assistant. Your task is to correct invalid
BIBFRAME RDF/XML to conform to Library of Congress specifications.

Rules:
1. Fix namespace declarations (use bf: for BIBFRAME, bflc: for LC extensions)
2. Add missing required properties (bf:title, bf:adminMetadata, etc.)
3. Convert literals to proper resource structures where needed
4. Preserve all valid existing content
5. Output only valid RDF/XML, no explanations<|im_end|>
<|im_start|>user
Fix the following invalid BIBFRAME RDF/XML:

```xml
[corrupted RDF/XML]

Errors to fix: [corruption descriptions]

Output the corrected RDF/XML:<|im_end|> <|im_start|>assistant [valid RDF/XML]<|im_end|>


## Dataset Fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | LOC record identifier (e.g., `"21578643"`) |
| `text` | string | Full ChatML-formatted prompt-completion pair |

## Splits

| Split | Examples | Purpose |
|-------|----------|---------|
| train | 7,455 | Fine-tuning |
| validation | 829 | Evaluation during training |

## Intended Use

- **Fine-tuning LLMs** for BIBFRAME RDF/XML correction (e.g., bibframe-olmo)
- **Evaluating LLM ability** to repair structured metadata (e.g., power test harness comparing bare vs. intervention conditions)
- **Benchmarking** SHACL-aware vs. context-free correction approaches

## Evaluation

The companion [power test harness](https://github.com/jimfhahn/bibframe-olmo/blob/main/eval/power_test_harness.py) evaluates models trained on this dataset by:

1. Feeding corrupted examples to LLMs under two conditions:
   - **Bare:** LLM + basic prompt only
   - **Intervention:** LLM + SHACL validation context, ontology docs, BFE profile hints, LOC examples
2. Re-validating LLM output against BIBFRAME SHACL shapes via [validate.bibframe.app](https://validate.bibframe.app)
3. Computing conformance rates, violation counts, and gap scores
4. Running power analysis (Cohen's h / Cohen's d) to determine required sample sizes

## Limitations

- Source records are exclusively from the Library of Congress; other BIBFRAME implementations may differ
- Corruption strategies are synthetic, not derived from real-world cataloging errors
- The dataset focuses on Monograph profiles (Work, Instance, AdminMetadata); Serials and other profiles are underrepresented
- ChatML formatting is specific to the OLMo training pipeline; other model architectures may need reformatting

## Citation

```bibtex
@dataset{hahn2025bibframe,
  author = {Hahn, Jim},
  title = {BIBFRAME Corrections: Paired Examples for LLM Metadata Repair},
  year = {2025},
  publisher = {HuggingFace},
  url = {https://huggingface.co/datasets/jimfhahn/bibframe-corrections}
}
Downloads last month
52

Models trained or fine-tuned on jimfhahn/bibframe-corrections