TL;DR
When you read the word either, your brain starts waiting for an or; when you hear a musical chord progression wander away, your ear waits for it to resolve back home. Standard sequence models predict the next token well using surface statistics, while formal grammars explicitly track these "open goals" but make poor next-step predictors. This paper marries the two—using a probabilistic grammar to score and reweight the sampled futures of a frozen sequence model—and discovers that accounting for structural anticipation makes models significantly better at predicting human surprise, even while making them worse at predicting the actual next chord.
What Problem Does This Paper Address?
How do humans anticipate what comes next in structured streams like music and language? In computational cognitive science, the standard currency of expectation is surprisal (information content, $-\log_2 p(\text{event} \mid \text{context})$): the less probable an event is, the more surprised a human listener or reader will be.
Historically, two modeling camps have tackled this from opposite ends:
- Sequence models (like Transformers, LSTMs, or Markov models) soak up surface statistics and predict the immediate next event remarkably well. However, whatever structural rules they learn are locked inside opaque weights.
- Generative grammars explicitly build hierarchical trees and track open goals—predicted structural units that haven't happened yet, like a subject awaiting its verb or a musical tension chord awaiting resolution to the "home" chord (tonic, written
I). Yet on their own, probabilistic grammars are weak at predicting fluent sequences.
Directly comparing neural models to grammars is messy because they differ in architecture, capacity, and training data, not just structure. Furthermore, an open goal doesn't dictate the immediate next step—a song can linger on other chords before resolving home. The authors ask: if we hold a trained sequence model completely fixed and explicitly inject a grammar's awareness of open goals, does it better capture human expectation?
Methods
The authors introduce Grammar-Weighted Futures, a modular inference-time wrapper that requires zero retraining of the underlying sequence model.
Given an observed prefix $h$ (chords heard or words read so far), the model computes a hybrid next-event probability in four steps:
- Sample Futures: A frozen autoregressive sequence model $q$ generates $N$ plausible multi-step continuations ("futures") of up to length $H$.
- Infer Open Goals: Simultaneously, an incremental parser uses a probabilistic context-free grammar (PCFG) to analyze the prefix $h$ and identify the first one or two open goals—subtrees predicted by the current parse that lie in the future.
- Score and Reweight: Each sampled future is scored by how well it completes (in music) or makes progress toward (in language) those open goals. Futures that resolve open goals get boosted; those that leave goals hanging get down-weighted. Grouping futures by their very first event turns these path scores into a grammar-weighted next-event distribution, $p_{\text{syn}}$.
- Gated Mixture: Finally, a context-dependent gate $a_h \in [0, 1]$—computed from how certain the grammar is about the prefix—blends the original sequence model distribution $q_E$ with the grammar-weighted distribution $p_{\text{syn}}$.
To test whether the sampled multi-step futures actually matter, the authors compare their method against several clever controls, including shuffling grammar scores across futures, simply sharpening the base distribution's entropy, and multiplying $q_E$ directly by the grammar's own 1-step next-event probability (Grammar marginal).
Datasets
No new datasets are introduced; the study reanalyzes existing corpora and human behavioral/neural benchmarks:
- Music Training & Evaluation: Sequence models (Transformer, LSTM, and the variable-order Markov model IDyOM) and a 168-category harmonic grammar are trained on the McGill Billboard corpus (739 pop songs, holding out test sources). Human expectations are evaluated on Cheung et al. (2024), containing chord-by-chord surprise ratings from 25 listeners (musicians and non-musicians) across 30 pop chord progressions (2,018 total ratings).
- Language (Exploratory): Uses pretrained GPT-2 small paired with a PCFG estimated from the NLTK Penn Treebank sample (3,914 sentences), evaluated against human word-predictability ratings across 205 sentences (1,726 word events) from de Varda et al. (2024).
- Transfer Benchmarks: Tested on Bach chorale listening EEG data (Teng et al., 2024), self-paced reading times, N400 brain responses (Frank et al., 2013; 2015), and cloze probabilities.
Key Insights and Ideas
- Predicting human surprise and predicting the next token are not the same objective. For the neural music models, reweighting futures by open goals actually made the chords that occurred in the songs ~10% less probable—yet it significantly improved the fit to human surprise ratings. Because songs often delay resolution, forcing a model to anticipate goal completion hurts raw next-chord accuracy while aligning much closer to what human ears expect.
- The grammar's structural mapping is doing real work. Shuffling the grammar scores among sampled futures or merely matching the sharpness (entropy) of the probability distribution fails to reproduce the gains. The specific alignment between future trajectories and open structural goals matters.
- When do sampled futures beat a 1-step grammar lookup? It depends on the base model. For strong neural sequence models (Transformer, LSTM), simply multiplying their next-chord prediction by the grammar's own 1-step marginal probability recovers almost all the gain. However, for the Markov-based IDyOM, explicitly scoring multi-step sampled futures provides a reliable extra boost.
Key Results
Model fit is measured via $\Delta\text{ELPD}$ (expected log predictive density, in nats, summed over held-out ratings; higher means better prediction of human responses).
- Musical Surprise: Grammar-Weighted Futures reliably beat the unmodified sequence models across all three architectures: +61.7 ELPD for LSTM (3.1% more predictive density per rating; better in 23/30 songs), +46.5 for Transformer (2.4% per rating; 21/30 songs), and +106.7 for IDyOM (5.4% per rating; 27/30 songs).
- Likelihood Dissociation: Despite predicting human ratings better, the hybrid model lowered the probability of the actual occurring chords by 10.4% (LSTM) and 9.5% (Transformer) on average.
- Language Predictability: Combining GPT-2 with a treebank PCFG reliably improved held-out word predictability ratings over GPT-2 alone (+5.08 $\Delta\text{ELPD}$, better in 114/205 sentences), peaking at a short lookahead of $H=2$ terminals. However, it did not add a statistically reliable gain on top of Incremental Alternative Sampling (IAS), a recent representational-distance alternative.
Limitations and Future Work
The authors are candid about the boundaries of their findings:
- Explicit judgments vs. implicit processing: The gains did not reliably transfer to passive neural or behavioral measures—showing null or setting-dependent results on Bach chorale EEG, reading times, and N400 amplitudes. Thus, the evidence currently applies to explicit, conscious ratings of surprise and predictability.
- Scope and Priors: The primary music results rely on 30 pop progressions where the song's overall key is given to the models upfront. Furthermore, simpler static preferences for in-key stable chords still account for over half of the LSTM's gain on held-out songs, leaving open exactly how much work dynamic, progression-specific goals do versus general key stability.
- Language Simplifications: The exploratory language grammar only views future words through coarse part-of-speech tags. Future work could pair sequence models with richer Recurrent Neural Network Grammars (RNNGs) or use interpretability tools like Future Lens to probe whether neural networks already encode open goals internally without exposing them in next-token probabilities.
Summary updated