An assistant for complex documents

Use one corpus to compare RAG strategies.

What you will learn

  • Explain: search and ranking are different stages
  • Apply the idea in an example: An assistant for complex documents
  • Recognize limitations and verify the exercise outcome

Use one corpus to compare RAG strategies. A template change needs a measured justification.

These steps refer to features identified in the application code. This material has not been validated on a live instance; check the documentation and the options in your version.

How it works, step by step

Search and ranking are different stages

Retrieval selects candidates and ranking orders them. top_k is the number of requested results; increasing it can bring evidence but also noise. A reranker examines the query and candidates more closely. It cannot recover a passage missing from the initial list. BM25 looks for lexical matches and helps with exact codes; vector search looks for semantic similarity. RRF combines positions in ranked lists instead of adding scores with incompatible units. Extra stages must justify their quality, latency and cost through testing.

Explicit relationships with provenance

A graph contains entities and relationships, such as Product → uses → Part. LLM extraction can confuse names or invent relationships; preserve the document supporting each fact. Bounded traversal looks for connections across multiple hops. Local Graph RAG combines Neo4j facts with vector passages. It is not automatically the Microsoft GraphRAG pipeline with community detection and reports. Dependency questions can benefit from a graph; simple FAQ questions may be cheaper with vector retrieval.

Define success before optimizing

Prepare representative requests and expected answers or properties. Include ordinary cases, ambiguity, missing data and tool errors. For RAG, measure evidence retrieval separately from answer correctness. Recall@k measures the share of relevant evidence found in the first k results; precision@k measures the share of returned results that are relevant. For agents, also track actions, permissions and stopping. An LLM-as-judge can speed evaluation but needs calibration against humans. Do not change prompt, model and index simultaneously if you want to understand what improved results.

The visual map

An assistant for complex documents Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. Compare the same question using separate multimodal, graph and hybrid configurations. Their answers are evaluated separately, not fused into a new template. Connections: Source documents → Passages and source metadata; Passages and source metadata → Vector index; Source documents → Vision model: describe visuals; Vision model: describe visuals → Visual descriptions and references; Visual descriptions and references → Vector index; User request → Multimodal configuration; Multimodal configuration → Compare against expected results; Compare against expected results → Human verification; User request → Graph configuration; Graph configuration → Compare against expected results; User request → Hybrid configuration; Hybrid configuration → Compare against expected results; Vector index → Multimodal configuration; Vector index → Graph configuration; Vector index → Hybrid configuration; Neo4j knowledge graph → Graph configuration; Visual descriptions and references → Multimodal configuration; Expected facts and sources → Compare against expected results. C03 · Relationship map An assistant for complex documents Input Source documents AI model / agent Vision model: describe visuals Store / index Neo4j knowledge graph Data Passages and source metadata Store / index Vector index Data Visual descriptions and references Input User request Processing Multimodal configuration Processing Graph configuration Processing Hybrid configuration Decision / control Compare against expected results Data Expected facts and sources Decision / control Human verification Main flow Data and context Feedback and return

Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. Compare the same question using separate multimodal, graph and hybrid configurations. Their answers are evaluated separately, not fused into a new template. On smaller screens, scroll horizontally to follow the entire diagram.

A complete example

Questions include exact codes, synonyms, part relationships and missing sources. Test Naive, Rerank, Graph, Hybrid and Router; add Multimodal only with verified vision ingestion.

Fictional exercise data

Source Information to use
Catalog LX-240 uses part P-12; P-12 uses adapter A-7.
Returns Requests within 14 days of receipt; unused product in original packaging.
Delivery Estimated 2–3 business days after dispatch, not guaranteed.

Starter questions: “Which adapter does LX-240 use?”, “Can I return a used product?” and “How long does delivery take?”. Add ambiguous and unanswerable cases. Keep the same source in every comparison.

Try it yourself

  1. Run identical tests across variants and inspect every differing result.
  2. Record the input, source and expected outcome before running the experiment. Use only the fictional data in the example.
  3. Follow the diagram stages. At every step record what information is received and produced; do not confuse intermediate output with the final outcome.
  4. Repeat after removing necessary information or making the input ambiguous. Check whether the system clarifies, stops or invents an answer.
  5. Compare with the explained solution. Keep the configuration, date, result and an explanation for differences. Change one thing and retest.

An explained solution

The table records retrieved evidence, correctness, time, consumption and Router route, including direct. A successful exercise lets you show the connection between input, stages and outcome. When information is missing, a cautious answer is more useful than invented details. Compare more than style: check conditions, sources and operations too.

When it helps and what can go wrong

Different sources or questions invalidate the comparison. Choose this approach when it improves a measured need. Keep a simple baseline and compare outcomes using identical inputs. One successful example does not establish reliability in every situation.

Check your understanding

Can a reranker fix an unindexed document?

No. The passage must first exist in the index and candidate list.

Does an AI-extracted edge prove the relationship is true?

No. Check its source and the identities of the entities.

What outcome should this exercise produce?

The table records retrieved evidence, correctness, time, consumption and Router route, including direct.

Words to remember

  • Rerank: A more careful reordering of candidates already retrieved.
  • Hop: Crossing one relationship in a graph.
  • Regresie / Regression: A change that breaks a previously correct case.

Sources and your next step

To prepare: R04 — Rerank RAG: better evidence first · R05 — Multimodal RAG: documents also contain images · R06 — Graph RAG and knowledge graphs · R07 — Hybrid RAG: meaning and exact words · R08 — Router RAG and choosing your retrieval strategy · E02 — Evaluating RAG stage by stage