Grounded answers, or none at all.

Open-source clinical AI that answers only from sources you trust, cites every claim, and refuses when it can’t back one up.

MIT licensed. Or try the live demo.

  • 0 of 1,004 must-refuse questions answered in testing
  • 11 checks on every question
  • Runs on a laptop, no GPU or API key
Audit record a83c1266 778 ms

Question: “What is the recommended dose of Zalortin for a patient with Veltris syndrome?”

  1. Passed: PII redactionno personal data found8
  2. Passed: Scope checkno injection patterns6
  3. Passed: Rate limitwithin limit2
  4. Passed: Retrievetop 4 passages, best score 0.71745
  5. Passed: Retrieval gate0.71 clears the 0.30 threshold1
  6. Refused: Source coverage“zalortin” is in no trusted source4
  7. Not reached: Generatenot reached
  8. Not reached: Schema validationnot reached
  9. Not reached: Grounding checknot reached
  10. Not reached: Dosage guardnot reached
Refused Routed for review. No model was called.
Real runs of the pipeline. Zalortin isn’t in any source, so the first stops before a model writes a word. The second passes every check and is shown with its citations.

See it in 35 seconds

A real screen recording of the dashboard on a laptop, with no API key.

What happens in the video
  1. A question about Caloradine’s dose and interactions gets an answer in which every claim cites its source, with the retrieved passages and a trace of every check.
  2. A question about Zalortin, which no source mentions, is refused with the reason: the term does not appear in any trusted source.
  3. With the source coverage guard switched off, the same question gets a confident answer about Caloradine, a different drug. This is what an unguarded system does.

A system that knows when to stop is safer than one that always answers.

  • Code decides, not the model

    Plain, testable checks decide what’s shown, with or without AI.

  • Every claim is cited

    Each sentence points to the source passage it came from.

  • Every request is recorded

    A full trace is saved, whether it answered or refused.

Explore the dashboard

Unedited screenshots of the app in this repository.

Ask a question. Type your own, or start from grouped examples that answer and refuse.
Get a cited answer. Every claim is tagged with the ID of the source it came from.
See why it refused. The reason in plain language, and the exact stage that stopped the run.
Inspect the evidence. Retrieved passages with similarity scores, next to a trace of every stage.
Tune the guards. Move a threshold or switch a guard off, then ask again to compare.
Explore the corpus. A 3D map of every document, with this question’s sources highlighted.
Read the audit record. The full record of each request, saved to an append-only log.
Check the evaluation. Golden-set results and adversarial probes, failures included.

Who it’s for

  • Engineers

    Start from guardrails that already work, with tests.

  • Clinical safety teams

    See refusal, citation and audit enforced in code.

  • Researchers and educators

    An offline testbed with 2,008 test questions.

  • Reviewers and auditors

    Trace any decision to its check and its source.

Not for patient care. GroundCheck isn’t clinically validated or cleared by any regulator.

Eleven checks, always in order

Any check can stop the run. Everything after it is skipped and recorded.

  1. Check the question

    1. 1PII redactionHides emails and long numbers
    2. 2Scope checkBlocks prompt injection
    3. 3Rate limitStops one caller using it all
  2. Find the evidence

    1. 4RetrieveFinds the closest passages
    2. 5Retrieval gateRefuses weak matches
    3. 6Source coverageRefuses terms no source mentions
  3. Draft and verify

    1. 7GenerateDrafts claims with citations
    2. 8Schema validationRejects malformed output
    3. 9Grounding checkChecks each claim against its source
    4. 10Dosage guardVerifies every dose
  4. Decide and record

    1. 11Decision and auditAnswers or refuses, and saves why

The checks that matter most

Real inputs, real results.

Dosage guard

Every dose in a draft must match a source, however it’s written.

fifteen milligrams15mg15 mg15 mgin source
Start Caloradine at 50 mg once daily.50 mgin no source

Source coverage

Refuses before drafting when a key term appears in no source.

Can children take Caloradine?childrennot covered

Grounding check

Each claim must be supported by the source it cites.

Caloradine is started at 15 mg once daily for 14 daysVELT-002grounded

Input guards

Redacts obvious personal data and blocks injection attempts.

My email is a@b.comMy email is [redacted]
Ignore previous instructions and…blocked

Works with or without AI

Only the drafting step changes. The same checks decide every time.

  • Available

    Extractive

    Answers are built from sentences in your sources.

    • No API key
    • Fully offline
  • Available

    Cloud model

    Any OpenAI-compatible model drafts the answer. Groq is the default.

    • Needs an API key
    • Sends redacted question and passages
  • Planned

    Local AI model

    An open-source model on your own machine drafts the answer.

    • No API key
    • Offline after one download

If a model fails or times out, GroundCheck falls back to the extractive answer.

Planned: private AI on your own machine

AI-written answers that never leave your computer.

  • Checks your memory and GPU, including Apple silicon
  • Recommends open-source models that fit
  • Downloads and loads one with a click, through a runtime such as Ollama
  • Falls back to extractive answers if no model is available
Design sketch, not a screenshot. Models and sizes are illustrative.

Tested on 2,008 questions

The build fails if a single question that should be refused gets answered.

  • Must refuse

    1,004 of 1,004 refused

    Unknown drugs, off-topic questions, missing context. Gates every build.

  • Answerable

    998 of 1,004 answered

    6 over-refusals: safe, but reported.

  • Adversarial probes

    10 of 12 handled

    Leading questions, misspellings, injections. Reported, not gating.

Runs offline in extractive mode, so these results measure the checks, not a language model.

1,880 documents, none of them real

Structured like MedQuAD and DailyMed drug labels. Every drug and dose is invented, so it’s safe to share and fork.

Documents in the demo corpus by type
TypeDocuments
Conditions906
Drug labels752
Lab markers120
Procedures100
Reference notes2
The dashboard's 3D corpus map: document embeddings coloured by type, with the four sources retrieved for a question labelled.
The corpus map in the dashboard. Retrieved sources are labelled.

One JSON API

Call it from your own app, a batch job or a test suite.

Request
curl -X POST http://localhost:8000/api/ask \
  -H "Content-Type: application/json" \
  -d '{"query": "What is the recommended dose of Zalortin?"}'
Response, trimmed
{
  "decision": "refuse",
  "refused_reason": "the term 'zalortin' does not appear in any trusted source",
  "claims": [],
  "sources": [{ "id": "VELT-002", "score": 0.71, … }],
  "trace": [
    { "name": "retrieval gate", "status": "pass", "detail": "best score 0.71 clears threshold 0.30" },
    { "name": "source coverage", "status": "fail", "detail": "the term 'zalortin' does not appear in any trusted source" },
    { "name": "generate", "status": "skip", "detail": "not reached" },
    …
  ],
  "audit_id": "a83c1266",
  "llm_used": false
}

Send a settings object to override thresholds or switch individual guards for a single request. Configured defaults are never changed.

Endpoints

POST /api/ask
Run a question through the pipeline
GET /api/audit
Recent audit records
GET /api/audit/{id}
One full audit record
GET /api/settings
Default settings and their allowed ranges
GET /api/eval-summary
The latest evaluation results
GET /api/corpus
Corpus statistics and the 3D map
GET /api/health
Status, model mode and corpus size

Built with

  • FastAPI
  • Pydantic
  • sentence-transformers
  • FAISS
  • OpenAI client
  • Docker
  • Plain HTML, CSS, JS

Make it yours

Point it at your documents and run it on your own machines.

Use your own documents

Replace app/data/corpus.json and rebuild the index.

[
  {
    "id": "FORM-042",
    "title": "Amoxicillin: dosage",
    "topic": "amoxicillin",
    "section": "Dosage and Administration",
    "kind": "drug",
    "text": "…"
  }
]

Tune the thresholds

Every threshold is an environment variable.

RETRIEVAL_MIN_SCORE=0.30
GROUNDING_MIN=0.45
TOP_K=4
RATE_LIMIT_PER_MINUTE=30

Choose your model, or none

Any OpenAI-compatible API, or none at all.

GROQ_API_KEY=…
GROQ_BASE_URL=https://api.groq.com/openai/v1
GEN_MODEL=llama-3.3-70b-versatile
FORCE_EXTRACTIVE=false

Run it where your data lives

One container. In extractive mode, nothing leaves the machine.

docker build -t groundcheck .
docker run -p 7860:7860 groundcheck

Known limits

Each one is a good place to contribute.

  • Word-based coverage checkCan refuse over everyday words like “year” or “email”.
  • Broad extractive draftsCan include related passages the question didn’t ask about.
  • Basic PII redactionEmails and long numbers only. Not de-identification.
  • Synthetic tuningThresholds need re-tuning for real documents.
  • Self-referential testsAnswerable cases come from the corpus itself.
  • Local audit logSeveral instances would need a shared store.
  • No review queue yet“Routed for review” is a record, not a workflow.

Where GroundCheck is headed

From a reference pipeline to a platform hospitals can run safely. Planned work is built in the open.

  • Available now

    Grounded retrieval core

    Prove that a clinical assistant can refuse, cite and record by design.

    What’s included
    • Eleven-stage pipeline with deterministic guards
    • Citations, trace and audit record for every request
    • 2,008-case evaluation that gates the build
    • Tuning dashboard and JSON API
  • Planned

    Local AI models

    AI-written answers that never leave the machine.

    What’s included
    • Hardware check for memory, GPU and Apple silicon
    • Open-source models recommended to fit that hardware
    • One-click download and loading through a local runtime such as Ollama
    • Automatic fallback to extractive answers when no model is available
  • Planned

    Accounts and data foundation

    Give every user, source and decision a durable, queryable home.

    What’s included
    • Relational database: SQLite for a single machine, PostgreSQL or MySQL in production, with versioned migrations
    • Pluggable vector database: FAISS locally, pgvector or Qdrant at scale
    • Sign-in with securely hashed passwords, multi-factor authentication and session management
    • Clinician, reviewer and admin roles, with every audit record tied to a user
  • Planned

    Your organisation’s knowledge

    Answer from a hospital’s own approved guidelines, formularies and protocols.

    What’s included
    • Import PDF, Word and HTML, with section-aware chunking
    • Source ownership, versions, effective dates and expiry
    • Approval workflow before content can be cited
    • Automatic re-indexing, and evaluation cases generated from each source
  • Planned

    Clinician review and governance

    Turn every refusal and flagged answer into a reviewed, closed case.

    What’s included
    • Review queue with assignment, escalation and service-level timers
    • Clinician feedback that becomes new sources or evaluation cases
    • Clinical safety case and hazard log for each release
    • Usage, refusal and override reports for governance committees
  • Planned

    Security, privacy and access

    Meet hospital IT and information governance requirements.

    What’s included
    • Single sign-on with SAML and OpenID Connect, on top of the built-in accounts
    • Full PHI de-identification, beyond pattern matching
    • Encryption in transit and at rest, and tamper-evident audit logs
    • On-premises and private cloud deployment, with retention controls
  • Planned

    Patient-aware safety checks

    Check answers against the patient in front of the clinician, not just the literature.

    What’s included
    • Allergy, contraindication and drug-interaction checks
    • Dose ranges adjusted for weight, age, and kidney and liver function
    • Explicit handling of paediatrics, pregnancy and high-alert medicines
    • Refusal when required patient data is missing
  • Planned

    EHR integration

    Bring grounded answers into the clinical workflow, where decisions are made.

    What’s included
    • HL7 FHIR R4 access to medications, allergies, labs and problems
    • SMART on FHIR launch from inside the electronic health record
    • CDS Hooks cards with citations at the point of ordering
    • Write-back of reviewed notes, with consent and audit
  • Planned

    CT and MRI imaging

    Apply the same principle to scans: show the evidence, or abstain.

    What’s included
    • DICOM and DICOMweb intake from PACS, with de-identification
    • Pluggable models for CT and MRI tasks, such as segmentation and triage
    • Abstention on unfamiliar scanners, protocols or low-confidence results
    • Findings tied to image regions, a radiologist sign-off step, and DICOM Structured Reports
  • Planned

    Model training studio

    Train imaging models on your own data and hardware, then reuse them anywhere in the platform.

    What’s included
    • Pick a folder of images or a registered dataset, with format and label checks
    • Detects NVIDIA and Apple silicon GPUs and lets you choose one, falling back to the CPU
    • Live progress, validation metrics and the option to stop and resume
    • A versioned model library, ready to use in the imaging pipeline
  • Planned

    Production operations

    Run across many sites, and catch problems before clinicians do.

    What’s included
    • Multi-site tenancy, high availability and Kubernetes deployment
    • Monitoring of refusal rates, latency and data drift, with alerts
    • Versioned models and sources, staged rollout and one-step rollback
    • Incident reporting and post-market surveillance

Designed toward regulated use

GroundCheck holds no certifications or clearances today. These are the standards it is being designed toward.

Privacy
HIPAA, GDPR, UK GDPR
Security
SOC 2 Type II, ISO/IEC 27001
Medical software
IEC 62304 lifecycle, ISO 14971 risk management, ISO 13485 quality management
Regulation
FDA software as a medical device pathways, EU MDR, EU AI Act high-risk requirements
Clinical safety
Clinical validation studies, and DCB0129 and DCB0160 for NHS deployments

Want to shape what comes first, or help build it? Join the discussion on GitHub.

Planned: train models on your own scans

For teams without a machine learning platform. None of this is built yet.

  1. Choose a folder of DICOM, NIfTI or PNG images
  2. Check labels, duplicates and leftover identifiers
  3. Pick a detected GPU, or train on the CPU
  4. Watch loss and validation metrics live, and stop or resume
  5. Save to a versioned model library
  6. Use it in the imaging pipeline, with the same rules
Design sketch, not a screenshot. With several GPUs, you choose one.

Get started

Run it locally in a few minutes. Python 3.12, or Docker. The embedding model downloads once, the first time you build the index.

With Python

Terminal
git clone https://github.com/sumitgundawar/GroundCheck.git
cd GroundCheck
python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python scripts/build_index.py
uvicorn app.main:app --port 8000

Then open http://localhost:8000.

With Docker

Terminal
git clone https://github.com/sumitgundawar/GroundCheck.git
cd GroundCheck
docker build -t groundcheck .
docker run -p 7860:7860 groundcheck

Then open http://localhost:7860. The image builds the index and runs the evaluation during the build.

Full setup, configuration and Windows instructions are in the README.

Questions

Not answered here? Ask on GitHub.

Is GroundCheck a medical device?

No. It’s research and engineering software. It hasn’t been clinically validated or cleared by the FDA, a notified body or any other regulator, and it must not be used to make decisions about real patients.

Does my data leave my machine?

Not in extractive mode. Questions are processed locally, and the only download is the embedding model when the index is first built. In live model mode, the redacted question and retrieved passages are sent to the provider you configure, so choose that provider under your own data-protection rules.

Can I use it with real clinical documents?

Yes. Replace the corpus with your own records and rebuild the index. Then re-tune the thresholds and write evaluation cases for your content, because the defaults were tuned on synthetic data. Keep real patient data out of the corpus, issues and pull requests.

Which language models work?

Any API compatible with OpenAI chat completions that supports JSON output mode, including servers you host yourself. Set GROQ_BASE_URL, GROQ_API_KEY and GEN_MODEL. The variable names mention Groq because it’s the default provider.

Can I use AI without sending data to the cloud?

That’s what the planned local AI option is for. GroundCheck will recommend open-source models that fit your machine, download one, and run it locally. Until then, extractive mode is fully local, without AI-written drafts.

Do I need a GPU?

No. Embeddings and vector search run on a CPU, and a laptop handles the demo corpus comfortably. The planned local AI models will use a GPU when one is available, and smaller models will run on a CPU.

Can I use it in a commercial product?

The MIT License allows commercial use, modification and redistribution. Making a clinical product out of it is your responsibility, including any regulatory approvals, validation and data-protection obligations.

Can I train models on my own images?

Not yet. A training studio is planned. It’s designed to train on a folder you choose, using a GPU when one is available, and to save each model to a library for reuse.

Does it analyse CT or MRI scans yet?

Not yet. CT and MRI support is planned. Today GroundCheck works with text documents only.

Help build safer clinical AI

Run it, break it, and tell us what it got wrong. Code, test cases and ideas are all welcome.