RAGEngineering Hub

11

Safety and operations

Keep it safe, observable, fast, affordable and reliable.

  1. Concept 11.1

    Prompt injection and poisoned documents

    A document can contain instructions aimed at the model. Our corpus has one planted on purpose; search pulled it into the top 3 for a question that had nothing to do with it. Layers of defence, and how to test them.

  2. Concept 11.2

    Access control, privacy and governance

    Users must only get answers from documents they may read. Filter by role before ranking, never in the prompt. Without a filter, our restricted runbook reached a customer's top 3; with one, it cannot.

  3. Concept 11.3

    Index lifecycle operations

    An index is not built once. New documents, deletes, permission changes, new chunking and new models all change it. Build versioned indexes, gate them on the golden set, swap by alias, keep a rollback.

  4. Concept 11.4

    Observability and tracing

    Log enough about each request to replay it: the rewritten query, every retrieved chunk with its rank, the prompt size, each stage's time, the model and the feedback. A real trace from our pipeline shows where the time goes.

  5. Concept 11.5

    Latency, cost, caching and model routing

    Measure where time and money go before tuning. In our pipeline the reranker took 1.4 s and search under a millisecond; on input cost, RAG cut a question from $0.031 to $0.0043, and a smaller model would cut it about 40 times more.

  6. Concept 11.6

    Reliability, degraded modes and launch readiness

    Every part of a RAG system can fail: the embedder, the reranker, the model, the index. Plan a fallback for each and know its quality in advance. On our corpus, keyword search alone still found all 47 answers in the top 3.

Chapter 11 recap

6 pictures, 6 ideas