← Latest papers
💻 computer science

NESA: Relational Neuro-Symbolic Static Program Analysis

This paper introduces NESA, a compositional neuro-symbolic framework that leverages large language models guided by a restricted Datalog policy to enable compilation-free, customizable static program analysis with significantly reduced hallucinations, achieving performance comparable to or better than existing techniques in tasks like bug detection and program slicing.

Original authors: Chengpeng Wang, Yifei Gao, Wuqi Zhang, Xuwei Liu, Jinyao Guo, Mingwei Zheng, Qingkai Shi, Xiangyu Zhang

Published 2026-04-15
📖 5 min read🧠 Deep dive

Original authors: Chengpeng Wang, Yifei Gao, Wuqi Zhang, Xuwei Liu, Jinyao Guo, Mingwei Zheng, Qingkai Shi, Xiangyu Zhang

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 trying to find a specific typo in a massive, unfinished novel. You have two options:

  1. The Old Way (Traditional Static Analysis): You hire a team of strict, rule-following editors. They are incredibly accurate, but they have a catch: they can only read the book if it's been fully printed, bound, and formatted by a specific publishing machine. If the author is still typing the last chapter, or if the book was written in a different font, the editors refuse to work. Also, if you want them to look for a specific kind of mistake (like "find all sentences where the hero forgets his umbrella"), you have to hire a specialist editor who knows exactly how to reprogram the main editor's brain. It's rigid, expensive, and slow to set up.

  2. The New Way (LLMs Alone): You hire a brilliant, imaginative storyteller (an AI) who can read the unfinished draft instantly. They understand the plot, the characters, and the mood perfectly. However, this storyteller has a bad habit of hallucinating. They might confidently tell you, "The hero forgot his umbrella," even if the text actually says he packed it. They make up facts to fill in the gaps, leading to false alarms.

Enter NESA: The "Smart Project Manager"

The paper introduces NESA, a new tool that acts like a brilliant project manager who combines the best of both worlds. It uses the imaginative AI storyteller but puts them on a strict, step-by-step workflow to stop them from making things up.

Here is how NESA works, broken down into simple metaphors:

1. Breaking the Big Problem into Tiny Puzzles (Decomposition)

Instead of asking the AI, "Find all the bugs in this 10,000-line code," NESA breaks the task down. It says, "First, let's just find where the variable userCity is defined. Then, let's just find where it is used."

  • The Analogy: Imagine trying to find a lost key in a messy room. Instead of telling the AI, "Find the key," NESA says, "First, look under the lamp. Then, look in the drawer." By narrowing the scope, the AI is less likely to get confused or make up a fake location for the key.

2. The "Fact-Checker" vs. The "Storyteller" (Neuro-Symbolic)

NESA splits the work into two types of tasks:

  • The Fact-Checker (Symbolic): For things that are easy to count or see (like "Is this line of code on line 26?" or "Does this function call that one?"), NESA uses a strict, math-based parser. This part never hallucinates. It's like a calculator; it just gives the right answer.
  • The Storyteller (Neural/LLM): For things that require understanding meaning (like "Does this user input affect that database?"), NESA asks the AI. But it only asks the AI about the tiny, specific puzzle piece it just created.

3. The "Lazy" and "Incremental" Strategies

NESA is very smart about how it asks the AI questions to save money and time:

  • Lazy Prompting: NESA waits until it has all the "hard facts" from the Fact-Checker before asking the Storyteller a question.
    • Analogy: Instead of asking the AI, "What's the weather?" (which is vague), NESA waits until it knows it's "Tuesday in London" and then asks, "What's the weather in London on Tuesday?" This gives the AI a much better chance of being right.
  • Incremental Prompting: NESA remembers what it has already asked.
    • Analogy: If the AI has already told you that "Alice is friends with Bob," NESA won't ask the AI again, "Is Alice friends with Bob?" It just writes that down and moves on. This saves a lot of time and money.

4. The "Policy Language" (The Rulebook)

NESA uses a special, simple language (based on something called Datalog) that lets users write their own rules without needing to be a computer genius.

  • The Analogy: Instead of writing a complex computer program to find bugs, a developer can just write a simple recipe: "If you see a 'Source' (like user input) and a 'Sink' (like a database), and they are connected, flag it." NESA takes this simple recipe and does the heavy lifting.

Why Does This Matter?

The researchers tested NESA on real-world software and found:

  • It works on unfinished code: You don't need to compile the software first.
  • It catches more bugs: In tests, it found more real bugs and made fewer mistakes than current industrial tools.
  • It found real-world secrets: It actually found 13 memory leak bugs in real software used by companies like Uber, which the developers then fixed.
  • It's customizable: You can teach it to look for any specific type of bug just by giving it a few examples, without needing to rewrite the tool's core code.

In a nutshell: NESA is like giving a super-smart but slightly scatterbrained AI a strict checklist and a team of fact-checkers. It keeps the AI focused, stops it from making things up, and allows anyone to customize it to find exactly the bugs they care about, even in messy, unfinished code.

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 →