Naive RAG
Chunk → retrieve top-k → inject evidence → generate with citations.
Watch: retrieval errors flow directly into generation.
A rigorous, executable map of retrieval, reusable context, graphs, tables, memory, and tools—built to show where each mechanism works and where the acronyms stop.
Both RAG paths preserve provenance and produce decision traces. The other runnable primitives expose mechanism-specific outputs such as cache metrics, graph facts, recalled memory, row provenance, and tool results.
Intent, constraints, scope
Explicit RAG strategy or separately constructed primitive
Trust and ACLs before document indexing
Select or compute evidence
Cited RAG answer or inspectable result
Versioned lexical regression fixture
Filter by family. “Advanced” and “agentic” are umbrellas; Self-RAG, CRAG, CAG, KAG, and database TAG have specific fidelity boundaries.
Chunk → retrieve top-k → inject evidence → generate with citations.
Watch: retrieval errors flow directly into generation.
Transform queries, fuse retrievers, rerank, and filter.
Boundary: an umbrella, not one reproducible algorithm.
Compose replaceable retrievers, routers, verifiers, memory, and generators.
Requires: typed contracts, traces, and disciplined configuration.
Combine exact lexical ranking and vector-space ranking with RRF.
Lab: BM25 + transparent TF-IDF baseline.
Decompose and alternate retrieval with evidence accumulation.
Watch: error propagation and runaway loops.
A trained model emits retrieval and reflection tokens.
Not: any generic prompt-based critique loop.
Evaluate retrieval, refine knowledge, and use fallback sources.
Generic analogue: call it crag-inspired.
Route no-retrieval, single-hop, or iterative retrieval by query complexity.
Watch: routing mistakes become a new failure mode.
A bounded controller selects sources, observes, replans, and stops.
Requires: budgets, loop detection, and permissions.
Local graph evidence plus global community-level reports.
Lab: connected communities, not full Microsoft GraphRAG.
Use graphs, ontologies, rules, or schemas for explicit reasoning.
Boundary: OpenSPG KAG is a specific full stack.
Validated equality filters and finite calculations with row-index provenance.
Full TAG: combines DB and LM semantic operators.
Preload stable knowledge and reuse a model KV/prefix cache.
Lab: context reuse metrics, not fake past_key_values.
Place the corpus directly in context, with or without retrieval.
Watch: token cost and lost-in-the-middle effects.
Append and lexically recall process-local scoped strings.
Missing: persistence, provenance, correction, TTL, and deletion.
Call a registered Python function through name and keyword allowlists with finite JSON-compatible immutable records.
Missing: semantic per-tool schemas, authorization, timeout, sandbox, and durable audit logs.
Retrieve across text, images, audio, video, tables, and layout.
Requires: modality-specific provenance and evaluation.
The project deliberately avoids tutorial theater: no API key is needed, TF-IDF is not called a semantic model, and a cached string is not called a model KV cache.
$ python -m pip install --require-hashes -r constraints/build.txt $ python -m pip install --require-hashes -r constraints/py311.txt $ python -m pip install --no-build-isolation --no-deps -e . $ kal showcase $ kal evaluate --check { "naive-rag": { "citations": [...] }, "advanced-rag": { "trace": [...] }, "cag": { "cache_hits": 1 }, "kag": { "facts": [...] }, "graph-rag": { "community_reports": [...] }, "memory-augmented": {...}, "table-augmented": {...}, "tool-augmented": {...} }
Clone the project, run every path locally, and inspect the RAG decision traces alongside each primitive's mechanism-specific output.
Open on GitHub ↗