At every decoding step sieve-df checks whether an engine's token mask allows exactly the right tokens for a JSON Schema. It needs no model weights: it loads an ungated tokenizer.json (for example a Qwen tokenizer from Hugging Face) and does random token walks over the mask, weighted toward boundary tokens such as ":, "},{" and leading-space tokens.

| Engine | How it is driven | |---|---| | llguidance | Rust crate, linked directly | | outlines-core | Rust crate, linked directly | | XGrammar | Python, through a JSON-lines subprocess bridge | | 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 |

Everything is free and open source; nothing needs an account, API key or card.

  1. Contradictions – the mask allows a token, but the engine rejects it when it is fed.
  2. Dead ends – an allowed token leads to a state with an empty mask that cannot finish.
  3. Disagreements – two engines differ on one token. To decide who is right sieve-df tries to

finish the output and validates it withjsonschema-rs : a valid finish means the*blocking* engine is too strict; if none can be produced, the*allowing* engine is too loose.

  1. Invalid outputs (EOS allowed for a document that violates the schema),crashes (engine

panics, isolated) andhangs (compile blow-ups).

Each 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.

cargo build --release
examples/quickstart.sh            # built-in vocabulary, bundled schemas, no downloads

With a real tokenizer and the other engines:

scripts/fetch_tokenizer.sh        # Qwen2.5 tokenizer.json -> data/tokenizers/qwen2.5.json
scripts/setup_xgrammar.sh         # optional: .venv with XGrammar (no torch needed)
scripts/fetch_corpora.sh          # optional: JSON Schema Test Suite + JSONSchemaBench

target/release/sieve-df run \
  --tokenizer data/tokenizers/qwen2.5.json \
  --engines llguidance,outlines-core,xgrammar \
  --builtin --mcp examples/mcp \
  --suite data/corpora/json-schema-test-suite \
  --bench data/corpora/jsonschemabench --bench-subsets Handwritten,Kubernetes \
  --mutants 3 --walks 20 --out out/run

| Command | Purpose | |---|---| | sieve-df run | fuzz: random walks ( --mode single\|differential\|both ) over the selected schemas; writesfindings.jsonl ,findings/*.json ,stats.json | | sieve-df replay <findings> | re-run saved findings and report whether they still reproduce | | sieve-df shrink <findings> | reduce findings to a minimal schema + token path, deduplicated into unique bugs ( minimized.jsonl ) | | sieve-df report --minimized … | write one markdown issue draft per bug, results.md/csv andindex.md | | sieve-df bench | compile and mask-computation latency per engine |

Schema sources for run and bench: --schemas (files/dirs), --mcp (MCP tool definitions), --suite (JSON Schema Test Suite), --bench (JSONSchemaBench), --builtin, plus --mutants N to add mutated variants (nested anyOf, $ref recursion, pattern, unicode enums, escaped keys, bounds), --filter, --limit, --shuffle.

fuzz/ holds cargo-fuzz targets that feed mutated schemas and walks to the linked engines with libFuzzer's coverage feedback; see fuzz/README.md.

MIT

原文来源:github.com