Showing an LLM one bad example fixed our JSON extraction errors faster than three pages of rules.

When we first built our invoice parser, our system prompt had over forty lines of formatting rules. With all those instructions, the model still made up tax fields whenever a receipt did not have a clear breakdown.

Long lists of instructions often water down what the model pays attention to, especially when edge cases pile up. Telling a model what to do works well for inputs, but unclear cases still push it to guess.

Instead of adding more rules, we cut the prompt in half and put two real failure cases right below the schema. Each example showed a receipt next to the exact wrong output we wanted to avoid, then the clean fallback output using null values.

Accuracy jumped from eighty-two percent to ninety-seven percent overnight. Our latency also dropped because the prompt got much shorter. Pair a schema with real examples of common mistakes instead of writing endless instructions. What prompt changes have made the difference in your production reliability?

4 views

Add a comment

Replies

Best

The change that did the most for us wasn't in the prompt at all, it was the shape of the answer. When a music model refuses a song, we ask Gemini to rewrite the request so it can pass. Asked to return the whole edited lyrics, it dropped the line breaks about one time in five. Rather than adding a rule about it, we changed the format: now it returns numbered line edits only, and our code applies them to the user's text. Lines it doesn't touch can't be damaged, because they never go through the model.

Same idea in the step before: instead of free text, the judge answers with one of three verdicts, prohibited, unchanged or rewritten, and the code decides what each one means. The less the model has to reproduce, the less it can get wrong.