Skip to content
All projects

Personal project · public or synthetic data

Atelier Nord assistant

A RAG over internal policies that cites its sources and refuses when the documents don’t hold the answer.

Key results

answer accuracy (57/58)
98.3 %
correct citations
100 %
unanswerable questions refused
8 / 8
answerable questions wrongly refused
0 %
A gold set written in the documents’ wording would have hidden the main weakness: BM25 fell from 0.91 to 0.36 on paraphrases.

A question in everyday French, an answer with its source

Employees of a fictional 400-person manufacturer ask questions in everyday French ("my work laptop vanished in the metro, who do I tell?") and need a short answer with a citation to the exact policy section. When the documents do not contain the answer, the assistant must say so instead of inventing one.

Retrieval, reranking, guardrails

Structure-aware PDF chunking with contextual headers; BM25 + bge-m3 dense retrieval fused by weighted RRF; bge-reranker-v2-m3 cross-encoder; a strict grounding prompt with numbered citations checked against the retrieved chunks.

Input guardrails: Llama Prompt Guard 2 and high-precision injection patterns, with "documents are data, not instructions".

A 66-question gold set (direct, paraphrased, unanswerable) scoring retrieval, answers, citations, refusals, faithfulness (an LLM judge from another model family) and injection attempts.

66 questions, traps included

Answer accuracy 0.983 (57/58; 1.000 on questions phrased like the documents, 0.929 on paraphrases), citation accuracy 1.000, 0 % of answerable questions refused, 8/8 unanswerable questions refused, faithfulness 0.948 per the judge.

The one miss is visible: a paraphrased question about business class omits the "flight over 9 hours" condition. The judge also caught a subtle hallucination ("analysed by the security team" for "per team") that exact-match checks alone would have missed.

What paraphrases revealed

Paraphrases expose BM25. Alone, it reached hit@1 0.91 on questions phrased like the documents and 0.36 on paraphrases. A gold set written in the documents’ wording would have hidden this.

Embedding choice mattered most: dense hit@1 on paraphrases went from 0.57 (multilingual MiniLM) to 0.93 (bge-m3).

Classic RRF hurt: equal-weight fusion dragged paraphrases down (0.93 → 0.71); weighting the dense ranking at 0.9 kept the exact-term benefit without the penalty.

The reranker is reported honestly: +0.012 MRR for 10× the latency. On this small corpus it is not clearly worth it, and a CPU deployment should use dense retrieval only.

A "refuse if the reranker score is low" gate was rejected: its best threshold would have refused 15 % of answerable questions.

Retrieval ablation: hit@1 and MRR for BM25, dense bge-m3, weighted fusion and fusion plus reranker, on direct and paraphrased questions.
Retrieval ablation on 58 answerable questions.Figure produced by the project code

What these numbers do not prove

The corpus is small (10 documents, 52 chunks) and fictional, so retrieval is easier than on a real intranet; the paraphrase set is the main safeguard against over-optimism.

Prompt Guard 2 alone blocked 4 of 6 attacks; the 6/6 figure is optimistic, because one pattern was added after seeing the miss. The faithfulness judge is itself an LLM, spot-checked, not audited.