This prompt is designed for intelligence, investigation, and data engineering teams who need to link entity references across multiple documents, deduplicate records, and produce a single merged profile with source citations. Use it when you have a collection of documents that mention the same real-world entity (person, organization, location, product) using different names, partial details, or conflicting attributes. The prompt instructs the model to act as a resolution engine: it identifies which mentions refer to the same entity, merges their attributes, flags conflicts, and attaches a confidence score to every link decision.
Prompt
Cross-Document Entity Resolution Prompt Template

When to Use This Prompt
Defines the job-to-be-done, ideal user, required context, and boundaries for the cross-document entity resolution prompt.
This is not a single-document extraction prompt. It assumes you have already extracted entity mentions from each document and are now feeding those mentions into the resolution step. The output is a structured entity profile ready for insertion into a master data management system, knowledge graph, or investigative case file. The ideal user is a data engineer or analyst who controls the extraction pipeline upstream and needs a reliable, auditable resolution step before ingestion.
Do not use this prompt when you need real-time streaming resolution, when entity mentions have not been pre-extracted, or when the documents share no common entity references. It is also unsuitable for resolving entities where the ground truth is unknowable without external authoritative databases—this prompt resolves mentions, not identities against a golden master. For high-stakes compliance or legal workflows, always route low-confidence merges to a human review queue and log every resolution decision with its evidence chain.
Use Case Fit
Where cross-document entity resolution prompts deliver reliable value and where they introduce unacceptable risk. Use these cards to decide if a prompt-based approach fits your operational context before investing in evaluation harnesses.
Good Fit: Multi-Source Investigation
Use when: analysts manually correlate entities across 5–50 documents and need structured merge proposals with provenance. Guardrail: require citation anchoring for every merged field so reviewers can trace claims to source spans.
Bad Fit: Real-Time Transactional Deduplication
Avoid when: latency must be under 200ms or throughput exceeds 1000 records per second. LLM resolution is too slow and expensive for operational MDM pipelines. Guardrail: use deterministic matching for high-volume flows; reserve prompts for periodic batch reconciliation of edge cases.
Required Inputs
Must have: source documents with extractable entity mentions, a defined entity schema, and at least one canonical reference set for evaluation. Guardrail: if no ground truth pairs exist, start with a human-adjudicated golden dataset of 50–100 resolution decisions before prompting.
Operational Risk: False Merges
What to watch: the model confidently merges two distinct entities because they share a name and context. This is the highest-consequence failure in investigation workflows. Guardrail: implement a merge confidence threshold below which proposals route to human review; never auto-merge without explicit approval for high-risk domains.
Operational Risk: Missed Links
What to watch: the model fails to connect the same entity across documents due to name variants, transliteration differences, or sparse context. Guardrail: run recall-focused eval sets with known alias pairs and transliteration edge cases; tune prompt to prefer over-linking with confidence flags over silent misses.
Scale Boundary
What to watch: prompt-based resolution degrades when document count exceeds the context window or when entity mentions number in the thousands. Guardrail: pre-cluster mentions with lightweight embeddings before prompting; feed the model only candidate pairs within a manageable window, not the full corpus.
Copy-Ready Prompt Template
A production-ready prompt for merging partial entity profiles across multiple documents into a single canonical record with source citations, confidence scores, and conflict notes.
This template is designed for intelligence analysts, investigation teams, and data engineers who need to resolve entity references across multiple documents into a single merged profile. The prompt expects pre-extracted entity fragments from each source document—not raw text—and produces a structured output that includes the canonical entity, field-level provenance, merge confidence, and explicit conflict flags. Before using this prompt, ensure you have already run per-document extraction and have a list of candidate entity mentions that may refer to the same real-world person, organization, or object. Do not use this prompt when you need real-time streaming resolution, when source documents are not yet extracted, or when the entity type requires domain-specific normalization rules that haven't been applied upstream.
textYou are an entity resolution specialist. Your task is to merge multiple partial entity profiles extracted from separate documents into a single canonical record. Each input profile represents a mention of what may be the same real-world entity. You must decide which profiles refer to the same entity, produce a merged canonical record, and document your evidence for every field. ## INPUT You will receive a list of entity mention objects. Each object contains: - mention_id: unique identifier for this mention - source_document_id: identifier for the source document - entity_type: PERSON, ORGANIZATION, LOCATION, PRODUCT, or OTHER - fields: a dictionary of extracted attributes (may include name, aliases, date_of_birth, address, phone, email, identifiers, role, description, etc.) - extraction_confidence: 0.0 to 1.0 confidence score from the extraction step - source_span: the text span from which this entity was extracted [ENTITY_MENTIONS] ## CONSTRAINTS - Merge mentions only when you have sufficient evidence they refer to the same entity. When uncertain, keep them separate and flag the relationship as POSSIBLE_MATCH. - For each merged field, cite the mention_id(s) that provided the value. - If two mentions provide conflicting values for the same field (e.g., different birth dates), do not silently pick one. Record both in a conflicts array with source citations. - Assign a merge_confidence score (0.0 to 1.0) reflecting your certainty that all merged mentions refer to the same entity. - Flag any fields that are missing from all mentions as null with a reason: MISSING. - Do not hallucinate values. Every output field must be traceable to an input mention. ## OUTPUT SCHEMA Return a JSON object with this structure: { "canonical_entities": [ { "canonical_id": "string, a unique ID you generate for this merged entity", "entity_type": "PERSON | ORGANIZATION | LOCATION | PRODUCT | OTHER", "merged_fields": { "field_name": { "value": "the resolved value or null", "source_mentions": ["mention_id"], "confidence": 0.0 } }, "conflicts": [ { "field_name": "string", "values": [ {"value": "string", "source_mention": "mention_id"} ], "resolution_note": "string explaining why resolution wasn't possible" } ], "merge_confidence": 0.0, "merge_rationale": "string explaining the evidence for this merge", "unmerged_mentions": ["mention_id"] } ], "possible_matches": [ { "mention_id_a": "string", "mention_id_b": "string", "similarity_score": 0.0, "evidence": "string describing why these might match", "recommendation": "HUMAN_REVIEW" } ], "processing_notes": ["string"] } ## EXAMPLES [FEW_SHOT_EXAMPLES] ## RISK LEVEL [HIGH_RISK_FLAG: false]
To adapt this template for your workflow, replace the square-bracket placeholders before sending it to the model. The [ENTITY_MENTIONS] placeholder should contain your pre-extracted entity fragments as a JSON array—ensure each object includes the required fields (mention_id, source_document_id, entity_type, fields, extraction_confidence, source_span). The [FEW_SHOT_EXAMPLES] placeholder is optional but strongly recommended: include 2-4 worked examples showing correct merges, correct non-merges, and conflict handling. If your use case involves high-stakes decisions—such as watchlist matching, financial investigations, or legal proceedings—set the [HIGH_RISK_FLAG] to true and add an additional constraint requiring human review before any merge is finalized. For production deployments, validate the output against the schema before ingestion, log every merge decision with the input mentions and model response, and consider running a second-pass verification prompt on low-confidence merges (merge_confidence below 0.7) or any entry in the possible_matches array.
Prompt Variables
Inputs the Cross-Document Entity Resolution prompt needs to work reliably. Validate these before sending to avoid silent merge failures or hallucinated entity links.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[SOURCE_DOCUMENTS] | Array of documents to resolve entities across | [{"doc_id": "doc-1", "text": "..."}, {"doc_id": "doc-2", "text": "..."}] | Must contain at least 2 documents. Each doc_id must be unique and non-empty. Text fields must be non-null strings. Reject if any document text exceeds model context window after prompt assembly. |
[ENTITY_TYPE] | Type of entity to resolve across documents | "person" | Must match one of: "person", "organization", "location", "product", "event", "custom". If "custom", [CUSTOM_ENTITY_DEFINITION] becomes required. Validate against allowed enum before sending. |
[CUSTOM_ENTITY_DEFINITION] | Definition of custom entity type when ENTITY_TYPE is custom | "A vessel or ship referenced by name, IMO number, or call sign" | Required only when ENTITY_TYPE is "custom". Must be a non-empty string under 500 characters. Null allowed otherwise. Reject if present but ENTITY_TYPE is not "custom". |
[RESOLUTION_RULES] | Rules governing when two entity references should be merged | "Merge if name matches exactly OR if email or phone number matches. Do not merge on name alone if location conflicts." | Must be a non-empty string. Should specify matching fields, conflict handling, and merge thresholds. Test that rules are parseable by running a known merge pair through the prompt and checking adherence. |
[OUTPUT_SCHEMA] | JSON schema describing the expected output shape | {"type": "object", "properties": {"canonical_entities": [...]}} | Must be valid JSON Schema. Validate with a schema parser before sending. Schema must include fields for entity_id, canonical_name, aliases, source_doc_ids, confidence_score, and conflict_notes at minimum. Reject if required fields are missing. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score for automated merge acceptance | 0.75 | Must be a float between 0.0 and 1.0. Merges below this threshold should be flagged for human review. Validate range. If null, default to 0.7 and log a warning. |
[MAX_ENTITIES_PER_DOC] | Upper bound on entities extracted per document to prevent runaway extraction | 50 | Must be a positive integer. Used to guard against prompt hallucination of spurious entities. Validate as integer > 0. If null, default to 100 and log. |
[NORMALIZATION_RULES] | Rules for normalizing entity names before comparison | "Lowercase all names. Strip titles (Mr, Dr, PhD). Expand common abbreviations (Corp -> Corporation)." | Must be a non-empty string. Should specify case handling, title stripping, abbreviation expansion, and punctuation rules. Test with known variant pairs to confirm normalization produces expected canonical forms. |
Implementation Harness Notes
How to wire the Cross-Document Entity Resolution prompt into a production application with validation, retries, logging, and human review.
The Cross-Document Entity Resolution prompt is not a standalone tool—it is a component inside a larger entity resolution pipeline. The prompt expects a batch of document excerpts and a target entity type, and it returns a set of merged entity profiles. In production, you will typically call this prompt after a document ingestion step and before writing resolved entities to a master record store. The application layer is responsible for chunking documents, assembling the input context, calling the model, validating the output schema, and deciding what to do with low-confidence merges.
Input assembly and batching. Before calling the prompt, collect document excerpts that contain entity mentions. Each excerpt should include a stable document identifier and a snippet of surrounding text. The prompt template uses the [DOCUMENTS] placeholder, which expects a JSON array of objects with doc_id, text, and optional metadata fields. If you are processing a large corpus, batch documents into groups of 5–15 per prompt call to stay within context limits while giving the model enough cross-document signal. Avoid sending hundreds of documents in a single call—the model will miss cross-document links and hallucinate merges. For very large corpora, pre-cluster documents by shared attributes (date range, geography, topic) before sending them to the resolution prompt.
Output validation and schema enforcement. The prompt returns a JSON object with a resolved_entities array. Each resolved entity must contain canonical_name, entity_type, mentions (with doc_id and source_span), confidence_score, and merge_rationale. Validate the output against this schema immediately after the model responds. Use a JSON Schema validator to catch missing fields, type errors, and malformed structures. If validation fails, retry the prompt once with the validation error message appended to the [CONSTRAINTS] section. If the retry also fails, log the failure and route the batch to a human review queue. Do not silently accept malformed entity records into your master store.
Confidence thresholds and human review. The prompt produces a confidence_score between 0.0 and 1.0 for each resolved entity. Configure a threshold in your application (start with 0.7) below which merges are flagged for human review. For high-stakes domains like due diligence or compliance, route all merges below 0.9 to a review interface where an analyst can confirm, reject, or modify the merge decision. Log every human override to build a feedback dataset for future prompt improvements. The merge_rationale field is critical here—it gives the reviewer enough context to make a fast decision without re-reading all source documents.
Model choice and tool integration. This prompt works best with models that have strong reasoning and structured output capabilities, such as GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro. Avoid smaller or older models that struggle with multi-document reasoning and consistent JSON output. If your application already uses a retrieval system, pass the top-k retrieved document excerpts directly into the [DOCUMENTS] placeholder rather than asking the model to search. For entity resolution at scale, consider pairing this prompt with a lightweight mention-extraction step that runs first, so the resolution prompt receives pre-extracted entity mentions rather than raw text. This reduces token usage and improves merge accuracy.
Logging, monitoring, and iteration. Log every prompt call with the input document count, output entity count, confidence distribution, validation pass/fail status, and human review rate. Monitor these metrics over time to detect drift—if the average confidence score drops or the human rejection rate rises, your source documents may have changed or the model may need a prompt update. Store resolved entities with their doc_id and source_span references so downstream systems can always trace a merged entity back to its original evidence. When you update the prompt template, run a regression test against a golden set of known entity pairs to catch regressions in merge quality before deploying to production.
Expected Output Contract
Defines the structure, types, and validation rules for the merged entity profile returned by the Cross-Document Entity Resolution prompt. Use this contract to parse, validate, and ingest the model response into downstream systems.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
resolved_entity.canonical_name | string | Must be the most complete authoritative name. Not null or empty. Length <= 500 characters. | |
resolved_entity.entity_type | enum string | Must match one of: [PERSON, ORGANIZATION, LOCATION, PRODUCT, EVENT, OTHER]. Case-sensitive. | |
resolved_entity.aliases | array of objects | Each object must contain 'name' (string, required) and 'source_document_ids' (array of strings, min 1 item). Empty array allowed if no aliases found. | |
resolved_entity.attributes | object | Keys must be attribute names from [INPUT_ATTRIBUTE_SCHEMA]. Values must match the declared type. Null values allowed only for optional attributes. | |
resolved_entity.merged_from_entities | array of strings | Must contain at least 2 entity IDs from the input documents. Each ID must be a non-empty string matching the pattern ^[A-Za-z0-9_-]+$. | |
evidence.merge_confidence | number | Must be a float between 0.0 and 1.0 inclusive. Values below [CONFIDENCE_THRESHOLD] should trigger human review. | |
evidence.conflict_notes | array of objects | Each object must contain 'attribute' (string), 'values' (array of strings, min 2), and 'resolution' (enum: RESOLVED_AUTOMATICALLY, FLAGGED_FOR_REVIEW). Empty array if no conflicts. | |
source_citations | array of objects | Each object must contain 'document_id' (string), 'entity_id' (string), and 'evidence_spans' (array of strings, min 1). At least one citation per merged entity required. |
Common Failure Modes
Entity resolution across documents breaks in predictable ways. These are the most common failure modes in production cross-document resolution pipelines and how to guard against them before they corrupt downstream systems.
False Merges from Weak Signals
What to watch: The model merges two distinct entities because they share a common name, location, or role. This is the most damaging failure mode—once merged, downstream analytics treat separate entities as one. Guardrail: Require at least two independent matching signals (name + identifier, name + date-of-birth, name + address) before allowing a merge. Add a merge_strength field and route single-signal matches to human review.
Missed Links from Overly Strict Matching
What to watch: The model fails to link the same entity across documents because of minor name variations, typos, transliteration differences, or missing fields. This creates duplicate entity records that fragment downstream analysis. Guardrail: Implement fuzzy matching pre-processing for names and identifiers before the resolution prompt runs. Include explicit alias expansion rules and transliteration normalization in the prompt's pre-resolution instructions.
Context Window Truncation Silently Dropping Evidence
What to watch: When resolving entities across many documents, the prompt exceeds the context window. The model silently drops middle documents or late evidence, producing resolution decisions based on incomplete information without warning. Guardrail: Chunk documents into batches sized for the model's context window, resolve within each batch, then run a second-pass merge across batch results. Log document counts in and out of each resolution step.
Confidence Scores That Don't Calibrate
What to watch: The model outputs high confidence for incorrect merges and low confidence for correct ones. Raw LLM confidence scores are not calibrated probabilities and will mislead threshold-based automation. Guardrail: Calibrate confidence thresholds against a golden dataset of known entity pairs. Use a separate calibration step that maps raw scores to empirical precision rates. Set automation thresholds based on calibration curves, not raw scores.
Temporal Inconsistency in Entity Attributes
What to watch: The model merges entities correctly but fails to handle attribute changes over time—old addresses, previous employers, former names. The merged profile presents contradictory attributes as conflicts rather than temporal changes. Guardrail: Add temporal reasoning instructions that distinguish between conflicting attributes (error) and time-sequenced attributes (change). Include valid_from and valid_until fields in the output schema for time-varying attributes.
Citation Drift Under Load
What to watch: As document count increases, the model starts fabricating or misattributing source citations. It cites document 3 for evidence that actually came from document 7, or invents page references that don't exist. Guardrail: Post-process every citation against source documents using exact string matching or embedding similarity. Flag citations below a similarity threshold for human review. Include a citation_verified boolean in the output that defaults to false until post-processing confirms it.
Evaluation Rubric
Run these checks against a golden dataset of known entity pairs to validate resolution quality before shipping. Each criterion targets a specific failure mode in cross-document entity resolution.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
True Merge Recall |
| System fails to link [ENTITY_A] and [ENTITY_B] when ground truth confirms same entity | Run prompt against 100+ confirmed true-merge pairs; count missed links |
False Merge Precision | <= 0.03 false merge rate on known distinct-entity pairs | System merges [ENTITY_C] and [ENTITY_D] when ground truth confirms different entities | Run prompt against 100+ confirmed distinct-entity pairs; count incorrect merges |
Confidence Score Calibration | Mean confidence >= 0.85 for correct merges; mean confidence <= 0.40 for incorrect merges | High confidence on false merges or low confidence on true merges indicates miscalibration | Bin predictions by confidence decile; compute expected calibration error against ground truth labels |
Source Citation Completeness |
| Merge decision present but [SOURCE_SPAN] field is null, empty, or references non-existent document section | Parse output for citation fields; verify each citation resolves to a valid source document and span |
Conflict Flag Accuracy |
| System either ignores contradictory attribute values or flags non-conflicting variations as conflicts | Inject documents with known conflicting attributes; verify [CONFLICT_NOTES] field presence and accuracy |
Alias Table Completeness |
| Known name variants, transliterations, or abbreviations missing from [ALIASES] output array | Compare output alias tables against pre-compiled alias ground truth for each resolved entity |
Null vs. Missing Distinction | Null fields explicitly annotated with reason; missing fields flagged as [MISSING] not silently omitted | Required field absent from output without explanation or null value present without null-reason annotation | Schema-validate output; check that every null field has corresponding [NULL_REASON] and every missing required field has [MISSING_FIELD] flag |
Temporal Consistency |
| Entity profile shows birth date after death date or overlapping non-overlapping roles with conflicting timestamps | Parse all temporal attributes; run temporal constraint validator checking sequence, overlap, and impossible intervals |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a small set of 3–5 documents. Remove strict schema requirements initially—ask for a narrative merge summary with inline citations instead of a typed JSON schema. Use a frontier model with a high context window. Focus on whether the model correctly identifies the same entity across documents before worrying about output format.
Watch for
- Over-merging: the model links entities that share only superficial attributes (e.g., same city, same industry)
- Under-merging: the model creates duplicate profiles for the same entity because of minor name variations
- Citation drift: source references that don't actually contain the claimed evidence
- Missing conflict notes when two documents disagree on a fact about the same entity

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us