Read original ↗
newsReddit r/LocalLLaMATrust 58 · CommunityPublished yesterdayLive · yesterday

A cheap trick for reliable structured output: feed the validation error back into the retry

If you generate structured output from an LLM and validate against a schema, you know the failure mode: usually fine, occasionally a missing field or an unparseable response. The common fix is a retry, but a plain retry is the same prompt at the same temperature, so you are just re-rolling. What worked much better for me was making the retry self-correcting: when validation fails, put the validation error and the model's own previous output back into the