Skip to content
Agent Field Notes
Course contentsExpand a topic to choose a lesson.

SYSTEMATIC LEARNING / FOUR-LEVEL COURSE

Entity disambiguation and constraint preservation in query rewriting

Examining multiple rounds of reference, entity linking, clarification, and original constraint preservation.

Learning objectives: The purpose of rewriting is to express the known intention more retrievably and not to create missing facts. Entity, negation, time, and scope must have a source, and ambiguities affecting the answer need to be preserved or clarified.

Content checked: 2026-10-03 · Each level has independent explanations, tasks and inspections

Choose a starting point based on your familiarity with this topic. Current level: Design · Explain the trade-offs. After completing the task, continue to the next level. Reading and self-checks alone do not establish mastery.

On this level

Review the prerequisites

Suitable for: Backend developers learning Agent applications.

Entity disambiguation and constraint preservation in query rewriting
The purpose of rewriting is to express the known intention more retrievably and not to create missing facts. Entity, negation, time, and scope must have a source, and ambiguities affecting the answer need to be preserved or clarified.

How does the mechanism work?

Step-by-step explanation
  1. What should I do if the two candidates are very similar?

    Move from resolving references to ambiguities that can change the answer.

  2. How can a user retain an entity that he just rejected in the last round?

    Multi-turn state must handle corrections, rather than merely accumulate related terms.

  3. How to deal with different definitions brought by query expansion?

    Even when broader coverage improves, prevent different business definitions from being merged.

Design · Explain the trade-offs

Explain design trade-offs · Entity disambiguation and constraint preservation in query rewriting

Objectives of this level: Separate extraction, resolution and retrieval evidence under revocation.

Visual guide · Resolve intent without adding facts

Resolve intent without adding facts

This function validates an already extracted intent, not a model rewrite. Preserve exclusions and dates; current access must be checked again at retrieval. Select the figure to open it at full size.

Same after-sales project

The after-sales user asks “Can it be returned, excluding gifts, during October?” after comparing two orders. This exercise validates a structured intent envelope from already extracted inputs; it does not parse natural language, generate a model rewrite or measure retrieval quality. The server’s current allowed_entities narrows candidates but mentioning an order does not grant access.

The existing capstone main-return creates a return application; it does not execute a refund. These manifests are independent fictional extensions or policy/evidence/counting exercises. They do not add real refunds, publication, model calls or Java execution to the capstone runtime.

Changed contract and architecture decision

Add a user selection next turn, then revoke access before retrieval. Specify extraction→resolution→authorization→retrieval→citation stages and their separate evaluation cases. Junior owns this envelope; intermediate integrates an actual retriever and before/after intent logs; senior designs tenant/version/cache rechecks plus one specialty experiment. Low-risk candidate exploration may be a proposed alternate policy but is not implemented here. To claim improved RAG, supply annotated real rewrite/retrieval outputs, including negation and time-bound failures; fixed envelope checks alone cannot establish model comprehension.

Independent deliverables

Submit a condition delta, at least two alternatives with rejected reasons, ADR/owner/rollback triggers, one personally authored negative test and code or checker diff with the same input red→green rerun. Label architecture proposals, executed local evidence, actual integrations and production responsibility separately. A reviewer must introduce an independently chosen condition at assessment; the public fixed manifests alone do not prove transfer. Do not invent measurements or enterprise incidents.

Responsibility boundary

Four tracks are learning methods, not job levels. Junior candidates own bounded code and a counterexample; intermediate candidates own integration/recovery and changed-business evidence; senior candidates add architecture, isolation/migration/incident ownership and one specialty. Real API and JD-required production experience stay separate evidence gates. A fixed local pass is not a learner mastery or hiring certificate.

code example

Change the boundary and defend responsibility

Add a user selection next turn, then revoke access before retrieval. Specify extraction→resolution→authorization→retrieval→citation stages and their separate evaluation cases. Junior owns this envelope; intermediate integrates an actual retriever and before/after intent logs; senior designs tenant/version/cache rechecks plus one specialty experiment. Low-risk candidate exploration may be a proposed alternate policy but is not implemented here. To claim improved RAG, supply annotated real rewrite/retrieval outputs, including negation and time-bound failures; fixed envelope checks alone cannot establish model comprehension.

Acceptance task for this level

Deliver the course-specific changed-contract ADR, alternatives, owner/rollback policy and one independent executed counterexample; keep unexecuted claims pending. Contract: build_query_plan(payload).

Acceptance self-checks

Reading this browser’s record…

Hide the answer and check your understanding

Does this local pass establish a model can resolve pronouns?

Further explanations and practice

When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.

All linked explanations and exercises (1 )

Sources and verification scope

The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.