Tutorials
June 3, 2025

How to Build a RAG System on Prem

  •  
Read time:  
3
mins
Daniel Warfield
Senior Engineer

The world’s most valuable data isn’t in the cloud, it’s locked behind firewalls, inside private servers, and sometimes in air-gapped environments. That’s why EyeLevel.ai built their RAG (Retrieval-Augmented Generation) system to run entirely on premises, close to the data, with full control and compliance. In this post, we’ll walk through how to architect a private RAG system that can ingest, retrieve, and serve insights from massive document stores, without ever leaving your secure perimeter.

How to Build a RAG System On Prem

The most important data in the world isn’t in the cloud. It lives in private data centers, behind firewalls, and often in air-gapped environments. These are the settings where Retrieval-Augmented Generation (RAG) must be deployed on premises, close to the data, inside the security perimeter, and at enterprise scale.

This article walks through what it actually takes to build and run a performant RAG system on premises, based on a technical discussion with Ben Fletcher, Chief Scientist & Co-Founder at EyeLevel.ai and former founding engineer on IBM’s Watson team. We unpack what makes on-prem RAG different, where common approaches break down, and how to architect systems that can ingest, process, and retrieve massive volumes of documents reliably.

Why On-Prem RAG Requires a Different Approach

RAG applications are often introduced as lightweight tools to “chat with your documents,” but in regulated industries such as finance, healthcare, and defense, the real need is much heavier. These organizations can’t send data to the cloud, no matter how powerful the model. The infrastructure must come to them.

Deploying RAG inside a private data center or air-gapped environment introduces constraints that cloud-native RAG systems never face. You can’t rely on external APIs for embeddings. You can’t offload inference to OpenAI or Anthropic. Every part of the stack, from document ingest to GPU scheduling, has to be owned, secured, and scaled internally.

The Scale Problem Hides in the Documents

Most developers think about scaling in terms of users. If your app gets popular, the traffic grows. With RAG, scale doesn’t come from users, it comes from documents.

One 200-page PDF can generate thousands of calls to layout parsers, OCR engines, embedding models, and language models. A single folder of files might contain 20,000 pages, creating tens of thousands of requests just to process and store the content. This isn’t theoretical. It happens on the second test run.

That means from day one, an on-prem RAG system has to be architected like a consumer-scale cloud service, except it runs locally, in a tightly controlled environment. There’s no opportunity to start small and scale gradually. You hit production-level load almost immediately.

Why Monolithic Pipelines Fail at Scale

Most open-source RAG frameworks, like LangChain, assume a simple architecture where parsing, chunking, embedding, and storage all happen in sequence, often on a single machine. That approach works well for demos, but it doesn’t hold up when documents get large or complex.

A key takeaway from the GroundX team’s experience was the need to decouple every stage in the ingest pipeline into distinct, scalable microservices. OCR, for example, runs most efficiently on CPUs. Table and layout models, on the other hand, need GPUs. If you treat these as a single step, you either underutilize your hardware or overload it. Separating them allows each component to run on the optimal compute resource.

This architectural refactor isn’t just about efficiency. It’s required to avoid ingest times that stretch into days or weeks when running large-scale uploads.

Hosting Models Locally is Just the Beginning

A common misconception is that hosting your own models solves the on-prem RAG challenge. In reality, that’s only one part of the problem.

Yes, you’ll need to download or fine-tune your own embedding models and language models. But that’s just the start. You’ll also need to:

  • Serve models via optimized inference servers that take full advantage of your GPU hardware

  • Implement asynchronous processing to queue tasks and avoid idle compute

  • Balance GPU workloads to ensure throughput stays high under variable demand

  • Use caching and auto-scaling logic to avoid bottlenecks when spikes occur

GPU efficiency is especially critical, since GPUs are one of the most expensive parts of the system. Poor orchestration means either overpaying or underperforming. GroundX’s approach involves using prediction signals at the ingest stage to forecast GPU demand, spin up additional workers preemptively, and route tasks through queues that keep utilization high.

Ingest is the Hardest Part of RAG

Search and retrieval get most of the attention in RAG systems, but ingest is often the biggest challenge, especially in secure, on-prem environments.

The ingest pipeline typically includes OCR, layout detection, structural parsing, and chunk metadata creation. In GroundX, this is handled through a sequence of independent microservices optimized by hardware type and run asynchronously.

Another challenge is balancing pre-computed embeddings with real-time vectorization. While many systems embed all text during ingest, GroundX delays embedding until query time for efficiency. Only a small portion of each chunk is embedded and stored, while the full text is processed on retrieval for semantic re-ranking. This hybrid approach improves precision without bloating the database.

Security Comes Before Search

Security in on-prem RAG doesn’t begin with encryption, it begins with architecture. If you expose sensitive content during retrieval, even accidentally, you’ve already failed.

The GroundX approach involves tagging every document and chunk with metadata at ingest. These tags can represent roles, access levels, or compliance rules. When a query comes in, GroundX filters chunks before retrieval. Only authorized content is available for matching, and nothing ever reaches the LLM unless it meets those filters.

This is critical in enterprise use cases, where compliance and traceability matter as much as accuracy.

Evaluating Accuracy is Still an Open Problem

The final challenge is evaluation. Measuring how well your RAG system performs, both in terms of retrieval quality and language model output, is still difficult, especially with custom or private data.

The GroundX team emphasizes the importance of building robust eval workflows that test both ingestion completeness and retrieval precision. Without these metrics, it’s hard to know whether your pipeline is surfacing the right context or simply returning plausible text.

Evaluation is especially important in on-prem settings, where documents may be long, dense, and multimodal. Systems that appear to work in lightweight environments often collapse under real load without strong eval practices.

Summary: What It Takes to Run RAG On Prem

Deploying RAG on premises is not a matter of copying a cloud architecture. It’s a full-stack engineering problem that blends infrastructure, model optimization, and security.

Here’s what makes it work:

  • Decoupled ingest pipeline with task-specific microservices

  • Optimized compute placement across CPUs and GPUs

  • Asynchronous processing with intelligent queuing and load prediction

  • Secure retrieval via metadata filtering at query time

  • Real-time vectorization combined with semantic reranking

  • Eval infrastructure to validate precision and performance

Building this isn’t easy. For organizations that need control, compliance, and speed, it’s the only viable path. And when done right, it unlocks the full potential of AI, without compromising where or how data lives.

More news

Research

RAG vs CAG: What Cache-Augmented Generation Means for Enterprise AI

RAG retrieves what matters, CAG remembers it. Together, they unlock faster, smarter enterprise AI.

Read Article
Tutorials

Build Secure and Accurate RAG for Regulated Industries on OpenShift with GroundX

The world’s most important information doesn’t live on the public Internet and never will. This is how to set up private RAG in RedShift.

Read Article

Find out what the buzz is about. Learn to build AI you can trust.