← Latest papers
💬 NLP

FD-NL2SQL: Feedback-Driven Clinical NL2SQL that Improves with Use

FD-NL2SQL is a feedback-driven clinical NL2SQL assistant for oncology databases that decomposes natural language queries into sub-questions, retrieves expert exemplars, and synthesizes executable SQL while continuously improving its performance through clinician edits and automated logic-based SQL augmentation.

Original authors: Suparno Roy Chowdhury, Tejas Anvekar, Manan Roy Choudhury, Muhammad Ali Khan, Kaneez Zahra Rubab Khakwani, Mohamad Bassam Sonbol, Irbaz Bin Riaz, Vivek Gupta

Published 2026-04-20
📖 4 min read☕ Coffee break read

Original authors: Suparno Roy Chowdhury, Tejas Anvekar, Manan Roy Choudhury, Muhammad Ali Khan, Kaneez Zahra Rubab Khakwani, Mohamad Bassam Sonbol, Irbaz Bin Riaz, Vivek Gupta

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a doctor trying to find the perfect clinical trial for a patient. You know exactly what you need: "Show me trials for lung cancer that started after 2018, using a specific drug, with a follow-up period longer than two years."

In the old days, to get this answer, you'd have to speak a secret, complex language called SQL (Structured Query Language). It's like trying to ask a librarian for a book, but instead of saying "I want a mystery novel," you have to know the exact shelf number, the book's barcode, and the specific code for the "mystery" genre. If you get one digit wrong, the librarian (the database) gives you nothing or, worse, the wrong book.

This is where FD-NL2SQL comes in. Think of it as a super-smart, self-improving translator that sits between you and the database.

Here is how it works, broken down into simple steps:

1. The "Deconstruction" Chef

When you ask your question in plain English, the system doesn't just guess the answer. Instead, it acts like a head chef breaking down a complex recipe.

  • Your Question: "Show me lung cancer trials from 2018+ with Drug X."
  • The System's Thought Process: It breaks this down into tiny, simple ingredients:
    1. Filter by: Cancer Type = Lung.
    2. Filter by: Year >= 2018.
    3. Filter by: Drug = Drug X.
      This ensures the system doesn't get overwhelmed and misses a crucial detail.

2. The "Memory Bank" Librarian

Before it writes the final code, the system checks its Expert Memory Bank. It looks for past questions that are similar to yours.

  • Analogy: Imagine you ask, "How do I bake a chocolate cake?" The system doesn't start from scratch; it looks at a card in its library that says, "How to bake a vanilla cake," and another that says, "How to bake a strawberry cake." It uses these proven recipes as a guide to ensure it doesn't invent a weird, inedible cake.
  • In this system, these "recipes" are SQL queries that experts have already verified are correct.

3. The "Translator" and the "Safety Check"

The system combines your broken-down question with the expert recipes to write the final SQL code.

  • The Safety Check: Before showing you the result, it runs a quick "test drive." It checks: "Does this code actually work? Does it return any results? Did I accidentally try to delete the whole database?" (It's programmed to only read data, never delete it).

4. The "Magic Loop" (How it gets smarter)

This is the coolest part. The system is alive.

  • Scenario: You ask a question, the system gives you a SQL query, but you notice it missed a detail. You fix the code yourself.
  • The Upgrade: The system says, "Thank you! I learned something new." It saves your corrected version into its Expert Memory Bank.
  • The "Mutation" Trick: To get even smarter without needing humans to write more examples, the system takes your approved code and makes tiny, safe changes (like changing "2018" to "2019" or "Lung" to "Breast"). If that new version works, it asks a second AI to write a new question for it. Now, the system has learned two new things from just one human correction!

Why does this matter?

  • For Doctors: You don't need to be a computer programmer to explore millions of medical trials. You just talk to the system like a human.
  • For Science: It speeds up research. Instead of waiting days for a data analyst to write a query, a doctor can get answers in seconds.
  • For Safety: Because it shows you how it got the answer (the breakdown, the examples it used, the final code), you can trust it. It's not a "black box" guessing; it's a transparent assistant.

In short: FD-NL2SQL is like having a personal research assistant who speaks both "Doctor" and "Computer," remembers every successful search you've ever done, and gets better at its job every time you interact with it.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →