cd /news/natural-language-processing/what-i-learned-building-a-compliance… · home topics natural-language-processing article
[ARTICLE · art-50165] src=dev.to ↗ pub= topic=natural-language-processing verified=true sentiment=↑ positive

What I learned building a compliance answer engine that refuses to make things up

A developer built Canton Compliance Hub, a free multilingual resource that helps foreign founders navigate Swiss business compliance without hallucinating answers. The system uses hybrid retrieval with BM25 and vector search on pgvector, and enforces citation markers for every factual claim to prevent errors. Two open datasets—a minimum-wage-by-canton comparison and an SME compliance-deadline calendar—were published as byproducts.

read2 min views1 publishedJul 7, 2026

Swiss business compliance is a genuinely hard information problem. There is no national minimum wage, VAT rules live at the federal level, social-insurance (AHV) admin runs through 26 cantonal offices, and most of the official guidance is only in German or French. If you are a foreign founder setting up a GmbH, you are stitching answers together from a dozen government PDFs.

I have been building Canton Compliance Hub, a free multilingual resource that tries to make that legible. The interesting engineering problem was not the content, it was trust: in a domain where a wrong number can cost someone real money, the system has to be citable and it must not hallucinate. Here is what actually worked.

The naive RAG setup is: chunk documents, embed them, retrieve top-k, stuff into the prompt. It works until a legal term like AHV or MWST needs an exact match that a dense vector glosses over.

I run two layers on Postgres with pgvector:

Retrieval is hybrid: a BM25 pass catches the exact legal acronyms, a vector pass catches the paraphrases, and a metadata filter (canton, topic, language) runs before ranking so a Geneva question never pulls a Zurich-only rule.

"Please don't hallucinate" in a system prompt is not a control. What worked was making every factual claim carry a citation marker back to a chunk, then treating any claim without one as a defect.

That last pass was the highest-leverage thing we added. Cheap draft models are confident and wrong exactly where it matters most in compliance: a plausible-looking rate.

The corpus has to stay current, but re-summarising an unchanged page with an LLM is waste. Change detection is four boring signals: Last-Modified, ETag, an on-page timestamp, and a SHA-256 of the extracted text. The LLM only runs when the content genuinely changed.

Two byproducts became reusable public artifacts, grounded in official sources and published as open datasets (CC BY 4.0): a minimum-wage-by-canton comparison, and an SME compliance-deadline calendar. The whole retrieval stack sits behind a free compliance self-check: describe your situation in plain language and get a personalised, source-cited overview.

If you work with Swiss compliance content and want to compare notes, the site is cantoncompliancehub.ch. Happy to answer questions in the comments.

── more in #natural-language-processing 4 stories · sorted by recency
── more on @canton compliance hub 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/what-i-learned-build…] indexed:0 read:2min 2026-07-07 ·