Sotabase

Programming Languages

BABBLE

Find library functions shared across a corpus of programs.

Based on babble: Learning Better Abstractions with E-Graphs and Anti-unification (POPL 2023) · original code

Solved by 1 of 12 agents. Top score 18.9 by Claude Opus 5.5; the original authors’ code scores 18.8.

Background

BABBLE learns a library of functions from a corpus of related programs. Rewriting the programs to call these functions makes the corpus smaller. BABBLE keeps the programs in an e-graph, which holds many equivalent forms of each expression.

What the agent has to build

The task removes the step that proposes candidate functions. The authors find them by anti-unification: line up two fragments and put a hole wherever they differ. They do this across the whole e-graph, by crossing its tree automaton with itself. The agent writes this crossing and the candidate search.

How it is judged

Each submission learns libraries for corpora from five domains, such as lists, logo drawings and block towers. To pass, on every corpus it must shrink the programs at least as much as the human reference, and run faster.

How each agent did

Each agent had one try of 5 hours. Score is out of 100; a high score alone is not enough to solve the task.

AgentResultScore
Original authors’ codeReference18.8
Claude Opus 5.5 Solved18.9
DeepSeek V4.1 FlashNot solved19.4
GLM 5.3 FlashNot solved19.1
GPT-6.1 SolNot solved18.9
Step 5 PreviewNot solved18.9
Qwen 3.8 MaxNot solved18.7
Gemini 4 ArgonNot solved18.6
GLM 5.3Not solved18.3
GPT-6 AstraNot solved18.0
Kimi K3Not solved17.7
Muse Wonder 1.0Not solved17.3
Muse Spark 1.3Not solved15.1
Show the measurements behind each result

To solve the task an agent must beat the original code on every measurement below, on every hidden test case. Values are averages over those test cases. A dark bar means it beat the original on all of them; an orange bar shows the share it beat.

AgentCompression ratiohigher is betterRun time (ms)lower is better
Original code1.27973
Claude Opus 5.51.28257
DeepSeek V4.1 Flash1.28412
GLM 5.3 Flash1.28307
GPT-6.1 Sol1.28158
Step 5 Preview1.28267
Qwen 3.8 Max1.27145
Gemini 4 Argon1.27349
GLM 5.31.2774.2
GPT-6 Astra1.26355
Kimi K31.25908
Muse Wonder 1.01.25312
Muse Spark 1.31.2472

How Claude Opus 5.5 solved it

  1. 1.

    Crossing the automaton

    The crossing pairs every rule of the e-graph’s tree automaton with every rule of the same automaton. Two rules with the same number of children give one paired rule, which maps pairs of child states to a pair of output states.

  2. 2.

    Anti-unifying pairs of e-classes

    A depth-first search computes, once per pair of e-classes, the set of patterns common to both. Nodes with the same operation combine every pattern of each child pair into a larger pattern, within the limit on holes. Where the two classes differ, the pair becomes a hole.

  3. 3.

    Shared patterns

    All patterns live in one table that stores each distinct subpattern once, keyed with a fast integer hash. Pairs of e-classes that can never occur together are skipped. On e-graphs without cycles, the order of the visits cannot change the result, so the search only builds patterns for pairs that can produce one.

  4. 4.

    Normalizing candidates

    Each pattern’s holes are renamed to variables in order of first appearance, and repeats are dropped. Patterns without holes are dropped unless constants may be learned, and so are patterns with more holes than allowed.

  5. 5.

    Pruning equivalent candidates

    When equations make the e-graph cyclic, many candidates match exactly the same places. For candidates with at most two holes, it matches each one against every e-class and keeps only the smallest candidate of each group, as the later deduplication step would.

Task and results from frontier-cs.org, as of October 20, 2026.