Skip straight to reading
FcckeokukA warm everyday magazine about home projects, parties and reunions, tech in the living room, trips away, food worth sharing and the sport we follow.
All sections

EntranceTable 3: Tech

Server, cloud and development

Table 3TechSeat 2 / 18

Expanding the Frontiers: Scalability in RAG Systems Using Vector Databases

How vector databases help retrieval-augmented generation systems scale: indexing, sharding, filtering, caching and prompt design that keeps answers grounded.

Posted
Length
2 minute read

What RAG actually does

Retrieval-augmented generation, usually shortened to RAG, pairs a language model with a search step. When a question comes in, the system first looks up relevant passages from a document collection, then hands those passages to the model as context for its answer. The model writes; the retrieval layer supplies the facts. This keeps responses tied to source material the organisation controls, and it means knowledge can be updated by changing documents rather than retraining a model.

Why vector databases sit at the centre

To find relevant passages by meaning rather than exact keywords, documents are split into chunks and converted into embeddings: lists of numbers that place similar ideas near each other. A vector database stores those embeddings and quickly answers the question "which chunks are closest to this query?" With a few thousand documents almost any approach works. With millions of chunks, many concurrent users and frequent updates, the design of that database decides whether answers arrive in a blink or after an awkward pause.

Techniques that help a system grow

  • Approximate nearest neighbour indexes. Graph-based or clustered indexes trade a tiny amount of accuracy for large gains in speed.
  • Sharding and replication. Splitting the collection across machines spreads the load, while replicas absorb read traffic and add resilience.
  • Metadata filtering. Restricting a search by language, date, department or permission level shrinks the candidate set and keeps results relevant and secure.
  • Hybrid search. Combining keyword and vector scores catches product codes, names and rare terms that embeddings can blur.
  • Caching. Popular questions and their retrieved context can be cached to save repeated work.
  • Incremental updates. Re-embedding only changed documents keeps the index fresh without full rebuilds.

The prompt is part of the architecture

Retrieval only helps if the model uses the context well. Careful prompt engineering tells the model how to treat retrieved passages, when to admit it does not know, how to cite sources and how to format the answer. As the system scales, prompts also have to manage context length: deciding how many chunks to include, ordering them by relevance and trimming duplicates so the most useful evidence is not crowded out.

Measuring as you scale

Growth exposes weak spots. Track retrieval quality with a set of test questions that have known answers, watch latency at busy times and review a sample of responses regularly. Chunk size, embedding model, index parameters and prompt wording all interact, so change one at a time and compare. Teams that treat retrieval, storage and prompting as one connected system tend to find that scaling becomes a series of manageable adjustments rather than a painful rebuild.