Unit 9 of 11 · about 5 hours · implement

Freshness, deletion propagation, index versions and cache keys

An updated source does not update every derived artifact automatically. Freshness and deletion are observable serving contracts, not properties conferred by rebuilding a vector index.

You'll be able to

  • Publish compatible corpus and index versions without mixing old and new encoder or chunk contracts.
  • Propagate updates, deletions and revocations through retrieval, citations and cached answers under a measured visibility contract.
  • Test stale readers, concurrent publication and rollback without resurrecting denied evidence.

Covers

Freshness, update, deletion propagation and index rollbackCache keys, index versions and stale-result prevention
1

Read

In this order, only the parts listed

0 of 3 done

  1. Reviewed updates and retirementAI Agents in Depth - Knowledge Base

    Section 3.3.3: Incremental Updates for User Memory and Knowledge Bases; Periodic Reorganization of User Memory and Knowledge Bases (live edition, page read 2026-10-18)

    Read knowledge-base publication, versioning and obsolete-content retirement. Leave user-memory consolidation to the later memory section.

  2. Incremental indexing and version cutoverAI Engineering Handbook - Retrieval

    Chapter 6.8: Incremental indexing: hash before you embed; The reindex tax: why an embedding upgrade isn't free (page read 2026-10-18)

    Skip hosted prices, timing defaults and overlap-based go signals. The example lowercases before hashing; retain a raw digest and hash the actual encoder input plus its contract instead. Text hashes alone miss ACL and metadata changes.

  3. Deletion, reuse and concurrent faultsEvidence-Grounded Retrieval System

    Architecture constraints, version binding and delete propagation; Milestones C and D; Failure-injection requirements, concurrent update/delete and stale index/cache

2

Focus on

  • Build a replacement snapshot off the query path, validate identities and encoder compatibility, then publish one coherent manifest reference. A request pins that reference while checking current access and tombstones before exposure. Independent sparse and dense swaps can create an unintended mixed version.
  • Record source-change acceptance, index publication and first correct served result as separate events. Declare whether an update becomes visible at publication or immediately blocks older content; measure the chosen freshness lag with an injected clock.
  • For deletion, publish a serving tombstone or equivalent deny barrier, invalidate derived results and block stale readers before acknowledging the serving guarantee. Reclaim physical artifacts separately. Rollback must keep current tombstones and policy epochs; an old index is not permission to revive deleted evidence.
  • Bind answer-cache reuse to tenant, principal or equivalent permission scope, current policy epoch, corpus/index manifest, encoder and reranker contracts, query transformation, prompt, generator and decoding settings. Bind entries to cited versions and revalidate dependencies on a hit; TTL alone cannot enforce revocation or deletion.
Common mistakes · 3
  • Deleting old vectors before replacement publication without a transaction or snapshot switch. Readers can observe a gap; adding first without version isolation can expose both versions.
  • Skipping work because normalized text is unchanged. Case, parser, encoder, source metadata and access changes have different invalidation needs.
  • Calling serving denial physical erasure. Backups, retained audit artifacts and previously delivered text require a separate retention and erasure policy.
3

Try it yourself

Closed-book, before checking anything

From a blank file, simulate an index alias and injected clock over the two-tenant corpus. Publish a 7-day policy, warm an answer cache, then publish its 14-day replacement. Assert each response uses one coherent manifest. Pause a request after retrieval, delete the policy and publish its deny barrier, then resume: stale context, citation resolution and cached answers must be rejected. Roll back the index alias and require the deletion to remain effective. Retain event times and safe version IDs for every assertion.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Can rollback use all policies from the old snapshot?Answer

    No. Current revocations and tombstones still apply. Rollback restores a compatible search view, not old authority.

  2. 2.Does a short TTL satisfy an immediate post-acknowledgment deletion contract?Answer

    No. Stale entries remain usable during the TTL unless dependency checks or explicit invalidation block them.

  3. 3.Why measure publication lag separately from ingestion time?Answer

    A parsed and embedded update may still be absent from the serving manifest. Only a served query shows the end-to-end visibility behavior.

You're done when

No fixture response mixes snapshots, accepted deletes block every stale exposure path including rollback, and the report states measured freshness plus the distinct serving-denial and physical-erasure guarantees.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 17 more in the section
  • AI Engineering Handbook - RetrievalHandbook Academy · primary

    Complete Part 6 Retrieval: parsing and chunking, embeddings and vector search, hybrid search and reranking, query understanding, citations, advanced retrieval, retrieval evaluation and production RAG. Implement each stage on one controlled corpus before adding abstractions.

  • AI Agents in Depth - Knowledge BaseBojie Li · required

    Read Chapter 3 sections 3.2.1 to 3.2.4 (chunking, dense, sparse and hybrid retrieval), 3.3.1, 3.3.3 (incremental updates, retiring obsolete content, multi-user permissions and tenant isolation), 3.3.4 (agentic retrieval and the security boundaries of RAG) and 3.3.5 contextual retrieval. Keep 3.1 memory for AI-5. The companion chapter3/retrieval-pipeline/evaluate.py --no-dense --no-rerank runs offline.

  • Evidence-Grounded Retrieval SystemRoadmap-Final · required

    Build the bounded slice first: Milestone A (no-retrieval and oracle-evidence baselines), the architecture constraint that authorization filters apply before exposure and are rechecked before context, citation and cache reuse, and Milestones D and E. Use a small hand-written two-tenant corpus with stable source, version and chunk IDs, deleted and conflicting facts, near-miss unanswerables and poisoned documents. The full project (80 to 130 hours) continues in AI-8.

Also in this section

  • AlgoMaster - Evaluating RAG SystemsAlgoMaster · support

    The owned premium lesson is a short pass on retrieval and generation metrics, fixed evaluation sets, automated judges and regression workflows. Recompute every metric it uses in your own harness and keep item-level evidence.

  • The Hitchhiker's Guide to Agentic AI - Chapter 16Haggai Roitman · support

    Use v3 Chapter 16 selectively: 16.3 (BM25, DPR, RRF), 16.4 chunking, 16.7 agentic RAG, 16.8 metrics and failure modes, 16.9.4 incremental indexing. Its Equation 16.28 divides context precision by K where the Ragas docs divide by the relevant items, and its upsert_document listing deletes before adding with no transaction, so a query in between sees neither version: test that gap.

  • Sentence Transformers Retrieve and Re-RankSentence Transformers · required

    Implement the documented bi-encoder retrieval plus cross-encoder reranking pattern on SciFact or your own corpus. Reranking only reorders the candidates, so measure recall before it and ranking quality, latency and cost after it. The MiniLM cross-encoder outputs raw logits, not 0 to 1 probabilities. Pin model revisions.

  • The Probabilistic Relevance Framework: BM25 and BeyondStephen Robertson and Hugo Zaragoza · required

    Read Sections 3.4.4 to 3.5 (term-frequency saturation, length normalization (1 - b) + b * dl / avdl, variants). Library BM25 implementations differ in IDF handling, so record k1, b, tokenization and the implementation with every result.

  • Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning MethodsCormack, Clarke and Buettcher · required

    Read the Section 1 equation: score each document by the sum of 1 / (k + rank) over the rankings, with ranks from 1 and k = 60 fixed in a pilot. Fusion cannot recover a document missing from every candidate list; record candidate depths and tie handling.

  • ir-measures: Measure Definitionsir-measures · required

    Read the R, P, RR and nDCG entries and use the library as an oracle for your own metric code. Default nDCG uses linear gain with a log2(rank + 1) discount, not 2**rel - 1; precision@k divides by k. State the query set, unjudged-document handling and averaging.

  • Enabling Large Language Models to Generate Text with Citations (ALCE)Gao et al. · required

    Read Section 3.3 Citation Quality with the Figure 3 examples and the Appendix E limitation. Citation recall is statement-support coverage and citation precision uses a leave-one-out rule; implement both with stable claim and chunk IDs and a hand-labeled entailment check instead of the 11B scorer.

  • Know What You Don't Know: Unanswerable Questions for SQuADRajpurkar, Jia and Liang · required

    Read Section 2 (plausible, relevant negatives) and the threshold paragraph in Section 5.1 (tuned on development data). Build answerable and unanswerable pairs from your corpus and report coverage, risk on answered items and errors on unanswerable items separately.

  • Lost in the Middle: How Language Models Use Long ContextsLiu et al. · required

    Read Section 2.1, Table 1 (closed-book and oracle controls) and Figure 11 (retriever recall versus answer accuracy). Run an evidence-position sweep with the query, distractors, model and token budget fixed.

  • Not What You've Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt InjectionGreshake et al. · required

    Read Sections 3.1 (injection delivery), 4.1.1 (the synthetic setup) and 5.2 (limits). Add a local document that carries an instruction beside benign facts, mock every tool, and test instruction-following separately from retrieval. Permission filters do not stop an authorized document from injecting.

  • Ragas Metrics: Faithfulness, Context Precision and Context RecallRagas · support

    Read the faithfulness, context precision (an AP-like quantity, not precision@K) and context recall pages and the local-model adapter guide. The legacy API was removed in 1.0, so pin a version. Calibrate any LLM-based metric against your hand labels before trusting it.

  • FActScore: Fine-grained Atomic Evaluation of Factual Precision in Long Form Text GenerationMin et al. · support

    Read the Section 3.1 definition and Figure 1. FActScore is precision conditional on responding, so report it with the response rate; a system can raise it by saying less.

  • Poisoning Retrieval Corpora by Injecting Adversarial PassagesZhong et al. · support

    Read Section 3 (threat model) and Section 4.1 with Figure 2: success means one adversarial passage reaches the top k, and attacks transfer poorly across retrievers. Measure poison exposure at k separately from answer corruption.

  • PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language ModelsZou et al. · support

    Read Section 3.1 (attacker capabilities) and the retrieval and effectiveness conditions in Section 4.1, then Tables 2 and 4 (v1 numbering). Its attack success rate is target-substring matching, so check matches by hand.

  • Contextual RetrievalAnthropic · support

    Read "Introducing Contextual Retrieval", "Methodology" and the reranking section. The reported 5.7% to 2.9% retrieval failure is a 49% relative reduction in 1 - recall@20, not 49 points. Test one context-prefix ablation only after plain BM25, dense and hybrid retrieval pass, and keep the source text apart from generated context.

  • Enterprise RAG and Perplexity AI Search Case StudiesEngineering Handbook · support

    Read the Enterprise RAG case study as the main architecture review and compare it with the Perplexity AI Search case. Identify where tenant policy, freshness, citation, latency and evaluation belong, then defend what your bounded project deliberately omits.

  • BEIR: A Heterogeneous Benchmark for Zero-shot Evaluation of Information Retrieval ModelsBEIR Team · support

    Read Section 3 and Table 1 (SciFact: 5,183 documents, 300 test queries) and the qrels workflow in the repository README, then run one small dataset as a relevance oracle. Dataset terms differ from the code license (SciFact annotations are CC BY 4.0, abstracts ODC-By). Full benchmark reproduction stays depth.