RAG Support Assistant Evaluation and Latency Budget
Evaluate how a RAG support assistant API meets production requirements for grounded answers, fresh and authorized retrieval, and responsive performance. Learn to calculate query latency, ingestion freshness, burst capacity, token cost, and failure signals, then connect each measure to API safeguards.
A support assistant answers in 800 milliseconds and cites a release note, yet it still fails in production. The note it cites is two versions old, the policy uploaded five minutes ago is missing, and the retrieved passage came from another tenant’s private workspace. The endpoint is fast, but the API contract is broken.
This lesson evaluates how the API meets its non-functional requirements, then estimates the latency of a query, the freshness of a document update, the effect of burst traffic, and the cost of both paths. The query and ingestion paths share one index, but each has its own budget:
Non-functional requirements
The design must meet the eight requirements from the first lesson. Four of them become per-answer checks used throughout this lesson: supported (answer quality), current (freshness), authorized (security and tenant isolation), and timely (low latency). Let’s evaluate how the design meets each one.
Answer quality
Hybrid retrieval finds both exact identifiers, such as error codes, and passages that match the question’s meaning. Reranking orders a bounded candidate set, and evidence assembly checks that the selected passages actually support the question before generation starts. The generator receives only those passages with stable citation markers, and each citation in the response carries documentID, title, version, the quoted passage, and a stable url, so a reviewer can check every claim. When support is missing or contradictory, the service returns insufficient_evidence instead of a guess.
Quality is measured offline on a gold set of support questions, using retrieval metrics such as Recall@k and nDCG, and online by sampling answers for unsupported claims and invalid citations. LLM-as-judge reviews and user feedback feed the same review queue.
Note: Correctness and groundedness are not the same. A factually correct answer can still violate the API contract if the retrieved evidence does not support it.
Freshness and reliability
Ingestion runs asynchronously, and a document becomes ingested only after its chunks are indexed and access metadata is attached, so the API never advertises content that isn’t safe to retrieve. An update keeps the previous version searchable until the replacement completes, and deletion blocks retrieval before cleanup finishes. Stable document, version, and chunk identifiers let a failed job retry without duplicating searchable content, and each answer records the evidence and source versions it used for later audit. The latency budget below includes the freshness of a document update.
Security and tenant isolation
Tenant and permissions come from trusted identity and policy services, never from the request or the conversation. Retrieval runs only inside the caller’s permitted scope, and a final eligibility check runs before passages reach reranking, generation, or a citation, which catches permission changes the index hasn’t absorbed yet. Caches are keyed by tenant and access scope, and retrieved text is treated as evidence, never as instructions.
Availability, latency, and cost
Interactive queries and ingestion use separate worker pools and queue limits, so a large reindex can’t starve questions. An ingestion failure stays on its job, so it has limited impact on answering requests. Admission control rejects overload with 429 or 503 before streaming starts. Bounded candidate sets, a context budget, and output limits cap both latency and token spend, and streaming lets users read the answer while it’s still being generated.
The table below summarizes how the design meets each requirement and what to measure:
Non-functional requirement | Approaches | What to verify |
Answer quality | Hybrid retrieval, bounded reranking, support check, citation markers, abstention | Recall@k, nDCG, unsupported claim rate, citation validity, abstention accuracy |
Freshness | Asynchronous ingestion, publish on completion, block before cleanup on delete | Lag from source change to authorized retrieval, revocation time |
Security and tenant isolation | Trusted identity, scoped retrieval, final eligibility check, tenant-keyed caches | Cross-tenant tests, permission violation rate |
Low latency | Streaming, bounded candidates and context, warm workers | p95 first-text latency, p95 full-response time |
Availability | Separate worker pools for queries and ingestion, failure isolation | Query success rate during ingestion failures |
Scalability | Separate ingestion and query capacity, admission control | Query success rate during ingestion load, burst recovery |
Cost control | Context budget, bounded reranking, separate ingestion accounting | Cost per query, cost per ingested document |
Reliability and auditability | Idempotent submissions, stable artifact IDs, recorded evidence | Duplicate chunk rate, failed-job recovery, audit completeness |
Latency budget
We will use the following targets for an illustrative workload: p95 first-text latency at or below answer.delta event arrives; the initial query.created metadata event does not count.
Message size
As in the classic design problems, we start with message sizes. Answers are larger than chat replies because each citation carries a quoted passage:
Ask a question: about
of request (the question, filters, and context) and about of response for an answer with three citations, whether it is returned at once or streamed. Submit a document: about
...