Healthcare marketing in the UK and US is governed by tight rules: claims that are too definitive trigger regulator letters, fines, and pulled campaigns. The phrases that get flagged aren't always obvious to the marketers writing them. Railo is a bespoke AI tool we built to catch them automatically — before content goes live.
The brief
Our client — a healthcare marketing agency working with clinics, pharma and wellness brands — was spending hours per campaign on manual compliance review. The same phrases ("cure", "guaranteed results", "100% safe") were flagged in review again and again, but only after they'd been written, designed and approved internally. By that point, removing them meant rewriting headlines and re-doing creative.
The brief was simple: "Flag the language at draft stage, not at sign-off."
The challenge
Three constraints made this non-trivial:
- Context-dependent rules. "Cure" is fine in some markets, problematic in others. The regulator stance changes per country, per condition, per audience.
- Volume. A single campaign can be hundreds of touchpoints — landing pages, banner ads, email subjects, social captions. Manual review doesn't scale.
- False positives kill adoption. Over-flagging trains marketers to ignore the tool. We needed to be confidently wrong about as few things as possible.
What we built
The core of Railo is an audit pipeline that takes any marketing surface — a URL, a paste of copy, an uploaded PDF, an exported ad set — and runs it through a layered classifier:
- Tokenise & normalise. Extract the actual prose from the source format (HTML, PDF, ad XML).
- Pattern pre-filter. Catch known bad phrases instantly via a curated phrase library — fast and cheap.
- LLM contextual analysis. Each candidate phrase is sent to an LLM with a structured prompt that includes country, condition category, audience and the surrounding sentence. The LLM returns a risk classification with a reasoning string.
- Human-review queue. Anything above a confidence threshold for "high risk" is highlighted; anything ambiguous is sent to a human reviewer with the LLM's reasoning attached.
- Suggested replacements. For flagged phrases, Railo proposes compliant alternatives ("may help support…", "clinical trials show…") that the marketer can accept in a click.
The output looks like this — a clean panel of flagged phrases, suggestions and counts, scoped to the campaign:
The stack
- Backend · Python · FastAPI · PostgreSQL
- AI layer · LLM API with structured outputs · custom prompt library per market
- Frontend · Next.js · Tailwind · server components for the audit dashboard
- Hosting · GCP · Cloud Run · Cloud SQL · Cloudflare in front
- Auth · Magic-link email auth · per-organisation isolation
Notable trade-offs: we deliberately picked Cloud Run over a "real" Kubernetes setup so the team could focus on the audit logic and prompt engineering rather than infra ops. We picked PostgreSQL with simple JSONB columns for the audit log over a dedicated vector DB — semantic search wasn't on the critical path. Both decisions saved weeks.
Outcomes
- Compliance flagged at draft, not at sign-off — the original brief.
- ~85% reduction in late-stage rewrites for the agency's pilot client.
- Audit pipeline can scan a 100-page campaign in under 90 seconds end-to-end.
- Custom phrase libraries now in place for UK MHRA, US FDA, EU EMA contexts.
Lessons
Three things that stuck for future AI-tool builds:
- Pre-filter before you LLM. Pattern-match the obvious 80% with a phrase library; reserve LLM calls for the contextual edge cases. Cheaper, faster, and the model errors less when it's only being asked the hard questions.
- The reasoning string is half the product. Marketers won't trust a binary "this is risky" verdict. They will trust "this is risky because the MHRA's 2023 guidance says X". Surfacing the model's reasoning is non-negotiable.
- Build the human-review path first. The most useful version of the tool was the one that made the human reviewer's existing workflow faster — not the one that replaced them. The ambiguous-cases queue ended up being the most-used part.
Railo is live at railo.io. If you're building an AI tool for a regulated industry — healthcare, finance, legal — and want to talk about how the architecture above maps to your problem, drop us a line. We reply within one working day.