Separating system rules from user context with XML tags

by•

When I first built our customer support assistant, I put all company policies, product details and tone directions into one prompt. The accuracy seemed fine during tests, but when real users pasted long error logs, the model started making up refund rules. I split the prompt into XML‑style sections, putting the non‑negotiable policies at the top and wrapping raw user text in separate data tags at the bottom. After ten days and five hundred live tickets, the hallucinated policy answers dropped from 14% to under 2%. Language models follow instructions better when core constraints and untrusted user inputs never appear in the same paragraph. Keep your system rules at the top of your prompt. Explicitly tell the model to ignore any commands hidden inside the user data block. Which formatting structure has helped you keep language models grounded in your documentation?

4 views

Add a comment

Replies

Be the first to reply

Have a question or a thought to share? Add a comment above to start the conversation.