- Preface
- Part I. The Problem
- 1. Why "chunk and pray" fails
- 1.1 A tiny vector RAG
- 1.2 The failure: top-k is not relevance
- 1.3 The triple-mediated alternative
- 1.4 Limits
- 1.5 What the notebook asserts
- 1. Why "chunk and pray" fails
- Part II. The Substrate
- 2. Geometric memory in one chapter
- 2.1 The store is six primitives over a learned graph
- 2.2 lookup_enm: exact recall, not re-parsing
- 2.3 score_triple: contradiction is distance
- 2.4 query_triples and link_predict: asserted vs. predicted
- 2.5 check_holonomy and tension_energy: composition and contradiction
- 2.6 Limitations
- 3. Provenance: span <-> triple
- 3.1 Resolving a triple to its table cell
- 3.2 A prose triple is unaligned
- 3.3 The provenance-span fallback: coarse triples cover prose
- 3.4 Verifying that a span supports its triple
- 3.5 Limitations
- 3.6 Self-check
- 2. Geometric memory in one chapter
- Part III. Ingestion
- 4. From Document to Graph
- 4.1 Configuration
- 4.2 Building the store
- 4.3 Reload and query
- 4.4 Limitations
- 4.5 Self-check
- 5. GEODE: self-correcting extraction
- 5.1 The redundancy the loop exploits
- 5.2 Corrupt a segment figure: the sum anchor flags it
- 5.3 Corrupt a relational triple: the critic catches and fixes it
- 5.4 The limit: a lone value with no redundancy
- 5.5 Self-check
- 4. From Document to Graph
- Part IV. Data Generation and Encoder Tuning
- 6. Generating Data with a Designed Experiment
- 6.1 Base questions from the store
- 6.2 The designed experiment
- 6.3 Materializing contextual questions
- 6.4 One corpus, three consumers
- 6.5 Limitations
- 6.6 Self-check
- 7. Tuning the Encoders: Embedding SFT
- 7.1 v-space: concepts that must be close
- 7.2 u-space: terms that genuinely contradict
- 7.3 Calibrating the relevance gate
- 7.4 Limitations
- 7.5 Self-check
- 6. Generating Data with a Designed Experiment
- Part V. Retrieval
- 8. Triple-Mediated Retrieval
- 8.1 The query-triple vocabulary
- 8.2 A deterministic LLM for CI
- 8.3 Five questions become query triples
- 8.3.1 Multi-hop: chaining through a named variable
- 8.4 Schema grounding fixes a non-binding relation
- 8.5 The query-only repair fallback
- 8.6 The real Qwen path
- 8.7 Limitations
- 8.8 Self-check
- 9. Binding query terms to the graph
- 9.1 A stand-in store with the Northwind vocabulary
- 9.2 Fuzzy binding: substring resolves, paraphrase does not
- 9.3 Embedding binding: the injectable encoder
- 9.4 Refuse on ambiguity, do not mis-resolve
- 9.5 Limits
- 9.6 Self-check
- 10. Answering through the GMS
- 10.1 Bound triples become facts
- 10.2 Single-hop retrieval with provenance
- 10.3 Multi-hop through a variable environment
- 10.4 Asserted edges, not predictions
- 10.5 Limits
- 10.6 What this gives the rest of the pipeline
- 8. Triple-Mediated Retrieval
- Part VI. Generation and Trust
- 11. Grounded synthesis
- 11.1 The evidence block
- 11.2 Synthesizing and refusing
- 11.3 Per-role LLMs
- 11.4 Self-check
- 12. Self-verification: the GMS as a hallucination detector
- 12.1 A deterministic claim-extraction backend
- 12.2 The facts we verify against
- 12.3 A faithful draft verifies as supported
- 12.4 A hallucinated figure verifies as contradicted
- 12.5 The pipeline abstains on a failed verification
- 12.6 The real path: Qwen2.5-3B as the verify-LLM
- 12.7 Limits
- 13. Abstention and coverage
- 13.1 The coverage monitor
- 13.2 A prose question abstains
- 13.3 The per-query audit trail
- 13.4 Limitations
- 13.5 Self-check
- 11. Grounded synthesis
- Part VII. Calibration and Evaluation
- 14. Calibrate, Don't Guess
- 14.1 A deterministic, corpus-grounded encoder
- 14.2 An embedding-mode binder over the trained store
- 14.3 Positives, negatives and the sweep
- 14.4 The calibrated binder resolves paraphrases and refuses noise
- 14.5 Limits
- 15. Evaluating the RAG with a Designed Experiment
- 15.1 The cohort is the design, the GMS is the oracle
- 15.2 Four metrics, all against the GMS
- 15.3 Attributing the weakness
- 15.4 GEODE-RAG versus chunk and pray
- 15.5 Limits
- 15.6 Self-check
- 14. Calibrate, Don't Guess
- Part VIII. Production
- 16. Pluggable LLMs and the distrusted dense fallback
- 16.1 The three roles, one config
- 16.2 Loading the trained store
- 16.3 Default: a prose question abstains
- 16.4 Opt-in dense fallback -- answered, but quarantined
- 16.5 strict_mode -- refuse even the dense answer
- 16.6 Pointing the fallback at a custom backend
- 16.7 Limits
- 17. Persisting to an External Store (KAL / Postgres)
- 17.1 What KAL stores
- 17.2 A corpus-grounded fixture
- 17.3 Listing 1 -- Converting triples to KALTriple
- 17.4 Listing 2 -- Persist offline, then read back
- 17.5 Listing 3 -- Stamping GEODE verification
- 17.6 Listing 4 -- The Postgres path (gated)
- 17.7 Limits
- 16. Pluggable LLMs and the distrusted dense fallback
- Part IX. Capstone
- 18. Capstone: Summary, Conclusion and Lessons Learned
- 18.1 The system in one view
- 18.2 The verdict
- 18.3 Lessons learned
- 18.4 Limits, and when chunk and pray is enough
- 18.5 The bridge onward
- 18. Capstone: Summary, Conclusion and Lessons Learned
- A. Plugging GEODE-RAG into a governed agent
- A.1 A scripted backend for deterministic CI
- A.2 The pipeline behind the tool
- A.3 The tool: typed in, typed out, provenance carried
- A.4 A minimal governed loop
- A.5 The real Qwen path
- A.6 Self-check: a grounded, cited answer through the executor
- A.7 Abstention crosses the bridge too
- A.8 Exercise solution: a policy gate
- A.9 Limitations
- B. GEODE-RAG versus vector-RAG frameworks
- B.1 What each framework optimizes for
- B.2 Side-by-side: the same question, two contracts
- B.3 The comparison table
- B.4 Cost and operational profile
- B.5 When a vector-RAG framework is the right choice
- B.6 Limits of this comparison
- C. The GMS Substrate & Calibration
- C.1 The six store primitives
- C.2 Building a store
- C.3 The threshold-calibration method
- C.4 Limits
- C.5 Self-check
- D. Reproducing the Artifacts
- D.1 The artifact tree
- D.2 The one GPU step: build_store.py
- D.3 Notebooks are built, not hand-edited
- D.4 Verifying the reproduction (CPU only)
- D.5 From clone to runnable book
- D.6 Limitations
- E. A Runnable "Chunk and Pray" Baseline
- E.1 The corpus and the cohort, unchanged
- E.2 Step 1 -- chunk the document, blind to structure
- E.3 Step 2 -- embed and index
- E.4 Step 3 -- top-k retrieval, and the exact-number trap
- E.5 Step 4 -- stuff and generate, with no way to decline
- E.6 The cohort, scored exactly as in Chapter 15
- E.7 Provenance exists, but it is not verifiable
- E.8 Self-check
- About the Authors
- About KnowlytiX
Beyond "Chunk and Pray"
Building Trustworthy RAG with Geometric Knowledge Graphs
Top-k is not relevance, retrieved text is not evidence and an LLM judging another LLM is not verification. Beyond “Chunk and Pray” shows how to build RAG that answers through a verified knowledge graph, preserves exact numbers, cites its sources and abstains when it cannot prove the answer.
Minimum price
$9.95
$29.95
You pay
Author earns
About
About the Book
Most RAG systems are built on a deceptively simple recipe: split documents into chunks, embed them, retrieve the top few matches and trust an LLM to use them correctly. Beyond “Chunk and Pray” shows why that recipe breaks down when answers must be exact, auditable and safe to use. Top-k similarity is not relevance, retrieved prose is not evidence, numbers can drift and one model grading another does not create a reproducible control.
This hands-on book develops a different architecture: GEODE-RAG, built on the Geometric Memory System. Questions are translated into query triples, bound to a verified knowledge graph and answered through asserted facts with source-level provenance. Exact Numerical Memory preserves authoritative figures byte-for-byte, geometric verification catches contradictions, calibrated abstention makes blind spots visible and dense vector retrieval is demoted to a flagged fallback rather than treated as ground truth.
Using a running financial-report example, executable Python, a local open-weight model and reproducible notebooks, Agus Sudjianto and Wing Yan Lau take readers from document ingestion and self-correcting extraction through encoder tuning, multi-hop retrieval, grounded synthesis, self-verification, coverage monitoring, designed evaluation and production deployment. The book is for engineers building retrieval systems that compliance teams, auditors or regulators may examine—systems that must do more than sound plausible. They must show their work.
Categories
Feedback
Author
About the Author
Agus Sudjianto
Agus Sudjianto is the Chief Scientist at KnowlytiX. He has spent more than two decades building, governing and validating quantitative models inside major financial institutions. He was Executive Vice President and Head of Model Risk at Wells Fargo, where he served on the Management Committee and led enterprise model risk management. Earlier in his career he held senior quantitative risk roles at Lloyds Banking Group and Bank of America. Since leaving corporate industry, he has continued this work as an advisor, builder and researcher across banking, fintech and AI.
Agus's work sits at the intersection of machine learning, model risk and governed AI systems. He created PiML and MoDeVa, toolkits for interpretable model development and validation, and his more recent work extends that same discipline into agentic AI, graph-grounded retrieval and geometric memory. Across these projects, the through-line is consistent: high-stakes AI should be built with the same rigor expected of high-stakes statistical models.
He is also co-author of Design and Modeling for Computer Experiments, holds several U.S. patents and has long worked across engineering, quantitative finance and applied machine learning. His current research centers on learning as geometry discovery in both predictive machine learning and generative AI.
In this series, Agus brings the perspective of someone who has spent a career asking not only whether a model works, but whether it can be governed, defended and trusted in practice.
WingYan Lau
Wing Yan Lau is the Chief Technology Officer at KnowlytiX. Her work centers on the systems layer that makes GMS usable in practice: document ingestion, knowledge-store construction, query infrastructure, verification pathways and the interfaces that connect governed AI to real enterprise data. She is a co-author of KnowlytiX's research on graph-verified evaluation and structured financial-document retrieval, including work reflected in FinStructBench and in the company's broader knowledge and testing stack.
Wing brings more than two decades of database and data-platform engineering experience to that work. She has contributed to core systems at IBM, SAP and Workday, with technical work spanning query optimization, storage systems and execution infrastructure. That background is visible throughout the KnowlytiX platform, where the challenge is not only to generate answers, but to connect models to structured knowledge in ways that remain exact, inspectable and operationally reliable.
In this series, Wing brings implementation discipline to every layer of the system: how documents become structured stores, how numeric facts remain exact, how graph-backed retrieval is made usable and how governed workflows are turned into code rather than left as intentions in prose. Her contribution is what turns the ideas in the architecture into systems an engineer can actually build, test and run.
Contents
Table of Contents
Get the free sample chapters
Click the buttons to get the free sample in PDF or EPUB, or read the sample online here
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.