Quiz: Production RAG Systems
30 questions about scaling, caching, and security.
Q1: At what document count should you consider sharding?
Answer: Around 1M+ documents typically require sharding.
Q2: What is semantic caching?
Answer: Caching results for queries similar to previously seen queries.
Q3: What's the benefit of embedding caching?
Answer: Reduces API calls for repeated query embeddings.
Q4: What is multi-tenancy?
Answer: Serving multiple customers/organizations from one system with data isolation.
Q5: How do namespaces help with multi-tenancy?
Answer: Each tenant's data is stored in a separate namespace, isolating searches.
Q6: What is prompt injection?
Answer: Malicious input designed to manipulate the LLM's behavior.
Q7: How to prevent prompt injection?
Answer: Input validation, sanitization, and secure prompt design.
Q8: What should be audit logged in RAG?
Answer: User ID, query, documents accessed, timestamp, and response metadata.
Q9: What's document-level permissions?
Answer: Controlling which users can access which specific documents.
Q10: How to implement doc-level permissions?
Answer: Store allowed doc IDs per user and filter search results.
Q11: What is async processing useful for?
Answer: Handling high query volume and batch indexing without blocking.
Q12: What's a typical semantic cache threshold?
Answer: 0.95+ similarity - only cache very similar queries.
Q13: When should cache be invalidated?
Answer: When underlying documents are updated or deleted.
Q14: What's the fastest cache type?
Answer: Response cache - returns complete cached response (<50ms).
Q15: How to handle 10M+ documents?
Answer: Distributed vector database with sharding.
Q16: What is queue-based indexing?
Answer: Adding documents to a queue for async background indexing.
Q17: What's load balancing in RAG?
Answer: Distributing queries across multiple RAG instances.
Q18: What metadata enables multi-tenancy?
Answer: tenant_id field stored with each document.
Q19: What's data isolation?
Answer: Ensuring one tenant cannot access another tenant's data.
Q20: What's TTL in caching?
Answer: Time To Live - how long cached items remain valid.
Q21: Why use Redis for RAG caching?
Answer: Fast in-memory storage with TTL support and persistence options.
Q22: What's the tradeoff with smaller cache TTL?
Answer: More freshness but fewer cache hits and higher costs.
Q23: How does sharding work?
Answer: Splitting data across multiple database nodes based on a key.
Q24: What should be encrypted?
Answer: Documents at rest, API keys, and data in transit.
Q25: What's a security audit in RAG?
Answer: Regular review of access controls, logs, and vulnerabilities.
Q26: How often should audit logs be reviewed?
Answer: Continuously via automated monitoring, manual review monthly.
Q27: What's batch processing for indexing?
Answer: Processing documents in groups rather than one at a time.
Q28: What cost does caching reduce?
Answer: Embedding API calls, LLM API calls, and compute resources.
Q29: What's horizontal scaling?
Answer: Adding more instances/nodes rather than bigger machines.
Q30: What's the SLA consideration for production RAG?
Answer: Response time guarantees (e.g., 95th percentile <3 seconds).