Menu ☰
rag · · 3 min read

RAG on Romanian Legal Corpus: From PDF to Cited Answer

By August 2026, every legal team we onboard asks the same question: why does our internal assistant cite OPANAF 1.581/2025 correctly on Monday and invent a paragraph number by Friday? The answer sits in the pipeline,…

CAI Technology · Last reviewed: 8/31/2026
Clean editorial portrait of a professional woman in a bright office with soft blue/purple light; no text, no logos, anatomy is correct. Fits an enterprise legal/RAG article co

RAG on Romanian Legal Corpus: From PDF to Cited Answer

By August 2026, every legal team we onboard asks the same question: why does our internal assistant cite OPANAF 1.581/2025 correctly on Monday and invent a paragraph number by Friday? The answer sits in the pipeline, not the model.

Romanian legal RAG breaks in predictable places. Source drift on Monitorul Oficial. OCR noise on scanned pre-2010 acts. Hierarchical ambiguity when one ordinance amends five prior ones. A generic chunker treats all of this as prose — which is why answers rot inside three months.

Ingestion: normalize before you embed

Skip cosmetic PDF parsing. What survives to production is a two-pass extractor — pdfplumber for post-2015 digital PDFs, Tesseract with a Romanian language pack for older scans. Every chunk carries structured metadata before it ever sees an embedding model: regulation ID, article, alineat, publication date, superseding-act pointer. Miss this step and you cannot answer “as of today, what does GDPR Art. 6(1)(f) require in Romania?” — retrieval has no time axis.

chunker:
  strategy: legal_hierarchical
  granularity: alineat
  metadata:
    - source_id: OPANAF_1581_2025
    - article_no: "6"
    - alineat_no: "1.f"
    - published: 2025-06-14
    - superseded_by: null
  max_tokens: 512
flowchart LR A[PDF from Monitorul Oficial] --> B{Digital or scanned?} B -->|digital| C[pdfplumber layout parse] B -->|scanned| D[Tesseract RO OCR] C --> E[Legal hierarchical chunker] D --> E E --> F[Metadata: article, date, supersession] F --> G[Hybrid BM25 + dense index] G --> H[Query with citation grounding] classDef good fill:#dcfce7,stroke:#10b981 classDef risk fill:#fee2e2,stroke:#ef4444 class F,H good class D risk

Retrieval and citation grounding

Dense-only retrieval fails on Romanian legal text because embeddings collapse “persoană fizică autorizată” and “persoană juridică” into neighbouring vectors. Hybrid BM25 plus a cross-encoder reranker is not optional. The ENISA guidance on AI cybersecurity treats retrieval poisoning as a first-class threat — the same logic applies inside a legal corpus where one wrong amendment silently propagates for months.

Grounding is where teams give up too early. A citation is not the string “Art. 6(1)(f)”; it is a verifiable pointer back to the source chunk, timestamped, with retrieval score and superseding-act check attached. If the generator emits a claim without a resolved citation, the answer is dropped rather than softened. That discipline is the core of our RAG pillar and it ships end-to-end inside Lexnomia for compliance workloads that touch the EU AI Act.

Where the pipeline still breaks

The remaining failure sits at the boundary between retrieval and drafting. Even with clean chunks, a model that paraphrases across two amendments will produce a plausible synthesis that no lawyer can defend in front of ANSPDCP or ANAF. Our working position at CAI Technology: never let the LLM paraphrase legal text. Extract. Quote verbatim. Attach the chunk pointer. Anything else is theatre.

The alignment logic here sits in the same family as our work on agent safety topology — the model is a component, not the guarantee. If your legal RAG is quoting yesterday’s law today, start with the reference stack in Lexnomia.

Read further

We start with a 30-minute conversation.

Free AI-readiness audit for companies with 50+ employees. We reply within 24 hours.