A RAG system serves 10,000 users with highly personalized queries. Each user has a unique profile including preferences, history, and data access permissions. How should user-specific context be architecturally integrated into the retrieval system?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal — metadata-filtered vector search is the most scalable and architecturally clean approach. User attributes (role, permission level, preference tags) are stored as metadata on document chunks at indexing time.
Full explanation below image
Full Explanation
Metadata-filtered vector search is the most scalable and architecturally clean approach. User attributes (role, permission level, preference tags) are stored as metadata on document chunks at indexing time. At query time, the vector search applies metadata filters (e.g., 'only retrieve chunks tagged for this user's permission level') before semantic ranking, ensuring Claude only sees permitted, relevant content. A compact profile summary in Claude's context provides personalization signal without overwhelming the context window. Option A (full profile in system prompt) doesn't enforce data access controls at the retrieval level — Claude receives unpermitted chunks and must self-filter, which is unreliable and doesn't meet security requirements. Option C (per-user index) is operationally infeasible at 10,000 users; index management at that scale is prohibitively complex and expensive. Option D (query reformulation pre-step) adds latency and an extra LLM call but doesn't enforce permission filters at the retrieval level.