Graph RAG retrieval

그래프 기반 RAG 검색

Follow entity relationships from a question to connected evidence.

···
html
<div class="v"><header><b>GRAPH EVIDENCE</b><span id="state"></span></header><main><div class="gflow" id="gflow"></div><div class="evidence" id="evidence"></div></main><footer>question → entities → source passages</footer></div>
css
.v{width:min(92vw,660px);height:min(86vh,310px);box-sizing:border-box;padding:clamp(9px,2.5vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;flex-direction:column;gap:7px;color:var(--fg);font:500 clamp(15px,4.5vmin,19px)/1.25 var(--font-sans, sans-serif)}.v header,.v footer{display:flex;justify-content:space-between;align-items:center;gap:8px;white-space:nowrap}.v header b{color:var(--accent);font-size:.9em}.v header span,.v footer{color:var(--muted);font-size:.82em}.v main{flex:1;min-height:0;position:relative;overflow:hidden}.v .mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.v .active{background:var(--accent)!important;color:var(--bg)!important;border-color:var(--accent)!important}.v .muted{opacity:.45} .gflow{height:75%;display:grid;grid-template-columns:1fr auto 1fr auto 1fr;align-items:center;gap:clamp(2px,1vw,12px)}.gcol{min-width:0;text-align:center}.gcol small{display:block;color:var(--muted);font-size:.72em;margin-bottom:4px}.gcol b{display:inline-grid;place-items:center;min-width:clamp(20px,5vmin,36px);height:clamp(20px,5vmin,36px);padding:0 2px;margin:1px;border:1px solid var(--line);border-radius:5px;font:600 .72em ui-monospace,monospace}.garrow{color:var(--muted);font-size:.85em}.evidence{text-align:center;color:var(--accent);font-size:.75em}
js
let step=0;function col(title,labels,active){return "<div class=gcol><small>"+title+"</small>"+labels.map(x=>"<b class='"+(active?"active":"muted")+"'>"+x+"</b>").join("")+"</div>"}function draw(){document.getElementById("gflow").innerHTML=col("QUESTION",["Q"],true)+"<span class=garrow>→</span>"+col("ENTITIES",["A","B"],step>=1)+"<span class=garrow>→</span>"+col("SOURCES",["1","2"],step>=2);document.getElementById("evidence").textContent=["find question entity","follow A → B","collect linked passages","evidence ready"][step];document.getElementById("state").textContent=["seed","expand graph","collect","ready"][step];step=(step+1)%4}draw();setInterval(draw,850)

Graph-based RAG organizes entities and relationships extracted from documents into a graph. Retrieval starts from question entities, follows edges, and gathers connected source passages.

It can connect facts spread across documents, but graph construction has a cost. Incorrect extracted edges can propagate into results, so source links need validation.

When to use

Use it for multi-hop questions whose evidence spans documents.

Open as page ↗