The retrieval prompt should preserve exact identifiers, units, and site scope while asking for conceptual matches. Dense similarity can find related wording but miss a specific part code; keyword search can find the code but miss a paraphrased procedure. Candidate generation may combine both, then deduplicate by document and passage identity. Apply the same authorization constraint to every branch before merging results. A model-rewritten query is a search aid, not a replacement for the original request: retain the original entity and reject rewrites that change it. Retrieval recall is measured against answer-bearing authorized passages, not against a list of merely similar texts.
Retrieval prompts: balance exact identifiers and semantic recall
Operational case
A technician asks for the P-47 seal reset on site M-12. One approved manual says 'P-47 seal reset'; another describes 'restore the gland pressure after seal service' without the code in its heading. An exact-token search and a semantic search each contribute a candidate. A third hit concerns pump P-74 and should be rejected after identifier checking. The restricted C-91 contract remains absent from both candidate streams. The prompt sees two authorized passages with document version and section ID, then asks whether they cover the same maintenance state or distinct steps. It does not merge them merely because both mention seals.
Original request: site M-12, pump P-47, seal reset.
Exact branch: preserve P-47 and M-12.
Semantic branch: gland-pressure restoration after seal service.
Filter both branches by server-authorized corpus.
Deduplicate passage IDs; reject P-74 identifier mismatch.Performance and operating cost
If exact and semantic search return K and S candidates, deduplication with a set is O(K+S) time and memory before reranking. Two search branches cost more latency and index work than one, so use them for queries where exact codes and conceptual language both matter. A broadened candidate pool helps recall but can lower precision; measure whether the correct authorized passage survives the final context budget. Keep the original query, rewritten queries, and candidate IDs in a private trace for failure analysis without copying raw restricted text into logs.
Common Mistakes
- Do not let a semantic near-match replace P-47 with P-74.
- Do not run one branch without the caller's permission filter.
- Do not judge recall by total hit count alone.
Connected lessons
- Prompt engineering applications
- Prompt Engineering
- Retrieval queries: resolve references without adding facts
- Retrieved context: select sufficient evidence before writing the answer
- Document chunks: preserve the clause and its governing exception
- Retrieval prompts: enforce document permission first
- Retrieval prompts: rerank only authorized, current evidence
- Retrieval prompts: pack evidence and map claims
- Retrieval release: test permission changes and deletion
- Project: secure the Meridian maintenance assistant
- Authorized-retrieval prompt decisions
