Structured Prompting with Negative Constraints
What it does
A method of structured prompting with negative constraints for extracting data from text. The prompt consists of four layers: output format, positive rules (what to include), negative constraints (what to exclude), and edge case handling. Increases accuracy from 60% to 80%+ by explicitly forbidding the addition of non-existent information.
When it helps
Use this technique when you need to extract structured data from large volumes of unstructured text with high accuracy. Especially effective for scientific articles, reports, reviews, legal documents where accuracy and absence of extra information is important. Apply when basic prompts give too much 'creativity' from LLM — the model adds data that isn't in the text, or includes irrelevant information. The method is critical for creating databases, organizing archives
A prompt you can paste
Generic by design: it applies the technique without knowing your task. Adapt the marked parts.
### Role and Task
You are an expert data analyst. Your task is to analyze the provided text and extract specific information according to the defined structure.
### Output Format
Respond **SOLELY** in a Markdown table with the following columns:
- `Placeholder 1`
- `Placeholder 2`
- `Placeholder 3`
### Instructions and Constraints
1. **What to include:**
* Include all data points that match the defined criteria for each column.
* If a specific data point is not found for a column, leave the cell empty.
2. **What NOT to include (CRITICAL):**
* **DO NOT** include any information that does not directly correspond to the defined columns.
* **DO NOT** include any introductory phrases, greetings, summaries, or concluding remarks.
* **DO NOT** include duplicate entries if the same information appears multiple times.
### Text for Analysis
[Insert text for analysis here]
If this one does not fit, the two closest alternatives in the corpus are Layered Context Prompting and Prompt-based Extraction (Cloze Prompting with Verbalizer), which target the same failure from a different angle.
Worked example
The same technique applied to a concrete job: pull structured fields out of inconsistent invoices. Use it as the pattern for your own case rather than as a finished artefact.
### Role and Task
You are an expert data extraction specialist. Your task is to analyze the provided invoice texts and extract specific, structured information.
### Output Format
Respond **ONLY** with a Markdown table containing the following columns:
- `Invoice Number`
- `Invoice Date`
- `Vendor Name`
- `Total Amount`
- `Line Item Description`
- `Line Item Quantity`
- `Line Item Unit Price`
- `Line Item Total`
### Instructions and Constraints
1. **What to include:**
* Extract data for all identifiable invoices within the provided text.
* For each invoice, include all line items that are clearly listed.
* If a specific field (e.g., `Invoice Date`, `Total Amount`) is missing for an invoice, leave the corresponding cell in the table blank.
* For line items, if quantity or unit price is not explicitly stated but the line item total is present, infer the missing value if logically possible (e.g., Total = Quantity * Unit Price). If inference is not possible, leave blank.
* Include descriptions for line items as written in the text.
2. **What NOT to include (CRITICAL):**
* **DO NOT** include any introductory or concluding text, greetings, or summaries. Your entire response must be the Markdown table.
* **DO NOT** include information from sections that are clearly not part of an invoice (e.g., general company contact information not tied to a specific invoice, payment terms not associated with a particular invoice number).
* **DO NOT** include details about previous invoices or future payment schedules unless they are part of the current invoice's itemized list.
* **DO NOT** include taxes, discounts, or shipping costs as separate line items unless they are explicitly itemized as such with a description and amount. If they are part of the `Total Amount`, they should not be broken out further unless detailed.
### Text for Analysis
[Paste the inconsistent invoice texts here.]
Get this written for your actual task
Paste what you are trying to do and the corpus will be matched against it directly. Free, no account, about ten seconds.
single retrieval pass
That number is low on purpose, and it is real. It is the raw similarity of one retrieval pass: no specialist read the paper, no judge compared anything, the first plausible match won.
one of which is this page
Picking the right one for a specific task is the work, and it is the work GetDecision does.
| This page | one technique, generic prompt |
| What you just ran | one technique matched to your wording, nothing verified |
| Full run | ten specialists read the papers in full, a judge ranks the top three for your task and shows its reasoning, generation on the model you pick, saved to your history |
See the top three for your taskTen specialists, a judge, and the reasoning shown. Free account, first run included.
Run the full analysis