🕵️ SicherheitslückenCVE-2026-69116 | xpf0000 FlyEnv up to 4.17.x Html Sanitization injection(17.09.2026 um 04:28 Uhr)
🕵️ SicherheitslückenCVE-2026-69114 | Spacebar Server Message Deletion Handlers permission(17.09.2026 um 04:28 Uhr)
🕵️ SicherheitslückenCVE-2026-18695 | MongoDB Server up to 7.0.39/8.0.28/8.3.7 denial of service(17.09.2026 um 04:28 Uhr)
🕵️ SicherheitslückenCVE-2026-69116 | xpf0000 FlyEnv up to 4.17.x Html Sanitization injection(17.09.2026 um 04:28 Uhr)
🕵️ SicherheitslückenCVE-2026-69114 | Spacebar Server Message Deletion Handlers permission(17.09.2026 um 04:28 Uhr)
🕵️ SicherheitslückenCVE-2026-18695 | MongoDB Server up to 7.0.39/8.0.28/8.3.7 denial of service(17.09.2026 um 04:28 Uhr)
🔧 Programmierung 🕛 vor 2 Monaten 2 Min Lesezeit
0

Build a Tiny Citation Gate Before Trusting RAG Answers

↗ Quelle (dev.to)
🗣️ Stimme:

A RAG answer can cite a real document and still make an unsupported claim. Retrieval answers “which text was nearby?” Citation verification asks a different question: “does the cited text contain enough evidence for this sentence?”



Start with a deterministic gate before adding another model.




CODE
from dataclasses import dataclass

@dataclass
class Claim:
text: str
citation_ids: list[str]
required_terms: set[str]

def verify(claim: Claim, sources: dict[str, str]) -> dict:
missing = [cid for cid in claim.citation_ids if cid not in sources]
evidence = " ".join(sources.get(cid, "") for cid in claim.citation_ids).lower()
absent = sorted(term for term in claim.required_terms if term.lower() not in evidence)
return {
"claim": claim.text,
"valid_source_ids": not missing,
"missing_sources": missing,
"missing_terms": absent,
"supported": not missing and not absent,
}

sources = {
"doc-1": "The service retains audit logs for 30 days.",
"doc-2": "Enterprise plans can export logs as JSON."
}

claim = Claim(
"All plans retain exportable audit logs for 90 days.",
["doc-1", "doc-2"],
{"all plans", "90 days"},
)

print(verify(claim, sources))






Expected result:




CODE
... 'missing_terms': ['90 days', 'all plans'], 'supported': False}






This is intentionally not semantic reasoning. It catches missing references and obvious term mismatches while remaining easy to inspect. That makes it a useful first test and a poor final verifier.






Extend it carefully




  1. Split an answer into atomic claims. One citation at the end of a paragraph is ambiguous.

  2. Store source ID, URL, revision, and retrieved span together.

  3. Reject citations to spans the retriever did not actually return.

  4. Add numeric normalization so 30 and thirty can be compared.

  5. Only then test an entailment model, using a labeled dataset with supported, contradicted, and insufficient-evidence examples.



Measure precision and recall separately. A gate that blocks every answer has perfect recall for bad answers and no product value. A gate that approves everything is fast but meaningless.



The public MonkeyCode repository describes AI task and project-requirement workflows. Citation gates can be useful anywhere an assistant summarizes repository requirements or task evidence, but this exercise does not test MonkeyCode or describe its implementation.




Disclosure: I contribute to the MonkeyCode project. The repository description is public; this Python lesson is independent.




After this exercise, the key lesson should be clear: a citation is an address, not proof. Verification needs its own explicit step.

Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Your startup’s next teammate might be an AI agent: Gusto, Insight Partners, and Leland explain what that changes at TechCrunch Disrupt 2026
1 Quelle
The streamers are fighting over Halloween
1 Quelle
Apple überrascht mit Update auf iOS 27.2
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Build a Tiny Citation Gate Before Trusting RAG Answers

Thematisch verwandte Begriffe: Build, Tiny, Citation, Gate · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...