Part 1
Designing a RAG System for 10 Million Documents
How to size, build and measure retrieval-augmented generation over 10M documents: ingestion, hybrid retrieval, reranking, ACLs, cost and evals.
25 deep dives on designing production LLM systems, grouped by topic.
Chunking, hybrid search, reranking and debugging retrieval-augmented generation.
Part 1
How to size, build and measure retrieval-augmented generation over 10M documents: ingestion, hybrid retrieval, reranking, ACLs, cost and evals.
Part 2
A stage-by-stage method for localizing RAG failures: build a replayable failure set, attribute each case to a stage, fix the biggest bucket, and gate on it.
Part 3
Why fixed-size chunks fail on contracts, and how to chunk by clause with context headers, defined terms, cross-references and amendment lineage.
Part 4
How lexical, dense, learned-sparse and late-interaction retrieval fail differently, how to fuse them with RRF, and how to choose on your own traffic.
Part 5
How to add a cross-encoder reranker to a RAG pipeline, size it, and prove the gain with paired offline evals, end-to-end checks and a guarded A/B test.
Make LLM systems cheaper and faster: caching, routing, batching and GPU serving.
Part 6
How to stack prompt caching, model routing, batch APIs and token hygiene into a 70-80% cost cut, with an eval gate that proves quality held.
Part 7
Decompose TTFT into network, pre-model work, queueing and prefill, then cut each stage: parallelism, prefix caching, chunked prefill and headroom.
Part 8
A layered semantic cache for LLM responses: scoped keys, tuned thresholds, borderline verification, invalidation, and false-hit-aware hit-rate metrics.
Part 9
Design an LLM router that sends each request to the cheapest good-enough model: rules, learned routers, cascades, threshold tuning and drift monitoring.
Part 21
How to size and run an open-weight LLM fleet: prefill vs decode, KV-cache math, continuous batching, FP8/FP4 quantization and goodput per dollar.
Reliable tool calling, agent loops, long-term memory and structured output.
Part 10
Tool-use reliability is a systems property: tool design, a guarded control loop, permission gates, and pass^k evals on verifiable end states.
Part 11
Classify why an agent loops, add harness guardrails and better tool feedback, and recover with an escalation ladder you can measure.
Part 12
A tiered memory design with explicit write, read and forgetting policies, plus the benchmarks and production signals that show it works.
Part 13
Enforce JSON Schema at decode time, design schemas that keep quality high, and add validation, repair and truncation handling on top.
Eval suites, LLM-as-a-judge and keeping hallucinations in check.
Part 14
Separate hallucination types, detect them with claim-level verification and uncertainty signals, and reduce them without making the model useless.
Part 15
Build support-bot evals from real failures: layered offline tests, calibrated judges, statistically sound release gates and a production flywheel.
Part 16
Treat an LLM judge like a measurement instrument: calibrate it against human labels, remove its known biases, and size your eval sets for real error bars.
Defend agents against prompt injection and keep personal data away from models.
Part 17
Why model-level filters can't stop prompt injection, and how control/data separation, taint tracking and sink policies make attacks harmless.
Part 18
A layered design for detecting, pseudonymizing and re-identifying PII before it reaches a model, and how to measure the leak rate honestly.
When to fine-tune instead of prompting or RAG, and how to do it with LoRA.
Part 19
Diagnose whether your gap is knowledge or behavior, then climb from prompting to RAG to fine-tuning only when the cheaper rung plateaus.
Part 20
A practical LoRA recipe for an 8B model on 5K examples: data hygiene, hyperparameters, a real GPU memory budget, and eval-driven checkpoint selection.
Streaming, tracing, safe rollbacks and running chat for millions of users.
Part 22
Stream tokens with server-sent events, decouple generation from the connection, resume with Last-Event-ID, and cancel cleanly so GPUs are freed.
Part 23
Model multi-agent runs as one OpenTelemetry trace: GenAI span conventions, context propagation across queues, private content storage and tail sampling.
Part 24
Make prompt rollback a sub-minute alias flip, catch regressions with canaries and guardrail metrics, and clean up what the bad prompt left behind.
Part 25
Back-of-envelope sizing, architecture and overload strategy for an LLM chat product at 1M DAU, where GPUs set both the cost and the latency.