Apply to my task
arXiv:2507.16711 ★ 73 Jul 22, 2025

A Structured Prompt for Document Analysis: Three Commands That Kill Hallucinations

Key result

The problem: an LLM makes things up when analyzing your documents not because the tech is immature, but because you never explicitly told it not to. A structured prompt with three mandatory blocks turns any LLM chat into a reliable text analyst (reviews, reports, contracts) with citations and no fantasies. The trick: separate instructions from data with tags, add three explicit commands ("think out loud," "cite the source," "admit when you don't know") and the model stops improvising. Instead of a murky retelling, you get a structured breakdown tied to specific paragraphs.

Advancing Risk and Quality Assurance: A RAG Chatbot for Improved Regulatory Compliance

Key Aspects of the Study:

The study describes building a chatbot for compliance specialists that helps them work with a large volume of complex legal documents. It uses RAG (Retrieval Augmented Generation), where the model doesn't just answer from its general memory but searches a dedicated knowledge base and uses the retrieved chunks to generate the answer. The authors show that combining advanced retrieval methods with, most importantly, a purpose-built prompt significantly improves the accuracy and reliability of the answers.

Key Result: A well-designed prompt structure that makes the model "think" first and then answer, citing sources and admitting when information is missing, is a critical element of a reliable RAG assistant.


The Core of the Method, Explained:

For an everyday user, the essence of the method is moving from a simple "question-answer" prompt to a multi-part instruction that governs the LLM's behavior. Instead of just asking a question, you write the model a full "spec" inside a single prompt.

The approach presented in the study has three key parts, which you should clearly separate in your request:

  1. User Question: Your main question or task.
  2. Instruction Block: The most important part. These are meta-instructions telling the LLM how to think and how to format the answer. This block includes:
    • "Think before you answer" (Chain-of-Thought): The instruction Before answering the question, lay out your full thought process... makes the model first analyze the request and plan its answer. This sharply reduces the odds of impulsive, wrong answers.
    • "Don't make things up" (Anti-Hallucination Guardrail): The direct order If you cannot answer... state that the information is not present, don’t invent or hallucinate acts as a "guardrail" that teaches the model to admit not knowing instead of inventing facts.
    • "Cite your sources" (Grounding & Citation): The requirement After each fact you state, provide the corresponding document name... makes the model tie every claim to a specific chunk of the provided text. This boosts credibility and lets the user easily verify the information.
  3. Context Block: This is where you paste the text (an article, report, reviews, a meeting transcript) the model should base its answer on. Clearly separating the data with tags like <document context> helps the model understand what counts as "truth" for the current task.

So you're not just asking, you're programming the model to work with information in a specific, more reliable and structured way.


Practical Applicability:

  • Direct applicability: Very high. Users can copy the prompt structure from the paper, replace {user_question} and {retrieved_chunks} with their own data, and get a better result right away. This is especially useful for analyzing and summarizing your own texts (articles, reports, emails), which you can paste into the prompt context.

  • Conceptual value: Huge. The study clearly shows that an LLM isn't a "black box" but a system whose behavior can and should be controlled with clear instructions. It teaches a fundamental principle: separate the data from the instructions for processing it. This helps you understand why the model sometimes "hallucinates" (because nobody told it not to) and how to make it give structured answers.

  • Adaptation potential: Maximum. The template from the paper is a universal scaffold. It adapts easily to any task:

    • Review analysis: change the citation format to (review #5).
    • Meeting summary: change the instruction to "Highlight the key decisions and owners."
    • Content planning: change the instruction to "Analyze the article and suggest 5 blog post topics with links to the relevant paragraphs."

A Practical Example:

Say a marketer wants to analyze customer reviews of a new product to prepare a report for leadership.

Analyze the customer reviews and prepare a short summary of the product's main strengths and weaknesses.


Before giving your final answer, lay out your plan of action and analyze my request.
Your answer must be in English.
Your task is to identify the main strengths and weaknesses of the product mentioned in the reviews.
After each point (strength or weakness), you must state in parentheses the number of the review it comes from. For example: "The battery lasts a very long time" (Review 3).
If the reviews contain no information about some aspect (for example, packaging quality), say so directly: "The provided reviews contain no information about packaging." Do not invent anything or make assumptions.
Group all strengths under a "Strengths" section and all weaknesses under a "Weaknesses" section.



[Review 1]
"The camera is just gorgeous, the shots look like they came from a pro camera! But the body is really slippery, you can't carry it without a case. The screen is bright, the colors pop."

[Review 2]
"Very disappointed with the battery. It barely makes it to the evening with average use. On the plus side, it's really fast, apps open instantly. The camera is good, but not wow."

[Review 3]
"Best phone for the money. Performance is top-notch, nothing lags. The battery easily lasts a day and a half. The only downside is there's no headphone jack, which is inconvenient."

[Review 4]
"The screen is its main selling point. Watching videos is a joy. The camera, though, is mediocre, I expected more. The body smudges easily, it's always covered in fingerprints."

Why This Works:

This prompt is effective thanks to a combination of several mechanics described in the study:

  1. Thinking first (Chain-of-Thought): The phrase Before giving your final answer, lay out your plan of action... makes the LLM first break the task down (1. Read all the reviews. 2. Find mentions of pros. 3. Find mentions of cons. 4. Group them. 5. Format the answer with citations), which makes the final answer more logical and complete.
  2. Structure and markup: Using the <instruction> and <document context> tags clearly shows the model where the rules of the game are and where the data is. This lowers the chance the model will confuse an instruction with part of the text being analyzed.
  3. Grounding: The requirement to state in parentheses the number of the review makes the model not just generalize but find specific support for every word in the source text. This makes the answer verifiable and more trustworthy.
  4. A limiting instruction: The directive Do not invent anything or make assumptions directly fights the LLM's tendency to "fill in" information, improving the factual accuracy of the answer.

Another Practical Example

An HR specialist wants to quickly pull the key takeaways from the transcript of an exit interview with a departing employee.

Analyze the exit interview text and identify the key reasons for leaving, as well as suggestions for improving work processes.


Your answer must be in English.
Before giving your final answer, briefly describe your plan for analyzing the text.
Your task is to organize the interview information into two categories: "Reasons for Leaving" and "Suggestions for Improvement."
For each item in both categories, give a short quote from the text in quotation marks and the paragraph number in parentheses, for example: (Paragraph 3).
If the employee made no specific suggestions, write in the corresponding section: "No specific suggestions for improvement were made." Do not invent information.
Format the answer as bulleted lists.



[Paragraph 1]
"Overall, we had a good team, I was friends with a lot of people. But the main reason I'm leaving is the lack of opportunities for career growth. I spent three years in the same position, and nobody ever laid out any path to a promotion for me."

[Paragraph 2]
"Another thing is the constant overtime, which was never compensated. For the last six months I regularly stayed 2-3 hours late. That really wears you down. Management knew, but didn't do anything."

[Paragraph 3]
"As for what could be improved... I think the company should introduce a more transparent system of job levels and career tracks. So people understand what they need to do to grow. It would also be great to set up a system for tracking overtime and either paying for it or giving comp time."

[Paragraph 4]
"I have no complaints about the work itself, it was interesting. But the feeling that you're standing still kills all your motivation. I hope it'll be better at the new place."

Why This Example Works: The Mechanism.

This prompt works on the same fundamental principles as the previous one, adapted to a different task:

  1. Task decomposition: The model first makes a plan (find reasons, find suggestions, group, format), which ensures a systematic approach to analyzing the text.
  2. A clear separation of roles: The <instruction> and <document context> tags help the model keep rules and data apart. It understands that the text in <document context> is the source of facts, while the text in <instruction> is the algorithm to follow.
  3. Forced citation: Requiring a quote and paragraph number makes the model not just paraphrase but extract and precisely locate information. This guarantees the HR specialist's conclusions rest on the employee's actual words, not the model's interpretation.
  4. Structured output: Asking for bulleted lists by category ("Reasons for Leaving," "Suggestions for Improvement") saves the user time, since the information is already sorted and ready to drop into a report or further analysis.

Usefulness Score: 92

02

Main Evaluation Criteria

  • A. Relevance to prompting techniques: 10/10. The study provides a complete, ready-to-use prompt template with several cutting-edge techniques.
  • B. Better conversational answers: 9/10. The methods aim to improve accuracy, reduce hallucinations and ensure citability, which is critical for quality.
  • C. Direct practical applicability: 8/10. The prompt template can be copied and adapted immediately. However, the full RAG system described in the paper requires technical knowledge, which lowers the score a bit.
  • D. Conceptual value: 10/10. It explains the RAG concept perfectly at a practical level and shows how to "program" LLM behavior through instructions in the prompt.
  • E. New useful practice (clusters): The paper fits clusters 1 (Phrasing techniques), 3 (Structure optimization), 5 (Extraction and structuring), 6 (Context and memory) and 7 (Reliability and stability).
  • Practicality checklist: Gives ready-made phrases, shows structure, reveals behavioral quirks, offers ways to improve accuracy. (+15 points to the base score).
03

Numeric Usefulness Score

The study scores high because it contains one of the most valuable artifacts for a user: a detailed, multi-part prompt template. This template packs in several prompt-engineering best practices at once (Chain-of-Thought, limiting instructions, output formatting) that you can apply right away to improve the quality and reliability of LLM answers, especially when working with your own texts.

Counterarguments (why the score could be different):

  • Why higher (>95): The prompt template from this study is practically a "Swiss Army knife" for working with context. It's so universal and effective that adapting it can dramatically improve results for anyone who analyzes text. It's one of the most useful and complete instructions you'll find in research papers.
  • Why lower (<80): The paper's main focus is building and evaluating a complex RAG system, including optimizing chunking, embeddings and retrieval methods. These aspects are completely out of reach for an ordinary ChatGPT or Claude user. You can't influence chunk size or search type. So 90% of the paper has no direct practical value for them, and only the small "Prompt Design" section is relevant.

Research digest

Key result

The problem: an LLM makes things up when analyzing your documents not because the tech is immature, but because you never explicitly told it not to. A structured prompt with three mandatory blocks turns any LLM chat into a reliable text analyst (reviews, reports, contracts) with citations and no fantasies. The trick: separate instructions from data with tags, add three explicit commands ("think out loud," "cite the source," "admit when you don't know") and the model stops improvising. Instead of a murky retelling, you get a structured breakdown tied to specific paragraphs.

Principle

A standard request is like giving a new hire a task with no instructions. They'll guess as best they can. A structured prompt is a job description: what to do, how to think, what to say if you don't know. Three principles that change everything: Plan first, answer second. The command "describe your analysis plan before answering" is step-by-step reasoning (chain-of-thought). The model stops "shooting from the hip" and first breaks the task down: what to look for, where, how to group it. Impulsive errors drop. Data in one place, rules in another. The `` and `` tags draw a clear line: here's what to do, here's what to do it with. Without that line, the model mixes rules up with content and literally starts analyzing the instructions as part of the text. Explicit permission to say "I don't know." Without a direct command, the model is uncomfortable admitting ignorance, so it adds plausible details. The line "if the information isn't there, say so directly, don't make it up" takes that pressure off.

Why it works

An LLM is trained to be helpful and complete. That works against us: the model would rather add a plausible fact than say "I don't know." It's not a bug, it's built-in default behavior. A structured prompt overrides the defaults by hand. Requiring a source citation after every point is a forced "spot check": if the text has no support, the model can't write the point. It literally can't cite something that isn't there. Separating `` and `` works because the model sees a clear boundary: here are the rules of the game, here are the facts. Without the separation, instructions get "diluted" in the overall text and some of them get lost. The study showed that combining all three techniques in one prompt gives a qualitatively different result than any of them alone. It's not just a set of tips; it's a system where each element backs up the others.

When to apply

Analyzing any documents you paste into the prompt: customer reviews, meeting and interview transcripts, contracts and policies, articles and reports, especially when you need concrete conclusions tied to the source rather than a retelling. Especially useful when: a manager needs an interview report, a marketer needs a review summary, a lawyer needs specific contract clauses, an editor needs the structure of someone else's article for a content plan. NOT a fit for tasks where the model has no source text: then the `` block is simply empty and the method loses its point. It works specifically for analyzing your texts, not for generating out of thin air.

Mini recipe

1. Split the prompt into three parts: first the question or task, then the instruction block in `...` tags, then the text itself in `...` tags. 2. Add three mandatory commands to the instruction block: — "Before answering, briefly describe your analysis plan" — "After each point, cite the source: paragraph, review or section number" — "If the information isn't there, say so directly. Don't invent or fill in the blanks" 3. Add an output format: say how to structure the answer: bulleted list, sections, table. Without this the model picks on its own, and not always conveniently. 4. Paste the text into `` with markup: number the reviews, paragraphs or sections, so the citations in the answer are specific rather than "as noted above."

Examples

[BAD]: `Analyze the reviews and write what customers think of the product` [GOOD]: `Analyze the customer reviews and identify the product's pros and cons. Before answering, briefly describe your analysis plan. Answer in English. Group the information into two sections: "Strengths" and "Weaknesses". After each item, give the review number in parentheses, for example: (Review 2). If the reviews contain no information about some aspect, say so directly: "The reviews contain no information about X." Do not fill in the blanks. [Review 1] "Great camera, but the body is slippery" [Review 2] "Weak battery, but it's fast" [Review 3] "Best phone for the money, no headphone jack" `

In plain words

Here's the deal: modern companies are drowning in tons of internal policies, ISO standards and legal paperwork that nobody reads until the first audit. Traditional keyword search is useless here: it gives you a list of documents, not an answer. A system built on RAG (Retrieval-Augmented Generation) works differently: it doesn't just remember a database, it literally "goes to the library" for the right page at the moment you ask. That turns a dead file dump into an intelligent compliance officer that hands you a concrete answer backed by a link to the current regulation.

It's like having a nerdy lawyer with a phenomenal memory perched on your shoulder. You don't dig through the archive yourself; you ask, "Can we advertise this cream as therapeutic?" In a split second the lawyer flips through five thousand pages of fine print, finds the right paragraph and says: "No, you'll get fined, because Regulation No. 42 prohibits it." Instead of reading tea leaves or spending a week on an audit, you get a verified answer right here, right now.

It rests on three pillars: semantic search, context filtering and hallucination checks. The system first turns your question into a vector (a numeric code of meaning), finds the most similar chunks of text in the base and feeds them to the model. The key feature is strict adherence to the source. If the base has no answer, the bot isn't allowed to fantasize; it honestly says there's no data. This is critical in regulatory work, where any AI "freelancing" can cost a company millions in court.

The study was run on hard-core regulatory texts, but the principle is universal. The same setup can be stretched over review analysis, tech support or internal instructions for a factory. A marketer can dump thousands of angry comments into the system and ask, "What do people in Chicago complain about most?" The bot won't just spit out a tag cloud; it will pull out specific quotes and patterns a human would miss with tired eyes. RAG turns data chaos into structure you can actually make decisions with.

Bottom line: the era of searching for files by name is officially over. The future belongs to systems that understand meaning and take responsibility for every word with a link to a document. If your business still makes people check policy compliance by hand, you're living in the last century and asking for a regulatory faceplant. Roll out RAG now so you don't end up explaining to a regulator why your chatbot was just kidding.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on A Structured Prompt for Document Analysis: Three Commands That Kill Hallucinations arXiv:2507.16711

Sign in to apply this study New accounts get 50 free credits.

Get the week’s best papers by email

One email on Sundays with the highest-rated new techniques. Unsubscribe with one click.