ReGAL: Refactoring Programs to Discover Generalizable Abstractions
Not on the map. Why?
Abstract (arXiv)
While large language models (LLMs) are increasingly being used for program synthesis, they lack the global view needed to develop useful abstractions; they generally predict programs one at a time, often repeating the same functionality. Generating redundant code from scratch is both inefficient and error-prone. To address this, we propose Refactoring for Generalizable Abstraction Learning (ReGAL), a gradient-free method for learning a library of reusable functions via code refactorization, i.e., restructuring code without changing its execution output. ReGAL learns from a small set of existing programs, iteratively verifying and refining its abstractions via execution. We find that the shared function libraries discovered by ReGAL make programs easier to predict across diverse domains. On five datasets -- LOGO graphics generation, Date reasoning, TextCraft (a Minecraft-based text-game) MATH, and TabMWP -- both open-source and proprietary LLMs improve in accuracy when predicting programs with ReGAL functions. For CodeLlama-13B, ReGAL results in absolute accuracy increases of 11.5% on LOGO, 26.1% on date understanding, and 8.1% on TextCraft, outperforming GPT-3.5 in two of three domains. Our analysis reveals ReGAL's abstractions encapsulate frequently-used subroutines as well as environment dynamics.
Key facts. Cited by 32 papers in the map (data through 7 Oct 2026). Builds on 41 of its 71 references that are in the map. First posted on arXiv 29 Jan 2024.
Builds on
41 of 71 references.
References · 41
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,203
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,072
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2023Voyager: An Open-Ended Embodied Agent with Large Language Modelscited by 2,081
- 2022Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language modelscited by 1,970
- 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIscited by 1,880
- 2022Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Themcited by 1,767
- 2023AgentBench: Evaluating LLMs as Agentscited by 1,211
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
- 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,057
- 2022Language Models as Zero-Shot Planners: Extracting Actionable Knowledge for Embodied Agentscited by 1,029
29 more
- 2021Ethical and social risks of harm from Language Modelscited by 957
- 2023VoxPoser: Composable 3D Value Maps for Robotic Manipulation with Language Modelscited by 733
- 2023ViperGPT: Visual Inference via Python Execution for Reasoningcited by 591
- 2022Decomposed Prompting: A Modular Approach for Solving Complex Taskscited by 554
- 2023Identifying the Risks of LM Agents with an LM-Emulated Sandboxcited by 514
- 2022Visual Programming: Compositional visual reasoning without trainingcited by 507
- 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 496
- 2023Augmented Language Models: a Surveycited by 398
- 2015Neural Module Networkscited by 375
- 2023Chameleon: Plug-and-Play Compositional Reasoning with Large Language Modelscited by 352
- 2022Dynamic Prompt Learning via Policy Gradient for Semi-structured Mathematical Reasoningcited by 347
- 2018TextWorld: A Learning Environment for Text-based Gamescited by 304
- 2023Large Language Models as Tool Makerscited by 293
- 2023Faithful Chain-of-Thought Reasoningcited by 285
- 2023ADaPT: As-Needed Decomposition and Planning with Language Modelscited by 172
- 2023CRAFT: Customizing LLMs by Creating and Retrieving from Specialized Toolsetscited by 122
- 2023Large Language Models as Analogical Reasonerscited by 107
- 2018Semantic Parsing for Task Oriented Dialog using Hierarchical Representationscited by 101
- 2023CREATOR: Tool Creation for Disentangling Abstract and Concrete Reasoning of Large Language Modelscited by 90
- 2023CLIN: A Continually Learning Language Agent for Rapid Task Adaptation and Generalizationcited by 88
- 2024TroVE: Inducing Verifiable and Efficient Toolboxes for Solving Programmatic Taskscited by 70
- 2022Top-Down Synthesis for Library Learningcited by 57
- 2023Visual Programming for Text-to-Image Generation and Evaluationcited by 53
- 2021Few-Shot Semantic Parsing with Language Models Trained On Codecited by 50
- 2023LILO: Learning Interpretable Libraries by Compressing and Documenting Codecited by 46
- 2021Leveraging Language to Learn Program Abstractions and Search Heuristicscited by 44
- 2023Learning adaptive planning representations with natural language guidancecited by 36
- 2022Summarization Programs: Interpretable Abstractive Summarization with Neural Modular Treescited by 14
- 2023Leveraging Code to Improve In-context Learning for Semantic Parsingcited by 10
Built on by
Citing papers per year: 2024: 11; 2025: 7; 2026: 14.
32 papers.
Sort:
By area:
- 2024When Can LLMs Actually Correct Their Own Mistakes? A Critical Survey of Self-Correction of LLMscited by 230
- 2024A Survey on Large Language Model-Based Game Agentscited by 106
- 2024What Are Tools Anyway? A Survey from the Language Model Perspectivecited by 53
- 2024Is Programming by Example solved by LLMs?cited by 27
- 2024Learning to Refine with Fine-Grained Natural Language Feedbackcited by 27
- 2025LLMs Can Generate a Better Answer by Aggregating Their Own Responsescited by 27
- 2024Empowering Large Language Model Agents through Action Learningcited by 20
- 2024The Fusion of Large Language Models and Formal Methods for Trustworthy AI Agents: A Roadmapcited by 20
- 2024Pix2Code: Learning to Compose Neural Visual Concepts as Programscited by 18
- 2025Generator-Assistant Stepwise Rollback Framework for Large Language Model Agentcited by 13
- 2024Enhancing Agent Learning through World Dynamics Modelingcited by 9
- 2025One Life to Learn: Inferring Symbolic World Models for Stochastic Environments from Unguided Explorationcited by 9
20 more
- 2026Evolving Programmatic Skill Networkscited by 7
- 2025ToolLibGen: Scalable Automatic Tool Creation and Aggregation for LLM Reasoningcited by 5
- 2025Refactoring Codebases through Library Designcited by 4
- 2026Experience Transfer for Multimodal LLM Agents in Minecraft Gamecited by 4
- 2024Action abstractions for amortized samplingcited by 3
- 2024Library Learning Doesn't: The Curious Case of the Single-Use "Library"cited by 3
- 2025GATE: Graph-based Adaptive Tool Evolution Across Diverse Taskscited by 3
- 2025A Compute-Matched Re-Evaluation of TroVE on MATHcited by 2
- 2026Test-Time Learning with an Evolving Librarycited by 2
- 2026AllocBench: Measuring Online Tool Allocation Capability in LLM Agentscited by 2
- 2026BIM Information Extraction Through LLM-based Adaptive Explorationcited by 1
- 2026ReaComp: Compiling LLM Reasoning into Symbolic Solvers for Efficient Program Synthesiscited by 1
- 2026CoCoDA: Co-evolving Compositional DAG for Tool-Augmented Agentscited by 0
- 2026PYTHALAB-MERA: Validation-Grounded Memory, Retrieval, and Acceptance Control for Frozen-LLM Coding Agentscited by 0
- 2026XSearch: Explainable Code Search via Concept-to-Code Alignmentcited by 0
- 2026PACE: Primitive-Aware Code Evolution for Automated Algorithm Designcited by 0
- 2026Better, Faster, Stronger: Programmatic Skill Learning Best Reduces Agent Costcited by 0
- 2026Credo: Reusable Declarative Primitives for Agentic Workflowscited by 0
- 2026Mathematics for and by human cognition: A resource-rational search for bottlenecks in problem-solvingcited by 0
- 2026Can Agents Design Libraries for Agents?cited by 0
- 2026Can Agents Design Libraries for Agents?29 Sep 2026
- 2026Mathematics for and by human cognition: A resource-rational search for bottlenecks in problem-solving28 Sep 2026
- 2026Credo: Reusable Declarative Primitives for Agentic Workflows28 Aug 2026
- 2026Better, Faster, Stronger: Programmatic Skill Learning Best Reduces Agent Cost11 Aug 2026
- 2026PACE: Primitive-Aware Code Evolution for Automated Algorithm Design7 Aug 2026
- 2026AllocBench: Measuring Online Tool Allocation Capability in LLM Agents25 Jul 2026
- 2026XSearch: Explainable Code Search via Concept-to-Code Alignment15 May 2026
- 2026Test-Time Learning with an Evolving Library14 May 2026
- 2026PYTHALAB-MERA: Validation-Grounded Memory, Retrieval, and Acceptance Control for Frozen-LLM Coding Agents8 May 2026
- 2026CoCoDA: Co-evolving Compositional DAG for Tool-Augmented Agents8 May 2026
- 2026ReaComp: Compiling LLM Reasoning into Symbolic Solvers for Efficient Program Synthesis6 May 2026
- 2026BIM Information Extraction Through LLM-based Adaptive Exploration3 May 2026
20 more
- 2026Experience Transfer for Multimodal LLM Agents in Minecraft Game7 Apr 2026
- 2026Evolving Programmatic Skill Networks7 Jan 2026
- 2025One Life to Learn: Inferring Symbolic World Models for Stochastic Environments from Unguided Exploration14 Oct 2025
- 2025ToolLibGen: Scalable Automatic Tool Creation and Aggregation for LLM Reasoning9 Oct 2025
- 2025A Compute-Matched Re-Evaluation of TroVE on MATH16 Jul 2025
- 2025Refactoring Codebases through Library Design26 May 2025
- 2025LLMs Can Generate a Better Answer by Aggregating Their Own Responses6 Mar 2025
- 2025Generator-Assistant Stepwise Rollback Framework for Large Language Model Agent4 Mar 2025
- 2025GATE: Graph-based Adaptive Tool Evolution Across Diverse Tasks20 Feb 2025
- 2024The Fusion of Large Language Models and Formal Methods for Trustworthy AI Agents: A Roadmap9 Dec 2024
- 2024Library Learning Doesn't: The Curious Case of the Single-Use "Library"26 Oct 2024
- 2024Action abstractions for amortized sampling19 Oct 2024
- 2024Enhancing Agent Learning through World Dynamics Modeling25 Jul 2024
- 2024Learning to Refine with Fine-Grained Natural Language Feedback2 Jul 2024
- 2024Is Programming by Example solved by LLMs?12 Jun 2024
- 2024When Can LLMs Actually Correct Their Own Mistakes? A Critical Survey of Self-Correction of LLMs3 Jun 2024
- 2024A Survey on Large Language Model-Based Game Agents2 Apr 2024
- 2024What Are Tools Anyway? A Survey from the Language Model Perspective18 Mar 2024
- 2024Empowering Large Language Model Agents through Action Learning24 Feb 2024
- 2024Pix2Code: Learning to Compose Neural Visual Concepts as Programs13 Feb 2024
- 2024A Survey on Large Language Model-Based Game Agentscited by 106
- 2024Empowering Large Language Model Agents through Action Learningcited by 20
- 2024The Fusion of Large Language Models and Formal Methods for Trustworthy AI Agents: A Roadmapcited by 20
- 2025Generator-Assistant Stepwise Rollback Framework for Large Language Model Agentcited by 13
- 2024Enhancing Agent Learning through World Dynamics Modelingcited by 9
- 2026AllocBench: Measuring Online Tool Allocation Capability in LLM Agentscited by 2
- 2026CoCoDA: Co-evolving Compositional DAG for Tool-Augmented Agentscited by 0
- 2026PYTHALAB-MERA: Validation-Grounded Memory, Retrieval, and Acceptance Control for Frozen-LLM Coding Agentscited by 0
- 2026Better, Faster, Stronger: Programmatic Skill Learning Best Reduces Agent Costcited by 0
- 2026Credo: Reusable Declarative Primitives for Agentic Workflowscited by 0
- 2026Credo: Reusable Declarative Primitives for Agentic Workflows28 Aug 2026
- 2026Better, Faster, Stronger: Programmatic Skill Learning Best Reduces Agent Cost11 Aug 2026
- 2026AllocBench: Measuring Online Tool Allocation Capability in LLM Agents25 Jul 2026
- 2026PYTHALAB-MERA: Validation-Grounded Memory, Retrieval, and Acceptance Control for Frozen-LLM Coding Agents8 May 2026
- 2026CoCoDA: Co-evolving Compositional DAG for Tool-Augmented Agents8 May 2026
- 2025Generator-Assistant Stepwise Rollback Framework for Large Language Model Agent4 Mar 2025
- 2024The Fusion of Large Language Models and Formal Methods for Trustworthy AI Agents: A Roadmap9 Dec 2024
- 2024Enhancing Agent Learning through World Dynamics Modeling25 Jul 2024
- 2024A Survey on Large Language Model-Based Game Agents2 Apr 2024
- 2024Empowering Large Language Model Agents through Action Learning24 Feb 2024
- 2024When Can LLMs Actually Correct Their Own Mistakes? A Critical Survey of Self-Correction of LLMscited by 230
- 2024What Are Tools Anyway? A Survey from the Language Model Perspectivecited by 53
- 2024Is Programming by Example solved by LLMs?cited by 27
- 2024Learning to Refine with Fine-Grained Natural Language Feedbackcited by 27
- 2025LLMs Can Generate a Better Answer by Aggregating Their Own Responsescited by 27
- 2024Pix2Code: Learning to Compose Neural Visual Concepts as Programscited by 18
- 2026Evolving Programmatic Skill Networkscited by 7
- 2025Refactoring Codebases through Library Designcited by 4
- 2024Action abstractions for amortized samplingcited by 3
- 2025GATE: Graph-based Adaptive Tool Evolution Across Diverse Taskscited by 3
- 2025A Compute-Matched Re-Evaluation of TroVE on MATHcited by 2
- 2026Test-Time Learning with an Evolving Librarycited by 2
12 most cited of 17 All 17 (JSON)
- 2026Can Agents Design Libraries for Agents?29 Sep 2026
- 2026Mathematics for and by human cognition: A resource-rational search for bottlenecks in problem-solving28 Sep 2026
- 2026PACE: Primitive-Aware Code Evolution for Automated Algorithm Design7 Aug 2026
- 2026XSearch: Explainable Code Search via Concept-to-Code Alignment15 May 2026
- 2026Test-Time Learning with an Evolving Library14 May 2026
- 2026BIM Information Extraction Through LLM-based Adaptive Exploration3 May 2026
- 2026Evolving Programmatic Skill Networks7 Jan 2026
- 2025A Compute-Matched Re-Evaluation of TroVE on MATH16 Jul 2025
- 2025Refactoring Codebases through Library Design26 May 2025
- 2025LLMs Can Generate a Better Answer by Aggregating Their Own Responses6 Mar 2025
- 2025GATE: Graph-based Adaptive Tool Evolution Across Diverse Tasks20 Feb 2025
- 2024Action abstractions for amortized sampling19 Oct 2024
12 newest of 17 All 17 (JSON)