Mandatory clauses need retrieval, and a stricter prompt cannot supply it
A paper posted on 24 November 2026 finds that putting compliance constraints into retrieval improves evidence selection, while putting them only into generation gives higher clause coverage but lower overall compliance. We explain what that means for teams generating structured documents with RAG, and what we would build.
- Written by
- Baraqix Engineering
- Published
- Read
- 4 min
- Filed under
- rag, compliance, retrieval evaluation
Contents4 sections
On 24 November 2026, three researchers posted CA-RAG to arXiv. It names a problem that anyone generating structured documents from a corpus will eventually hit. Standard retrieval ranks chunks by semantic relevance to a query. A compliance document is judged by something else: whether every mandatory clause is backed by evidence. A chunk can be highly relevant to the topic of a section and still say nothing about the clause a reviewer will check first.
What the paper reports
CA-RAG changes the query before any evidence is selected. Each section specific query is augmented with structural constraints derived from an ontology and with relations from a policy grounded knowledge graph. The evaluation that matters most to engineers is the retrieval only one, scored against manually annotated evidence. The authors report consistent improvements across retrieval budgets. These are their figures at k = 6:
| Metric at k = 6 | Standard RAG | CA-RAG |
|---|---|---|
| Precision | 0.5268 | 0.5692 |
| Pooled recall | 0.5402 | 0.5950 |
| F1 | 0.5389 | 0.5672 |
The second finding is the one we would bring to a design review. The authors also tried putting the constraints only into generation. That gave higher clause coverage but lower overall compliance and reliability. The paper also reports better compliance and reliability from CA-RAG in generation, in what it calls several model and domain settings. The abstract does not claim every setting, and the difference is worth noticing.
Why the prompt is the wrong place for obligations
Here is our reading of that result. Suppose the prompt says the output must include a termination clause, and nothing in the retrieved context covers termination. The model has two options: leave the clause out, or write it from its priors. A coverage checklist rewards the second option. That is how a team ends up with a document that passes a section audit and fails a legal one. Higher coverage paired with lower compliance is exactly what that failure looks like in a metric.
The numbers deserve a calm reading. The gains at k = 6 are modest, a few points on each metric. With precision near 0.57, a little over four in ten retrieved chunks at that budget are not in the annotated evidence. With pooled recall near 0.60, about four in ten annotated pieces of evidence are still missed. What matters is the direction of the result. The pipeline still needs a path for misses, because they will keep happening.
What we would do
- Write obligations down as data. For each document type, keep a table of sections, the clauses each section must contain, and one retrieval query per clause. In our view a PostgreSQL table is enough to start. A knowledge graph earns its place once obligations start depending on each other.
- Retrieve per obligation first, then per section. Reserve part of the budget k for each mandatory clause, so a dense cluster of topical chunks cannot crowd it out.
- Score retrieval before touching prompts. Annotate the evidence for a small set of real documents and track recall per clause. That number predicts audit failures better than any judgement of the finished text.
- Give the generator an explicit gap state. If no chunk clears the threshold for a clause, show the gap to a reviewer instead of letting the model write filler.
- Attach evidence ids to every generated clause, so a reviewer can check each claim against its source in one step.
The retrieval step is not complicated. This sketch shows the shape we would start from:
def retrieve_for_section(section, obligations, search, k=6):
picked, gaps = [], []
for ob in obligations[section.id]:
hits = [h for h in search(ob.query, k=3) if h.score >= ob.min_score]
if hits:
picked.append(hits[0])
else:
gaps.append(ob.id) # shown to a reviewer, never written as prose
seen = {p.id for p in picked}
for h in search(section.query, k=k):
if len(picked) >= k:
break
if h.id not in seen:
picked.append(h)
seen.add(h.id)
return picked, gapsThe same principle runs through our own work. The LLM risk scoring engine we built attaches evidence to every score. The search on this site shows honest misses instead of the nearest unrelated result. A clause with no evidence should show up as a visible gap, and the model should never cover it with fluent prose.
Where we would push back
- The paper targets compliance sensitive long form generation. A chat assistant answering open questions has no fixed list of obligations, so this approach has much less to work with there.
- Someone has to write and maintain the ontology and the policy relations. That is domain work, and its cost belongs in the scope of the project, written down before work starts.
- This is one arXiv preprint. Before you trust the gains, rerun the comparison on your own corpus with your own annotated evidence.
If you generate structured documents from your own files and every required clause must trace back to a source, this is the kind of design we scope in our two week fixed price Discovery Sprint. See how we build retrieval and generation pipelines on our AI integration page.
Baraqix Engineering. Written by the engineers who did the work.
NOTE/17. First published .