CodeQuest101Advanced RAGChapter Studio
Advanced RAG

8 chapters · Learn by building

RAG basics

Chapter 06 / 08

Follow relationships back to evidence.

Connect products, suppliers, and policies, then inspect the documents supporting each link.

The idea, in plain words

Retrieve across connected facts

One document may name the X200's battery supplier, while another describes that supplier's replacement policy. A knowledge graph links those entities so retrieval can follow the relationship.

This lesson uses authored, source-backed graph facts and local traversal. Global GraphRAG can instead search community summaries for broader questions; this local demonstration is not that global summary pipeline.

1

Find the entities mentioned in the question.

2

Follow the selected number of relationship hops.

3

Collect the source passages supporting those relationships.

4

Read and cite the passages, rather than treating an unlabeled edge as proof.

Decision inspector

Where does this link come from?

Inspect traversed relationships
X200 headset

product · Reached by the current traversal

Relationships can expose evidence split across documents when a question requires several linked facts.

Math & code

A hop follows one relationship; traversing more hops expands the candidate evidence, not the certainty of the answer.

entities = question_entities
relations = traverse(entities, hop_limit)
passages = source_passages(relations)
Developer’s reasoning

Entity matching or extraction can be wrong. An edge needs source provenance. These factual relationships are different from an HNSW index's vector-proximity links.

Sources & model provenance

sentence-transformers/all-MiniLM-L6-v2 · 384D · mean pooling + L2 normalization.

cross-encoder/ms-marco-MiniLM-L6-v2 · recorded raw logits.

Rewrites, subquestions, HyDE text, and answer claims are authored teaching examples.

Encoder revision onnx-sha256:4f148ba8ae9c2c7fbee4af2b132db8d06c6a6545b47fc83bbb98c3d22b8393e6

Reranker revision 233902d25c440f23af6f7d6e94d2946bac0bee0a

Corpus SHA256 d1c21da297e88785f9a6ac434e0a58f3e10975052a48419ba511145d461f704e

Current sources only; archived documents D9 are excluded before retrieval.

GraphRAG · Retrieve across connected facts