Introduction
This paper introduces Neurosymbolic Deep Generative Models (SGM) for sequences like poetry and music, which often require strict global structure (e.g., rhyme schemes or melodic repetition). By using program synthesis to extract symbolic "blueprints" of relational constraints from training data, the model learns to generate new sequences that are both locally realistic and globally coherent, outperforming pure deep learning models like GPT-2 and MusicVAE.
The Challenge of Global Coherence
While modern deep generative models (like Transformers) are incredibly good at maintaining local coherence—making the next word or note sound plausible—they frequently struggle with global coherence.
In structured domains like poetry or music, "correctness" isn't just about the next token; it’s about long-range relational constraints. For example, the first line of a poem must rhyme with the third, or a musical theme must repeat with a specific transposition four measures later. Standard neural networks often "forget" these constraints over long sequences or require massive amounts of data to learn them implicitly. This paper tackles the challenge of explicitly incorporating these high-level structures into the generative process.
Methods: A Two-Stage Neurosymbolic Framework
The authors propose a two-stage neurosymbolic framework that separates the generation of structure from the generation of content.
- Structure Inference (Program Synthesis): During training, the model doesn't just look at the raw data ($x$). It uses a program synthesis algorithm (powered by the Z3 SMT solver) to infer a "program" ($c$) that represents the relational constraints in the example.
- They represent these constraints as a bipartite graph where one set of nodes are "prototypes" (the original patterns) and the other set are the actual subcomponents (lines or measures).
- Edges define how a subcomponent relates to its prototype (e.g., "this line rhymes with that prototype").
- The Generative Pipeline:
- Model (i) - $p(c|z)$: A Variational Autoencoder (VAE) learns to generate realistic structures (the constraint graphs).
- Model (ii) - $p(x|c)$: A second model generates the actual content (text or notes) conditioned on that structure.
To handle the second step, the authors explore three approaches: constrained rejection sampling, constraint-aware embeddings using a Graph Convolutional Network (GCN), and combinatorial optimization.
Key Insights
- Structure as Compression: Explicitly modeling structure acts as a form of data compression. By telling the model "these two lines must rhyme," the model doesn't have to "waste" its capacity learning the concept of rhyming from scratch; it can focus on semantics and imagery.
- Bipartite Graph Representation: Representing structure as relationships to "prototypes" keeps the problem computationally tractable, turning a quadratic number of potential constraints into a linear one.
- Human-in-the-Loop: Because the structure is represented symbolically, a human user can manually edit the "blueprint" before the model generates the content. You can tell the AI, "Give me a poem with this specific rhyme scheme," and it will fill in the blanks realistically.
Key Results
The model was evaluated on the Essen folk song corpus (music) and a collection of 10-line poems from Project Gutenberg (poetry). The neurosymbolic approach (SGM) consistently outperformed state-of-the-art baselines.
- Music: SGM achieved lower Negative Log-Likelihood (NLL) and better Fréchet Distance scores compared to MusicVAE and MusicAutobot, indicating it produces more realistic and better-structured melodies.
- Poetry: In a user study with 50 participants, SGM was rated higher than GPT-2 and RichLyrics in terms of lyricism and structure. While GPT-2 was slightly better at "coherence" (logical flow), it failed significantly at maintaining the formal constraints of poetry that SGM handled easily.
- Ablation Study: Using an SMT solver to find optimal structures was significantly better than using "greedy" heuristics, proving that the symbolic optimization step is a core driver of performance.
Limitations and Future Work
- Scalability of SMT: While SMT solvers are powerful, they are computationally expensive. For very long sequences, the synthesis step might become a bottleneck.
- Predefined Relations: Currently, the "vocabulary" of relations (rhyme, meter, transposition) must be defined by experts. Future work could involve learning these relations automatically from raw data.
- Broader Applications: The authors suggest extending this to dialog generation (maintaining persona consistency) and document summarization, where relational constraints between different sections of text are vital.
Summary updated