Skip to content
Aditya Aryan — home

/ live demo / 116 FDA documents / 1,752 chunks

It answers from the documents, or it doesn’t answer.

Regulatory questions are the kind where a confident wrong answer is worse than no answer. So this doesn’t just search and summarise. It pulls five passages out of 97 FDA 510(k) clearances and 19 guidance documents, asks whether they actually answer the question, drafts an answer that has to cite them by number, and then checks those citations in plain code. A draft that cites something it was never given gets thrown away.

Wound dressing clearances and FDA guidance · retrieval runs on this server · drafting by DeepSeek V3

Or try one of these

Loading the document index…

02 / what happens to a question

Five steps, and two of them are allowed to say no.

  1. 01 / Retrieve

    Two searches over 1,752 chunks. One by meaning, using bge-small embeddings, which finds “gamma irradiation” when you ask about sterilisation. One by exact keyword, BM25, which finds “ISO 10993-1” when meaning search would wander. Thirty candidates each, fused by rank into five.

  2. 02 / Gate

    Search always returns something, relevant or not. So a model is asked one question with a one-word answer: do these passages actually help? If not, it refuses before writing a word.

  3. 03 / Draft

    The model answers from the five passages only, and every factual sentence has to carry a tag, [S1] to [S5]. Numbered tags, not document names, because a number can only be right or wrong.

  4. 04 / Check

    Plain code, no model. Every tag has to point at a passage the model was actually given, and an answer with no tags at all fails too. This is the step that makes a made-up source impossible to serve.

  5. 05 / Retry or refuse

    A failed draft is sent back once, with what was wrong. If the second draft fails the check too, the answer is a refusal, not the best of two bad drafts.

03 / is this actually the project

The same search as the Python, checked number for number.

The project is Python, and it searches with PyTorch and an embedded Qdrant database, neither of which fits in a serverless function. So the search on this page is a TypeScript port, embedding model included. A port that’s nearly right quietly returns different passages, so it was checked against the real Python retriever on 24 questions before it was allowed to run here.

24 / 24

questions tokenised identically

plus 300 chunks of corpus text

0.99999997

lowest cosine to the Python vectors

1.0 would be bit-identical

24 / 24

identical top 30, both searches

meaning and keyword, in order

24 / 24

identical top 5, every mode

dense, keyword, and fused

The embedding model ships at half precision, 67 MB instead of 133. That was measured before it was chosen: half precision kept every ranking identical on all 24 questions, while 8-bit, at half the size again, changed the top 30 on 23 of them. A small model is not a reason to accept a different answer.

04 / what it doesn’t do yet

Where I’d push on it.

  • There is no evaluation set yet.

    The citation check proves an answer only cites passages it was given. It does not prove the answer reads those passages correctly. Measuring that needs a set of questions with known answers, and that is the next piece of work, not something this page can claim.

  • The gate is a judgement, not a rule.

    Whether passages are relevant is decided by a model saying one word. It is told to lean towards yes, so it will sometimes let a weak set of passages through; the drafting step can still refuse, and often does.

  • It can find the right subject in the wrong kind of document.

    Ask what biocompatibility testing FDA expects for a dressing on an open wound, and it declines. Four of the five passages it retrieves are manufacturers describing the tests they ran on their own devices, and the model reports that none of them says what FDA expects. Declining is the right call with those passages. Finding better ones, by searching the guidance when a question asks what FDA wants, is the fix.

  • Older filings are under-represented.

    42 of the 140 clearances downloaded were scanned paper with no extractable text, and most of those are older. They were left out rather than indexed as empty pages, which is honest but skews the corpus towards recent submissions.

  • It is a demonstration, not regulatory advice.

    It knows wound dressings and the guidance around them, and nothing else. Ask it about something outside that and the right behaviour is the one it has: refusing.

← Back to the workRead the code on GitHub →