How to Implement Generative AI and Local RAG in Compliance with ISO 27001 and ISO 9001
Introduction
As Generative Artificial Intelligence becomes indispensable in the enterprise, a critical regulatory challenge emerges: how to process confidential corporate data without violating information security regulations? Sending audit reports, financial data, or technical specifications to proprietary cloud APIs can pose a direct risk of leaking intellectual property.
The solution to this impasse lies in Data Sovereignty combined with Local AI. In this article, the design of a local RAG (Retrieval-Augmented Generation) pipeline running on CPU (using Ollama and Llama 3) answers concrete controls in ISO 27001 (Information Security) and ISO 9001 (Quality Management).
π Aligning Local AI with ISO 27001 Controls
The ISO/IEC 27001 standard demands control over where data resides and who can reach it. A local architecture answers two Annex A controls (2022 edition). The others stay in the evidence folder:
- A.5.14 (Information transfer): the prompt and the document stay on the machine. There is no transfer to a third-party API.
- A.5.23 (Information security for use of cloud services): the decision not to use a cloud AI service is the control. Asset inventory (A.5.9) and privacy (A.5.34) remain mandatory. Local RAG does not satisfy them by itself. A.5.34 applies when the document holds personal data, and the sanitizing step is step 1.
βοΈ The CPU-Based Local RAG Architecture
To comply with ISO 9001 (Quality and Repeatability), we need a consistent data retrieval process. The recommended architecture is structured into 4 internal layers:
[Internal Documents (PDF/txt)]
β
βΌ
[Markdown Conversion / Chunking]
β
βΌ
[Local Vector Indexing (PostgreSQL + pgvector, or Chroma)]
β
βΌ
[Python Orchestrator (LangChain)] <βββ> [Local LLM (Ollama / Llama 3)]
Step 1: Qualified Document Ingestion
In line with ISO 9001 (only controlled documents, in their approved version, go in) and with privacy law such as the LGPD, ensure that input files pass through a data sanitization routine (removing PII - Personally Identifiable Information) before being fragmented into chunks.
Step 2: Local Vector Database
If the company already runs PostgreSQL, the pgvector extension on that same server avoids another service. The tutorial that stores the index in Chroma, on the same machine and without Postgres, is the local RAG agent article. Two paths. Not the same system.
Step 3: Local LLM Execution via Ollama
Ollama allows you to spin up advanced language models (like Llama 3 or Mistral) locally. To optimize hardware usage on standard servers without dedicated GPUs, utilize 4-bit quantized models (Q4_K_M), which run with high efficiency directly on the CPU.
Bring the model up without leaving the machine
The control an auditor wants (ISO 27001 and, in practice, SOC 2 CC6) is easy to show: the process listens only on localhost and the model was pulled to local disk.
ollama pull llama3
ollama pull nomic-embed-text
ss -ltnp | grep 11434
curl -s http://127.0.0.1:11434/api/generate \
-d '{"model":"llama3","prompt":"Reply with only: pong","stream":false}'
The prompt is neutral on purpose. Asking the model for the production policy, without the retriever, makes Llama invent the control. The question that uses a document is in the Chroma tutorial. ss is Linux. On macOS, use lsof -nP -iTCP:11434 -sTCP:LISTEN.
If ss shows 127.0.0.1:11434 and not 0.0.0.0:11434, the data does not cross the network. That is the screenshot I take to the audit, next to the ID (digest) ollama list shows. That is not the sha256 of the file on disk.
π Conclusion and Audit Benefits
Presenting a self-hosted AI system during a compliance audit drastically reduces the scope of risks assessed by auditors. You can prove end-to-end that the company's artificial intelligence operates under the same physical and logical security policies that already govern your traditional databases.
Related Articles
ISO 27001 for IT Companies: Access, Logging, and Backup Evidence
What an ISO 27001 auditor opens at an IT company: the access list, a log sample, and proof of restore. Commands for all three, without turning the standard into a slide.
Building a Local RAG Agent with Python, Ollama (Llama 3), and CPU
Local RAG on CPU with Python, LangChain, and Ollama (Llama 3): commands to pull the model, index documents, and keep data off the cloud.