𝗣𝗿𝗼𝗺𝗽𝘁𝘀 𝗔𝗿𝗲𝗻'𝘁 𝗘𝗻𝗼𝘂𝗴𝗵: 𝗘𝗻𝗳𝗼𝗿𝗰𝗶𝗻𝗴 𝗛𝗮𝗿𝗱 𝗖𝗼𝗻𝘀𝘁𝗿𝗮𝗶𝗻𝘁𝘀 𝗼𝗻 𝗟𝗟𝗠 𝗢𝘂𝘁𝗽𝘂𝘁

LLM demos look great until they face strict requirements.

Models work on probability. Production systems need guarantees.

I learned this while building an AI news pipeline for Radio del Volga in Argentina. The system rewrites news and creates social media posts. It worked well until one problem appeared. Gemini kept writing in the wrong Spanish.

In Argentina, people use specific words. They say "podés" instead of "puedes" and "sos" instead of "eres." If the model uses neutral Spanish, the text feels wrong to local readers.

I tried better prompting first. I told the model:

This helped, but it did not solve everything. Formal news sources pushed the model back to neutral Spanish. No matter how much I wrote in the prompt, the errors remained.

I stopped treating this as a prompting problem. I started treating it as a validation problem.

Some things are probabilistic, like tone or style. Other things are deterministic. If a text contains "puedes," it is wrong. You do not need an AI to figure that out. You need simple code.

I added a post-processing step. It runs after the AI finishes. It looks for specific words and replaces them:

This list is small and safe. I do not try to fix all of Spanish. I only fix the rules that code can verify with certainty.

The lesson is not about Spanish. It is about the limits of prompt engineering.

Prompting improves performance, but it does not provide guarantees. If a rule is stable and testable, use code to enforce it.

Use LLMs to generate fluent text. Use deterministic code to enforce brand terms, regulatory wording, and formatting rules.

Reliable systems divide responsibilities: • The model generates the content. • Code enforces the hard rules. • Humans make the final editorial call.

Source: https://dev.to/zendev2112/prompts-arent-enough-enforcing-hard-constraints-on-llm-output-2hpo

Optional learning community: https://t.me/GyaanSetuAi