SHEN YIFull-Stack & AI

Paris • Singapore • Shanghai

RAG Formation · Reference

Semantic search, keyword search, and hybrid retrieval

A standalone cheat sheet for learning and testing RAG quality on this site.

$ reference --status
▸ course RAG Formation
▸ mode standalone reference
▸ status Complete
● learn → test → verify

Reference sheet

Semantic search, keyword search, and hybrid retrieval

The guided RAG Formation course content is complete; this reference is available for self-directed practice.

One-line rule

Before changing the retrieval architecture, measure which signal actually adds the expected source.

Glossary

TermMeaning
Vector searchUses embedding similarity to find meaning and paraphrases. Cross-language results depend on the embedding model.
Full-text searchMatches identifiers, names, acronyms, and numbers literally.
Summary retrievalOne embedded summary per whole document, not per chunk — for "what is this document about" questions a single chunk is too narrow for.
Graph retrievalLightRAG's entity/relationship graph, built and traversed separately from chunk search — the only signal that connects facts across chunks or documents.
Cumulative unionIn Lesson 5, the expected source counts as found when its metadata appears in any of the four signals.
Hybrid retrievalIn this system: all four signals run in parallel and their formatted results are concatenated — not fused or reranked. Real fusion only happens inside LightRAG itself.

How to read the table

ColumnUse this evidenceDon't claim
Vector resultretrieval.indexes.vector.allThat semantic search produced a correct answer.
Full-text resultretrieval.indexes.fulltext.allThat full-text ranking wins for every query.
Summary resultretrieval.indexes.summary.allThat a document-level summary hit means the chunk-level answer was found too.
Graph resultretrieval.indexes.graph.allAn exact hit — this column is approximate (see callout below).
Cumulative unionretrieval.cumulative["vector+fulltext+summary+graph"].allAny fusion or ranking beyond "found somewhere among the four."
InterpretationWhich expected source was added, duplicated, or is still missing.A general architecture decision based on one row.

Always match expected document references against source metadata, not arbitrary chunk text. Otherwise, cross-references can create false hits.

The graph column is approximate: LightRAG returns one flat context string, not a document list, so a hit there may come from a cross-reference inside another document rather than the target document itself.

Decision hints

Question shapeUseful first hypothesisNext experiment
Exact document IDFull-text search may recover what vector search misses.Extract the ID, search for it literally, then merge and deduplicate.
Cross-lingual conceptVector search may help when the embedding model is multilingual.Compare the cross-lingual row and verify that the model supports this assumption.
Two-document (multi-hop) questionUnion recall can be high even when answer quality is low.Check the graph column first — it's the signal built to connect two facts across documents — then inspect context assembly and generation.

Local pointers

  • demo/eval.py
  • demo/eval_set.yaml
  • reports/lesson-05-experiment.json

Continue learning: Open the matching standalone lesson · Course roadmap