Saltar al contenido
Auditable RAG compiled in Rust — AI Act, NIS2 and DORA compliance for critical enterprise AI systems

An auditable RAG must be compiled — what Python cannot guarantee

Why a production RAG must be compiled rather than interpreted: technical analysis of Rust's guarantees versus Python, and the regulatory requirements (AI Act, NIS2, DORA, CRA) that make auditability non-negotiable.

Última actualización: 11 de marzo de 2026

Search “RAG Python” on Google: thousands of tutorials, Jupyter notebooks, LangChain and LlamaIndex guides. The ecosystem is dense, documented, accessible. Python has become the common language of applied AI.

Search “RAG Rust”: near-silence.

This silence is not an industry oversight. It signals that an entire territory remains unexplored — and that the question nobody is asking yet is precisely the most important one for organizations deploying AI on sensitive data: is a production RAG system truly predictable, traceable, and auditable? Or does it merely work?


What Python brings — and what it cannot guarantee

Python dominates the AI ecosystem for good reasons. Its rich library ecosystem (LangChain, LlamaIndex, HuggingFace Transformers…), accessible syntax, and massive community make it the best prototyping tool available. For experimenting, iterating quickly, exploring approaches — Python is unmatched.

But Python is an interpreted language. Source code is translated on the fly into bytecode, executed by a runtime that manages memory, threads, and resources itself. This abstraction layer is valuable for productivity. It also introduces behaviors that are structurally difficult to control in production:

The GIL (Global Interpreter Lock) prevents simultaneous execution of multiple Python threads on CPU-intensive tasks. For a RAG handling many parallel requests, this represents a real bottleneck, compensated in practice by multiprocessing — at the cost of added complexity and higher memory footprint.

Python’s garbage collector operates via reference counting, supplemented by a cycle collector. In practice, memory release happens at moments the application code does not control. For most use cases, this does not matter. For a production system under strict SLA, continuously processing confidential documents, every unexpected pause becomes a variable to monitor.

Python’s dynamic typing means many errors — type errors, reference errors, data structure mismatches — only surface at runtime, sometimes in code paths rarely taken. A bug can remain dormant until a specific condition triggers it in production.

These limitations do not condemn Python. They place it where it excels: exploration and prototyping. They mean, however, that a critical system built exclusively in Python requires constant runtime vigilance that the architecture cannot delegate to the language itself.


What Rust guarantees — at compile time, not at runtime

Rust is a compiled language. Code is transformed into a machine binary before any execution. This transformation is not a mere technical step: it is where the Rust compiler performs the bulk of its verification work.

Its central mechanism — the ownership and borrow checker system — enforces strict rules on how memory is allocated, used, and freed. These rules are verified statically, at compile time. If the code does not comply, it does not compile. There is no runtime to catch errors: they simply do not exist in the produced binary.

The practical consequences are profound:

No garbage collector. Memory is freed deterministically: as soon as a variable goes out of scope, its resources are reclaimed immediately and predictably. No unexpected pauses. No latency variation caused by a collector deciding to intervene at the wrong moment. This is what the real-time systems community calls zero-cost memory management.

No data races. The Rust compiler prohibits, by construction, unsafe concurrent access to shared data. Rust’s native multithreading — with no GIL equivalent — enables true parallelism, with safety guarantees that Python can only offer through coding conventions and additional tooling.

Errors detected before execution. The majority of bug classes that affect Python systems in production — type errors, invalid accesses, null references — are impossible in idiomatic Rust code. The compiler identifies and blocks them before the binary exists.

For a production RAG processing sensitive enterprise documents, these properties are not performance advantages. They are behavioral guarantees — a difference in nature, not degree.


Why this changes everything for auditability

An auditor examining an AI system asks a fundamental question: if I replay this operation under the same conditions, do I get a consistent and explainable result?

In a Rust system, production behavior is predictable and traceable. Memory management is deterministic. Execution paths are resolved at compile time. Errors are detected before deployment. An auditor can analyze the binary, replay scenarios, and obtain stable results.

In a Python system, the execution layer itself introduces variability: the GC intervenes according to heap state, dynamic imports can alter module behavior depending on the environment, and the GIL affects the actual order of operations in a multithreaded context. These behaviors are perfectly legitimate for a data science tool. They make auditability structurally more complex for a critical system.

The distinction is clear: placing an audit trail on a system whose execution layer is itself variable is like signing a document whose authorship you do not fully control.


European regulations: requirements arriving fast

This technical debate does not play out in a vacuum. A set of European regulations — in force or imminent — is redefining what it means to deploy an AI system in an enterprise.

The AI Act (EU Regulation 2024/1689) entered into force on 1 August 2024 and is being phased in progressively. Since August 2025, the first obligations for general-purpose AI models are active. From 2 August 2026, full requirements will apply to high-risk AI systems — those used in healthcare, critical infrastructure, finance, justice, and human resources. These systems must notably be traceable and auditable via an automatic logging mechanism, accompanied by up-to-date technical documentation and demonstrate robustness and cybersecurity guarantees throughout their lifecycle. A RAG handling medical records, financial contracts, or HR decisions falls directly within this scope.

NIS2, currently being transposed into national law across EU member states, extends cybersecurity obligations to 18 critical sectors and their IT subcontractors. It mandates documented governance, information system traceability, and direct director liability for non-compliance. Sanctions can reach €10 million or 2% of global turnover.

DORA (Digital Operational Resilience Act), applicable since 17 January 2025, imposes strict ICT risk management, resilience testing, and incident traceability requirements on the financial sector. Any technology provider supplying critical services to financial entities falls within its scope.

The Cyber Resilience Act (CRA), which entered into force in January 2025 and will be fully applicable in 2027, will require vulnerability and patch traceability across the entire lifecycle of software products.

These four texts converge on the same requirement: an AI system deployed in an enterprise must be able to demonstrate its behavior, not merely assert it.


Ferrocene: when the compiler itself is certified

This is where Rust crosses a boundary that Python cannot reach.

Ferrocene, developed by Ferrous Systems, is the first Rust compiler qualified for safety-critical systems, certified by TÜV SÜD. It meets the most demanding industry standards: ISO 26262 (ASIL D) for automotive, IEC 61508 (SIL 4) for industry, and IEC 62304 (Class C) for medical devices.

What this means in practice: the compilation chain itself — not just the application code — is verified, documented, and audited. An auditor can trace back to the compiler and obtain formal proof of its behavior.

Python has no equivalent. There is no Python compiler qualified for safety-critical systems, and the interpreted nature of the language makes this type of qualification structurally difficult to achieve.


What this means for Lexiane

Lexiane chose Rust not because it is fashionable, nor solely because it is faster. It is an architectural choice, with precise regulatory and operational implications.

A RAG engine in Rust provides:

  • Predictable production behavior — no GC pauses, no runtime variability
  • Memory safety guaranteed at compile time — entire classes of vulnerabilities eliminated before deployment
  • Native and safe parallelism — without the GIL bottleneck
  • A development chain compatible with certification requirements of regulated sectors
  • Reduced memory footprint — lighter infrastructure, controlled server costs

For organizations that must comply with the AI Act, NIS2, DORA, or prepare for ISO 27001 certification, these properties are not marketing arguments. They are evidence the system can produce before an auditor.


The question is not “does my RAG work?” — it is “can my RAG prove it?” Lexiane was designed to answer the second question.


Introduction to RAG

Hexagonal architecture

Sovereign RAG overview

Solicitar acceso al Core Auditable

Regístrese para ser notificado de la apertura del programa de auditoría de nuestro Core. De conformidad con nuestra política de privacidad, su dirección de correo electrónico profesional se utilizará exclusivamente para esta comunicación técnica, sin ningún uso de marketing posterior. Acceso distribuido a través de registro privado seguro.

Contáctenos