|
Download README.md from mudabbirali412/ifstruct-v1.0: direct link, hf CLI and curl.
- Browser
- Download file 5.33 kB
-
https://huggingface.co/datasets/mudabbirali412/ifstruct-v1.0/resolve/main/README.md
- Command line
-
hf download hf://datasets/mudabbirali412/ifstruct-v1.0/README.md
-
curl -L -o README.md https://huggingface.co/datasets/mudabbirali412/ifstruct-v1.0/resolve/main/README.md
5.33 kB
| pretty_name: IFStruct v1.0 | |
| language: | |
| - en | |
| tags: | |
| - structured-output | |
| - json | |
| - yaml | |
| - instruction-following | |
| - schema-following | |
| task_categories: | |
| - text-generation | |
| size_categories: | |
| - 1K<n<10K | |
| configs: | |
| - config_name: default | |
| data_files: | |
| - split: test | |
| path: test.parquet | |
| license: apache-2.0 | |
| # IFStruct v1.0 | |
|  | |
| > [!Note] | |
| > 📝 **Blog post**: https://www.liquid.ai/blog/ifstruct-v1.0 | |
| > | |
| > 💻 **GitHub**: https://github.com/Liquid4All/ifstruct | |
| IFStruct is a benchmark for **structured-output compliance**: can a model produce valid JSON/YAML that follows a requested schema, when the requirements are phrased the many different ways real users phrase them? It is scored *without* constrained decoding, and only the **structure** is judged (not content quality, extraction accuracy, or reasoning) so the signal is isolated to output validity and schema following. | |
| Each prompt asks the model to generate a handful of instances of a randomized item (e.g. *"Generate two recipes for blueberry pancakes"*) against a target schema, plus sampled presentation/output constraints. Scoring is **binary**: a response passes only if every requested structural constraint is satisfied. Difficulty is calibrated to be discriminative for low-to-mid-ability models and to saturate near 100% at the frontier. | |
| This dataset is the frozen public test set: **2,000 prompts** with the ground-truth specification each response is validated against. | |
| ## Dataset structure | |
| One row per prompt. The fields after `prompt` are the ground-truth spec the validator checks a model's response against. There are no gold responses, since scoring is done by the validator in the eval repo. | |
| | Field | Type | Description | | |
| | :---- | :--- | :---------- | | |
| | `doc_id` | int | Stable identifier (0–1999). | | |
| | `entity_type` | string | Taxonomy the schema was sampled from (e.g. `test__recipe`, `test__escaping__short_story_chapter`). | | |
| | `prompt` | string | The request shown to the model. | | |
| | `output_format` | string | Required format: `json` or `yaml`. | | |
| | `top_level_count` | string (JSON) | Required item count: an exact int (`"3"`) or an inclusive range (`"[2, 4]"`). | | |
| | `top_level_key` | string | Wrapper key name, when a wrapper object is required. | | |
| | `require_wrapper_key` | bool | If true, the top level must be an object wrapping the array under `top_level_key`; if false, a bare array. | | |
| | `require_code_block` | bool | Whether the response must be wrapped in a fenced code block. | | |
| | `require_no_commentary` | bool | Whether text outside the payload is forbidden. | | |
| | `json_schema` | string (JSON) | The schema the output must satisfy (exact fields, types, enums, numeric bounds, nested-list lengths). | | |
| > `json_schema` and `top_level_count` are stored as JSON-encoded strings (schemas vary in shape and the count is sometimes an int, sometimes a range). Parse them with `json.loads`. | |
| ```python | |
| from datasets import load_dataset | |
| import json | |
| ds = load_dataset("LiquidAI/ifstruct-v1.0", split="test") | |
| row = ds[0] | |
| schema = json.loads(row["json_schema"]) | |
| count = json.loads(row["top_level_count"]) | |
| ``` | |
| ## Validation | |
| The validator (in the eval repo) extracts the payload from a fenced block if present and falls back to a raw parse, penalizing fencing only when the prompt required or forbade it. It then checks two kinds of constraints: | |
| - **Sampled, per-prompt:** format (JSON/YAML), top-level shape (bare array vs. exact wrapper key), item count, code fencing, commentary, and a ban on any field not in the schema. | |
| - **From the schema:** required vs. optional fields, types (a boolean is never accepted for a numeric field or vice versa), enum membership and numeric bounds, and nested objects/lists validated recursively including their min/max lengths. | |
| A response also fails if it contains **any key the schema did not request**: inventing fields is treated as not following the schema. | |
| ## How the data was generated | |
| Schemas are sampled generatively from curated taxonomies, then surfaced through one of several **presentation styles** sampled independently of the schema: naturally-written chat requests, bullet points with explicit paths, raw JSON Schema, annotated JSON/YAML structure examples, flat path glossaries, and ASCII field tables. About half of the prompts are rewritten by an LLM into humanlike prose (including "thinking-out-loud" requests that revise the spec before settling), to emulate organic requests rather than a neatly finalized schema. Many prompts deliberately stress string escaping (embedded quotes, code snippets, file paths, stack traces packed into otherwise-valid JSON/YAML), a common real-world breaking point. | |
| ## Limitations | |
| Only structural requirements are checked, not content correctness or quality. A response can ignore content-level instructions (e.g. "10 lines of poetry") and still pass as long as the schema is followed. When optimizing against IFStruct (e.g. as an RL reward), pair it with a separate quality signal such as an LLM judge. | |
| ## Citation | |
| ``` | |
| @article{liquidAI2026IFStruct, | |
| author = {Liquid AI}, | |
| title = {IFStruct: Measuring structured-output compliance}, | |
| journal = {Liquid AI Blog}, | |
| year = {2026}, | |
| note = {www.liquid.ai/blog/ifstruct-v1.0} | |
| } | |
| ``` |