atlas

Research map / Large language models / Agents, code and math

ReGAL: Refactoring Programs to Discover Generalizable Abstractions

ICML 2024 · Large language models › Agents, code and math · approach: Code generation benchmarks · 1 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes ReGAL, a gradient-free method that refactors primitive programs with a frozen LLM (GPT-3.5) to learn a verified library of reusable helper functions, improving program prediction across five domains.

Problem

LLMs generate programs one query at a time from primitives, leading to redundant code, repeated errors, and no shared abstractions across examples.

Approach

Learn a code bank of reusable helper functions by batch-refactoring clustered, curriculum-ordered primitive programs with a frozen LLM, verifying helpers by execution, retrying with feedback, and periodically editing and pruning the library; at test time an agent retrieves helpers and demos as in-context examples.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use ReGAL helper functions instead of primitive-only programsCodeLlama-13B · LOGO testaccuracy: 45.6 -> 57.1Helped
Use ReGAL helper functions instead of primitive-only programsGPT-3.5-turbo · Date testaccuracy: 88.9 -> 90.2Helped
Use ReGAL helper functions instead of primitive-only programsGPT-3.5-turbo · MATH Algebra testaccuracy: 43.2 -> 55.4Helped
Add retry (ablation)ReGAL · LOGO devaccuracy: 48.3 -> 55.0Helped
Add retry (ablation)ReGAL · Date devaccuracy: 51.9 -> 77.0Helped
Add retry (ablation)ReGAL · TextCraft devaccuracy: 30.43 -> 34.12Helped
Use a curriculum ordered from shorter to longer queries rather than shuffled clusters (ablation)ReGAL · LOGO devaccuracy: 36.3 -> 55.0Helped
Use a curriculum ordered from shorter to longer queries rather than shuffled clusters (ablation)ReGAL · Date devaccuracy: 56.6 -> 77.0Helped
Use a curriculum ordered from shorter to longer queries rather than shuffled clusters (ablation)ReGAL · TextCraft devaccuracy: 28.78 -> 34.12Helped
Add pruneCodeBank (ablation)ReGAL · LOGO devaccuracy: 52.0 -> 55.0Helped
Add pruneCodeBank (ablation)ReGAL · Date devaccuracy: 65.5 -> 77.0Helped
Add pruneCodeBank (ablation)ReGAL · TextCraft devaccuracy: 25.26 -> 34.12Helped

Surprising findings

Limitations

Experimental setup

Datasets: LOGO BigBench-Hard date understanding TextCraft MATH TabMWP

Benchmarks: LOGO Date understanding TextCraft MATH (Algebra) TabMWP

Metrics: accuracy

Baselines: Primitive programs baseline agent Lilo Faithful-CoT ReAct GPT-3.5-turbo primitive programs

Builds on: DreamCoder Lilo Faithful-CoT ReAct Program-of-Thoughts

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy