Document extraction: text to the JSON its schema asks for
EngineSurogate Engine
Qwen3.5-0.8B learns to read a document (an email, a receipt, a badge scan, a school
notice) and return exactly the JSON object its schema describes. 60 GRPO steps on one
GPU take the share of fields it gets right on 500 held-out documents from 67.6% to
87.8%. Small enough to run on a laptop.
LiquidAI/structured-extraction
(Apache-2.0): 6,000 training and 500 test documents in 30 types and 16 languages, each
with its own JSON Schema of 6 to 13 top-level fields. The schema goes in the system
prompt and the document is the user message. The kit trains on the 5,888 training documents
that fit a 2,048-token context with room for the answer, and evaluates on all 500 test
documents. 14 of those do not fit, and they count as wrong both before and after.
Reward: the fraction of top-level fields whose normalised value equals the gold
one (dates as YYYY-MM-DD, times as HH:MM, amounts as numbers). Invalid JSON scores 0. A field the
reply leaves out scores 0 even where the gold is null, so echoing the schema back earns nothing. The
numbers below were scored before that rule was added. Rescoring the run’s saved answers with it moves the base model
down about half a point and leaves the trained model unchanged.
Two times in three. It reads the document well, but it often answers with a filled-in
copy of the schema instead of the object: {"title": ..., "type": "object", "properties": {"full_name": "Nadja Wüthrich", ...}}. It also copies dates and times as
they are written instead of converting them to the requested format.
Greedy decoding, the same prompt and budget as training, one run. Checked outside the
engine with plain transformers + peft on the first 48 test documents: 77.6% before,
91.6% after; 2 of the 48 got worse.
Scored on top-level fields. Inside a list (attendees, line items) a small slip
costs the whole field; the model still sometimes flattens a list of objects into a
list of strings.
Documents up to about 2,000 tokens, the context it was trained with.