SalutefaceAAC's picture
Upload README.md with huggingface_hub
9321328 verified
|
Raw History Blame Contribute Delete
8.01 kB
---
language:
- en
license: apache-2.0
task_categories:
- text-generation
tags:
- synthetic
- structured-output
- json
- yaml
- csv
- xml
- markdown
- fine-tuning
- instruction-following
pretty_name: Structured Output Generation
size_categories:
- n<1K
---
# Structured Output Generation
A hand-authored synthetic dataset of **107 natural-language prompts paired with ideal structured-format completions**, spanning JSON, YAML, CSV, Markdown tables, and XML. Designed for fine-tuning and evaluating instruction-following models on structured output tasks.
## Dataset at a Glance
| Property | Value |
|---|---|
| Total examples | 107 |
| Formats | JSON (36), YAML (20), Markdown table (19), CSV (18), XML (14) |
| Difficulty levels | Easy (26), Medium (46), Hard (35) |
| Domains | software, finance, healthcare, AI, education, HR, ecommerce, logistics, IoT, media, sports, geography, food, legal, science |
| Train / Val / Test | 85 / 10 / 12 |
| License | Apache 2.0 |
| Generation method | Hand-authored |
## Schema
Each example has 8 fields:
| Field | Type | Description |
|---|---|---|
| `id` | string | MD5 hash of prompt+completion (12 chars) |
| `prompt` | string | Natural-language instruction requesting structured output |
| `format` | string | Target format: `json`, `yaml`, `csv`, `markdown_table`, `xml` |
| `schema_description` | string | One-line description of the expected output structure |
| `completion` | string | The ideal structured output |
| `domain` | string | Subject domain (software, finance, healthcare, …) |
| `difficulty` | string | `easy`, `medium`, or `hard` |
| `num_fields` | int | Approximate number of top-level fields / columns |
## Sample Records
### JSON — Medium difficulty (finance)
**Prompt:**
> Produce a JSON object for a bank transaction record. Fields: transaction_id, account_from, account_to, amount, currency, type (debit/credit/transfer), and timestamp.
**Completion:**
```json
{
"transaction_id": "TXN-20241101-998812",
"account_from": "ACC-001-882234",
"account_to": "ACC-002-117765",
"amount": 2500.00,
"currency": "USD",
"type": "transfer",
"timestamp": "2024-11-01T09:15:33Z"
}
```
---
### YAML — Hard difficulty (software)
**Prompt:**
> Write a YAML config for a Kubernetes Deployment of an nginx container with 3 replicas, a CPU request of 100m and limit of 500m, memory request of 128Mi and limit of 256Mi, and a readiness probe on port 80 path /healthz.
**Completion:**
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.27
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "256Mi"
readinessProbe:
httpGet:
path: /healthz
port: 80
initialDelaySeconds: 5
periodSeconds: 10
```
---
### CSV — Medium difficulty (ecommerce)
**Prompt:**
> Create a CSV of 5 e-commerce orders. Columns: order_id, customer_email, order_date, item_count, subtotal_usd, shipping_usd, tax_usd, total_usd, status.
**Completion:**
```
order_id,customer_email,order_date,item_count,subtotal_usd,shipping_usd,tax_usd,total_usd,status
ORD-10001,alice.chen@email.com,2024-10-29,2,89.98,5.99,7.65,103.62,delivered
ORD-10002,bob.wilson@email.com,2024-10-30,1,24.99,0.00,2.12,27.11,shipped
ORD-10003,diana.osei@email.com,2024-10-31,4,215.50,12.99,18.32,246.81,processing
ORD-10004,ethan.ko@email.com,2024-11-01,1,149.99,9.99,12.75,172.73,pending
ORD-10005,fiona.ray@email.com,2024-11-01,3,67.47,5.99,5.73,79.19,confirmed
```
---
### Markdown Table — Hard difficulty (ai)
**Prompt:**
> Create a Markdown results table for a benchmark comparing three LLM inference backends (vLLM, TGI, LiteLLM) on: throughput (tokens/sec), latency P50 (ms), latency P99 (ms), GPU memory (GB), and max concurrent requests.
**Completion:**
```markdown
| Backend | Throughput (tok/s) | Latency P50 (ms) | Latency P99 (ms) | GPU Memory (GB) | Max Concurrent |
|---|---|---|---|---|---|
| vLLM | 3,840 | 128 | 410 | 18.2 | 512 |
| TGI | 2,970 | 165 | 520 | 16.8 | 256 |
| LiteLLM | 1,820 | 243 | 780 | 14.1 | 128 |
```
---
### XML — Medium difficulty (iot)
**Prompt:**
> Write an XML document for an IoT device heartbeat message. Include: device_id, device_type, firmware_version, timestamp, battery_level_pct, signal_strength_dbm, sensors (list of sensor elements with id and status), and location (lat, lon).
**Completion:**
```xml
<?xml version="1.0" encoding="UTF-8"?>
<heartbeat>
<device_id>DEV-IOT-8812</device_id>
<device_type>environmental_monitor</device_type>
<firmware_version>3.2.1</firmware_version>
<timestamp>2024-11-01T14:00:00Z</timestamp>
<battery_level_pct>74</battery_level_pct>
<signal_strength_dbm>-62</signal_strength_dbm>
<sensors>
<sensor id="temp-01" status="ok"/>
<sensor id="humidity-01" status="ok"/>
<sensor id="co2-01" status="degraded"/>
</sensors>
<location>
<lat>51.5074</lat>
<lon>-0.1278</lon>
</location>
</heartbeat>
```
## Usage
```python
from datasets import load_dataset
ds = load_dataset("SalutefaceAAC/structured-output-generation")
train = ds["train"]
# Filter by format
json_examples = train.filter(lambda x: x["format"] == "json")
# Filter by difficulty
hard_examples = train.filter(lambda x: x["difficulty"] == "hard")
```
### Fine-tuning prompt template
```python
def to_prompt(example):
return (
f"Generate the following structured output:\n\n"
f"{example['prompt']}\n\n"
f"Format: {example['format'].upper()}\n\n"
f"Output:\n{example['completion']}"
)
```
## Generation Methodology
All examples were hand-authored to ensure:
1. **Prompt clarity** — each prompt unambiguously specifies the desired output format and fields
2. **Completion correctness** — all JSON/YAML/XML is syntactically valid; CSV headers match column descriptions; Markdown tables render correctly
3. **Domain diversity** — 15+ domains including software, finance, healthcare, AI/ML, education, ecommerce, IoT, sports, legal, and science
4. **Realistic values** — data uses plausible names, codes, prices, timestamps, and identifiers rather than placeholder values
5. **Format coverage** — hard examples include nested structures, arrays of objects, references between fields, and format-specific idioms (SOAP envelopes, Atom feeds, Maven POMs, OpenAPI paths)
## Difficulty Levels
- **Easy**: Simple flat structures, 5-7 fields, no nesting required
- **Medium**: Moderate nesting (1-2 levels), some arrays, domain-specific conventions
- **Hard**: Deep nesting, arrays of objects, format-specific idioms, cross-field consistency (e.g. computed totals, RFC-compliant structures)
## Limitations
- English-only prompts and completions
- ~107 examples — sufficient for evaluation and few-shot prompting; augmentation recommended for full SFT
- Software domain is intentionally over-represented (~39%) reflecting real-world structured output demand
- XML examples do not cover DTD/XSD validation patterns
- Does not include adversarial or out-of-distribution prompts
## Intended Uses
- Supervised fine-tuning (SFT) of instruction-following models for structured output generation
- Evaluation of model ability to produce format-valid and semantically correct structured data
- Few-shot prompting baselines for structured generation tasks
- Curriculum data for difficulty-staged training
## License
Apache 2.0 — free to use, share, and modify with attribution.
## Citation
```bibtex
@dataset{salutefaceaac2024structured,
title = {Structured Output Generation},
author = {SalutefaceAAC},
year = {2024},
url = {https://huggingface.co/datasets/SalutefaceAAC/structured-output-generation}
}
```