Moving from RAG Apps to RAG Systems Engineering
Moving from a basic RAG prototype to a production RAG system requires engineering discipline across both retrieval and generation stages. Systems can fail either at the evidence input layer due to document revisions, stale chunks, or mixed embedding spaces, or at the output layer through unsupported claims. Addressing these failures necessitates operational mechanisms like safe index migrations and data lineage alongside applied ML techniques such as query-time verification and calibrated abstention thresholds. Because verification can only validate whether an answer matches retrieved passages rather than whether the passages are fresh, both retrieval freshness and answer support require distinct, coordinated controls. This section explains how GPUs schedule and organize workloads, transitioning from a launched kernel to hardware-level execution. Programs group threads into blocks that make up a grid, which are assigned to Streaming Multiprocessors (SMs) and executed in 32-thread units called warps. Warp scheduling allows SMs to switch execution to ready threads while others wait for memory, avoiding idle stalls. The text also connects GPU hardware mechanics—such as shared memory, registers, and High Bandwidth Memory (HBM)—to LLM serving realities, noting why small batch size decoding is typically memory-bound.
Contents
Moving from RAG apps to RAG systems engineering
Moving from a basic RAG prototype to a production RAG system requires engineering discipline across both retrieval and generation stages. Systems can fail either at the evidence input layer due to document revisions, stale chunks, or mixed embedding spaces, or at the output layer through unsupported claims. Addressing these failures necessitates operational mechanisms like safe index migrations and data lineage alongside applied ML techniques such as query-time verification and calibrated abstention thresholds. Because verification can only validate whether an answer matches retrieved passages rather than whether the passages are fresh, both retrieval freshness and answer support require distinct, coordinated controls.
- RAG systems can fail at two distinct layers: the evidence entering the system (retrieval rot) and the claims leaving the system (unsupported generation).
- Evidence-level failures stem from issues like document updates, mixed embedding spaces, stale chunks, and query distribution shifts.
- Output verification should be framed as a classification and selective prediction problem rather than a generation task.
- A verifier can confirm whether an answer aligns with retrieved context, but it cannot determine whether that retrieved context is outdated.
- Production RAG engineering requires implementing operational controls such as migration gates and rollback paths alongside ML controls like risk bounds and calibrated abstention thresholds.
How GPUs organize work, clearly explained:
This section explains how GPUs schedule and organize workloads, transitioning from a launched kernel to hardware-level execution. Programs group threads into blocks that make up a grid, which are assigned to Streaming Multiprocessors (SMs) and executed in 32-thread units called warps. Warp scheduling allows SMs to switch execution to ready threads while others wait for memory, avoiding idle stalls. The text also connects GPU hardware mechanics—such as shared memory, registers, and High Bandwidth Memory (HBM)—to LLM serving realities, noting why small batch size decoding is typically memory-bound.
- A GPU kernel launch organizes threads into blocks that form a grid, which are then assigned to Streaming Multiprocessors (SMs).
- All threads in a single block execute on the same SM and can share data using shared memory.
- SMs execute threads in 32-thread groups called warps, applying single instructions across active threads.
- Branch divergence inside a warp forces inactive threads to wait while active ones run, reducing execution efficiency.
- SMs hide memory latency by context-switching to ready warps when other warps stall waiting for data.
- LLM decoding at small batch sizes is often memory-bound because moving weights from HBM takes longer than performing calculations.