Fixing a prompt that ignores key constraints
practical prompt-engineering instincts.
move the critical constraint to a prominent position, state it positively and specifically, separate instructions from data with delimiters, and add a concrete example.
WHAT THIS TESTS This checks whether you have concrete, mechanism-aware prompt-debugging habits rather than superstition, and whether you understand how attention and structure affect instruction following.
A GOOD ANSWER COVERS The first fix is positioning: models attend most strongly to the beginning and end of a prompt, so a critical constraint buried in the middle of a long block is easily lost. Move it to a prominent location and state it as its own clear line. Second, phrasing: make the constraint explicit, specific, and positive, telling the model what to do rather than only what to avoid, since negative-only instructions are less reliable. Third, structure: use clear delimiters such as headers or triple quotes to separate the instructions from the user-supplied data, so the model does not treat data as instructions or vice versa. Fourth, demonstrate: add one or two worked examples showing input and the desired output that honors the constraint, which is far more effective than abstract description. Optionally, ask the model to restate the constraints before answering, or split a complex task into steps. Then test the revised prompt on the failing cases to confirm the change actually helped.
COMMON WRONG ANSWERS Just telling the model to try harder or be careful; adding all-caps emphasis without restructuring; making the prompt longer and more cluttered; not separating data from instructions; never testing whether the change worked.
LIKELY FOLLOW-UPS Why does position matter? When do you switch to few-shot examples? How do delimiters prevent prompt injection confusion? When is the issue the model, not the prompt?
ONE CONCRETE EXAMPLE A prompt asks for a JSON summary but buries the rule never include personal names deep in a paragraph, and the model keeps including them. You lift that rule to its own bolded line near the top, restate it positively as redact all personal names with the token REDACTED, wrap the input document in delimiters, and add one example showing a name correctly redacted. Compliance jumps.
Read the original → ai.google.dev
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.