Fine-tuning a 7B model on your own 500 failed agent trajectories beats prompt engineering a 400B model
Walk into almost any AI engineering team and inspect their agent's system prompt: it's a 6,000-token graveyard of scar tissue:
- "NEVER output markdown backticks around SQL!"
- "ALWAYS check if
deleted_at IS NULLwhen queryingusers!" - "DO NOT call
create_tickettwice on timeout!"
By rule #45, even 400B frontier models start ignoring rule #12 because attention dilutes across conflicting negative constraints.
The High-Leverage Alternative: Failure-Driven LoRA
Take the 500 exact trajectories from your production logs where the agent messed up, have a senior engineer (or an offline teacher model) write the corrected tool call, and run a 25-minute LoRA SFT + DPO pass on Qwen-2.5-7B-Instruct or Llama-3.1-8B:
- Your system prompt shrinks from 6,000 tokens down to 300 tokens.
- Domain-specific schema rules become baked into the model weights instead of competing for attention budget.
- Inference latency drops 5x and marginal API cost drops 20x.
Stop treating system prompts like a patchfile for model behavior. Train on your failures.