Skip to content

Repository files navigation

RAG · EU AI Act

CI 🤗 Live Demo hit-rate@5: 0.893 grounded: 1.000 License: MIT

Retrieval-augmented generation over Regulation (EU) 2024/1689, built the way you would build it if a regulator were going to read the output: every claim carries a citation, and a [n] that does not resolve to a retrieved passage is dropped and the answer flagged grounded=false, rather than being quietly kept.

Runs offline by default — no Qdrant, no model download, no API key.

$ uv run rag query "What obligations apply to providers of high-risk AI systems?"

Article 16: Article 16 sets obligations for providers of high-risk AI systems.
Providers shall ensure that their high-risk AI systems comply with the
requirements set out in Section 2 before placing them on the market [1].

demo-extractive · 0.29 ms · grounded=True
  [1] Article 16: Article 16 sets obligations for providers of high-risk AI systems…

Measured, not asserted

hit-rate@5 (hybrid) 0.893 95% bootstrap CI [0.786, 1.0], 28 questions
hit-rate@5 (dense-only) 0.786 CI [0.643, 0.929] — BM25 + RRF fusion closes 3 of 6 misses
grounded-rate 1.000 every [n] resolves to a retrieved passage
attribution-precision 1.0 by construction on the extractive demo backend; kept as a regression guard for the live path
false-answer-rate (demo) 1.0 known limit: the demo's extractive answerer never abstains on unanswerable probes — measured and documented, not hidden

Full method, the misses, and trade-offs: EVAL.md.

Hygiene: 57 hermetic tests (<1 s) · ruff + strict mypy · CI runs lint, types, tests and the offline eval on every push · deterministic offline mode · Docker.

Try it

make install && make check   # deps, then lint + strict mypy + 57 tests
make eval                    # offline metrics — no Qdrant, no key, no model download
make ui                      # Gradio demo (EXTRAS="--extra ui")

Architecture: docs/architecture.md · decisions (ADRs): docs/decisions.md · reviewer path: docs/portfolio-review.md · live backend + API: docs/runbook.md · roadmap: docs/enhancement-runbook.md

MIT. Corpus is public EUR-Lex text (CELEX 32024R1689) — data lineage · regulatory timeline.

About

Citation-enforced RAG over the EU AI Act: hybrid BM25+dense (RRF), hit-rate@5 0.893 with bootstrap CIs, offline eval harness

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages