Skip to main content
QUICK REVIEW

[Paper Review] HYSYNTH: Context-Free LLM Approximation for Guiding Program Synthesis

Shraddha Barke, Emmanuel Anaya Gonzalez|arXiv (Cornell University)|May 24, 2024
Parallel Computing and Optimization TechniquesComputer Science5 citations
TL;DR

HYSYNTH uses LLM completions to learn a context-free surrogate (PCFG) that guides a bottom-up program synthesizer, achieving better performance than unguided search, LLM-only sampling, and domain baselines across Arc, Tensor, and String tasks.

ABSTRACT

Many structured prediction and reasoning tasks can be framed as program synthesis problems, where the goal is to generate a program in a domain-specific language (DSL) that transforms input data into the desired output. Unfortunately, purely neural approaches, such as large language models (LLMs), often fail to produce fully correct programs in unfamiliar DSLs, while purely symbolic methods based on combinatorial search scale poorly to complex problems. Motivated by these limitations, we introduce a hybrid approach, where LLM completions for a given task are used to learn a task-specific, context-free surrogate model, which is then used to guide program synthesis. We evaluate this hybrid approach on three domains, and show that it outperforms both unguided search and direct sampling from LLMs, as well as existing program synthesizers.

Motivation & Objective

  • Motivate hybrid program synthesis to overcome LLMs' precision limitations on domain-specific DSLs.
  • Propose a context-free surrogate model learned from LLM completions to guide bottom-up search.
  • Instantiate and evaluate the approach across Arc grid puzzles, tensor manipulations, and string manipulations.
  • Demonstrate that LLM-guided synthesis improves efficiency and success rates over baselines.

Proposed method

  • Sample completions from an LLM for a given DSL and task and collect a set of candidate programs.
  • Parse completions into a program set and learn a PCFG via maximum likelihood, with smoothing, to approximate the LLM distribution.
  • Convert the PCFG into a weighted CFG to guide a bottom-up search that enumerates programs by increasing cost.
  • Use a bottom-up search algorithm that reuses subexpressions and caches evaluation results to prune observationally equivalent programs.
  • In Arc, apply a divide-and-conquer strategy to separately synthesize transforms and filters to accelerate search.
  • Compare against baselines (domain solvers Arga, Probe, TFCoder) and ablations (no search, unguided search).
(a) Arc
(a) Arc

Experimental results

Research questions

  • RQ1Can a context-free surrogate model learned from LLM completions effectively guide bottom-up program synthesis across multiple DSL domains?
  • RQ2How does LLM-guided PCFG weighting influence search efficiency and success rate compared to unguided search and pure LLM sampling?
  • RQ3What are the domain-specific gains and limitations when applying HYSYNTH to Arc, Tensor, and String tasks?

Key findings

  • The hybrid approach solves 58% of 299 tasks overall, outperforming unguided search (40%) and LLMs without search (2%).
  • In Arc, Tensor, and String, HYSYNTH outperforms domain baselines Arga, TFCoder, and Probe, respectively.
  • The LLM-guided PCFG can reduce the search space (e.g., 450K programs to around 220K for the motivating Arc example), enabling solution in about a minute with LLM guidance.
  • In the Tensor domain, guidance from the LLM not only speeds up search but also removes the need for user-provided non-standard constants.
  • Using 100 LLM samples to learn the PCFG provides strong performance across domains, with smaller sample counts still outperforming baselines.
  • Overall, HYSYNTH demonstrates that a task-specific context-free approximation can harness LLM intuition while preserving efficient bottom-up search.
(b) Tensor
(b) Tensor

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.