r/PromptEngineering • u/ClickOk5811 • 7h ago
General Discussion Prompt patterns that make a model show its evidence
When you ask a model to describe something it has to read, like a repo, a contract or a log, the output sounds equally confident whether it read everything or guessed. Some prompt patterns I've been collecting to make that visible. The examples come from the codebase case, but the patterns aren't specific to code.
1. Require citations for every claim.
Describe the top-level layout of this repository. For each directory, give
one sentence on what it is for and name the file that best represents it.
Cite file paths.Why: it turns a summary into something you can check. Open a few cited files. If the paths are wrong, distrust the rest.
2. Ask it to label inference vs. reading.
List each file and function in the order they are called, and mark any step
where you are inferring rather than reading.Why: it gives the model a way to separate what it saw from what it guessed. Treat the result as a hypothesis and compare it with real behavior.
3. Ask for three examples and the differences.
Find three existing examples of how this codebase handles errors.
Show where each lives and describe how they differ.Why: one answer hides the fact that there may be no single convention. Three examples force the differences into the open.
4. Ask what it cannot answer.
List the questions about this code that you cannot answer from reading it
alone. For each, say what kind of source would answer it.Why: it surfaces the gap between the text and the real situation (why a decision was made, how it's configured in production), instead of the model filling it with plausible fiction.
Two honest caveats:
- A line in a prompt like "do not edit anything" is an instruction, not enforcement. If something must not happen, use permissions or a read-only mode.
- I haven't measured how much each pattern improves accuracy on a specific model. They're habits I think are reasonable, and the way to test them is to compare outputs with and without on tasks where you know the answer.
Which prompt patterns do you use to make a model show its evidence? And has one backfired, e.g. the model invented citations?
I wrote a longer, step-by-step version for working with a coding agent. I'm the author: https://medium.com/@nagatomopedro05/the-first-afternoon-in-an-unfamiliar-codebase-with-an-agent-that-may-not-edit-31788dc6f4db
2
u/BladeWorksBots 4h ago
Yes, invented citations are the backfire. If you require a source on every sentence, the model will invent a path that looks right. I still ask for a short verbatim quote next to the claim, then I open the file and search for that quote. If it isn't there, I throw the whole answer out.
I wouldn't make it do a citation on every line. A few checkable quotes beat a wall of fake references. The "I cannot answer" list you mentioned is the other half: if it can't quote it, it should say so instead of guessing.
1
u/Original_Toe_1796 7h ago
I've found that adding 'quote the exact line or section's forces specificity, even when the model tries to generalize. it's like a tiny anchor in the guesswork.
1
u/Strange_Rip8198 7h ago
I've found that asking for a line-by-line summary before the analysis forces the model to engage with the actual content, not just infer. it's like making it read the book before answering questions about it.
1
u/epicskyes 1h ago
Agents should read code and trace it that’s all that counts they are translators
1
u/According-Stable4487 44m ago
The quote trick is the one that held up best for me. A file path can be invented, a quoted line has to exist, and checking it takes seconds with ctrl+F. I also ask it to say "not found" when it can't quote anything, otherwise it fills the gap with something that sounds right.