CA-RAG: Constraint-Aligned Retrieval for Structurally Faithful Long-Form Generation
Organizations: Lero – The Research Ireland Centre for Software Department of Computer Science & Information Systems University of Limerick, Limerick, Ireland
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 , CA-RAG increases Precision@ from to , pooled Recall@ from to , and F1@ from to 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.
Figures & tables
| Method | P@ | Pooled R@ | F1@ | |
|---|---|---|---|---|
| RAG | 3 | 0.5000 | 0.2569 | 0.3966 |
| CA-RAG | 3 | 0.5311 | 0.2754 | 0.4193 |
| RAG | 6 | 0.5268 | 0.5402 | 0.5389 |
| CA-RAG | 6 | 0.5692 | 0.5950 | 0.5672 |
| RAG | 9 | 0.5499 | 0.8654 | 0.6506 |
| CA-RAG | 9 | 0.5866 | 0.9185 | 0.6938 |
| Llama-3.2-3B | Llama-3.1-8B | Mistral-7B | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Method | Finance | Healthcare | Education | Finance | Healthcare | Education | Finance | Healthcare | Education |
| RAG | 0.6156 0.015 | 0.6634 0.012 | 0.6515 0.015 | 0.6259 0.018 | 0.6560 0.034 | 0.6685 0.023 | 0.6051 0.016 | 0.6682 0.017 | 0.6588 0.010 |
| Self-RAG | 0.6227 0.023 | 0.6602 0.010 | 0.6167 0.119 | 0.6024 0.023 | 0.6666 0.021 | 0.6772 0.025 | 0.6106 0.050 | 0.6625 0.019 | 0.6673 0.004 |
| Flare-RAG | 0.6092 0.044 | 0.6604 0.020 | 0.6459 0.016 | 0.6145 0.034 | 0.6793 0.025 | 0.6626 0.027 | 0.6113 0.034 | 0.6780 0.020 | 0.6504 0.052 |
| CA-RAG ∗ | 0.6410 0.006 | 0.6730 0.012 | 0.6521 0.022 | 0.6404 0.008 | 0.6549 0.016 | 0.6830 0.006 | 0.6329 0.021 | 0.6698 0.008 | 0.6653 0.013 |
| Variant | Clause Cov. | Comp. | Rel. |
|---|---|---|---|
| RAG | 75.9 | 0.6571 | 0.6459 |
| Gen-Constraint | 78.7 | 0.6683 | 0.6517 |
| CA-RAG | 77.8 | 0.6726 | 0.6569 |
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Retrieved Evidence |
|---|---|
| RAG | General data-sharing and recipient access passages. |
| CA-RAG | Recipient onward-sharing restrictions, incident response duties, retention-period obligations, and data-subject-rights support. |
| Domain | Method | Retrieved Evidence | Representative Missing Clauses |
|---|---|---|---|
| Finance | RAG | General transfer policies, recipient access rules, and generic governance passages | Cross Border Transfers , DPIA/TIA , Data Minimisation , Legal Basis , Onward Disclosure , Subprocessors Third Parties |
| Finance | CA-RAG | Transfer safeguards, retention obligations, governance dependencies, and audit requirements | Primarily residual administrative clauses such as Data Format Schema , Attribution Publication , Intellectual Property |
| Healthcare | RAG | Generic patient-data handling and storage policies | Incident Response , Breach Notification , Data Subject Rights , Transparency Notices , Cross Border Transfers |
| Healthcare | CA-RAG | Incident response duties, breach reporting, governance and audit procedures | Reduced omission frequency, with remaining omissions concentrated in secondary administrative clauses |
| Education | RAG | Institutional data-access and student-data usage policies | Incident Response , Cross Border Transfers , Legal Basis , Data Subject Rights , Subprocessors Third Parties |
| Education | CA-RAG | Governance procedures, retention obligations, transfer safeguards, review requirements | Primarily procedural and publication-related clauses, such as Attribution Publication and Sanctions Remediation |
| Domain | Comp. | Sim. | ||||
|---|---|---|---|---|---|---|
| Healthcare | 0.6617 | 0.6609 | 0.6600 | 0.6592 | 0.6589 | 0.6628 |
| Finance | 0.5808 | 0.6002 | 0.6195 | 0.6389 | 0.6486 | 0.5518 |
| Education | 0.6499 | 0.6557 | 0.6615 | 0.6672 | 0.6701 | 0.6413 |
| Method | Top-k | Comp. | Rel. | Sim. |
|---|---|---|---|---|
| RAG | 3 | 0.6547 | 0.6282 | 0.5662 |
| 6 | 0.6615 | 0.6259 | 0.5427 | |
| 9 | 0.5809 | 0.5741 | 0.5582 | |
| CA-RAG | 3 | 0.6614 | 0.6306 | 0.5587 |
| 6 | 0.6742 | 0.6404 | 0.5615 | |
| 9 | 0.6541 | 0.6350 | 0.5904 |
| Model | Variant | Tokens | Lat (s) | TFLOPs/s | Clause Cov. (%) | Comp. | Sim. |
|---|---|---|---|---|---|---|---|
| Mistral-7B | RAG | 1247 | 21.60 | 0.42 | 74.57 | 0.6731 | 0.6569 |
| RAG+O | 1363 | 30.27 | 0.39 | 76.30 | 0.6604 | 0.6526 | |
| RAG+KG | 1433 | 31.57 | 0.43 | 78.93 | 0.6490 | 0.6574 | |
| CA-RAG | 1555 | 27.18 | 0.73 | 78.07 | 0.6727 | 0.6629 | |
| Self-RAG | 3236 | 48.61 | 2.19 | 76.30 | 0.6663 | 0.6537 | |
| Flare-RAG | 1603 | 53.73 | 0.47 | 79.83 | 0.6802 | 0.6727 |
| Model | Variant | Tokens | Lat (s) | TFLOPs/s | Clause Cov. (%) | Comp. | Sim. |
|---|---|---|---|---|---|---|---|
| Mistral-7B | RAG | 1668 | 18.37 | 0.70 | 74.57 | 0.6267 | 0.5546 |
| RAG+O | 1709 | 16.73 | 0.88 | 74.57 | 0.6878 | 0.5229 | |
| RAG+KG | 1957 | 19.07 | 0.97 | 78.07 | 0.6577 | 0.5214 | |
| CA-RAG | 2118 | 20.05 | 0.99 | 74.57 | 0.6780 | 0.5277 | |
| Self-RAG | 4425 | 45.80 | 2.57 | 69.30 | 0.6377 | 0.5472 | |
| Flare-RAG | 2374 | 58.17 | 0.73 | 71.97 | 0.6384 | 0.5482 |
| Model | Variant | Tokens | Lat (s) | TFLOPs/s | Clause Cov. (%) | Comp. | Sim. |
|---|---|---|---|---|---|---|---|
| Mistral-7B | RAG | 1253 | 20.04 | 0.39 | 77.20 | 0.6705 | 0.6316 |
| RAG+O | 1395 | 19.75 | 0.44 | 73.70 | 0.6911 | 0.6240 | |
| RAG+KG | 1549 | 21.15 | 0.49 | 77.17 | 0.6551 | 0.5992 | |
| CA-RAG | 1694 | 22.85 | 0.50 | 76.30 | 0.6798 | 0.6313 | |
| Self-RAG | 3228 | 16.36 | 4.14 | 78.03 | 0.6869 | 0.6216 | |
| Flare-RAG | 1912 | 38.65 | 0.99 | 70.17 | 0.6670 | 0.6115 |
| Health | Finance | Edu. | |||||
|---|---|---|---|---|---|---|---|
| LLM | Method | Lat. | TF/s | Lat. | TF/s | Lat. | TF/s |
| Mistral-7B | RAG | 21.6 | 0.42 | 18.4 | 0.70 | 20.0 | 0.39 |
| CA-RAG | 27.2 | 0.73 | 20.1 | 0.99 | 22.8 | 0.50 | |
| Self-RAG | 48.6 | 2.19 | 45.8 | 2.57 | 16.4 | 4.14 | |
| Flare-RAG | 53.7 | 0.47 | 58.2 | 0.73 | 38.6 | 0.99 | |
| Llama-3.1-8B | RAG | 16.8 | 0.63 | 18.1 | 0.78 | 12.7 | 0.66 |
| Baseline | Mean Diff. | 95% CI | Significant |
|---|---|---|---|
| RAG | +0.0122 | [0.0034, 0.0207] | Yes |
| Self-RAG | +0.0171 | [0.0024, 0.0352] | Yes |
| Flare-RAG | +0.0116 | [0.0002, 0.0236] | Yes |
| Gen-Constraint | +0.0099 | [-0.0006, 0.0203] | No |
| Method | Health | Finance | Education |
|---|---|---|---|
| RAG | |||
| RAG+O | |||
| RAG+KG | |||
| CA-RAG |
| Method | Transfer | Policy | Procedural |
|---|---|---|---|
| RAG | High | High | Medium |
| Self-RAG | Medium | Medium | High |
| Flare-RAG | Medium | Low | Medium |
| Gen-Constraint | High | High | Medium |
| CA-RAG | Low | Low | Low |
Retrieval-Augmented Generation
Retrieval-augmented generation connects language models to external knowledge so answers can use current, domain-specific evidence.
See all 847 papers