← Latest papers
🤖 AI

CodeDistiller: Automatically Generating Code Libraries for Scientific Coding Agents

The paper introduces CodeDistiller, a system that automatically distills scientific GitHub repositories into vetted code libraries, significantly enhancing the accuracy and completeness of Automated Scientific Discovery agents while demonstrating the feasibility of using LLM-as-a-judge as a scalable evaluation proxy.

Original authors: Peter Jansen, Samiah Hassan, Pragnya Narasimha

Published 2026-05-18
📖 5 min read🧠 Deep dive

Original authors: Peter Jansen, Samiah Hassan, Pragnya Narasimha

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 Big Problem: The "Smart but Clueless" Scientist

Imagine you have a brilliant robot scientist. It has read millions of books and knows a lot of general facts about science (this is called "parametric knowledge"). However, when you ask it to run a specific, complex experiment, it often fails.

Why? Because science is like cooking. The robot knows the theory of how to bake a cake, but it doesn't have the specific recipe for the "Chocolate Lava Cake" you want. It tries to guess the recipe based on what it knows, but it usually gets the measurements wrong or forgets a crucial ingredient.

Currently, scientists have to manually write these specific "recipes" (code examples) for the robot, or the robot has to try to twist old recipes it already knows into something new. Both methods are slow, expensive, and limit how much the robot can actually discover.

The Solution: CODEDISTILLER (The "Recipe Extractor")

The authors built a new system called CODEDISTILLER. Think of it as a super-efficient sous-chef whose only job is to scan thousands of messy, complex cookbooks (GitHub repositories) and pull out the one perfect, working recipe for a specific dish.

Here is how it works, step-by-step:

  1. The Library Scan: The system looks at a massive collection of scientific code repositories (like a giant library of cookbooks).
  2. Finding the Good Stuff: Most of these libraries are huge and messy. CODEDISTILLER acts like a librarian who quickly scans the table of contents and identifies the one page that actually has the recipe, ignoring the ads, the author's bio, and the blank pages.
  3. Cooking the Recipe (Generation): It takes that specific page and tries to write a clean, simple "starter recipe" (a code example) that anyone can follow.
  4. Taste Testing (Debugging): It doesn't just write the recipe; it actually tries to cook the dish in a virtual kitchen (a cloud computer).
    • If the cake burns (the code crashes), the system looks at the smoke, figures out what went wrong, and tries again.
    • It repeats this "cook, fail, fix, cook again" loop until the dish comes out perfect.
  5. The Result: It creates a library of ready-to-use, working recipes that the robot scientist can use immediately.

The Experiment: Testing in the "Materials Science" Kitchen

The researchers tested this system using Materials Science (the study of how things like metals and crystals are built).

  • The Setup: They took 250 different scientific code libraries from the internet.
  • The Test: They asked CODEDISTILLER to turn these libraries into working examples.
  • The Results:
    • Using a very smart (but expensive) AI model, the system successfully created working recipes for 74% of the libraries.
    • Using a cheaper, faster model, it only succeeded about 26% of the time.
    • Analogy: It's like hiring a master chef (expensive model) vs. a line cook (cheap model). The master chef can successfully recreate the dish most of the time, while the line cook struggles.

The Payoff: Does It Actually Help?

The researchers then asked: "If we give our robot scientist these pre-made recipes, does it do better science?"

They ran a head-to-head competition (A/B test):

  • Team A (The Baseline): The robot scientist with only its general knowledge and a few generic recipes.
  • Team B (The Augmented): The robot scientist with the new library of specific, working recipes from CODEDISTILLER.

The Winner: Team B won almost every time.

  • Accuracy: Team B's experiments were more correct.
  • Completeness: Team B's reports were more thorough.
  • Scientific Soundness: Team B's conclusions made more sense scientifically.

Analogy: It's the difference between a student trying to solve a math problem by guessing (Team A) versus a student who has the correct formula and a worked-out example right in front of them (Team B). The second student gets the right answer much faster and more reliably.

The "Judge" Question: Can AI Judge AI?

The paper also asked a funny question: "Can an AI judge tell us if the science is good, or do we need a human expert?"

  • They had a human expert and an AI "Judge" rate the experiments side-by-side.
  • The Verdict: They agreed about 60-70% of the time.
  • What this means: The AI Judge is a decent "proxy" (a stand-in) for a human expert. It's not perfect, but it's good enough to save money and time when you need to check thousands of experiments quickly. However, for the most critical details, you still need a human.

Summary

CODEDISTILLER is a tool that automatically turns messy, complex scientific code libraries into clean, working "starter kits." By doing this, it allows automated scientific robots to stop guessing and start using proven methods, leading to more accurate and reliable scientific discoveries.

Key Takeaway: You don't need to manually write every recipe for the robot scientist. You just need a system that can find and fix the recipes for you, and the robot will do much better science.

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 →