How to work with validJSON

Before you hire us, do this. Most structured-output problems can be diagnosed and fixed without consulting. Here’s the order to try things, cheapest first.

Step 1 — Diagnose what’s actually wrong (free, ~30 minutes)

pip install valjson

Run the diagnostic ladder against your current outputs:

At the end of Step 1 you will know whether your problem is:

Step 2 — Try the cheap fixes (free, ~1–2 days)

In order:

  1. Grammar-constrained decoding. llguidance, Outlines, XGrammar, or your provider’s native structured-output mode. Solves format completely.
  2. Retry on validation failure. Up to ~5×, with the validation error fed back as context. Catches most remaining format edges. Note: retries cannot fix semantically wrong output — a confidently-wrong value will be confidently-wrong on every retry.
  3. Better prompt with schema in-context. Put the full JSON Schema in the prompt, plus one in-context example. Underrated.
  4. Try a different model. Some foundation models are markedly better at structured output than others; the cost of swapping is ~1 hour.
  5. Inference-time abstention. valjson --gate --margin-threshold 0.30 — commit when the model’s top-two value margin is wide enough, abstain otherwise. Catches confidently-wrong outputs without retraining.

If Step 2 closed the gap, you’re done. Tell us — we like hearing it.

Step 3 — Try the structural fixes (free + your engineering time, ~1–2 weeks)

When the cheap fixes don’t move the field:

Step 4 — When to call us

You’ve worked through Steps 1–3 and you still have one of these:

We will spend 30 minutes with you, free, if you bring the valjson output from Step 1. From there we scope a paid pilot: typically 4–6 weeks, fixed price; the deliverable is a per-field reliability report plus a fix — prompt/schema, gates, or a fine-tuned model — whichever the diagnosis warrants.

Get the free consult

Send a one-line description of the problem plus the output of valjson --anatomy --schema your_schema.json --data your_outputs.jsonl to breck@validjson.com. We reply within two business days with whether it’s a Step 2/3 fix or a Step 4 conversation.