When a model 'doesn't know X' or 'won't behave how I want,' there are three completely different fixes — and picking the wrong one wastes months. RAG changes what the model KNOWS, fine-tuning changes how it BEHAVES, prompting steers within what it already can do. Here's the decision framework, why they compose instead of competing, and where LoRA fits.
Semantic search and RAG rest on one deceptively simple operation: find the nearest vectors to a query. At a few thousand rows that's a boring loop; at a hundred million it's the whole ballgame. Here's what a vector index actually does inside — why brute force falls over, why HNSW's layered graph wins, and which three knobs decide your recall, latency, and RAM bill.
An agent with a 1M-token context still meets you as a total stranger tomorrow — the context window is RAM, wiped the moment the session ends. Real memory is an engineering system you build around the model: what to save, when to update it, and what to forget. This is the taxonomy, the storage trade-offs, and the write policy that separates a gimmick from a colleague.
Prompt engineering was about wording one message. Context engineering is about managing the entire context window as a scarce budget — what goes in, in what order, and what gets evicted. For a backend engineer, it's working-set management applied to an LLM.
Plain vector RAG can't answer multi-hop or 'across everything' questions — the answer is spread across chunks that no single chunk contains. GraphRAG extracts a knowledge graph instead. Here's how it works, the honest cost, and how to start in Postgres without a graph database.
Retrieval-Augmented Generation explained in plain English. The librarian analogy, the five steps, a working Python example you can run in 50 lines, and the mistakes every beginner makes the first time.