Narcissus: Program Synthesis Using Context-Aware LLM Approximations
cs.AI, cs.LG, cs.PL, cs.SE
Submitted: 2026-08-26
Updated: 2026-08-26
Code: https://github.com/Herb-AI/Narcissus
License: http://creativecommons.org/licenses/by-sa/4.0/
The gist: Large language models (LLMs) excel at programming, but not when the task fixes the target language: prompted with a grammar rare in their training data, their programs usually break the grammar or
Terminology
Abstract
Large language models (LLMs) excel at programming, but not when the task fixes the target language: prompted with a grammar rare in their training data, their programs usually break the grammar or fail the given specification. Enumerative synthesizers search the space of syntactically correct programs systematically guided by LLMs; the state of the art guides them by approximating LLM proposals into rule frequencies, which loses where each construct belongs and prunes every rule the proposals miss, exactly when the proposals are wrong. We present Narcissus, a synthesizer that keeps the proposals as syntax trees and scores each expansion of a candidate program in its context: does a proposal with the same surrounding structure continue the same way, and does the expansion rebuild a fragment the proposals repeat? A regularization term keeps every rule reachable, so wrong proposals delay the solution but cannot hide it. Across five domains and two search backends, Narcissus beats static guidance at every budget and consistently outperforms re-prompting the LLM to fix its own proposals; it reaches proposal-like programs an order of magnitude sooner and solves 40% of ARC tasks where the raw proposals solve 13%, all without a single LLM call during search.
Sources
- Evaluating Large Language Models Trained on Code
- On the Measure of Intelligence
- ARC Prize 2024: Technical Report
- Probabilistic Programs of Thought
- Herb.jl: A Unifying Program Synthesis Library
- Combining Induction and Transduction for Abstract Reasoning
- Competition-Level Code Generation with AlphaCode
- ReaComp: Compiling LLM Reasoning into Symbolic Solvers for Efficient Program Synthesis
- ConceptSearch: Towards Efficient Program Search Using LLMs for Abstraction and Reasoning Corpus (ARC)
- SynCode: LLM Generation with Grammar Augmentation
Related papers
- MAVEN-T: Reinforced Heterogeneous Distillation for Real-Time Multi-Agent Trajectory Prediction
- Model Discovery Agent: LLM-assisted Bayesian experiment design for data-efficient discovery of mechanistic world models
- The Clinician's Veto: Navigating Trust, Liability, and Uncertainty in Autonomous AI Prescribing
- MindHelper: Closed-Loop Embodied Mental-State Reasoning for Precision Intervention
- Incumbent Advantage: Brand Bias and Cognitive Manipulation Dynamics in LLM Recommendation Systems
- VSAL: A Vision Solver with Adaptive Layouts for Graph Property Detection