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 → verifyReference 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
| Term | Meaning |
|---|---|
| Vector search | Uses embedding similarity to find meaning and paraphrases. Cross-language results depend on the embedding model. |
| Full-text search | Matches identifiers, names, acronyms, and numbers literally. |
| Summary retrieval | One embedded summary per whole document, not per chunk — for "what is this document about" questions a single chunk is too narrow for. |
| Graph retrieval | LightRAG's entity/relationship graph, built and traversed separately from chunk search — the only signal that connects facts across chunks or documents. |
| Cumulative union | In Lesson 5, the expected source counts as found when its metadata appears in any of the four signals. |
| Hybrid retrieval | In 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
| Column | Use this evidence | Don't claim |
|---|---|---|
| Vector result | retrieval.indexes.vector.all | That semantic search produced a correct answer. |
| Full-text result | retrieval.indexes.fulltext.all | That full-text ranking wins for every query. |
| Summary result | retrieval.indexes.summary.all | That a document-level summary hit means the chunk-level answer was found too. |
| Graph result | retrieval.indexes.graph.all | An exact hit — this column is approximate (see callout below). |
| Cumulative union | retrieval.cumulative["vector+fulltext+summary+graph"].all | Any fusion or ranking beyond "found somewhere among the four." |
| Interpretation | Which 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 shape | Useful first hypothesis | Next experiment |
|---|---|---|
| Exact document ID | Full-text search may recover what vector search misses. | Extract the ID, search for it literally, then merge and deduplicate. |
| Cross-lingual concept | Vector 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) question | Union 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.pydemo/eval_set.yamlreports/lesson-05-experiment.json
Continue learning: Open the matching standalone lesson · Course roadmap