LLM-Guided Strategy Synthesis for Scalable Equality Saturation

arXiv cs.AI / 4/21/2026

📰 NewsDeveloper Stack & InfrastructureIdeas & Deep AnalysisModels & Research

Key Points

  • Equality saturation(EqSat)を実用化するにはドメイン固有の「戦略(strategy)」が重要だが、従来は多くが手作業で自動化の障壁になっている。
  • 既存のルール合成は書き換え語彙を増やしてしまい、e-graphの爆発(explosion)を悪化させるため、単純な自動化だけではうまくいかない。
  • EggMindはLLMをガイドにしつつ、EqSat戦略を明示・検査可能な成果物として表すドメイン特化DSL「EqSatL」と、証明に由来する書き換えモチーフのキャッシュや探索の実行可能性ガイダンス等を組み合わせて、高品質戦略を効率的に合成する。
  • ベンチマーク評価では、ベクトル化に関する設定で最終コストを45.1%削減し、ピークRAMを69.1%削減するなど、資源と品質のトレードオフを大きく改善し、XLAベースのテンソルコンパイラや論理合成ケーススタディにも適用できることが示された。

Abstract

Equality saturation (EqSat) is a powerful optimization paradigm that compactly represents many equivalent programs in an e-graph and delays commitment until extraction selects a lowest-cost program. Making EqSat effective, therefore, requires not only domain-specific rewrite rules but also domain-specific strategies. Today, much of this strategy design is still manual, making it a major obstacle to automating e-graph-based compilers. Recent rule-synthesis frameworks can automatically infer large rewrite vocabularies from semantic specifications, but they also enlarge the rewrite space and further exacerbate e-graph explosion. Although large language models (LLMs) make automated strategy synthesis plausible, directly evolving backend code remains ineffective in practice. The search lacks reusable strategy abstractions and actionable feedback, and can easily trigger e-graph explosion or converge to poor designs. We present EggMind, an LLM-guided, end-to-end framework for synthesizing reusable EqSat strategies. At its core, EggMind introduces a domain-specific language, EqSatL, to represent EqSat strategies as explicit and inspectable artifacts. It then proposes an LLM-guided agentic workflow, equipped with novel techniques including proof-derived rewrite motif caching and tractability guidance, to search efficiently for high-quality strategies while keeping synthesis stable under e-graph growth. Evaluation shows that EggMind substantially improves the resource-quality trade-off on vectorization benchmarks, reducing final cost by 45.1% and peak RAM by 69.1% relative to full EqSat. We further show that the same methodology transfers effectively to an XLA-based tensor compiler, and demonstrate its practical potential in a logic-synthesis case study with augmented rewrite spaces.