Regression Language Models for Code
This paper introduces a unified, lightweight Regression Language Model (RLM) that leverages a frozen LLM encoder to accurately predict diverse code execution metrics—including memory footprint, latency, and accuracy—across multiple programming languages and hardware platforms, outperforming prior feature-engineered and graph-based approaches without task-specific customization.
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 have a massive library of computer programs written in dozens of different languages (like Python, C++, or even specialized languages for graphics cards). Usually, if you want to know how much memory a program will eat up, how long it will take to run, or how accurate a neural network will be, you have to actually run the program on a computer to find out. This is slow, expensive, and sometimes impossible if you haven't built the hardware yet.
For a long time, experts tried to build special "crystal balls" to predict these numbers without running the code. But these crystal balls were like custom-made tools: to predict memory for Python, you needed one tool; to predict speed for a graphics card, you needed a completely different tool. They required humans to manually dig through the code, count specific commands, and turn the code into complex charts and graphs just to feed them into a calculator. If the code changed slightly, the tool often broke.
The New "Universal Translator" for Code
This paper introduces a new kind of AI called a Regression Language Model (RLM). Think of this not as a calculator, but as a super-translator that speaks both "Computer Code" and "Numbers."
Here is how it works, using simple analogies:
1. The "Frozen Brain" and the "Creative Writer"
The model is built like a two-part team:
- The Frozen Brain (Encoder): This part is a pre-trained AI (based on a model called T5Gemma) that has already read millions of books and lines of code. It understands the structure of sentences and code perfectly. The researchers "froze" this part, meaning they didn't teach it anything new. It just acts as a smart reader that understands what the code is saying.
- The Creative Writer (Decoder): This is the part they actually trained. Instead of writing a story, this writer's job is to look at the code the "Brain" read and write a number as the next word in a sentence.
The Analogy: Imagine you are reading a recipe (the code). A normal AI might try to guess the ingredients list. This new AI looks at the recipe and says, "Based on this text, the next word is '500' (calories)." It treats the prediction of a number (like memory usage or speed) exactly like finishing a sentence.
2. One Tool for Everything
The biggest breakthrough is that this single "Universal Translator" can handle everything at once.
- It can read Python code and guess how much memory it uses.
- It can read C++ code and guess how long it takes to run.
- It can read a Neural Network design (written in a format called ONNX) and guess how accurate it will be or how fast it runs on a specific chip.
Previously, you needed a different "expert" for each of these tasks. This model is like a Swiss Army Knife that can switch between being a memory expert, a speed expert, and an accuracy expert just by looking at the text.
3. How It "Counts" Without Math
One of the clever tricks is how the model outputs numbers. Instead of trying to do complex math to output "72.5," it breaks the number down into tiny pieces, like a digital lock.
- It doesn't say "72.5".
- It says: "Plus sign... 7... 2... decimal point... 5."
- The Analogy: Imagine you are teaching a child to count. Instead of asking them to solve "50 + 25," you ask them to write the answer digit by digit: "5... 0... plus... 2... 5... equals... 7... 2... 5." This makes it much easier for the AI to handle huge numbers (like millions of bytes) or tiny numbers without getting confused.
4. Why It's Better Than the Old Way
- No Manual Labor: Old methods required humans to manually design features (like "count the number of loops"). This model reads the raw text directly, just like a human reads a book.
- Better at Ranking: The paper shows that if you give this model 10 different versions of the same code, it is very good at sorting them from "fastest" to "slowest" or "smallest memory" to "largest memory." It's like a judge who can look at 10 runners and instantly know who will win, even without a stopwatch.
- Cost: The researchers found that using this model is much cheaper than using giant, general-purpose AI chatbots (like GPT-5) to guess the numbers. The chatbots are like using a sledgehammer to crack a nut; they are expensive and often wrong. This model is a specialized, lightweight tool that gets the job done for pennies.
What They Actually Proved
The paper tested this on:
- CodeNet: A huge dataset with millions of code snippets in 37 different languages. The model successfully predicted memory usage across all of them.
- APPS: A set of coding challenges. The model could look at a solution and predict its memory usage with very high accuracy (better than 90% correlation with reality).
- Neural Networks: It predicted the speed and accuracy of AI designs better than the previous state-of-the-art methods that used complex graph diagrams.
In Summary:
The paper claims that we don't need to build complex, custom tools to predict how code performs. Instead, we can treat code like a story and numbers like the next word in that story. By training a single, unified AI to do this, we can predict memory, speed, and accuracy for almost any programming language or AI design, simply by reading the text. It turns a difficult math problem into a simple "what comes next?" game.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.