Supervised fine-tuning (SFT) struggles to reliably produce valid structured output from LLMs because it optimizes token-level similarity rather than correctness. GRPO (Group Relative Policy Optimization) offers a better approach: instead of labeled examples, you write a reward function that scores outputs by whether they parse and match a schema. Using Fireworks' Training API, Qwen3-8B is fine-tuned for JSON invoice extraction with a three-tier reward (0.0 for unparseable, 0.5 for valid JSON with wrong schema, 1.0 for schema-valid). After training on 200 prompts with H200 GPUs, schema-valid output improves from 62% to 82%, surpassing GPT-4.1 at 58%. The approach generalizes to any task where correctness can be defined in code — SQL, API responses, tool calls, or linting.

10m read timeFrom blog.dailydoseofds.com
Post cover image
Table of contents
CMU’s new study is a must-read for coding agent users.Training an LLM to generate reliable structured output
522 Impressions