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,…
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
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.