{"slug": "sieve-df-a-rust-fuzzer-for-llm-structured-output-engines-llguidance-outlines", "title": "Sieve-df: a Rust fuzzer for LLM structured-output engines (llguidance, outlines)", "summary": "A new open-source Rust tool called sieve-df fuzzes LLM structured-output engines by walking token masks against JSON Schemas without loading model weights, checking llguidance, outlines-core, XGrammar and optionally the llama.cpp grammar sampler. At each decoding step sieve-df flags four bug classes — contradictions, dead ends, cross-engine disagreements and invalid outputs — plus crashes and hangs, then shrinks each finding to a minimal schema and token path and writes a markdown issue draft. Disagreements are adjudicated by attempting to finish the output and validating it with jsonschema-rs: a valid finish means the blocking engine is too strict, and if none can be produced the allowing engine is too loose.", "body_md": "At every decoding step sieve-df checks whether an engine's token mask allows exactly the\nright tokens for a JSON Schema. It needs **no model weights**: it loads an ungated\n`tokenizer.json` (for example a Qwen tokenizer from Hugging Face) and does random token walks\nover the mask, weighted toward boundary tokens such as `\":`, `\"},{\"` and leading-space tokens.\n\n| Engine | How it is driven | \n|---|---|\n| [llguidance](https://github.com/guidance-ai/llguidance) | Rust crate, linked directly | \n| [outlines-core](https://github.com/dottxt-ai/outlines-core) | Rust crate, linked directly | \n| [XGrammar](https://github.com/mlc-ai/xgrammar) | Python, through a JSON-lines subprocess bridge | \n| [llama.cpp](https://github.com/ggml-org/llama.cpp) grammar sampler (optional) | via llama-cpp-python and a vocab-only GGUF generated from `tokenizer.json` ;`scripts/setup_llamacpp.sh` ; needs a real tokenizer | \n\nEverything is free and open source; nothing needs an account, API key or card.\n\n1. **Contradictions** – the mask allows a token, but the engine rejects it when it is fed.\n2. **Dead ends** – an allowed token leads to a state with an empty mask that cannot finish.\n3. **Disagreements** – two engines differ on one token. To decide who is right sieve-df tries to\nfinish the output and validates it with[jsonschema-rs](https://github.com/Stranger6667/jsonschema) :\na valid finish means the*blocking* engine is too strict; if none can be produced, the*allowing* engine is too loose.\n4. **Invalid outputs** (EOS allowed for a document that violates the schema),**crashes** (engine\npanics, isolated) and**hangs** (compile blow-ups).\n\nEach bug is shrunk to a minimal schema plus token path, written as a markdown issue draft, and counted in an engine x JSON Schema feature x tokenizer table.\n\n```\ncargo build --release\nexamples/quickstart.sh            # built-in vocabulary, bundled schemas, no downloads\n```\n\nWith a real tokenizer and the other engines:\n\n``` php\nscripts/fetch_tokenizer.sh        # Qwen2.5 tokenizer.json -> data/tokenizers/qwen2.5.json\nscripts/setup_xgrammar.sh         # optional: .venv with XGrammar (no torch needed)\nscripts/fetch_corpora.sh          # optional: JSON Schema Test Suite + JSONSchemaBench\n\ntarget/release/sieve-df run \\\n  --tokenizer data/tokenizers/qwen2.5.json \\\n  --engines llguidance,outlines-core,xgrammar \\\n  --builtin --mcp examples/mcp \\\n  --suite data/corpora/json-schema-test-suite \\\n  --bench data/corpora/jsonschemabench --bench-subsets Handwritten,Kubernetes \\\n  --mutants 3 --walks 20 --out out/run\n```\n\n| Command | Purpose | \n|---|---|\n| `sieve-df run` | fuzz: random walks ( `--mode single\\|differential\\|both` ) over the selected schemas; writes`findings.jsonl` ,`findings/*.json` ,`stats.json` | \n| `sieve-df replay <findings>` | re-run saved findings and report whether they still reproduce | \n| `sieve-df shrink <findings>` | reduce findings to a minimal schema + token path, deduplicated into unique bugs ( `minimized.jsonl` ) | \n| `sieve-df report --minimized …` | write one markdown issue draft per bug, `results.md/csv` and`index.md` | \n| `sieve-df bench` | compile and mask-computation latency per engine | \n\nSchema sources for `run` and `bench`: `--schemas` (files/dirs), `--mcp` (MCP tool definitions),\n`--suite` (JSON Schema Test Suite), `--bench` (JSONSchemaBench), `--builtin`, plus `--mutants N`\nto add mutated variants (nested `anyOf`, `$ref` recursion, `pattern`, unicode enums, escaped\nkeys, bounds), `--filter`, `--limit`, `--shuffle`.\n\n`fuzz/` holds cargo-fuzz targets that feed mutated schemas and walks to the linked engines\nwith libFuzzer's coverage feedback; see [fuzz/README.md](https://github.com/Flotrpy/sieve-df/blob/main/fuzz/README.md).\n\n- [docs/findings.md](https://github.com/Flotrpy/sieve-df/blob/main/docs/findings.md) – bugs found so far, each pinned by a test\n- [docs/architecture.md](https://github.com/Flotrpy/sieve-df/blob/main/docs/architecture.md) – design, oracles, bridge protocol\n- [CONTRIBUTING.md](https://github.com/Flotrpy/sieve-df/blob/main/CONTRIBUTING.md) – setup, rules, adding engines and mutations\n\nMIT", "url": "https://wpnews.pro/news/sieve-df-a-rust-fuzzer-for-llm-structured-output-engines-llguidance-outlines", "canonical_source": "https://github.com/Flotrpy/sieve-df", "published_at": "2026-12-05 18:11:18+00:00", "updated_at": "2026-12-05 18:15:41.334945+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "developer-tools", "ai-agents", "structured-data"], "entities": ["sieve-df", "llguidance", "outlines-core", "XGrammar", "llama.cpp", "jsonschema-rs", "Qwen2.5", "JSONSchemaBench"], "also_reported_by": [], "takeaway": "sieve-df drives llguidance and outlines-core as linked Rust crates and XGrammar through a JSON-lines subprocess bridge, using only an ungated tokenizer.json to find mask contradictions, dead ends and cross-engine disagreements, then shrinks each to a minimal schema plus token path.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/sieve-df-a-rust-fuzzer-for-llm-structured-output-engines-llguidance-outlines", "markdown": "https://wpnews.pro/news/sieve-df-a-rust-fuzzer-for-llm-structured-output-engines-llguidance-outlines.md", "text": "https://wpnews.pro/news/sieve-df-a-rust-fuzzer-for-llm-structured-output-engines-llguidance-outlines.txt", "jsonld": "https://wpnews.pro/news/sieve-df-a-rust-fuzzer-for-llm-structured-output-engines-llguidance-outlines.jsonld"}}