← Latest papers
🤖 AI

RuleFlow : Generating Reusable Program Optimizations with LLMs

RuleFlow is a hybrid optimization framework that uses LLMs to discover program-specific optimizations, converts them into generalized rewrite rules, and integrates them into a compiler to achieve state-of-the-art speedups on Pandas benchmarks.

Original authors: Avaljot Singh, Dushyant Bharadwaj, Stefanos Baziotis, Kaushik Varadharajan, Charith Mendis

Published 2026-02-11
📖 3 min read☕ Coffee break read

Original authors: Avaljot Singh, Dushyant Bharadwaj, Stefanos Baziotis, Kaushik Varadharajan, Charith Mendis

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

The Problem: The "Lazy Chef" vs. The "Overwhelmed Genius"

Imagine you are running a massive restaurant kitchen. Your cooks (the computer) are tasked with following recipes (the PANDAS code) to prepare data.

Currently, you have two ways to make things faster, but both have huge flaws:

  1. The Overwhelmed Genius (LLMs): You hire a world-class, genius chef (an AI like ChatGPT). Every time a cook starts a recipe, you call the genius on the phone and ask, "How can I make this faster?" The genius gives brilliant advice, but they are expensive to call, slow to answer, and sometimes they get distracted and tell you to add salt when you actually needed sugar (unreliable).
  2. The Lazy Manual (Compilers): You give your cooks a printed manual of "shortcuts." It’s fast and reliable, but the manual is outdated. It only knows a few basic tricks, like "chop onions with a larger knife." It can't teach them complex new techniques, so the kitchen stays relatively slow.

The goal of this paper is to find a way to get the genius's brilliance without having to call them every single time.


The Solution: RULEFLOW (The "Master Recipe" System)

The researchers created RULEFLOW. Instead of calling the genius for every single dish, they use a three-step process to turn the genius's "one-time advice" into "permanent kitchen rules."

Step 1: The Discovery Stage (The Training Session)

Instead of waiting for a cook to ask for help, the researchers sit the Genius (the LLM) down in a room with thousands of old recipes. They say, "Look at these recipes and tell us how to make them better."

The Genius suggests a change, like: "Instead of peeling every single potato one by one, use a specialized peeler." The researchers then test this. They check: Does it actually work? Does it actually save time? If the Genius suggests something silly or wrong, they throw it in the trash.

Step 2: The Bridge (Turning Advice into a Rule)

This is the "secret sauce." If the Genius suggests a great trick for a specific recipe (e.g., "Use a peeler on these 5 Yukon Gold potatoes"), that's not very helpful for the whole kitchen.

The Bridge takes that specific advice and turns it into a General Rule: "Whenever you see a potato, use a peeler."

They use a specialized "translator" (the Bridge) to strip away the specific details (the specific potatoes) and turn them into a mathematical pattern (the "Peeler Rule"). This rule includes "safety checks"—like making sure you don't try to use a potato peeler on a steak.

Step 3: The Deployment Stage (The New Kitchen Manual)

Now, the Genius is sent home. You don't need to call them anymore!

You take all those new, tested, generalized rules and print them into a New Kitchen Manual (the Compiler). When a cook starts a new recipe, they just glance at the manual. If they see a pattern that matches a rule, they apply it instantly. It’s lightning-fast, it’s free, and it’s incredibly reliable.


Why It Matters (The Results)

The researchers tested this on a massive "cooking competition" (a benchmark called PANDASBENCH).

  • The old "Manual" way (DIAS) was okay, but RULEFLOW was 4.3x faster.
  • The old "Systems" way (MODIN) was a heavy-duty machine that often struggled with real-world recipes. RULEFLOW was a staggering 1,914x faster in some cases.

In short: RULEFLOW takes the "magic" of AI, filters out the mistakes, and turns it into a permanent, high-speed toolkit that makes data processing much, much faster.

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 →