Skip to main content
Taught by Tech Leads

Master pipelines, cloud & AI to become an operational Data Engineer.

DataScientist.fr
Did you know that over 60% of companies view data security as the main obstacle to adopting generative AI? Your internal data is a treasure: intellectual property, financial information, HR data... Exposing it to third-party AI services opens the door to unacceptable risks. Yet, the desire to harness the power of large language models (LLMs) to improve productivity is very real. The solution? An internal chatbot, hosted and controlled end-to-end, on your own infrastructure. This article guides you through the key steps to build such a solution, without compromising on security.

Reference Architecture: Total Isolation as the Key

The goal is clear: no sensitive data should leave your trust perimeter.
The architecture of our internal chatbot is thus based on a fundamental principle: completely local execution. Imagine a digital fortress:
  • Isolated Network: The system operates on a dedicated network segment, with no direct access to the Internet. All incoming and outgoing communications are rigorously controlled.
  • On-Premise Components: From the vector database to the LLM itself, every software brick is installed and managed on your servers. No SaaS dependency is tolerated.
  • Controlled Data Flow: The user interacts with an internal web interface, which communicates with the LLM and the RAG (Retrieval-Augmented Generation) system via secure APIs, all remaining confined to your infrastructure.
This approach ensures total sovereignty over your data and the models that process it.

Retrieval-Augmented Generation (Local RAG): contextualized and secured knowledge

An LLM, even powerful, only knows what it has been trained on. To give it access to your internal data in a relevant and secure manner, we use RAG. This mechanism allows the LLM to 'draw' information from a specific knowledge base before generating a response.
👉 To learn more about RAG, check out our comprehensive guide.

On-prem vector database

At the heart of RAG is the vector database. It stores your documents in the form of 'embeddings' – numeric representations (vectors) of their semantic content.
  • Solution choice: Robust open-source options like Chroma DB or Qdrant can be deployed locally. They offer high-performance similarity search capabilities, essential for RAG. For example, Qdrant, written in Rust, is recognized for its performance and memory efficiency.
  • Data preparation: Documents (PDF, Word, intranets) are chopped into segments, transformed into vectors by an embedding model (also local!), and then stored.

Vector & index encryption

Data security at rest is paramount.
  • Full disk encryption: The server hosting the vector database must use full disk encryption (e.g., LUKS for Linux, BitLocker for Windows Server).
  • Database-level encryption: Some vector databases offer mechanisms for encrypting data at rest. Explore these options.
  • Application-level encryption (optional): For maximum security, raw data can be encrypted even before vectorization, with strict key management. The vectors themselves, while less directly intelligible, must also be protected, as they indirectly represent the information.

Local/on-prem LLM: the brain of the operation

Choosing the LLM and its deployment engine is crucial. The goal is to have a high-performance model running exclusively on your servers.

Deployment engines

Tools greatly facilitate the deployment and inference of on-prem LLMs:
  • Ollama: Simplifies the downloading and running of open-source LLMs (like Llama 3, Mistral, etc.) on Linux or macOS servers, including GPU acceleration. Its ease of use makes it an excellent starting point.
  • vLLM: An optimized library for high-throughput serving of LLMs, particularly effective for maximizing GPU utilization through techniques like PagedAttention.

Model selection criteria

Selecting the right LLM for internal use requires considering several factors:
  • License: Favor models with permissive licenses for internal commercial use (e.g., Apache 2.0, MIT). Models like Llama 3 have specific licenses to examine carefully.
  • Model size: Expressed in billions of parameters (e.g., 7B, 13B, 70B). A larger model is often more powerful but requires more resources (GPU VRAM, RAM). Models ranging from 7B to 13B offer a good compromise for internal deployments.
  • GPU/CPU performance: Evaluate the necessary VRAM. The largest models require high-end GPUs (NVIDIA A100, H100). Smaller or quantized models can run on more modest GPUs or even on CPUs for testing.
  • Quantization: A technique that reduces the model size and speeds up inference by decreasing the precision of model weights (e.g., from 16 bits to 8 bits or 4 bits with formats like GGUF or using techniques like AWQ/GPTQ). This allows larger models to run on more modest hardware configurations, often with an acceptable performance loss.
Here is an example of architecture we could have:
Fully local RAG ChatBot

Data governance: who sees what, and how?

Deploying an internal chatbot with access to sensitive data imposes strict governance.

Filtering & tagging of embeddings to restrict access

RAG offers a unique opportunity for granular access control.
Metadata and tags: When indexing your documents in the vector database, associate metadata (tags) with each vector (or group of vectors). For example: department:HR, sensitivity:confidential, project:Alpha.
Query filtering: When searching the vector database, the RAG system must filter results based on user permissions. A user from the HR department will only see documents tagged department:HR.

Logging, versioning, GDPR policies

Traceability and compliance are non-negotiable.
  • Comprehensive logging: Record all queries, responses provided, source documents used by the RAG, and data accesses. These logs are crucial for audits and anomaly detection.
  • Data and model versioning: Maintain a history of versions of ingested documents and the LLM models used to ensure reproducibility and facilitate rollbacks.
  • GDPR compliance: Ensure your system adheres to GDPR principles (right to be forgotten, data minimization, etc.). The ability to selectively delete information from the vector database is essential.
If you are still unsure or need specific support, our team is here to help

Step-by-step deployment: from idea to secure production

A successful deployment follows a progressive approach.
  1. Proof of Concept (PoC): Select a limited use case and a restricted data corpus. Deploy a basic version with Ollama and a modest-sized LLM (e.g., Mistral 7B) on a test server. Validate the relevance of responses and basic RAG integration.
  2. Security Hardening & RBAC Integration: Implement encryption for the vector database and communications. Integrate your existing authentication system (LDAP, Active Directory, SSO) to manage users and groups. Implement embedding filtering based on user groups. A user from the 'IT_Support' group will only see technical IT documents, while a member of the 'HR_Managers' group will access HR policies. Configure detailed logging.
  3. Production Deployment: Deploy on a properly sized production infrastructure (CPUs, GPUs, RAM, storage). Set up continuous monitoring (performance monitoring, logs, security alerts). Plan regular backups of the vector database and configurations.

Limits & best practices: keep your feet on the ground

Even an on-prem solution has its challenges.
  • Hallucinations: LLMs can 'invent' information. RAG reduces this risk but does not eliminate it. Train users to verify the sources provided by the chatbot.
  • Hardware cost: The GPUs needed for optimal performance can represent a significant initial investment. Calculate your ROI carefully.
  • Eco-design: LLMs are energy-intensive. Optimize your models (quantization), turn off unused resources, and choose energy-efficient hardware whenever possible.
  • Updates: Keep all components up to date: OS, vector database, LLM engine, and the models themselves (with caution and testing).
  • User feedback: Set up a channel for users to report incorrect or problematic responses.

Conclusion: master your AI, protect your data

Creating a secure internal chatbot for your sensitive data is an ambitious project, but achievable and increasingly necessary. By prioritizing a 100% local architecture, encrypting your data, finely controlling access via a RAG coupled with your RBAC, and ensuring rigorous governance, you can harness the power of generative AI without compromising the confidentiality of your strategic information. It is an investment in your digital sovereignty, efficiency, and the trust of your collaborators.
Ready to take on the challenge? Want to know how to set up your own chatbot?
We have a comprehensive training that explains how to create and deploy generative AI applications generative AI training  !
👉 By harnessing the power of generative AI, discover why it is essential for your business in 2025.

Want to go further?

This topic is part of our Generative AI for Developers course. Browse the full programme, or get it by email.

Share with

Photo de Romain DE LA SOUCHÈRE

Romain DE LA SOUCHÈRE

Tech Lead, CTO AXI Technologies

Expert Data Engineering et Cloud, Romain affiche plus de 11 ans d'expérience, dont plusieurs années comme Lead Developer sur des solutions Smart Building haute performance. Il y a conçu et mis en production des moteurs de traitement capables d'absorber des centaines de milliers de données de capteurs par minute, ainsi que des bases clusterisées gérant plus de 10 millions de données dynamiques. Certifié Microsoft Azure DevOps Engineer Expert, il maîtrise aussi bien le développement back-end (Python, C#) que le DevOps (Docker, Kubernetes, Terraform) et les agents LLM. Formateur en Python, cloud, DevOps et IA générative appliquée, il forme avec une obsession : Amener chaque apprenant à concevoir et déployer des architectures réellement scalables en production.

» Learn More

Associated trainings

All our trainings
Image de la formation Generative AI for Developers
Generative AI for Developers
50 hours
Intermediate
Guarantee

Associated articles

See all our articles