babble: Learning Better Abstractions with E-Graphs and Anti-unification
David Cao, Rose Kunkel, Chandrakana Nandi, Max Willsey, Zachary Tatlock, Nadia Polikarpova
Abstract
Library learning compresses a given corpus of programs by extracting common structure from the corpus into reusable library functions. Prior work on library learning suffers from two limitations that prevent it from scaling to larger, more complex inputs. First, it explores too many candidate library functions that are not useful for compression. Second, it is not robust to syntactic variation in the input.
We propose library learning modulo theory (LLMT), a new library learning algorithm that additionally takes as input an equational theory for a given problem domain. LLMT uses e-graphs and equality saturation to compactly represent the space of programs equivalent modulo the theory, and uses a novel e-graph antiunification technique to find common patterns in the corpus more directly and efficiently.
We implemented LLMT in a tool named babble. Our evaluation shows that babble achieves better compression orders of magnitude faster than the state of the art. We also provide a qualitative evaluation showing that babble learns reusable functions on inputs previously out of reach for library learning.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
25 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Improving Unsupervised Visual Program Inference with Code Rewriting Families cites Synthesizing structured CAD models with equality saturation and inverse transformations
- Improving Unsupervised Visual Program Inference with Code Rewriting Families cites egg: Fast and extensible equality saturation
- Improving Unsupervised Visual Program Inference with Code Rewriting Families cites DreamCoder: bootstrapping inductive program synthesis with wake-sleep library learning
- Improving Unsupervised Visual Program Inference with Code Rewriting Families cites Top-Down Synthesis for Library Learning
- ShapeCoder: Discovering Abstractions for Visual Programs from Unstructured Primitives cites Synthesizing structured CAD models with equality saturation and inverse transformations
- ShapeCoder: Discovering Abstractions for Visual Programs from Unstructured Primitives cites DreamCoder: bootstrapping inductive program synthesis with wake-sleep library learning
- ShapeCoder: Discovering Abstractions for Visual Programs from Unstructured Primitives cites Top-Down Synthesis for Library Learning
- Automatic Generation of Vectorizing Compilers for Customizable Digital Signal Processors cites Synthesizing structured CAD models with equality saturation and inverse transformations
- Automatic Generation of Vectorizing Compilers for Customizable Digital Signal Processors cites egg: Fast and extensible equality saturation
- Automatic Generation of Vectorizing Compilers for Customizable Digital Signal Processors cites Vectorization for digital signal processors via equality saturation
- egg: Fast and extensible equality saturation cites Synthesizing structured CAD models with equality saturation and inverse transformations
- LILO: Learning Interpretable Libraries by Compressing and Documenting Code cites Leveraging Language to Learn Program Abstractions and Search Heuristics
- LILO: Learning Interpretable Libraries by Compressing and Documenting Code cites DreamCoder: bootstrapping inductive program synthesis with wake-sleep library learning
- LILO: Learning Interpretable Libraries by Compressing and Documenting Code cites Top-Down Synthesis for Library Learning
- Top-Down Synthesis for Library Learning cites egg: Fast and extensible equality saturation
- Top-Down Synthesis for Library Learning cites Leveraging Language to Learn Program Abstractions and Search Heuristics
- Top-Down Synthesis for Library Learning cites DreamCoder: bootstrapping inductive program synthesis with wake-sleep library learning
- Vectorization for digital signal processors via equality saturation cites Synthesizing structured CAD models with equality saturation and inverse transformations
Cited by top-tier papers25
- LILO: Learning Interpretable Libraries by Compressing and Documenting CodeGabriel Grand, Lionel Wong, Matthew Bowers, Theo X. Olausson et al.ICLR 2024 · 35 citations
- Top-Down Synthesis for Library LearningMatthew Bowers, Theo X. Olausson, Lionel Wong, Gabriel Grand et al.POPL 2023 · 32 citations
- ShapeCoder: Discovering Abstractions for Visual Programs from Unstructured PrimitivesR. Kenny Jones, Paul Guerrero, Niloy J. Mitra, Daniel RitchieSIGGRAPH 2023 · 19 citations
- Automatic Generation of Vectorizing Compilers for Customizable Digital Signal ProcessorsSamuel Thomas, James BornholtASPLOS 2024 · 16 citations
- Improving Unsupervised Visual Program Inference with Code Rewriting FamiliesAditya Ganeshan, R. Kenny Jones, Daniel RitchieICCV 2023 · 13 citations
Builds on12
- egg: Fast and extensible equality saturationMax Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt et al.POPL 2021 · 170 citations
- DreamCoder: bootstrapping inductive program synthesis with wake-sleep library learningKevin Ellis, Catherine Wong, Maxwell I. Nye, Mathias Sablé-Meyer et al.PLDI 2021 · 97 citations
- Synthesizing structured CAD models with equality saturation and inverse transformationsChandrakana Nandi, Max Willsey, Adam Anderson, James R. Wilcox et al.PLDI 2020 · 65 citations
- Leveraging Language to Learn Program Abstractions and Search HeuristicsCatherine Wong, Kevin Ellis, Joshua B. Tenenbaum, Jacob AndreasICML 2021 · 59 citations
- Vectorization for digital signal processors via equality saturationAlexa VanHattum, Rachit Nigam, Vincent T. Lee, James Bornholt et al.ASPLOS 2021 · 57 citations
Related papers
- Fast and Optimal Extraction for Sparse Equality GraphsAmir Kafshdar Goharshady, Chun Kit Lam, Lionel ParreauxOOPSLA 2024 · 11 citations
- ReGAL: Refactoring Programs to Discover Generalizable AbstractionsElias Stengel-Eskin, Archiki Prasad, Mohit BansalICML 2024 · 23 citations
- Automating Constraint-Aware Datapath Optimization using E-GraphsSamuel Coward, George A. Constantinides, Theo DraneDAC 2023 · 19 citations
- Dis/Equality GraphsGeorge Zakhour, Pascal Weisenburger, Jahrim Gabriele Cesario, Guido SalvaneschiPOPL 2025 · 3 citations
- Automated Knowledge-Aware Test ReuseZiyuan Zhang, Yi Gao, Xing Hu, Xin Xia et al.FSE 2026
