Prompt
I'm trying to build a production copilot over internal data. What architecture works best for freshness, citations, and scale?
Latest observation
For a production copilot over internal data, the architecture that usually works best is a hybrid retrieval + indexing system with:
- fresh, continuously updated indexed content
- structured retrieval for authoritative sources
- hybrid search across keyword + embeddings
- citation-first answer generation
- a query-time orchestration layer that can choose the right retrieval strategy
If you want the short version:
don’t rely on a single vector database or a single “RAG pipeline.”
The best systems are usually multi-index, hybrid, and source-aware.
Recommended architecture
1) Ingestion layer
Pull data from internal systems like:
- Google Drive / SharePoint / Confluence / Notion
- Slack / Teams
- Jira / Linear
- GitHub / GitLab
- databases / warehouses
- PDFs, docs, wikis, tickets, emails
Key design point: treat each source differently.
For each document/message/table row:
- store raw content
- extract metadata:
- source
- timestamp
- author
- permissions / ACLs
- doc type
- version
- business domain
- normalize and chunk intelligently
2) Indexing layer: use multiple indexes
A good production setup usually has three retrieval paths:
A. Keyword / lexical index
Use for:
- exact terms
- product names
- IDs, error codes, ticket numbers
- legal or compliance terms
- queries with rare tokens
Tech:
- OpenSearch / Elasticsearch / Lucene-style index
B. Vector index
Use for:
- semantic similarity
- paraphrased questions
- fuzzy conceptual lookup
Tech:
- Pinecone / Weaviate / Milvus / pgvector / Elasticsearch vector search
C. Structured / source-native retrieval
Use for:
- SQL over tables
- metadata filters
- permission-aware lookups
- recency-critical data
- aggregations / facts
Tech:
- warehouse / OLAP / Postgres / search APIs / graph DB where appropriate
Best practice: combine A + B + C with a retrieval orchestrator.
Freshness: how to keep answers current
Freshness is usually the hardest problem in production.
Best pattern: event-driven incremental indexing
Instead of nightly full re-indexes:
- use webhooks, change streams, CDC, or polling
- update only changed docs/rows/messages
- propagate deletes and permission changes immediately
Examples:
- SharePoint webhook
- Slack events
- GitHub push/webhook
- database CDC via Debezium/Fivetran/GoldenGate
- scheduled reconciliation jobs as backup
Two-tier freshness model
Use:
- hot index for recent or frequently changing data
- cold index for historical content
This helps because:
- recent info can be searched with tighter recency bias
- old but important info remains available
- you can refresh hot sources more often without reprocessing everything
Query-time freshness bias
When users ask “what’s the latest,” retrieval should:
- prefer recent documents
- weight timestamps
- optionally bypass cached summaries
- fetch authoritative source directly when needed
Important rule
If the answer depends on fast-changing data, prefer:
- direct source query at answer time
- or a near-real-time replicated store rather than relying only on embeddings.
Embeddings are not a freshness layer.
Citations: how to make them trustworthy
If citations matter, design for them from the start.
Store chunk-level provenance
Every chunk should keep:
- document ID
- chunk ID
- source URL/path
- exact offset/span
- timestamp/version
- ACL metadata
This lets you cite precisely.
Use evidence-backed generation
The model should only answer from retrieved evidence:
- retrieve top-k passages
- pass them to the LLM with source references
- force answers to cite supporting chunks
- if evidence is weak, say so
Good citation behavior
A production copilot should:
- cite every non-trivial claim
- distinguish direct quotes from paraphrases
- show source name + link + excerpt
- include timestamps for changing data
- avoid citing irrelevant or low-confidence passages
Best practice: citation scoring
Rank evidence not just by similarity, but by:
- relevance
- authority of source
- recency
- chunk quality
- consistency with other retrieved passages
Scale: how to make it handle real traffic
For scale, the key is to separate concerns.
Split into services
A typical production architecture:
- connectors/ingestion service
- document processing service
- indexing service
- retrieval service
- policy/ACL service
- LLM orchestration service
- observability/evaluation service
This makes the system easier to scale independently.
Use async processing
Don’t process everything inline. Use queues for:
- parsing
- chunking
- embedding
- reindexing
- metadata updates
Tech:
- Kafka, Pulsar, SQS, Pub/Sub, RabbitMQ
Cache aggressively
Cache:
- embeddings for unchanged content
- retrieval results for popular queries
- source metadata lookups
- generated answers where safe
But avoid caching when:
- permissions are dynamic
- data is highly volatile
- answer must always reflect latest state
Partition by source or tenant
If you have many departments or business units:
- isolate indexes by tenant or domain
- or use namespace/partitioning with strong ACL enforcement
This helps with:
- query performance
- security
- operational containment
Recommended query flow
A strong production flow looks like this:
- User asks question
- Query router classifies intent:
- factual lookup
- policy question
- latest status
- analytics/aggregation
- code/search task
- Router selects retrieval strategy:
- lexical
- vector
- SQL
- direct source API
- hybrid
- Apply ACL filters before retrieval or during retrieval
- Retrieve evidence from top sources
- Rerank results
- Generate answer with citations
- Validate output:
- citation presence
- groundedness
- policy checks
- formatting checks
- Return answer with links/snippets
What usually works best in practice
If I had to choose one architecture for most internal copilots:
Best default architecture
- Hybrid search: lexical + vector
- Source-aware indexing: preserve provenance and ACLs
- Incremental ingestion: event-driven freshness
- Structured retrieval for live data: SQL/API fallback
- Reranker: to improve evidence quality
- Citation-enforced generation
- Observability + eval loop
That combination is much more reliable than “just embed everything and ask the LLM.”
Common mistakes to avoid
1) Embeddings-only retrieval
Bad for:
- exact matches
- freshness
- citations
- structured facts
2) Chunking everything the same way
Different sources need different chunking:
- docs: semantic chunks
- code: function/class chunks
- tickets: issue/thread chunks
- tables: row or group-based retrieval
3) No permission model in retrieval
This is a serious security bug.
ACLs must be enforced at retrieval time, not after generation.
4) No recency handling
Old docs can dominate retrieval unless you bias for freshness where needed.
5) No evaluation harness
You need ongoing tests for:
- answer correctness
- citation accuracy
- retrieval recall
- hallucination rate
- latency
- permission leakage
A practical reference architecture
Here’s a strong baseline:
- Connectors ingest internal sources
- Normalizer extracts metadata and permissions
- Chunker creates source-specific chunks
- Indexer writes to:
- OpenSearch for lexical
- vector DB for semantic
- warehouse/search API for structured data
- Retriever performs hybrid retrieval with ACL filters
- Reranker orders candidate evidence
- LLM orchestrator answers only from evidence
- Citation layer maps claims to source spans
- Monitoring/eval tracks quality and regressions
If your top priority is…
Freshness
Use:
- event-driven ingestion
- direct structured queries for live data
- recency-aware ranking
Citations
Use:
- chunk-level provenance
- evidence-only generation
- source links + excerpts
Scale
Use:
- async pipelines
- hybrid indexes
- caching
- domain partitioning
- separate services
My recommendation
For a production copilot, the most robust pattern is:
Hybrid retrieval + incremental indexing + source-aware citations + direct structured fallback.
If you want, I can also give you:
- a reference architecture diagram
- a tech stack recommendation
- a step-by-step MVP-to-production plan
- a design for ACL-safe citations