← Latest papers
💻 computer science

Defusing Logic Bombs in Symbolic Execution with LLM-Generated Ghost Code

Gordian is a hybrid symbolic execution framework that enhances the analysis of real-world code by selectively employing LLMs to generate lightweight ghost code—such as inversions, surrogates, and heap partitions—that assists SMT solvers in overcoming logic bombs and complex reasoning challenges, thereby significantly improving coverage while drastically reducing token usage compared to pure LLM-based approaches.

Original authors: Dimitrios Stamatios Bouras, Sergey Mechtaev

Published 2026-03-23
📖 5 min read🧠 Deep dive

Original authors: Dimitrios Stamatios Bouras, Sergey Mechtaev

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 detective trying to solve a massive, locked mystery inside a computer program. Your goal is to find a specific "secret code" (a bug or a hidden feature) hidden deep within the software.

To do this, you have two main tools:

  1. The Logic Machine (SMT Solver): This is a super-smart, rigid robot that follows strict mathematical rules. It's incredibly precise but gets completely stuck if the puzzle involves complex math (like trigonometry) or messy, shifting data structures (like a tangled ball of yarn). It's like a robot trying to untangle a knot by only using a ruler; it can't handle the chaos.
  2. The Creative Assistant (LLM): This is a highly intelligent, creative human-like AI. It's great at understanding context, guessing patterns, and coming up with creative solutions. However, it's not perfect. If you ask it to solve a massive, multi-step logic puzzle involving 50 different rooms, it might get confused, forget the rules of the first room by the time it reaches the last, or just make up a plausible-sounding but wrong answer.

The Problem:
Traditional detectives (Symbolic Execution) rely entirely on the Logic Machine. When they hit a "Logic Bomb" (a tricky piece of code with complex math or weird data), the machine freezes. The detective gives up, and the secret remains hidden.

Some new detectives tried replacing the Logic Machine entirely with the Creative Assistant. While the Assistant is good at guessing, it often fails when the path to the secret is long and requires remembering strict rules from the very beginning of the journey. It loses track of the "global picture."

The Solution: Gordian

The paper introduces Gordian, a new detective team that combines the best of both worlds. Instead of replacing the Logic Machine, Gordian uses the Creative Assistant only when the machine gets stuck.

Think of Gordian as a Master Keymaker who uses a creative apprentice to forge special "Ghost Keys" (Ghost Code) that help the Logic Machine open impossible locks.

Here is how Gordian works using three creative analogies:

1. The "Reverse-Engineered Map" (Inversion)

The Scenario: The Logic Machine is trying to find an input x that results in a specific output y after going through a complex math maze. The maze is so twisted the machine can't figure out how to get from y back to x.
The Gordian Fix: The Creative Assistant looks at the maze and says, "I can't solve the forward path, but I can build a reverse tunnel."
It writes a small piece of "Ghost Code" that acts like a reverse map. Instead of guessing x to get y, the system starts with the desired y, runs it through the reverse tunnel, and gets a candidate x.

  • The Magic: The Logic Machine then checks this candidate x against the strict rules of the beginning of the program. If it fits, boom—you found the secret. If not, the machine tweaks it slightly and tries again.

2. The "Cheat Sheet" (Surrogate Models)

The Scenario: The program uses a complex encryption function or a weird library that the Logic Machine doesn't understand. It's like trying to solve a puzzle where one piece is written in a language the robot doesn't speak.
The Gordian Fix: The Creative Assistant writes a simplified cheat sheet. It says, "I know the real function is complex, but for the purpose of finding this bug, here is a simple, fake version that behaves exactly the same way but is easy for the robot to understand."

  • The Magic: The Logic Machine solves the puzzle using the easy cheat sheet. Once it finds a solution, the team double-checks it against the real, complex code to make sure it's actually valid.

3. The "Shape Sorter" (Semantic Heap Partitioning)

The Scenario: The program deals with dynamic data structures (like a linked list or a tree). The number of ways these can be arranged is infinite. The Logic Machine tries to check every single possibility and gets overwhelmed (path explosion). It's like trying to find a specific needle in a haystack by checking every single straw one by one.
The Gordian Fix: The Creative Assistant looks at the code and says, "We don't need to check every shape. We only need to check the five most important shapes that actually matter for this specific bug."
It writes a "Ghost Code" that forces the data to look like one of these five shapes (e.g., a perfect circle, a broken chain, a straight line).

  • The Magic: The Logic Machine only has to solve the puzzle for these five specific, meaningful shapes instead of infinite possibilities. It's like the detective realizing the thief only enters through the front door, the back door, or the window, so they stop checking the chimney.

The Result

By using this hybrid approach, Gordian is able to:

  • Find more bugs: It covers 52% to 84% more code than traditional methods.
  • Be smarter than pure AI: It covers 86% to 419% more code than methods that rely only on the Creative Assistant.
  • Save money: Because it only asks the Creative Assistant for help in tiny, specific moments (to make the Ghost Keys), it uses 90–96% less computing power (tokens) than methods that ask the AI to do everything.

In summary: Gordian is the ultimate detective team. It keeps the strict, precise Logic Machine in charge to ensure accuracy, but it hires a creative Assistant to build special tools (Ghost Code) whenever the machine hits a wall. This allows them to solve the unsolvable without losing their minds or their budget.

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 →