CA-RAG: Constraint-Aligned Retrieval for Structurally Faithful Long-Form Generation

Vimal Kumar Kumar, Meghana Kshirsagar, Conor RyanarXiv 2026

TL;DR

Standard Retrieval-Augmented Generation (RAG) hunts for text that sounds semantically similar to your prompt, which often leaves out boring-but-mandatory legal or regulatory details when drafting long documents. CA-RAG fixes this "retrieval–generation mismatch" by injecting document schemas (ontologies) and policy rules (knowledge graphs) directly into the search query before retrieval even happens. By ensuring the LLM actually has the structurally required evidence on its desk before it starts writing, CA-RAG reduces critical omissions in high-stakes, compliance-heavy writing.

What Problem Does This Paper Address?

Imagine asking an AI to draft a complex Data Sharing Agreement (DSA) for a hospital. Using standard RAG, the system breaks the task down, searches an external database for passages semantically related to "data sharing," and feeds them to the language model.

Here is the catch: semantic similarity is not structural sufficiency.

Just because a retrieved paragraph talks about data sharing doesn't mean it contains the specific regulatory triggers—like mandatory Data Protection Impact Assessments (DPIAs) or cross-border transfer mechanisms—required to make that section legally valid. Existing fixes usually try to patch this during decoding (e.g., constrained prompting) or via iterative search loops. The authors hypothesize that many downstream failures in long-form generation aren't the LLM's fault at decoding time; rather, the retriever simply failed to fetch the right building blocks upfront.

Methods

Instead of building a brand-new neural retriever, the authors propose Constraint-Aligned RAG (CA-RAG), a pre-retrieval query-conditioning framework that unfolds in four clean stages:

Figure 1: Overview of CA-RAG: retrieval conditioned on structural and policy constraints for long-form generation.
  1. Constraint Extraction: Given an input scenario and planned document section headings, CA-RAG pulls from two structured sources (built semi-automatically via LLM template extraction):
  2. Ontology Constraints: Schema-level blueprints defining mandatory fields and section structures.
  3. Policy-Grounded Knowledge Graphs (KGs): Networks where nodes are clauses/entities and edges are hard rules like REQUIRES, PERMITS, and PROHIBITS.
  4. Query Construction: Rather than expanding queries with synonyms, CA-RAG appends up to three matched ontology concepts and three KG policy relations directly to the section query.
  5. Dense Evidence Retrieval: A standard dense retriever (all-MiniLM-L6-v2) uses this structurally augmented query to fetch the top-$k$ supporting passages.
  6. Section-Wise Generation: An open-weight LLM (Llama-3.1-8B, Llama-3.2-3B, or Mistral-7B) generates each section independently using the scenario, the newly retrieved evidence, and the structural constraints.

Datasets

To test compliance-critical generation, the authors curated custom domain corpora (regulatory policies, operational guidelines, ontologies, and KGs) for Data Sharing Agreement (DSA) synthesis across three distinct domains:

  • Healthcare (141 KG entities; privacy-sensitive)
  • Education (79 KG entities; governance-focused)
  • Finance (267 KG entities; dense regulatory dependencies)

Ground-truth DSAs were held out from the retrieval corpus for reference comparison. For automated compliance auditing, the authors built scoring pipelines informed by established legal NLP taxonomies—CUAD, LEDGAR, and LEXGLUE (Unfair-ToS)—alongside manually annotated pooled top-20 passage sets to evaluate retrieval completely independently of generation.

Key Insights and Ideas

  • Prompting alone builds hollow structures: In an ablation where structural constraints were only given to the LLM during generation (GEN-CONSTRAINT), the model hit the highest raw clause coverage (78.7%). It knew what clauses to write! However, its overall compliance and reliability lagged behind CA-RAG because it lacked the retrieved factual evidence to substantiate those clauses properly.
  • Ontologies and KGs play complementary roles: Looking at multi-dimensional compliance trade-offs, ontology constraints act like architectural scaffolding (boosting broad provision coverage), while KG relations act like a legal checklist (enforcing specific clause-level obligations).
Figure 3: Structural and compliance trade-offs across retrieval variants for Llama-3.1-8B. Scores are normalised across six auditing metrics. Ontology constraints improve structural completeness, while KG constraints strengthen clause compliance.
  • More context isn't a silver bullet: Simply cranking up the retrieval budget ($k=9$) caused standard RAG's compliance scores in finance to degrade substantially due to noise, whereas CA-RAG stayed stable—proving that targeted structural evidence beats more evidence.
  • Single-pass beats iterative loops on latency: Adaptive methods like SELF-RAG and FLARE-RAG pause to critique and re-retrieve during generation, driving up variance and latency. Front-loading constraints prior to retrieval keeps latency much closer to standard single-pass RAG.

Key Results

  • Pure Retrieval Gains: With generation completely disabled, CA-RAG beat standard RAG across all retrieval budgets ($k \in \{3, 6, 9\}$). At the standard generation budget ($k=6$), Precision@$6$ rose from 0.5268 to 0.5692, pooled Recall@$6$ jumped from 0.5402 to 0.5950, and F1@$6$ improved from 0.5389 to 0.5672.
  • Domain Nuances in Sufficiency: While CA-RAG improved clause-evidence coverage and reduced omissions in healthcare and education, finance proved tough—satisfying high-level KG constraints didn't automatically guarantee direct clause-supporting evidence in dense financial corpora.
  • Downstream Reliability: Measuring overall document reliability (a weighted blend of 70% multi-signal compliance and 30% surface similarity), CA-RAG achieved the highest mean score in 6 out of 9 model–domain pairs, sweeping all three finance configurations (e.g., reaching 0.6404 vs. RAG's 0.6259 on Llama-3.1-8B).
  • Auditor Trustworthiness: Comparing their GPT-4o-mini automated clause auditor against human experts yielded a tight Mean Absolute Error of 2.63 percentage points (Pearson $r = 0.967$).

Limitations and Future Work

  • Garbage in, garbage out for structured data: CA-RAG relies on domain ontologies and policy KGs. If those graphs are noisy, incomplete, or unavailable for a new domain, retrieval conditioning loses its edge.
  • No silver-bullet guarantees: Conditioning queries raises the odds of finding mandatory clauses, but if supporting evidence is weakly represented in the underlying text corpus (as seen in finance retrieval), omissions still happen.
  • Scope and Overhead: Constructing KGs and matching ontologies adds pre-retrieval latency compared to vanilla RAG, and experiments were restricted to DSA synthesis on 3B–8B open-weight models.

Future work aims to scale retrieval-stage structural alignment to broader regulatory tasks, policy synthesis, and agentic verification workflows that can actively catch and repair missing evidence-dependent clauses after drafting.

Summary updated

Abstract

Retrieval-augmented generation (RAG) typically optimises evidence selection for semantic relevance, whereas compliance-sensitive long-form generation also requires evidence supporting explicit structural obligations. Semantically relevant retrieval may therefore omit information needed for mandatory downstream clauses. We propose Constraint-Aligned RAG (CA-RAG), a retrieval-conditioning framework that augments section-specific queries with ontology-derived structural constraints and policy-grounded knowledge-graph relations before evidence selection. Retrieval-only evaluation with manually annotated evidence shows consistent improvements across retrieval budgets. At $k=6$, CA-RAG increases Precision@$k$ from $0.5268$ to $0.5692$, pooled Recall@$k$ from $0.5402$ to $0.5950$, and F1@$k$ from $0.5389$ to $0.5672$ over standard RAG. Generation experiments further show improvements in compliance and reliability in several model--domain settings, while generation-only constraints achieve higher clause coverage but lower overall compliance and reliability. These results indicate that structurally aligned retrieval can improve evidence sufficiency in compliance-sensitive long-form generation.
BibTeX
@misc{kumar2026ca,
  author = {Vimal Kumar Kumar and Meghana Kshirsagar and Conor Ryan},
  title = {{CA-RAG: Constraint-Aligned Retrieval for Structurally Faithful Long-Form Generation}},
  year = {2026},
  eprint = {2611.33497},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.33497},
}
Figure